blob: 4a3d52fc8c759252d57d678a1f2da3f53e4a74b8 (
plain) (
blame)
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
|
{
self,
extra_lib,
module_args,
extra_modules,
special_args,
nixpkgs-stable,
nixpkgs-unstable,
deploy-rs,
system,
}: let
hosts = extra_lib.mkByName {
useShards = false;
baseDirectory = ./by-name;
fileName = "configuration.nix";
};
mkNixosConfiguration = name: path: let
host_file = builtins.fromTOML (builtins.readFile (path + "/../host.toml"));
nixpkgs =
if host_file.nixpkgs == "stable"
then nixpkgs-stable
else nixpkgs-unstable;
in
nixpkgs.lib.nixosSystem {
specialArgs = special_args;
modules =
extra_modules
++ [
{
_module.args = module_args;
}
path
../modules
# ../modules/common
];
};
mkDeployHost = name: path: let
host_file = builtins.fromTOML (builtins.readFile path + "/host.toml");
in {
inherit (host_file) hostname;
profiles.system = {
user = "root";
path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}";
};
};
nixosConfigurations = builtins.mapAttrs mkNixosConfiguration hosts;
nodes = builtins.mapAttrs mkDeployHost hosts;
in {
inherit nixosConfigurations nodes;
}
|