blob: e1709e34dd047607c874861f9a26f519bfe65a29 (
plain)
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
|
{ self, inputs, lib, pkgs, ... } @ args:
with lib;
with lib.my;
{
mkSystem = { hostPath, nixpkgs ? inputs.unstable, system ? "x86_64-linux", overlays ? null, extraModules ? null }:
nixpkgs.lib.nixosSystem (
{
system = system;
specialArgs = args;
modules = [
{
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf hostPath));
nix.flakes.enable = true;
system.configurationRevision = self.rev or "dirty";
documentation.man = { enable = true; generateCaches = true; };
}
(import hostPath)
] ++ mapModulesRec' ../modules import
++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; }
++ nixpkgs.lib.optionals (extraModules != null) extraModules;
# let deployment options to be set without breaking eval on nixosConfigurations
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
}
);
mapSystems = dir: attrs @ { system ? system, ... }:
mapModules dir
(hostPath: mkSystem { inherit hostPath; });
mkColmenaFromNixOSConfigurations = conf:
{
meta = {
# Colmena requirement. Will be overridden in nodeNixpkgs.
nixpkgs = import inputs.unstable { system = "x86_64-linux"; };
nodeNixpkgs = builtins.mapAttrs (_: value: value.pkgs) conf;
nodeSpecialArgs = builtins.mapAttrs (_: value: value._module.specialArgs) conf;
};
} // builtins.mapAttrs (_: value: { imports = value._module.args.modules; }) conf;
mkHydraFromNixOSConfigurations = conf:
mapAttrs' (name: value: { name = "nixos-${name}"; value = value.config.system.build.toplevel; }) conf;
}
|