flake.nix: Provide the hoverlay and a version of fromHOL taking a

compiler argument, as well as the hpath function that does the work.
This commit is contained in:
L. S. Leary 2022-04-20 04:59:03 +12:00
parent 6fc90cd9d3
commit a5b708ba00

View File

@ -7,9 +7,15 @@
};
outputs = { self, flake-utils, nixpkgs, unstable, git-ignore-nix }:
let
fromHOL = hol: final: prev: with prev.lib; with attrsets;
setAttrByPath [ "haskellPackages" ]
((getAttrFromPath [ "haskellPackages" ] prev).override (old: {
hpath = { prefix ? null, compiler ? null }:
(if prefix == null then [] else [ prefix ]) ++
(if compiler == null
then [ "haskellPackages" ]
else [ "haskell" "packages" compiler ]
);
fromHOL = hol: comp: final: prev: with prev.lib; with attrsets;
setAttrByPath (hpath comp)
((getAttrFromPath (hpath comp) prev).override (old: {
overrides = composeExtensions (old.overrides or (_: _: {}))
(hol final prev);
}));
@ -21,7 +27,7 @@
(hself.callCabal2nix "xmonad"
(git-ignore-nix.lib.gitignoreSource ./.) { });
};
overlay = fromHOL hoverlay;
overlay = fromHOL hoverlay { };
overlays = [ overlay ];
in flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system overlays; };
@ -31,5 +37,5 @@
packages = p: [ p.xmonad ];
};
defaultPackage = pkgs.haskellPackages.xmonad;
}) // { inherit overlay overlays; lib = { inherit fromHOL; }; };
}) // { inherit hoverlay overlay overlays; lib = { inherit hpath fromHOL; }; };
}