diff options
| author | Mel <einebeere@gmail.com> | 2024-11-13 18:59:44 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-11-13 18:59:44 +0100 |
| commit | 8d9744c902882a0df01e06c5e2f9602ff147efbe (patch) | |
| tree | 5747ec1947c1330f747e10b26c14931bd91acaba /flake.nix | |
| parent | 9637de35f8efbf19bc2f81ced36caf03f30a9489 (diff) | |
| download | network-8d9744c902882a0df01e06c5e2f9602ff147efbe.tar.zst network-8d9744c902882a0df01e06c5e2f9602ff147efbe.zip | |
Expand `me` module argument for nicer usage patterns
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/flake.nix b/flake.nix index 3b0b980..f99f130 100644 --- a/flake.nix +++ b/flake.nix @@ -19,15 +19,31 @@ outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }: let + tailnetName = "serval-moth"; + systems = { x86 = "x86_64-linux"; arm = "aarch64-linux"; }; - machines = with systems; [ - { name = "corsac"; system = x86; } - { name = "lapin"; system = arm; } - { name = "renard"; system = x86; } + mkMachines = let + mkMachine = m: { + inherit (m) name system; + tailscale = { + inherit (m.tailscale) ip; + domain = "${m.name}.${tailnetName}.ts.net"; + }; + }; + + mkIdentities = ms: current: + lib.genAttrs (lib.catAttrs "name" ms) (m: current.name == m); + + in machines: map (m: (mkMachine m) // (mkIdentities machines m)) machines; + + machines = with systems; mkMachines [ + { name = "corsac"; system = x86; tailscale.ip = "100.64.100.100"; } + { name = "lapin"; system = arm; tailscale.ip = "100.83.254.27"; } + { name = "renard"; system = x86; tailscale.ip = "100.75.17.75"; } ]; packageSetsForSystem = system: let @@ -45,7 +61,7 @@ inherit (machine) system; specialArgs = inputs // (packageSetsForSystem machine.system) // { - me = machine.name; + me = machine; security = import ./security.nix; util = import ./util.nix { inherit lib; }; }; |
