From c0b76bba4ded69e6d31592fa829c3bfaa1db5a2a Mon Sep 17 00:00:00 2001 From: Lzebulon Date: Mon, 15 Dec 2025 20:17:16 +0100 Subject: [PATCH] continue POC refactor --- flake.nix | 71 +++++++------------------- hosts.nix | 147 ++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 137 insertions(+), 81 deletions(-) diff --git a/flake.nix b/flake.nix index d841f39..2c031ea 100644 --- a/flake.nix +++ b/flake.nix @@ -38,63 +38,26 @@ ./modules agenix.nixosModules.default ]; + hosts = import ./hosts.nix; in - { - apprentix = nixosSystem { + # Physiques + (mapAttrs (name: value: + nixosSystem { specialArgs = inputs; - modules = [ ./hosts/vm/apprentix ] ++ baseModules; - }; - - jitsi = nixosSystem { + modules = [./hosts/physiques/${name}] ++ baseModules; + } + ) + (filterAttrs (n: v: !(attrByPath ["is_debian"] false v)) hosts.physiques) + )// + # VMs + (mapAttrs (name: value: + nixosSystem { specialArgs = inputs; - modules = [ ./hosts/vm/jitsi ] ++ baseModules; - }; - - livre = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/livre ] ++ baseModules; - }; - - neo = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/neo ] ++ baseModules; - }; - - nextcloud = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/nextcloud ] ++ baseModules; - }; - - periodique = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/periodique ] ++ baseModules; - }; - - redite = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/redite ] ++ baseModules; - }; - - reverseproxy = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/reverseproxy ] ++ baseModules; - }; - - thot = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/physiques/thot ] ++ baseModules; - }; - - two = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/two ] ++ baseModules; - }; - - vaultwarden = nixosSystem { - specialArgs = inputs; - modules = [ ./hosts/vm/vaultwarden ] ++ baseModules; - }; - }; + modules = [./hosts/vm/${name}] ++ baseModules; + } + ) + (filterAttrs (n: v: !(attrByPath ["is_debian"] false v)) hosts.vms) + ); }; perSystem = diff --git a/hosts.nix b/hosts.nix index 086d03b..d85a6d3 100644 --- a/hosts.nix +++ b/hosts.nix @@ -1,20 +1,26 @@ -{adm,srv,srv-nat,san, adh}: +let + adm = 10; + srv = n: 4; + srv-nat = 2; + san = 3; + adh = 42; +in { - physiques = [ - { - name = "cephirot"; - id = 3; - vlans = [ - adm - san - ]; - serveur_type = ["san"]; - description = '' - Un serveur avec peut etre un jour ceph - ''; - public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; - } - { + physiques ={ + # cephirot = { + # name = "cephirot"; + # id = 3; + # vlans = [ + # adm + # san + # ]; + # serveur_type = ["san"]; + # description = '' + # Un serveur avec peut etre un jour ceph + # ''; + # public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + # }; + thot = { name = "thot"; id = 14; vlans = [ @@ -26,11 +32,11 @@ Serveur de backup du Crans, actuellement en SQ39 ''; public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; - } - ]; + }; + }; - vms = [ - { + vms = { + romanesco = { name = "romanesco"; is_debian = true; id = 145; @@ -43,8 +49,8 @@ DNS récursif ''; public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; - } - { + }; + neo = { name = "neo"; id = 145; vlans = [ @@ -56,9 +62,8 @@ Matrix du crans, heberge également le bridge IRC <-> Matrix ''; public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; - } - { - name = "NextCloud"; + }; + nextcloud = { id = 146; vlans = [ adm @@ -69,6 +74,94 @@ NextCloud du Crans ''; public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; - } - ]; + }; + apprentix = { + id = 150; + vlans = [ + adm + ]; + description = '' + VM NixOs apprentie + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + jitsi = { + id = 163; + vlans = [ + adm + (srv "185.230.79.15") + ]; + description = '' + Jitsi du crans + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + livre = { + id = 140; + vlans = [ + adm + srv-nat + ]; + description = '' + Stirling PDF + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + periodique = { + id = 118; + vlans = [ + adm + srv-nat + ]; + description = '' + Client matrix web (element) + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + redite = { + id = 139; + vlans = [ + adm + srv-nat + ]; + description = '' + Redite + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + reverseproxy = { + id = 151; + vlans = [ + adm + srv-nat + (srv "185.230.79.42") + ]; + description = '' + NextCloud du Crans + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + two = { + id = 135; + vlans = [ + adm + srv-nat + ]; + description = '' + Une vm de test + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + vaultwarden = { + id = 159; + vlans = [ + adm + srv-nat + ]; + description = '' + Vaultwarden + ''; + public-ssh = "ssh-rsa TODOTODOTODOTODOTODOTODOTODO"; + }; + }; }