@Aravind Gopal opened https://github.com/srid/haskell-flake/pull/204 which removes the need for IFD in local packages.
But IFD is still used in dependency overrides; for eg., packages.foo.source
will use IFD, via callCabal2nix or callHackage. The open question here is: how do we solve it?
cc @Shivaraj B H
We may have to borrow some ideas from https://horizon-haskell.net/
From @Aravind Gopal
maintaining package sets seems like the only possible way for this.
which is same as in horizon-haskell.
Hmm, I'll take a look at this as a next project. Ideally we want to define package sets in Nix expressions itself, and stick close to nixpkgs (unlike horizon).
Here's one way to solve this: https://github.com/srid/haskell-flake/pull/204#pullrequestreview-1809771568
Summary: copy over the hackage2nix/ callCabal2nix generated default.nix
to a directory, and have the developer commit that to Git.
It looks like this (note: we overrode relude to test dependency override),
❯ cat .haskellSrc2nix/haskell-template.nix
{ mkDerivation, aeson, async, base, data-default, directory
, filepath, lib, mtl, optics-core, profunctors, relude, shower
, time, with-utf8
}:
mkDerivation {
pname = "haskell-template";
version = "0.1.0.0";
src = /nix/store/51shzaxpi2abz3hfp4q05kcd1lls0lba-source;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
aeson async base data-default directory filepath mtl optics-core
profunctors relude shower time with-utf8
];
homepage = "https://srid.ca/haskell-template";
description = "A template for Haskell projects using Nix";
license = lib.licenses.mit;
mainProgram = "haskell-template";
}
But as you can see that hardcoded src = /nix/store/51shzaxpi2abz3hfp4q05kcd1lls0lba-source;
is problematic. Looks like we have to do some hacky patching of this generated nix to have the src point back to the actual path.
Looks like we have to do some hacky patching of this generated nix to have the src point back to the actual path.
AFAIR calling cabal2nix
executable results in a relative path rather than a path linking to the /nix/store for local packages.
But note we are using callCabal2nix
which passes nix store paths,
Last updated: Nov 21 2024 at 08:50 UTC