aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoispha Peetz <soispha@b-peetz.de>2026-11-26 02:52:49 +0100
committerSoispha Peetz <soispha@b-peetz.de>2026-11-27 00:55:53 +0100
commit175d062652ba0077990b40daf19cc729f22d45ae (patch)
treeb67603d88f50283ffc5d60d9d9e7d22c6c1771b7
parenttests/snm-email-{single,dual}-server: Remove removed `localResolver` (diff)
downloadnixos-server-175d062652ba0077990b40daf19cc729f22d45ae.zip
hosts/*: Include their deployment method in their definition
-rw-r--r--flake.nix1
-rw-r--r--hosts/by-name/server2/host.toml1
-rw-r--r--hosts/by-name/server3/host.toml1
-rw-r--r--hosts/default.nix32
4 files changed, 21 insertions, 14 deletions
diff --git a/flake.nix b/flake.nix
index 5b68682..56db66c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -68,6 +68,7 @@
hosts = import ./hosts {
inherit
self
+ lib
extra_lib
module_args
special_args
diff --git a/hosts/by-name/server2/host.toml b/hosts/by-name/server2/host.toml
index ca8423a..16e2764 100644
--- a/hosts/by-name/server2/host.toml
+++ b/hosts/by-name/server2/host.toml
@@ -1,2 +1,3 @@
hostname = "server2.vhack.eu"
nixpkgs = "stable"
+deployment = "deploy-rs"
diff --git a/hosts/by-name/server3/host.toml b/hosts/by-name/server3/host.toml
index 8a885ae..0f0cb59 100644
--- a/hosts/by-name/server3/host.toml
+++ b/hosts/by-name/server3/host.toml
@@ -1,2 +1,3 @@
hostname = "server3.vhack.eu"
nixpkgs = "stable"
+deployment = "deploy-rs"
diff --git a/hosts/default.nix b/hosts/default.nix
index 40f2bd8..8a85ad5 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -1,5 +1,6 @@
{
self,
+ lib,
extra_lib,
module_args,
special_args,
@@ -12,12 +13,14 @@
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: path: let
- host_file = builtins.fromTOML (builtins.readFile (path + "/../host.toml"));
+ mkNixosConfiguration = name: host: let
nixpkgs =
- if host_file.nixpkgs == "stable"
+ if host.definition.nixpkgs == "stable"
then nixpkgs-stable
else nixpkgs-unstable;
in
@@ -27,24 +30,25 @@
{
_module.args = module_args;
}
- path
+ host.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}";
- };
- };
+ 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 = builtins.mapAttrs mkDeployHost hosts;
+ nodes = lib.filterAttrs (_: value: value != null) (builtins.mapAttrs mkDeployHost hosts);
in {
inherit nixosConfigurations nodes;
}