Commit afcdd82f8f40

Vincent Demeester <vincent@sbr.pm>
2019-01-11 14:58:32
machines: share home common configuration and…
… alphabetically reorganize nix files (in machine/) Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 47dc3df
machine/hokkaido.nix
@@ -1,13 +1,8 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  imports = [ ../hardware/thinkpad-x220.nix ];
-  time.timeZone = "Europe/Paris";
-  fileSystems."/mnt/synodine" = {
-    device = "192.168.12.19:/";
-    fsType = "nfs";
-    options = ["x-systemd.automount" "noauto"];
-  };
+  imports = [ ../hardware/thinkpad-x220.nix ./home.nix ];
+  networking.firewall.allowPing = true;
   profiles = {
     avahi.enable = true;
     dev.enable = true;
@@ -17,7 +12,6 @@ with import ../assets/machines.nix; {
     virtualization.enable = true;
     nix-config.buildCores = 2;
   };
-  networking.firewall.allowPing = true;
   services = {
     logind.extraConfig = "HandleLidSwitch=ignore";    
     syncthing-edge.guiAddress = "${wireguard.ips.hokkaido}:8384";
machine/home.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, ... }:
+
+with import ../assets/machines.nix; {
+  time.timeZone = "Europe/Paris";
+  fileSystems."/mnt/synodine" = {
+    device = "${home.ips.synodine}:/";
+    fsType = "nfs";
+    options = ["x-systemd.automount" "noauto"];
+  };
+}
machine/honshu.nix
@@ -1,12 +1,11 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  imports = [ ../hardware/dell-latitude-e6540.nix ];
-  time.timeZone = "Europe/Paris";
-  fileSystems."/mnt/synodine" = {
-    device = "192.168.12.19:/";
-    fsType = "nfs";
-    options = ["x-systemd.automount" "noauto"];
+  imports = [ ../hardware/dell-latitude-e6540.nix ./home.nix ];
+  networking = {
+    enableIPv6 = false;
+    firewall.allowedTCPPorts = [ 3389 2375 7946 9000 80 ];
+    firewall.allowPing = true;
   };
   profiles = {
     avahi.enable = true;
@@ -15,11 +14,6 @@ with import ../assets/machines.nix; {
     ssh.enable = true;
     syncthing.enable = true;
   };
-  networking = {
-    enableIPv6 = false;
-    firewall.allowedTCPPorts = [ 3389 2375 7946 9000 80 ];
-    firewall.allowPing = true;
-  };
   services = {
     logind.extraConfig = "HandleLidSwitch=ignore";
     syncthing-edge.guiAddress = "${wireguard.ips.honshu}:8384";
@@ -31,7 +25,8 @@ with import ../assets/machines.nix; {
       endpointPublicKey = wireguard.kerkouane.publicKey;
     };
   };
-  
+
+  # -----------------------------------
   environment.etc."vrsync".text = ''
 /home/vincent/desktop/pictures/screenshots/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/screenshots/
 /home/vincent/desktop/pictures/wallpapers/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/wallpapers/
machine/kobe.nix
@@ -1,12 +1,11 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  time.timeZone = "Europe/Paris";
-  fileSystems."/mnt/synodine" = {
-    device = "192.168.12.19:/";
-    fsType = "nfs";
-    options = ["x-systemd.automount" "noauto"];
+  imports = [ ./home.nix ];
+  boot = {
+    cleanTmpDir = true;
   };
+  networking.firewall.allowPing = true;
   nix = {
     distributedBuilds = true;
     buildMachines = [{
@@ -24,16 +23,12 @@ with import ../assets/machines.nix; {
       maxJobs = 2;
     }];
   };
-  boot = {
-    cleanTmpDir = true;
-  };
   profiles = {
     avahi.enable = true;
     git.enable = true;
     nix-config.buildCores = 1;
     ssh.enable = true;
   };
-  networking.firewall.allowPing = true;
   services = {
     coredns = {
       enable = true;
machine/massimo.nix
@@ -1,15 +1,16 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  time.timeZone = "Europe/Paris";
-  fileSystems."/mnt/synodine" = {
-    device = "192.168.12.19:/";
-    fsType = "nfs";
-    options = ["x-systemd.automount" "noauto"];
-  };
+  imports = [ ./home.nix ];
   boot = {
     cleanTmpDir = true;
   };
+  networking = {
+    firewall = {
+      allowPing = true;
+      allowedTCPPorts = [ 5000 ];
+    };
+  };
   profiles = {
     avahi.enable = true;
     git.enable = true;
@@ -17,8 +18,6 @@ with import ../assets/machines.nix; {
     ssh.enable = true;
     syncthing.enable = true;
   };
-  networking.firewall.allowPing = true;
-  networking.firewall.allowedTCPPorts = [ 5000 ];
   services = {
     nix-binary-cache = {
       enable = true;
machine/shikoku.nix
@@ -1,23 +1,7 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  time.timeZone = "Europe/Paris";
-  fileSystems."/mnt/synodine" = {
-    device = "192.168.12.19:/";
-    fsType = "nfs";
-    options = ["x-systemd.automount" "noauto"];
-  };
-  profiles = {
-    buildkit.enable = true;
-    containerd.enable = true;
-    desktop.enable = true;
-    dev.enable = true;
-    docker.enable = true;
-    gaming.enable = true;
-    nix-config.buildCores = 4;
-    ssh.enable = true;
-    virtualization.enable = true;
-  };
+  imports = [ ./home.nix ];
   boot = {
     loader.efi.canTouchEfiVariables = true;
     loader.grub.enable = true;
@@ -40,13 +24,23 @@ with import ../assets/machines.nix; {
     kernelParams = [ "kvm_intel.nested=1" ];
   };
   hardware.bluetooth.enable = true;
-  programs.podman = {
-    enable = true;
-  };
   networking = {
     firewall.allowedUDPPortRanges = [ { from = 6001; to = 6101; } ];
     firewall.allowedTCPPorts = [ 7946 9000 5000 ];
   };
+  profiles = {
+    buildkit.enable = true;
+    desktop.enable = true;
+    dev.enable = true;
+    docker.enable = true;
+    gaming.enable = true;
+    nix-config.buildCores = 4;
+    ssh.enable = true;
+    virtualization.enable = true;
+  };
+  programs.podman = {
+    enable = true;
+  };
   services = {
     syncthing-edge.guiAddress = "${wireguard.ips.shikoku}:8384";
     smartd.enable = true;
machine/wakasu.nix
@@ -1,14 +1,8 @@
 { config, pkgs, ... }:
 
 with import ../assets/machines.nix; {
-  imports = [ ../hardware/lenovo-p50.nix ];
-  time.timeZone = "Europe/Paris";
-  hardware.sane.enable = true;
-  hardware.sane.extraConfig = {
-    "canon" = "bjnp://192.168.12.70";
-  };
+  imports = [ ../hardware/lenovo-p50.nix ./home.nix ];
   profiles = {
-    containerd.enable = true;
     dev.enable = true;
     docker.enable = true;
     laptop.enable = true;
@@ -19,10 +13,6 @@ with import ../assets/machines.nix; {
   programs = {
     podman.enable = true;
   };
-  networking = {
-    firewall.allowedUDPPortRanges = [ { from = 6001; to = 6101; } ];
-    firewall.allowedTCPPorts = [ 7946 9000 5000 ];
-  };
   services = {
     logind.extraConfig = ''
       HandleLidSwitch=suspend