From d112e705f1ebda198b05d52a49c28dbf96d2fb13 Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Fri, 30 Aug 2024 18:22:13 +0100 Subject: [PATCH] tohru: rearrange and split up configuration --- flake.nix | 12 +-- hosts/tohru/boot.nix | 14 ++++ .../tohru/{configuration.nix => default.nix} | 49 +++++------- hosts/tohru/filesystems.nix | 49 ++++++++++++ hosts/tohru/hardware-configuration.nix | 76 ------------------- hosts/tohru/hardware.nix | 9 +++ hosts/tohru/networking.nix | 12 +++ 7 files changed, 103 insertions(+), 118 deletions(-) create mode 100644 hosts/tohru/boot.nix rename hosts/tohru/{configuration.nix => default.nix} (55%) create mode 100644 hosts/tohru/filesystems.nix delete mode 100644 hosts/tohru/hardware-configuration.nix create mode 100644 hosts/tohru/hardware.nix create mode 100644 hosts/tohru/networking.nix diff --git a/flake.nix b/flake.nix index 3ca3ae6..10207a8 100644 --- a/flake.nix +++ b/flake.nix @@ -47,17 +47,7 @@ ]; }; - tohru = { name, nodes, ... }: { - networking.hostId = "31da19c1"; - deployment = { - allowLocalDeployment = true; - targetHost = null; # disallow remote deployment - }; - - imports = [ - ./hosts/tohru/configuration.nix - ]; - }; + tohru.imports = [ ./hosts/tohru ]; yevaud = { name, nodes, ... }: { networking.hostId = "09673d65"; diff --git a/hosts/tohru/boot.nix b/hosts/tohru/boot.nix new file mode 100644 index 0000000..5f9d144 --- /dev/null +++ b/hosts/tohru/boot.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + boot = { + loader.systemd-boot.enable = true; + loader.systemd-boot.editor = false; + loader.efi.canTouchEfiVariables = true; + + initrd.availableKernelModules = [ "xhci_pci" "nvme" "rtsx_pci_sdmmc" ]; + kernelModules = [ "kvm-intel" ]; + + supportedFilesystems = [ "ntfs" ]; # for USB drives + }; +} diff --git a/hosts/tohru/configuration.nix b/hosts/tohru/default.nix similarity index 55% rename from hosts/tohru/configuration.nix rename to hosts/tohru/default.nix index 73c578c..cf28ca3 100644 --- a/hosts/tohru/configuration.nix +++ b/hosts/tohru/default.nix @@ -2,33 +2,22 @@ { imports = [ - ./hardware-configuration.nix + ./boot.nix + ./filesystems.nix + ./hardware.nix + ./networking.nix + ./syncthing.nix ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.systemd-boot.editor = false; + nixpkgs.hostPlatform = "x86_64-linux"; + networking.hostId = "31da19c1"; - age.secrets.wireguard-peer-tohru.file = ../../secrets/wireguard-peer-tohru.age; - birdsong.peering = { - enable = true; - privateKeyFile = config.age.secrets.wireguard-peer-tohru.path; - persistentKeepalive = 23; + deployment = { + allowLocalDeployment = true; + targetHost = null; # disallow remote deployment }; - programs.evolution.enable = true; - qenya.services.fonts.enable = true; - qenya.services.steam.enable = true; - - home-manager.users.qenya = { pkgs, ... }: { - imports = [ - ./home.nix - ]; - }; - - networking.networkmanager.enable = true; - time.timeZone = "Europe/London"; i18n.defaultLocale = "en_GB.UTF-8"; @@ -43,6 +32,10 @@ sound.enable = true; hardware.pulseaudio.enable = true; + # services.pipewire = { + # enable = true; + # pulse.enable = true; + # }; age.secrets.user-password-tohru-qenya.file = ../../secrets/user-password-tohru-qenya.age; users.users.qenya.hashedPasswordFile = config.age.secrets.user-password-tohru-qenya.path; @@ -51,17 +44,11 @@ "networkmanager" # UI wifi configuration "dialout" # access to serial ports ]; + home-manager.users.qenya.imports = [ ./home.nix ]; - # USB drives - boot.supportedFilesystems = [ "ntfs" ]; - - hardware.enableAllFirmware = true; - services.fwupd.enable = true; - services.fstrim.enable = true; - - boot.initrd.luks.devices = { - "rpool".device = "/dev/nvme0n1p2"; - }; + programs.evolution.enable = true; + qenya.services.fonts.enable = true; + qenya.services.steam.enable = true; system.stateVersion = "23.11"; } diff --git a/hosts/tohru/filesystems.nix b/hosts/tohru/filesystems.nix new file mode 100644 index 0000000..e60965e --- /dev/null +++ b/hosts/tohru/filesystems.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +{ + boot.initrd.luks.devices = { + "rpool".device = "/dev/nvme0n1p2"; + }; + + fileSystems = { + "/" = { + device = "rpool/root"; + fsType = "zfs"; + }; + "/nix" = { + device = "rpool/nix"; + fsType = "zfs"; + }; + "/var" = { + device = "rpool/var"; + fsType = "zfs"; + }; + "/config" = { + device = "rpool/config"; + fsType = "zfs"; + }; + "/home" = { + device = "rpool/home"; + fsType = "zfs"; + }; + "/data" = { + device = "rpool/data"; + fsType = "zfs"; + }; + "/data/syncthing" = { + device = "rpool/data/syncthing"; + fsType = "zfs"; + }; + "/data/steam" = { + device = "rpool/data/steam"; + fsType = "zfs"; + }; + "/boot" = { + device = "/dev/disk/by-uuid/7DD4-487E"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + }; + + swapDevices = [{ device = "/dev/disk/by-uuid/a066313e-2467-4e07-ad0c-aeb7ff3f8d97"; }]; +} diff --git a/hosts/tohru/hardware-configuration.nix b/hosts/tohru/hardware-configuration.nix deleted file mode 100644 index 71a4dee..0000000 --- a/hosts/tohru/hardware-configuration.nix +++ /dev/null @@ -1,76 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "rpool/root"; - fsType = "zfs"; - }; - - fileSystems."/nix" = - { device = "rpool/nix"; - fsType = "zfs"; - }; - - fileSystems."/var" = - { device = "rpool/var"; - fsType = "zfs"; - }; - - fileSystems."/config" = - { device = "rpool/config"; - fsType = "zfs"; - }; - - fileSystems."/home" = - { device = "rpool/home"; - fsType = "zfs"; - }; - - fileSystems."/data" = - { device = "rpool/data"; - fsType = "zfs"; - }; - - fileSystems."/data/syncthing" = - { device = "rpool/data/syncthing"; - fsType = "zfs"; - }; - - fileSystems."/data/steam" = - { device = "rpool/data/steam"; - fsType = "zfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/7DD4-487E"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/a066313e-2467-4e07-ad0c-aeb7ff3f8d97"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno2.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/tohru/hardware.nix b/hosts/tohru/hardware.nix new file mode 100644 index 0000000..c4880a5 --- /dev/null +++ b/hosts/tohru/hardware.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ... }: + +{ + hardware.enableAllFirmware = true; + hardware.cpu.intel.updateMicrocode = true; + services.fwupd.enable = true; + services.fstrim.enable = true; +} + diff --git a/hosts/tohru/networking.nix b/hosts/tohru/networking.nix new file mode 100644 index 0000000..18cee0a --- /dev/null +++ b/hosts/tohru/networking.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: + +{ + networking.networkmanager.enable = true; + + age.secrets.wireguard-peer-tohru.file = ../../secrets/wireguard-peer-tohru.age; + birdsong.peering = { + enable = true; + privateKeyFile = config.age.secrets.wireguard-peer-tohru.path; + persistentKeepalive = 23; + }; +}