diff options
Diffstat (limited to 'hosts')
| -rw-r--r-- | hosts/kansai/configuration.nix | 7 | ||||
| -rw-r--r-- | hosts/kansai/hardware-configuration.nix | 118 | ||||
| -rw-r--r-- | hosts/shared/hardware-configuration.nix | 91 |
3 files changed, 122 insertions, 94 deletions
diff --git a/hosts/kansai/configuration.nix b/hosts/kansai/configuration.nix index b2c40db..2aefa15 100644 --- a/hosts/kansai/configuration.nix +++ b/hosts/kansai/configuration.nix @@ -13,7 +13,12 @@ primaryUser = "ebisu"; mosh.enable = true; nix.extendedSupport = true; - mounts.kioku.enable = true; + + mounts.kioku = { + enable = true; + name = "kioku"; + device = "/dev/disk/by-uuid/67BF-FE53"; + }; }; networking.hostName = "kansai"; diff --git a/hosts/kansai/hardware-configuration.nix b/hosts/kansai/hardware-configuration.nix index c253822..a4129c7 100644 --- a/hosts/kansai/hardware-configuration.nix +++ b/hosts/kansai/hardware-configuration.nix @@ -7,7 +7,6 @@ }: let nixosDevice = "/dev/disk/by-uuid/59148bdd-ecb1-49a0-beec-89d0adf909ae"; - plexMountName = "plex"; commonOptions = [ "noatime" @@ -26,80 +25,69 @@ in (import "${self}/hosts/shared/hardware-configuration.nix") ]; - boot = { - initrd = { - availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usb_storage" - "usbhid" - "sd_mod" - ]; + config = { + boot = { + initrd = { + availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "usbhid" + "sd_mod" + ]; - kernelModules = [ ]; - }; - - kernelModules = [ "kvm-amd" ]; - extraModulePackages = [ ]; - }; + kernelModules = [ ]; + }; - fileSystems = { - "/" = { - device = nixosDevice; - fsType = "btrfs"; - options = commonBtrfsOptions ++ [ "subvol=@" ]; + kernelModules = [ "kvm-amd" ]; + extraModulePackages = [ ]; }; - "/home" = { - device = nixosDevice; - fsType = "btrfs"; - options = commonBtrfsOptions ++ [ "subvol=@home" ]; - }; + fileSystems = { + "/" = { + device = nixosDevice; + fsType = "btrfs"; + options = commonBtrfsOptions ++ [ "subvol=@" ]; + }; - "/var" = { - device = nixosDevice; - fsType = "btrfs"; - options = commonBtrfsOptions ++ [ "subvol=@var" ]; - }; + "/home" = { + device = nixosDevice; + fsType = "btrfs"; + options = commonBtrfsOptions ++ [ "subvol=@home" ]; + }; - "/nix" = { - device = nixosDevice; - fsType = "btrfs"; - options = commonBtrfsOptions ++ [ "subvol=@nix" ]; - }; + "/var" = { + device = nixosDevice; + fsType = "btrfs"; + options = commonBtrfsOptions ++ [ "subvol=@var" ]; + }; - "/boot" = { - device = "/dev/disk/by-uuid/C675-43E1"; - fsType = "vfat"; + "/nix" = { + device = nixosDevice; + fsType = "btrfs"; + options = commonBtrfsOptions ++ [ "subvol=@nix" ]; + }; - options = [ - "fmask=0022" - "dmask=0022" - ]; - }; - - "/mnt/${plexMountName}" = { - device = "/dev/mapper/${plexMountName}"; - fsType = "exfat"; + "/boot" = { + device = "/dev/disk/by-uuid/C675-43E1"; + fsType = "vfat"; - options = [ - "rw" - "nofail" - "uid=1000" - "gid=1000" - "dmask=027" - "fmask=137" - ] ++ commonOptions; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; }; - }; - environment.etc.crypttab.text = '' - ${plexMountName} /dev/disk/by-partlabel/WD_BLACK ${config.sops.secrets.plex_drive_bitlocker_recovery_key.path} bitlk - ''; + modules.mounts.plex = { + enable = true; + extraOptions = commonOptions; + }; - swapDevices = [ ]; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + swapDevices = [ ]; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; } diff --git a/hosts/shared/hardware-configuration.nix b/hosts/shared/hardware-configuration.nix index eed2ce3..7f5bb4f 100644 --- a/hosts/shared/hardware-configuration.nix +++ b/hosts/shared/hardware-configuration.nix @@ -1,33 +1,68 @@ { config, ... }: +let + plex = config.modules.mounts.plex; + kioku = config.modules.mounts.kioku; +in { - fileSystems."/mnt/kioku" = - let - sharedOptions = [ - "x-systemd.automount" - "noauto" - "x-systemd.idle-timeout=60" - "x-systemd.device-timeout=5s" - "x-systemd.mount-timeout=5s" - "rw" - "nofail" - "noatime" - "uid=1000" - "gid=1000" - ]; - in - if config.modules.mounts.kioku.withSamba then - { - device = "//kioku/usb"; - fsType = "cifs"; + fileSystems = + { + "/mnt/${kioku.name}" = + let + sharedOptions = [ + "x-systemd.automount" + "noauto" + "x-systemd.idle-timeout=60" + "x-systemd.device-timeout=5s" + "x-systemd.mount-timeout=5s" + "rw" + "nofail" + "noatime" + "uid=1000" + "gid=1000" + ]; + in + if kioku.withSamba then + { + device = "//${kioku.name}/${kioku.shareName}"; + fsType = "cifs"; - options = [ - "credentials=${config.sops.secrets.samba_secrets.path}" - ] ++ sharedOptions; - } + options = [ + "credentials=${config.sops.secrets.samba_secrets.path}" + ] ++ sharedOptions ++ kioku.extraOptions; + } + else + { + device = kioku.device; + fsType = "exfat"; + options = sharedOptions; + }; + } + // ( + if plex.enable then + { + "/mnt/${plex.name}" = { + device = "/dev/mapper/${plex.name}"; + fsType = "exfat"; + + options = [ + "rw" + "nofail" + "uid=1000" + "gid=1000" + "dmask=027" + "fmask=137" + ] ++ plex.extraOptions; + }; + } + else + { } + ); + + environment.etc.crypttab.text = + if plex.enable then + '' + ${plex.name} /dev/disk/by-partlabel/WD_BLACK ${config.sops.secrets.plex_drive_bitlocker_recovery_key.path} bitlk + '' else - { - device = "/dev/disk/by-uuid/67BF-FE53"; - fsType = "exfat"; - options = sharedOptions; - }; + ""; } |