From 6cd432662b1e4806fd02ec71e1ce64a817087641 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 26 Jun 2024 01:25:55 +0200 Subject: [PATCH] explicit add zerotier --- flake.nix | 73 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/flake.nix b/flake.nix index 3644839..e130304 100644 --- a/flake.nix +++ b/flake.nix @@ -190,36 +190,44 @@ imports = modules ++ defaultModules ++ [ ./machines/${name}/configuration.nix - # clan core configuration - ({ pkgs, lib, ... }: { - imports = [ - # this magically adds all my machines in the zero tier network - # and makes the controller accept them. - # will automatic look into `/machines//facts/zerotier-ip - inputs.clan-core.clanModules.zerotier-static-peers - { - environment.systemPackages = [ - (pkgs.writers.writeBashBin "zerotier-script-nodeid" '' - sudo ${pkgs.zerotierone}/bin/zerotier-cli info | cut -d " " -f 3 - '') - ]; - } - - # Statically configure the host names of machines based on their respective zerotier-ip. - inputs.clan-core.clanModules.static-hosts - - # generate ssh host keys with facts - inputs.clan-core.clanModules.sshd - ]; - clan.static-hosts.topLevelDomain = "bear"; - - environment.systemPackages = [ - clan-core.packages.${pkgs.system}.clan-cli - ]; - }) ]; }; + zerotierControllerModule = + { + clan.networking.zerotier.controller = { + enable = true; + public = false; + }; + }; + + zerotierModules = { pkgs, ... }: { + imports = [ + + # this magically adds all my machines in the zero tier network + # and makes the controller accept them. + # will automatic look into `/machines//facts/zerotier-ip + inputs.clan-core.clanModules.zerotier-static-peers + + # Statically configure the host names of machines based on their respective zerotier-ip. + inputs.clan-core.clanModules.static-hosts + + # generate ssh host keys with facts + inputs.clan-core.clanModules.sshd + + # manual configs + { + clan.static-hosts.topLevelDomain = "bear"; + environment.systemPackages = [ + clan-core.packages.${pkgs.system}.clan-cli + (pkgs.writers.writeBashBin "zerotier-script-nodeid" '' + sudo ${pkgs.zerotierone}/bin/zerotier-cli info | cut -d " " -f 3 + '') + ]; + } + ]; + }; + defaultModules = [ # make flake inputs accessiable in NixOS { @@ -360,6 +368,7 @@ name = "cream"; host = "cream.bear"; modules = [ + zerotierModules nixos-hardware.nixosModules.framework-12th-gen-intel retiolum.nixosModules.retiolum private_assets.nixosModules.cream @@ -381,6 +390,7 @@ name = "cherry"; host = "cherry.bear"; modules = [ + zerotierModules nixos-hardware.nixosModules.framework-13th-gen-intel retiolum.nixosModules.retiolum private_assets.nixosModules.yubikey @@ -401,12 +411,8 @@ name = "chungus"; host = "chungus.bear"; modules = [ - { - clan.networking.zerotier.controller = { - enable = true; - public = false; - }; - } + zerotierModules + zerotierControllerModule homeManagerModules stylixModules retiolum.nixosModules.retiolum @@ -426,6 +432,7 @@ host = "orbi.bear"; #host = "95.216.66.212"; modules = [ + zerotierModules homeManagerModules stylixModules srvos.nixosModules.hardware-hetzner-online-intel