blob: 61734fbf9aee66cbbd218dde3a7dc321ae8f3bfa (
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,
lib,
extra_lib,
module_args,
special_args,
nixpkgs-stable,
nixpkgs-unstable,
deploy-rs,
system,
}: let
hosts = extra_lib.mkByName {
useShards = false;
baseDirectory = ./by-name;
fileName = "configuration.nix";
finalizeFunction = host_name: path: let
definition = builtins.fromTOML (builtins.readFile (path + "/../host.toml"));
in {inherit path definition;};
};
mkNixosConfiguration = name: host: let
nixpkgs =
if host.definition.nixpkgs == "stable"
then nixpkgs-stable
else nixpkgs-unstable;
in
nixpkgs.lib.nixosSystem {
specialArgs = special_args;
modules = [
{
_module.args = module_args;
}
host.path
../modules
];
};
mkDeployHost = name: host:
if (host.definition.deployment == "deploy-rs")
then {
inherit (host.definition) hostname;
profiles.system = {
user = "root";
path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}";
};
}
else null;
nixosConfigurations = builtins.mapAttrs mkNixosConfiguration hosts;
nodes = lib.filterAttrs (_: value: value != null) (builtins.mapAttrs mkDeployHost hosts);
in {
inherit nixosConfigurations nodes;
}
|