From 0cb64fc7ccc71cf92156217eac478a1bb2b034ea Mon Sep 17 00:00:00 2001 From: Uzair Mohammed Date: Mon, 16 Dec 2024 20:04:49 -0800 Subject: [PATCH] 6: Reverted NixOS hardware to specific commit, updated flake lock, updated device UUIDs for new install, added gaming mode specialisation, added nerd fonts with updated syntax, and added fwupd to powerManagement.nix --- flake.lock | 38 ++++++++++---------- flake.nix | 2 +- system/modules/bootloader.nix | 2 +- system/modules/graphics.nix | 43 ++++++++++++++++++++++- system/modules/hardware-configuration.nix | 40 ++++++++++----------- system/modules/nerdFonts.nix | 4 ++- system/modules/powerManagement.nix | 2 ++ 7 files changed, 88 insertions(+), 43 deletions(-) diff --git a/flake.lock b/flake.lock index 18c6d1a..5ccb70a 100644 --- a/flake.lock +++ b/flake.lock @@ -56,11 +56,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -173,11 +173,11 @@ ] }, "locked": { - "lastModified": 1731604581, - "narHash": "sha256-Qq2YZZaDTB3FZLWU/Hgh1uuWlUBl3cMLGB99bm7rFUM=", + "lastModified": 1734344598, + "narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=", "owner": "nix-community", "repo": "home-manager", - "rev": "1d0862ee2d7c6f6cd720d6f32213fa425004be10", + "rev": "83ecd50915a09dca928971139d3a102377a8d242", "type": "github" }, "original": { @@ -222,11 +222,11 @@ "zig-deps-fod": "zig-deps-fod" }, "locked": { - "lastModified": 1731742830, - "narHash": "sha256-w3cMP/IWj8ZMG2ZGP7B5rEznZROFCs0Z2e7Y0pAEHjU=", + "lastModified": 1731793907, + "narHash": "sha256-oDWPl9V7AGM+cci9/jhlQlVSImuNqfcu3t3ffmxEyY4=", "owner": "water-sucks", "repo": "nixos", - "rev": "19c876a042fa8998715a94c5535eede1ce4e381b", + "rev": "2d44c5c8a077f778b96fd1f213611786144d9a72", "type": "github" }, "original": { @@ -237,17 +237,17 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1731403644, - "narHash": "sha256-T9V7CTucjRZ4Qc6pUEV/kpgNGzQbHWfGcfK6JJLfUeI=", + "lastModified": 1733065584, + "narHash": "sha256-22W/cVrIMhIk0tTqBuuR8G49sftPElGhvFAWA8p06CM=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "f6581f1c3b137086e42a08a906bdada63045f991", + "rev": "893d255bed44d251e84e90fad25e7ad5f45cf117", "type": "github" }, "original": { "owner": "NixOS", - "ref": "master", "repo": "nixos-hardware", + "rev": "893d255bed44d251e84e90fad25e7ad5f45cf117", "type": "github" } }, @@ -325,11 +325,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1731319897, - "narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=", + "lastModified": 1734119587, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dc460ec76cbff0e66e269457d7b728432263166c", + "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", "type": "github" }, "original": { @@ -409,11 +409,11 @@ ] }, "locked": { - "lastModified": 1731644206, - "narHash": "sha256-J4HjGCDIJTBjlzhHDjQpbci/fMIE8eNcgOAKbDJUlBs=", + "lastModified": 1734322624, + "narHash": "sha256-9G6h+hHM8RyUvan2qojZwHlRoJ3gkLwZQLsW7bXyNrE=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "f8f8cac5aabb30009610e7ee4b56f04291577a12", + "rev": "f8289a4668187d3866caa7940dfd8ff680e41d0d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c9b871f..ab6b923 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ #}; nixos-hardware = { - url = "github:NixOS/nixos-hardware/master"; + url = "github:NixOS/nixos-hardware/893d255bed44d251e84e90fad25e7ad5f45cf117"; }; nixos-cli = { diff --git a/system/modules/bootloader.nix b/system/modules/bootloader.nix index 99e0116..c84cd00 100644 --- a/system/modules/bootloader.nix +++ b/system/modules/bootloader.nix @@ -4,7 +4,7 @@ boot.loader.efi.canTouchEfiVariables = true; # Copied from default configuration file - boot.initrd.luks.devices."luks-bc043db2-6b73-4181-9324-6a4ddd9574cf".device = "/dev/disk/by-uuid/bc043db2-6b73-4181-9324-6a4ddd9574cf"; + boot.initrd.luks.devices."luks-520879a6-1cac-4c27-95b1-1d5a0d817684".device = "/dev/disk/by-uuid/520879a6-1cac-4c27-95b1-1d5a0d817684"; # GRUB and MC theme disabled due to an issue - "nixos.png not found" # Enable Grub and set required parameters to make system bootable diff --git a/system/modules/graphics.nix b/system/modules/graphics.nix index 08f828c..400bcb5 100644 --- a/system/modules/graphics.nix +++ b/system/modules/graphics.nix @@ -1,5 +1,17 @@ -{ pkgs, ... }: { + pkgs, + lib, + config, + ... +}: +let + nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' + export __NV_PRIME_RENDER_OFFLOAD=1 + export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 + export __GLX_VENDOR_LIBRARY_NAME=nvidia + export __VK_LAYER_NV_optimus=NVIDIA_only + exec "$@" + ''; in { # Enable OpenGL hardware.graphics = { enable = true; @@ -9,4 +21,33 @@ intel-compute-runtime ]; }; + + environment.systemPackages = with pkgs; [ + lshw + ]; + + specialisation = { + gaming-mode.configuration = { + system.nixos.tags = ["gaming-mode"]; + + + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + + prime = { + intelBusId = lib.mkDefault "PCI:0:2:0"; + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + }; + }; + + environment.systemPackages = [ nvidia-offload ]; + }; + }; } diff --git a/system/modules/hardware-configuration.nix b/system/modules/hardware-configuration.nix index 9dbd32b..73cae14 100644 --- a/system/modules/hardware-configuration.nix +++ b/system/modules/hardware-configuration.nix @@ -14,29 +14,29 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/81e848c1-1481-456b-8df6-47eb247771ef"; + { device = "/dev/disk/by-uuid/f687d29b-d636-432a-98bb-af7f6e3dc226"; fsType = "ext4"; }; - boot.initrd.luks.devices."luks-929e4b3e-0219-4593-aa5f-4e60fca1d7e4".device = "/dev/disk/by-uuid/929e4b3e-0219-4593-aa5f-4e60fca1d7e4"; + boot.initrd.luks.devices."luks-33fd1822-bf27-4a3e-a8e7-1c703185a503".device = "/dev/disk/by-uuid/33fd1822-bf27-4a3e-a8e7-1c703185a503"; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/D5DB-A0C5"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/000c73ce-2d51-47c8-b751-baae70aac0a4"; } - ]; - - # 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.wlp59s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + { device = "/dev/disk/by-uuid/653C-4F14"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/7b97e697-298b-4af4-b8ff-8b0bef8d7520"; } + ]; + + # 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.wlp59s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/system/modules/nerdFonts.nix b/system/modules/nerdFonts.nix index c570b6c..76718ee 100644 --- a/system/modules/nerdFonts.nix +++ b/system/modules/nerdFonts.nix @@ -1,6 +1,8 @@ { pkgs, ... }: { fonts.packages = with pkgs; [ - (nerdfonts.override {fonts = [ "JetBrainsMono" "CascadiaCode" ]; }) + nerd-fonts.jetbrains-mono + nerd-fonts.caskaydia-cove + nerd-fonts._3270 ]; } diff --git a/system/modules/powerManagement.nix b/system/modules/powerManagement.nix index b3bc8c4..5635dff 100644 --- a/system/modules/powerManagement.nix +++ b/system/modules/powerManagement.nix @@ -10,6 +10,8 @@ thermald.enable = true; + fwupd.enable = true; + # List of governors: # - performance # - powersave