From a10dfba82d150c2c2fc0f1f9d3457b722728b00e Mon Sep 17 00:00:00 2001 From: Kabbone Date: Fri, 22 Sep 2023 19:22:19 +0200 Subject: [PATCH] desktop: no more tmpfs and add swap --- hosts/desktop/hardware-configuration.nix | 11 +++++++++-- hosts/fix-nfs4-kernel.nix | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 hosts/fix-nfs4-kernel.nix diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix index b935329..ecf4b2d 100644 --- a/hosts/desktop/hardware-configuration.nix +++ b/hosts/desktop/hardware-configuration.nix @@ -21,7 +21,8 @@ boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - boot.tmp.useTmpfs = true; + boot.tmp.useTmpfs = false; + boot.tmp.cleanOnBoot = true; zramSwap.enable = true; services.btrfs.autoScrub = { @@ -82,6 +83,12 @@ options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async" ]; }; + fileSystems."/swap" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@swap,discard=async" ]; + }; + fileSystems."/mnt/snapshots/root" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; @@ -106,7 +113,7 @@ }; - swapDevices = [ ]; + swapDevices = [ { device = "/swap/swapfile"; } ]; networking = { vswitches = { diff --git a/hosts/fix-nfs4-kernel.nix b/hosts/fix-nfs4-kernel.nix new file mode 100644 index 0000000..8deb952 --- /dev/null +++ b/hosts/fix-nfs4-kernel.nix @@ -0,0 +1,17 @@ +{ lib, config, pkgs, ... }: + +# NFSv4 fix for 6.5.3 and 6.1.53, remove asap +let + version = config.boot.kernelPackages.kernel.version; + badVersions = [ "6.5.3" "6.1.53" ]; +in + +lib.mkIf (lib.any (v: v == version) badVersions) { + boot.kernelPatches = [{ + name = "nfs4-patch"; + patch = pkgs.fetchpatch { + url = "https://patchwork.kernel.org/project/selinux/patch/20230911142358.883728-1-omosnace@redhat.com/raw/"; + hash = "sha256-m947t39xr4VqJBZ2mYTFq9Up/NWlwueH8aXFZRQwA7c="; + }; + }]; +}