diff options
Diffstat (limited to '')
| -rw-r--r-- | hosts/by-name/server2/host.toml | 2 | ||||
| -rw-r--r-- | hosts/by-name/server3/host.toml | 2 | ||||
| -rw-r--r-- | hosts/default.nix | 44 | ||||
| -rw-r--r-- | hosts/host-names.toml | 2 |
4 files changed, 33 insertions, 17 deletions
diff --git a/hosts/by-name/server2/host.toml b/hosts/by-name/server2/host.toml new file mode 100644 index 0000000..ca8423a --- /dev/null +++ b/hosts/by-name/server2/host.toml @@ -0,0 +1,2 @@ +hostname = "server2.vhack.eu" +nixpkgs = "stable" diff --git a/hosts/by-name/server3/host.toml b/hosts/by-name/server3/host.toml new file mode 100644 index 0000000..8a885ae --- /dev/null +++ b/hosts/by-name/server3/host.toml @@ -0,0 +1,2 @@ +hostname = "server3.vhack.eu" +nixpkgs = "stable" diff --git a/hosts/default.nix b/hosts/default.nix index 613db37..4a3d52f 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,34 +1,48 @@ { - pkgs, - nixLib, - nixpkgs, - specialArgs, - extraModules, - deploy-rs, self, + extra_lib, + module_args, + extra_modules, + special_args, + nixpkgs-stable, + nixpkgs-unstable, + deploy-rs, + system, }: let - hosts = nixLib.mkByName { + hosts = extra_lib.mkByName { useShards = false; baseDirectory = ./by-name; fileName = "configuration.nix"; }; - mkNixosConfiguration = _: value: + 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 { - system = "x86_64-linux"; - inherit specialArgs; + specialArgs = special_args; modules = - extraModules + extra_modules ++ [ + { + _module.args = module_args; + } + path + ../modules - value + # ../modules/common ]; }; - mkDeployHost = name: value: { - hostname = "${name}.vhack.eu"; + 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.x86_64-linux.activate.nixos self.nixosConfigurations."${name}"; + path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}"; }; }; diff --git a/hosts/host-names.toml b/hosts/host-names.toml deleted file mode 100644 index 2cf2833..0000000 --- a/hosts/host-names.toml +++ /dev/null @@ -1,2 +0,0 @@ -server2 = "server2.vhack.eu" -server3 = "server3.vhack.eu" |
