Commit 202ba44fe3e1

Vincent Demeester <vincent@sbr.pm>
2020-05-25 17:31:22
profiles.home: migrate home.nixos.nix
- Make it a profile that can be enabled - Use /home/build as a "detection" of "being in CI" Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 4882d2e
modules/profiles/home.nixos.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.home;
+  machines = import ../../assets/machines.nix;
+  home = machines.home;
+in
+{
+  options = {
+    profiles.home = mkEnableOption "Enable home profile";
+  };
+  config = mkIf cfg {
+    boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];
+    networking.domain = "home";
+    time.timeZone = "Europe/Paris";
+    # To mimic autofs on fedora
+    fileSystems."/net/synodine.home/" = {
+      device = "${home.ips.synodine}:/";
+      fsType = "nfs";
+      options = [ "x-systemd.automount" "noauto" ];
+    };
+    # FIXME(vdemeester): I think it acts like this because there is only one export
+    fileSystems."/net/sakhalin.home/export/" = {
+      device = "${home.ips.sakhalin}:/";
+      fsType = "nfs";
+      options = [ "x-systemd.automount" "noauto" ];
+    };
+    # Deprecated
+    fileSystems."/mnt/synodine" = {
+      device = "${home.ips.synodine}:/";
+      fsType = "nfs";
+      options = [ "x-systemd.automount" "noauto" ];
+    };
+    fileSystems."/mnt/sakhalin" = {
+      device = "${home.ips.sakhalin}:/";
+      fsType = "nfs";
+      options = [ "x-systemd.automount" "noauto" ];
+    };
+  };
+}
modules/module-list.nixos.nix
@@ -5,13 +5,14 @@
     ./profiles/avahi.nixos.nix
     ./profiles/base.nixos.nix
     ./profiles/buildkit.nixos.nix
-    ./profiles/fish.nixos.nix
     ./profiles/containerd.nixos.nix
     ./profiles/desktop.nixos.nix
     ./profiles/dev.nixos.nix
     ./profiles/docker.nixos.nix
+    ./profiles/fish.nixos.nix
     ./profiles/gaming.nixos.nix
     ./profiles/git.nixos.nix
+    ./profiles/home.nixos.nix
     ./profiles/i18n.nixos.nix
     ./profiles/ipfs.nixos.nix
     ./profiles/laptop.nixos.nix
systems/hokkaido.nix
@@ -4,6 +4,7 @@ let
     # assert builtins.trace "This is a dummy config, use switch!" false;
     {}
   '';
+  inCi = builtins.pathExists /home/build;
 in
 {
   imports = [
@@ -11,10 +12,10 @@ in
     ../modules/module-list.nixos.nix
     # hardware
     ../hardware/thinkpad-x220.nix
-    # FIXME: remove this
-    ../machines/home.nixos.nix
   ];
 
+  profiles.home = !inCi;
+
   networking = {
     hostName = "hokkaido";
   };
systems/wakasu.nix
@@ -15,6 +15,8 @@ in
     ../machines/home.nixos.nix
   ];
 
+  profiles.home = !inCi;
+
   networking = {
     hostName = "wakasu";
   };