home.nix (3113B)
1 { config, lib, pkgs, ... }: 2 3 with lib; 4 let 5 cfg = config.modules.profiles.home; 6 secretPath = ../../../secrets/machines.nix; 7 secretCondition = (builtins.pathExists secretPath); 8 machines = lib.optionalAttrs secretCondition (import secretPath); 9 in 10 { 11 options = { 12 modules.profiles.home = mkEnableOption "Enable home profile"; 13 }; 14 config = mkIf cfg { 15 boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ]; 16 networking = { 17 domain = "home"; 18 hosts = with machines; mkIf secretCondition { 19 "${home.ips.honshu}" = [ "honshu.home" ]; 20 "${home.ips.aion}" = [ "aion.home" ]; 21 "${home.ips.aomi}" = [ "aomi.home" ]; 22 "${wireguard.ips.aomi}" = [ "aomi.vpn" ]; 23 "${home.ips.shikoku}" = [ "shikoku.home" ]; 24 "${wireguard.ips.shikoku}" = [ "shikoku.vpn" ]; 25 "${home.ips.wakasu}" = [ "wakasu.home" ]; 26 "${wireguard.ips.wakasu}" = [ "wakasu.vpn" ]; 27 "${home.ips.hokkaido}" = [ "hokkaido.home" ]; 28 "${wireguard.ips.hokkaido}" = [ "hokkaido.vpn" ]; 29 # "${home.ips.sakhalin}" = [ "sakhalin.home" ]; 30 "${home.ips.sakhalin}" = [ "sakhalin.home" "nix.cache.home" ]; 31 "${wireguard.ips.sakhalin}" = [ "sakhalin.vpn" ]; 32 "${home.ips.synodine}" = [ "synodine.home" ]; 33 "${home.ips.okinawa}" = [ "okinawa.home" ]; 34 "${wireguard.ips.okinawa}" = [ "okinawa.vpn" ]; 35 "${wireguard.ips.kerkouane}" = [ "kerkouane.vpn" ]; 36 "${wireguard.ips.naruhodo}" = [ "naruhodo.vpn" ]; 37 "${home.ips.demeter}" = [ "demeter.home" ]; 38 "${home.ips.athena}" = [ "athena.home" ]; 39 }; 40 }; 41 time.timeZone = "Europe/Paris"; 42 # To mimic autofs on fedora 43 fileSystems = mkIf secretCondition { 44 "/net/synodine.home" = { 45 device = "${machines.home.ips.synodine}:/"; 46 fsType = "nfs"; 47 options = [ "x-systemd.automount" "noauto" ]; 48 }; 49 # FIXME(vdemeester): I think it acts like this because there is only one export 50 "/net/sakhalin.home/export" = { 51 device = "${machines.home.ips.sakhalin}:/"; 52 fsType = "nfs"; 53 options = [ "x-systemd.automount" "noauto" ]; 54 }; 55 # FIXME(vdemeester): Loop 56 "/net/aion.home/export/documents" = { 57 device = "aion.home:/export/documents"; 58 fsType = "nfs"; 59 options = [ "x-systemd.automount" "noauto" ]; 60 }; 61 "/net/aion.home/export/downloads" = { 62 device = "aion.home:/export/downloads"; 63 fsType = "nfs"; 64 options = [ "x-systemd.automount" "noauto" ]; 65 }; 66 "/net/aion.home/export/music" = { 67 device = "aion.home:/export/music"; 68 fsType = "nfs"; 69 options = [ "x-systemd.automount" "noauto" ]; 70 }; 71 "/net/aion.home/export/pictures" = { 72 device = "aion.home:/export/pictures"; 73 fsType = "nfs"; 74 options = [ "x-systemd.automount" "noauto" ]; 75 }; 76 "/net/aion.home/export/videos" = { 77 device = "aion.home:/export/videos"; 78 fsType = "nfs"; 79 options = [ "x-systemd.automount" "noauto" ]; 80 }; 81 }; 82 }; 83 }