From 3ae9e4aae3005658bddf76b5decd7b1d9ab5f447 Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Fri, 12 Sep 2025 17:14:06 -0500 Subject: [PATCH] fix: prepare for installing /w nixos-anywhere --- hosts/titanium/default.nix | 3 +- hosts/titanium/disko.nix | 126 +++++++++++++++++++----------------- hosts/titanium/hardware.nix | 23 ------- hosts/titanium/nvidia.nix | 24 +++++++ 4 files changed, 92 insertions(+), 84 deletions(-) create mode 100644 hosts/titanium/nvidia.nix diff --git a/hosts/titanium/default.nix b/hosts/titanium/default.nix index 77305be..bba79e0 100644 --- a/hosts/titanium/default.nix +++ b/hosts/titanium/default.nix @@ -6,7 +6,8 @@ ../../modules/nixos/desktop.nix ../../modules/nixos/gaming.nix inputs.nixos-hardware.nixosModules.asus-rog-strix-x570e - ./hardware.nix + #./hardware.nix ./configuration.nix + ./nvidia.nix ]; } diff --git a/hosts/titanium/disko.nix b/hosts/titanium/disko.nix index 97a2b39..f4da2dd 100644 --- a/hosts/titanium/disko.nix +++ b/hosts/titanium/disko.nix @@ -7,70 +7,76 @@ # `sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount /tmp/disk-config.nix` disko.devices = { disk = { - main-disk = { + main = { type = "disk"; device = "/dev/disk/by-path/pci-0000:08:00.0-ata-2"; content = { - type = "gpt"; - partitions = { - ESP = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - luks = { - size = "100%"; # Full Disk Encryption - content = { - type = "luks"; - name = "crypted"; - # disable settings.keyFile if you want to use interactive password entry - # passwordFile = "/tmp/secret.key"; # Interactive - settings = { - allowDiscards = true; - #keyFile = "/tmp/secret.key"; - }; - #additionalKeyFiles = [ "/tmp/additionalSecret.key" ]; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; # What? - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "/home" = { - mountpoint = "/home"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "/swap" = { - mountpoint = "/.swapvol"; - swap.swapfile.size = "16G"; - }; - }; - }; - }; - }; - }; + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; # Full Disk Encryption + content = { + type = "luks"; + name = "crypted"; + # disable settings.keyFile if you want to use interactive password entry + # passwordFile = "/tmp/secret.key"; # Interactive + extraOpenArgs = [ + "--allow-discards" + "--perf-no_read_workqueue" + "--perf-no_write_workqueue" + ]; + settings = { + allowDiscards = true; + crypttabExtraOpts = [ "fido2-device=auto" "token-timeout=10" ]; + #keyFile = "/tmp/secret.key"; + }; + #additionalKeyFiles = [ "/tmp/additionalSecret.key" ]; + content = { + type = "btrfs"; + extraArgs = [ "-L" "nixos" "-f" ]; # What? + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/home" = { + mountpoint = "/home"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "/swap" = { + mountpoint = "/.swapvol"; + swap.swapfile.size = "32G"; + }; + }; + }; + }; + }; + }; }; - }; + }; }; }; } diff --git a/hosts/titanium/hardware.nix b/hosts/titanium/hardware.nix index 27018e9..a2a8362 100644 --- a/hosts/titanium/hardware.nix +++ b/hosts/titanium/hardware.nix @@ -58,27 +58,4 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - - # GPU Things - # NOTE: The following command can be helpful when diagnosing GPU issues: - # `nix shell nixpkgs#vulkan-tools -c vulkaninfo --summary` - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - services.xserver.videoDrivers = [ "nvidia" ]; - # NOTE: This acceptLicense thing was necessary for nvidia packages to begin - # working, and it seems undocumented in the usual places. - # I found it on a forum thread, and then inside the nixpkgs repo. - # https://discourse.nixos.org/t/nvidia-settings-and-nvidia-offload-not-found/37187/23 - # https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/nvidia-x11/generic.nix#L65 - nixpkgs.config.nvidia.acceptLicense = true; - hardware.nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.latest; - modesetting.enable = true; - open = true; - nvidiaSettings = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - }; } diff --git a/hosts/titanium/nvidia.nix b/hosts/titanium/nvidia.nix new file mode 100644 index 0000000..66b3fa2 --- /dev/null +++ b/hosts/titanium/nvidia.nix @@ -0,0 +1,24 @@ +{ config, ... }: { + # GPU Things + # NOTE: The following command can be helpful when diagnosing GPU issues: + # `nix shell nixpkgs#vulkan-tools -c vulkaninfo --summary` + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + services.xserver.videoDrivers = [ "nvidia" ]; + # NOTE: This acceptLicense thing was necessary for nvidia packages to begin + # working, and it seems undocumented in the usual places. + # I found it on a forum thread, and then inside the nixpkgs repo. + # https://discourse.nixos.org/t/nvidia-settings-and-nvidia-offload-not-found/37187/23 + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/nvidia-x11/generic.nix#L65 + nixpkgs.config.nvidia.acceptLicense = true; + hardware.nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.latest; + modesetting.enable = true; + open = true; + nvidiaSettings = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + }; +}