From a8598a9be8a580dca3bf6284d2c5bcf5af49dce7 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Wed, 11 Mar 2026 23:36:54 +0100 Subject: [PATCH] refactor: extract host config into 'host.nix' files --- hosts/andromache/default.nix | 8 ++------ hosts/andromache/host.nix | 4 ++++ hosts/astyanax/default.nix | 8 ++------ hosts/astyanax/host.nix | 4 ++++ hosts/eetion-02/default.nix | 6 +----- hosts/eetion-02/host.nix | 4 ++++ hosts/eetion/default.nix | 6 +----- hosts/eetion/host.nix | 4 ++++ hosts/hecuba/default.nix | 8 ++------ hosts/hecuba/host.nix | 4 ++++ hosts/vm/default.nix | 7 ++----- hosts/vm/host.nix | 4 ++++ 12 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 hosts/andromache/host.nix create mode 100644 hosts/astyanax/host.nix create mode 100644 hosts/eetion-02/host.nix create mode 100644 hosts/eetion/host.nix create mode 100644 hosts/hecuba/host.nix create mode 100644 hosts/vm/host.nix diff --git a/hosts/andromache/default.nix b/hosts/andromache/default.nix index 220f993d..b0bf839f 100644 --- a/hosts/andromache/default.nix +++ b/hosts/andromache/default.nix @@ -12,12 +12,13 @@ in { imports = [ inputs.disko.nixosModules.disko - ../../modules/common ./hard.nix + ./host.nix inputs.nixos-hardware.nixosModules.common-cpu-intel inputs.nixos-hardware.nixosModules.common-pc inputs.nixos-hardware.nixosModules.common-pc-ssd inputs.sops-nix.nixosModules.sops + ../../modules/common ../../modules/boot/bootloader.nix (import ../../modules/disko/zfs-encrypted-root.nix { inherit lib config; @@ -43,11 +44,6 @@ in ../../modules/yubikey ]; - host = { - username = "h"; - name = "andromache"; - }; - home-manager.users.${config.host.username} = import ../../home/hosts/andromache { inherit inputs diff --git a/hosts/andromache/host.nix b/hosts/andromache/host.nix new file mode 100644 index 00000000..4479c345 --- /dev/null +++ b/hosts/andromache/host.nix @@ -0,0 +1,4 @@ +{ + username = "h"; + name = "andromache"; +} diff --git a/hosts/astyanax/default.nix b/hosts/astyanax/default.nix index 9ad17677..dc21ea65 100644 --- a/hosts/astyanax/default.nix +++ b/hosts/astyanax/default.nix @@ -11,12 +11,13 @@ in { imports = [ inputs.disko.nixosModules.disko - ../../modules/common ./hard.nix + ./host.nix inputs.nixos-hardware.nixosModules.common-pc inputs.nixos-hardware.nixosModules.common-pc-ssd # inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-intel-gen7 (not available yet?) inputs.sops-nix.nixosModules.sops + ../../modules/common ../../modules/boot/bootloader.nix (import ../../modules/disko/zfs-encrypted-root.nix { inherit lib config; @@ -40,11 +41,6 @@ in ../../modules/nfc ]; - host = { - username = "h"; - name = "astyanax"; - }; - home-manager.users.${config.host.username} = import ../../home/hosts/astyanax { inherit inputs diff --git a/hosts/astyanax/host.nix b/hosts/astyanax/host.nix new file mode 100644 index 00000000..eb16a6dd --- /dev/null +++ b/hosts/astyanax/host.nix @@ -0,0 +1,4 @@ +{ + username = "h"; + name = "astyanax"; +} diff --git a/hosts/eetion-02/default.nix b/hosts/eetion-02/default.nix index e4c2a7e9..675bebcc 100644 --- a/hosts/eetion-02/default.nix +++ b/hosts/eetion-02/default.nix @@ -6,15 +6,11 @@ { imports = [ ./hard.nix + ./host.nix ../../modules/ssh ../../modules/common ]; - host = { - username = "h"; - name = "eetion-02"; - }; - ssh = { inherit (config.host) username; publicHostname = config.host.name; diff --git a/hosts/eetion-02/host.nix b/hosts/eetion-02/host.nix new file mode 100644 index 00000000..f721a6ba --- /dev/null +++ b/hosts/eetion-02/host.nix @@ -0,0 +1,4 @@ +{ + username = "h"; + name = "eetion-02"; +} diff --git a/hosts/eetion/default.nix b/hosts/eetion/default.nix index 4b94d8f7..17197a87 100644 --- a/hosts/eetion/default.nix +++ b/hosts/eetion/default.nix @@ -6,16 +6,12 @@ { imports = [ ./hard.nix + ./host.nix ../../modules/ssh ../../modules/common # ../../modules/uptime-kuma ]; - host = { - username = "h"; - name = "eetion"; - }; - ssh = { inherit (config.host) username; publicHostname = config.host.name; diff --git a/hosts/eetion/host.nix b/hosts/eetion/host.nix new file mode 100644 index 00000000..c69fbcaf --- /dev/null +++ b/hosts/eetion/host.nix @@ -0,0 +1,4 @@ +{ + username = "h"; + name = "eetion"; +} diff --git a/hosts/hecuba/default.nix b/hosts/hecuba/default.nix index b0dd8308..d7cf910d 100644 --- a/hosts/hecuba/default.nix +++ b/hosts/hecuba/default.nix @@ -10,17 +10,13 @@ { imports = [ inputs.disko.nixosModules.disko - ../../modules/common ./hard.nix + ./host.nix + ../../modules/common ../../modules/ssh ../../modules/docker ]; - host = { - username = "username"; - name = "hecuba"; - }; - networking.hostName = config.host.name; ssh = { inherit (config.host) username; diff --git a/hosts/hecuba/host.nix b/hosts/hecuba/host.nix new file mode 100644 index 00000000..e7e10dd3 --- /dev/null +++ b/hosts/hecuba/host.nix @@ -0,0 +1,4 @@ +{ + username = "username"; + name = "hecuba"; +} diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix index 41449dfa..9dc3c380 100644 --- a/hosts/vm/default.nix +++ b/hosts/vm/default.nix @@ -10,6 +10,7 @@ inputs.disko.nixosModules.disko ../../modules/common ./hard.nix + ./host.nix inputs.sops-nix.nixosModules.sops ./disk.nix ../../modules/boot/bootloader.nix @@ -22,16 +23,12 @@ ../../modules/fonts ../../modules/ssh ../../modules/storage + ../../modules/stylix (import ../../modules/secrets { inherit lib inputs config; }) ]; - host = { - username = "h"; - name = "vm"; - }; - home-manager.users.${config.host.username} = import ../../home/hosts/vm { inherit inputs config pkgs; }; diff --git a/hosts/vm/host.nix b/hosts/vm/host.nix new file mode 100644 index 00000000..1500370f --- /dev/null +++ b/hosts/vm/host.nix @@ -0,0 +1,4 @@ +{ + username = "h"; + name = "vm"; +}