aboutsummaryrefslogtreecommitdiffstats
path: root/hosts
diff options
context:
space:
mode:
authorSoispha Peetz <soispha@b-peetz.de>2026-10-29 23:32:22 +0100
committerSoispha Peetz <soispha@b-peetz.de>2026-11-27 00:27:17 +0100
commit021564ffd40d54a59dd461b7d0d5e00a3c86ed0e (patch)
tree86e5d3612603fdf50b84c4c3fb62b0537da28249 /hosts
parenttests/stalwart-*: Hard disable them (diff)
downloadnixos-server-021564ffd40d54a59dd461b7d0d5e00a3c86ed0e.zip
treewide: Rework entry points and attribute names
That just makes a lot of stuff easier and more streamlined. Also, all choices between stable or unstable nixpkgs should now be explicit.
Diffstat (limited to '')
-rw-r--r--hosts/by-name/server2/host.toml2
-rw-r--r--hosts/by-name/server3/host.toml2
-rw-r--r--hosts/default.nix44
-rw-r--r--hosts/host-names.toml2
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"