summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.nix26
-rw-r--r--modules/common.nix4
-rw-r--r--modules/www.nix4
3 files changed, 25 insertions, 9 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; };
         };
diff --git a/modules/common.nix b/modules/common.nix
index db6ea85..354f04b 100644
--- a/modules/common.nix
+++ b/modules/common.nix
@@ -17,13 +17,13 @@
   users.motd = ''
 
 /^  /^
-\ ' ' 7   < Hi, I'm ${util.titleCase me}
+\ ' ' 7   < Hi, I'm ${util.titleCase me.name}
 /    \
 
   '';
 
   networking = {
-    hostName = me;
+    hostName = me.name;
   
     firewall = {
       enable = true;
diff --git a/modules/www.nix b/modules/www.nix
index 1df69cf..6e84ec0 100644
--- a/modules/www.nix
+++ b/modules/www.nix
@@ -2,9 +2,9 @@
 
 let 
   rnrdUrl =
-    if me == "renard"
+    if me.renard
       then "rnrd.eu"
-      else "${me}.rnrd.eu";
+      else "${me.name}.rnrd.eu";
 in
 {
   security.acme = {