-
-
Notifications
You must be signed in to change notification settings - Fork 276
/
flake.nix
48 lines (48 loc) · 1.72 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This file is maintained by @IvanMalison and @LSLeary (github)
# See NIX.md for an overview of module usage.
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
git-ignore-nix.url = "github:hercules-ci/gitignore.nix/master";
xmonad.url = "github:xmonad/xmonad";
};
outputs = { self, flake-utils, nixpkgs, git-ignore-nix, xmonad }:
with xmonad.lib;
let
hoverlay = final: prev: hself: hsuper: {
xmonad-contrib = hself.callCabal2nix "xmonad-contrib"
(git-ignore-nix.lib.gitignoreSource ./.) { };
};
defComp = if builtins.pathExists ./comp.nix
then import ./comp.nix
else { };
overlay = fromHOL hoverlay defComp;
overlays = [ overlay (fromHOL xmonad.hoverlay defComp) ];
nixosModule = { config, lib, ... }: with lib;
let
cfg = config.services.xserver.windowManager.xmonad;
comp = { inherit (cfg.flake) prefix compiler; };
in {
config = mkIf (cfg.flake.enable && cfg.enableContribAndExtras) {
nixpkgs.overlays = [ (fromHOL hoverlay comp) ];
};
};
nixosModules = [ nixosModule ] ++ xmonad.nixosModules;
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system overlays; };
hpkg = pkgs.lib.attrsets.getAttrFromPath (hpath defComp) pkgs;
modifyDevShell =
if builtins.pathExists ./develop.nix
then import ./develop.nix
else _: x: x;
in
rec {
devShell = hpkg.shellFor (modifyDevShell pkgs {
packages = p: [ p.xmonad-contrib ];
nativeBuildInputs = [ pkgs.cabal-install ];
});
defaultPackage = hpkg.xmonad-contrib;
modernise = xmonad.modernise.${system};
}) // { inherit hoverlay overlay overlays nixosModule nixosModules; } ;
}