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