From 4ecf5d10d68e79c177d36e2baf465e84eeba3228 Mon Sep 17 00:00:00 2001 From: Ulysse Cura Date: Sun, 21 Jun 2026 11:31:42 +0200 Subject: [PATCH] Added per hardware configuration. --- .gitignore | 2 +- .../thinkpad-p50/configuration.nix | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 hardware-configuration/thinkpad-p50/configuration.nix diff --git a/.gitignore b/.gitignore index 04d54e7..ce3dce1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -configuration.nix \ No newline at end of file +/configuration.nix diff --git a/hardware-configuration/thinkpad-p50/configuration.nix b/hardware-configuration/thinkpad-p50/configuration.nix new file mode 100644 index 0000000..4bc0561 --- /dev/null +++ b/hardware-configuration/thinkpad-p50/configuration.nix @@ -0,0 +1,94 @@ +{ config, lib, modulesPath, pkgs, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # Hostname. + networking.hostName = "thinkpad-p50"; + + # Enable bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; + + # Bootloader and boot options + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + # Filesystems + fileSystems."/" = { + device = "/dev/disk/by-uuid/f3d7ecac-7dfd-40a8-8771-02223a993bd4"; + fsType = "ext4"; + }; + + fileSystems."/run/media/ulysse-cura/Data" = { + device = "/dev/disk/by-uuid/ea67b685-b7d2-4205-8515-b02c481c7cd0"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/0012-EABE"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [{ + device = "/dev/disk/by-uuid/7ad6bd01-60c6-41c9-859e-ac18bc8a62ca"; + }]; + + # Platform misc + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Thinkfan + services.thinkfan.enable = true; + services.thinkfan.fans = [{ + type = "tpacpi"; + query = "/proc/acpi/ibm/fan"; + }]; + services.thinkfan.sensors = [{ + type = "tpacpi"; + query = "/proc/acpi/ibm/thermal"; + }]; + services.thinkfan.levels = [ + [ 0 0 50 ] + [ 1 48 56 ] + [ 2 54 62 ] + [ 3 60 68 ] + [ 6 66 74 ] + [ 7 72 80 ] + [ "level full-speed" 78 32767 ] + ]; + + # Enable and configure nvidia graphics drivers + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ + "modesetting" + "nvidia" + ]; + + hardware.nvidia.open = false; + hardware.nvidia.modesetting.enable = true; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_580; + hardware.graphics.extraPackages = with pkgs; [ + vulkan-loader + vulkan-validation-layers + vulkan-extension-layer + ]; + + hardware.nvidia.prime = { + offload.enable = true; + offload.enableOffloadCmd = true; + + intelBusId = "PCI:0@0:2:0"; + nvidiaBusId = "PCI:1@0:0:0"; + }; +}