mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 00:20:22 -07:00
flake.nix:
* Avoid mangling unused parts of pkgs.haskell in `fromHOL`. * Create 'defComp', specifying the default compiler, customisable through ./comp.nix. * Include `modernise` module as a workaround for NIX_GHC -> XMONAD_GHC. .gitignore: * Include nix 'result' symlink.
This commit is contained in:
parent
b771abeadc
commit
df6b40c980
3
.gitignore
vendored
3
.gitignore
vendored
@ -27,3 +27,6 @@ tags
|
|||||||
/cabal.sandbox.config
|
/cabal.sandbox.config
|
||||||
/dist-newstyle/
|
/dist-newstyle/
|
||||||
/dist/
|
/dist/
|
||||||
|
|
||||||
|
# nix artifacts
|
||||||
|
result
|
||||||
|
37
flake.nix
37
flake.nix
@ -15,17 +15,26 @@
|
|||||||
else [ "haskell" "packages" compiler ]
|
else [ "haskell" "packages" compiler ]
|
||||||
);
|
);
|
||||||
fromHOL = hol: comp: final: prev: with prev.lib; with attrsets;
|
fromHOL = hol: comp: final: prev: with prev.lib; with attrsets;
|
||||||
setAttrByPath (hpath comp)
|
let
|
||||||
((getAttrFromPath (hpath comp) prev).override (old: {
|
path = hpath comp;
|
||||||
|
root = head path;
|
||||||
|
branch = tail path;
|
||||||
|
hpkgs' = (getAttrFromPath path prev).override (old: {
|
||||||
overrides = composeExtensions (old.overrides or (_: _: {}))
|
overrides = composeExtensions (old.overrides or (_: _: {}))
|
||||||
(hol final prev);
|
(hol final prev);
|
||||||
}));
|
});
|
||||||
|
in {
|
||||||
|
${root} = recursiveUpdate prev.${root} (setAttrByPath branch hpkgs');
|
||||||
|
};
|
||||||
hoverlay = final: prev: hself: hsuper:
|
hoverlay = final: prev: hself: hsuper:
|
||||||
with prev.haskell.lib.compose; {
|
with prev.haskell.lib.compose; {
|
||||||
xmonad = hself.callCabal2nix "xmonad"
|
xmonad = hself.callCabal2nix "xmonad"
|
||||||
(git-ignore-nix.lib.gitignoreSource ./.) { };
|
(git-ignore-nix.lib.gitignoreSource ./.) { };
|
||||||
};
|
};
|
||||||
overlay = fromHOL hoverlay { };
|
defComp = if builtins.pathExists ./comp.nix
|
||||||
|
then import ./comp.nix
|
||||||
|
else { };
|
||||||
|
overlay = fromHOL hoverlay defComp;
|
||||||
overlays = [ overlay ];
|
overlays = [ overlay ];
|
||||||
nixosModule = { config, pkgs, lib, ... }: with lib; with attrsets;
|
nixosModule = { config, pkgs, lib, ... }: with lib; with attrsets;
|
||||||
let
|
let
|
||||||
@ -64,12 +73,28 @@
|
|||||||
nixosModules = [ nixosModule ];
|
nixosModules = [ nixosModule ];
|
||||||
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; };
|
||||||
|
hpkg = pkgs.lib.attrsets.getAttrFromPath (hpath defComp) pkgs;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
devShell = pkgs.haskellPackages.shellFor {
|
devShell = hpkg.shellFor {
|
||||||
packages = p: [ p.xmonad ];
|
packages = p: [ p.xmonad ];
|
||||||
};
|
};
|
||||||
defaultPackage = pkgs.haskellPackages.xmonad;
|
defaultPackage = hpkg.xmonad;
|
||||||
|
# An auxiliary NixOS module that modernises the standard xmonad NixOS module
|
||||||
|
# and wrapper script used, replacing them with versions from unstable.
|
||||||
|
# Currently, due to the NIX_GHC --> XMONAD_GHC env var change, this is
|
||||||
|
# necessary in order for Mod-q recompilation to work out-of-the-box.
|
||||||
|
modernise =
|
||||||
|
let
|
||||||
|
xmonadModFile = "services/x11/window-managers/xmonad.nix";
|
||||||
|
unpkgs = import unstable { inherit system; };
|
||||||
|
replaceWrapper = _: _:
|
||||||
|
{ xmonad-with-packages = unpkgs.xmonad-with-packages; };
|
||||||
|
in {
|
||||||
|
disabledModules = [ xmonadModFile ];
|
||||||
|
imports = [ (unstable + "/nixos/modules/" + xmonadModFile) ];
|
||||||
|
nixpkgs.overlays = [ replaceWrapper ];
|
||||||
|
};
|
||||||
}) // {
|
}) // {
|
||||||
inherit hoverlay overlay overlays nixosModule nixosModules;
|
inherit hoverlay overlay overlays nixosModule nixosModules;
|
||||||
lib = { inherit hpath fromHOL; };
|
lib = { inherit hpath fromHOL; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user