-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
109 lines (100 loc) · 2.92 KB
/
default.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
let
inputs = import ./deps;
lib = (import "${inputs.nixpkgs}/lib").extend (import ./lib inputs);
machines_plats = lib.lists.unique (
lib.mapAttrsToList (_name: value: value.system) (
lib.filterAttrs (_n: v: builtins.hasAttr "system" v) lib.infra.machines
)
);
nixosSystem = import ./lib/nixos-system.nix inputs lib;
nixpkgs_plats = builtins.listToAttrs (
builtins.map (plat: {
name = plat;
value = import inputs.nixpkgs {
system = plat;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "harmony-assistant" ];
overlays = [
(_: prev: {
gradle2nix = prev.callPackage inputs.gradle2nix { };
nix-update-script =
args:
prev.nix-update-script (
args
// {
extraArgs = [
"-f"
"release.nix"
] ++ args.extraArgs or [ ];
}
);
})
];
};
}) machines_plats
);
in
rec {
nixosModules =
import ./modules
// (builtins.listToAttrs (
map (x: {
name = "profile-${x}";
value = import (./profiles + "/${x}");
}) (builtins.attrNames (builtins.readDir ./profiles))
));
homeManagerModules = builtins.listToAttrs (
map (x: {
name = "profile-${x}";
value = import (./profiles/home-manager + "/${x}");
}) (builtins.attrNames (builtins.readDir ./profiles/home-manager))
);
nixosConfigurations = builtins.mapAttrs (
name: value:
(nixosSystem {
inherit name;
host-config = value;
modules = nixosModules;
hmModules = homeManagerModules;
nixpkgs = lib.infra.machines.${name}.nixpkgs_version;
extraPackages = packages;
inherit (lib.infra.machines.${name}) system;
home-manager = lib.infra.machines.${name}.hm_version;
})
) (lib.importConfig ./machines);
packages = builtins.listToAttrs (
builtins.map (plat: {
name = plat;
value =
lib.filterAttrs
(
_name: value:
(
!lib.hasAttrByPath [
"meta"
"platforms"
] value
)
|| builtins.elem plat value.meta.platforms
)
(
let
callPackage = nixpkgs_plats.${plat}.lib.customisation.callPackageWith (
nixpkgs_plats.${plat} // ours
);
ours = builtins.listToAttrs (
builtins.map (e: {
name = e;
value = callPackage (./pkgs + "/${e}") { };
}) (builtins.attrNames (builtins.readDir ./pkgs))
);
in
ours
);
}) machines_plats
);
inherit (lib.infra) machines;
checks = {
inherit packages;
machines = lib.mapAttrs (_: v: v.config.system.build.toplevel) nixosConfigurations;
};
}