From ab6049f578166f6c8de2bab9fb4a85eadded0d90 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Thu, 15 Jul 2021 20:18:51 +0700 Subject: [PATCH] splitting parts of system config - hardware-configuration.nix separated into kernel-winter.nix and filesystem-winter.nix - kernel.nix split off into kernel-winter.nix --- hosts/winter.nix | 4 +- modules/system/filesystem-winter.nix | 28 +++++++++ modules/system/hardware-configuration.nix | 69 ----------------------- modules/system/kernel-winter.nix | 22 ++++++++ modules/system/kernel.nix | 20 +------ 5 files changed, 54 insertions(+), 89 deletions(-) create mode 100644 modules/system/filesystem-winter.nix delete mode 100644 modules/system/hardware-configuration.nix create mode 100644 modules/system/kernel-winter.nix diff --git a/hosts/winter.nix b/hosts/winter.nix index 126697d..467f971 100644 --- a/hosts/winter.nix +++ b/hosts/winter.nix @@ -14,10 +14,12 @@ imports = with modules.system; [ audio + base + filesystem-winter gui - hardware-configuration input kernel + kernel-winter networking packages security diff --git a/modules/system/filesystem-winter.nix b/modules/system/filesystem-winter.nix new file mode 100644 index 0000000..4a365eb --- /dev/null +++ b/modules/system/filesystem-winter.nix @@ -0,0 +1,28 @@ +{ config, ... }: +let + mkMount = uuid: type: { + device = "/dev/disk/by-uuid/${uuid}"; + fsType = type; + }; + mkBtrfsMount = subvolid: mkMount "8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d" "btrfs" // { + options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=${builtins.toString subvolid}" ]; + }; +in +{ + fileSystems = { + "/" = { + device = "rootfs"; + fsType = "tmpfs"; + options = [ "defaults" "size=4G" "mode=755" ]; + }; + "/boot" = mkMount "E8E8-E570" "vfat"; + "/mnt/hdd" = mkMount "d5e3cfe5-c73a-4695-b81b-fc0215d4cefe" "ext4"; + + "/mnt/butter" = mkBtrfsMount 5; + "/nix" = mkBtrfsMount 258; + "/home" = mkBtrfsMount 260; + "/home/.snapshots" = mkBtrfsMount 319; + "/root" = mkBtrfsMount 261; + "/var" = mkBtrfsMount 259; + }; +} diff --git a/modules/system/hardware-configuration.nix b/modules/system/hardware-configuration.nix deleted file mode 100644 index 97ce11b..0000000 --- a/modules/system/hardware-configuration.nix +++ /dev/null @@ -1,69 +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 = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = []; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "rootfs"; - fsType = "tmpfs"; - options = [ "defaults" "size=4G" "mode=755" ]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/E8E8-E570"; - fsType = "vfat"; - }; - - fileSystems."/mnt/butter" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=5" ]; - }; - - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=258" ]; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=260" ]; - }; - - fileSystems."/home/.snapshots" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=319" ]; - }; - - fileSystems."/root" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=261" ]; - }; - - fileSystems."/var" = { - device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; - fsType = "btrfs"; - options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=259" ]; - }; - - fileSystems."/mnt/hdd" = { - device = "/dev/disk/by-uuid/d5e3cfe5-c73a-4695-b81b-fc0215d4cefe"; - fsType = "ext4"; - }; - - swapDevices = []; -} diff --git a/modules/system/kernel-winter.nix b/modules/system/kernel-winter.nix new file mode 100644 index 0000000..ec0e210 --- /dev/null +++ b/modules/system/kernel-winter.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: { + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + }; + }; + initrd.kernelModules = [ "i915" ]; + kernelParams = [ + "amdgpu.gpu_recovery=1" + "amdgpu.si_support=1" + "radeon.si_support=0" + "intel_pstate=passive" + "msr.allow_writes=on" + ]; + kernelPackages = pkgs.lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-lava); + }; +} diff --git a/modules/system/kernel.nix b/modules/system/kernel.nix index 04d5a4c..bfa3a91 100644 --- a/modules/system/kernel.nix +++ b/modules/system/kernel.nix @@ -1,32 +1,14 @@ { config, pkgs, ... }: { - powerManagement.cpuFreqGovernor = "ondemand"; boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - grub = { - enable = true; - efiSupport = true; - device = "nodev"; - }; - }; blacklistedKernelModules = [ "uvcvideo" ]; initrd = { includeDefaultModules = false; - kernelModules = [ "i915" ]; + availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; }; kernel.sysctl = { "kernel.core_pattern" = "|/bin/false"; "kernel.sysrq" = 1; }; - kernelParams = [ - "amdgpu.gpu_recovery=1" - "amdgpu.si_support=1" - "radeon.si_support=0" - "intel_pstate=passive" - "msr.allow_writes=on" - ]; - kernelPackages = pkgs.lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-lava); }; zramSwap.enable = true; }