{ config, lib, pkgs, modulesPath, desktop, username, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ../../common/services/powertop.nix ../../common/modules/secureboot.nix ]; # steam, nvidia-x11, etc nixpkgs.config.allowUnfree = true; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" "acpi_call" ]; boot.extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; fileSystems."/" = { device = "/dev/disk/by-label/ROOT"; fsType = "btrfs"; options = [ "subvol=@" ]; }; boot.initrd.luks.devices."DISK".device = "/dev/nvme0n1p1"; fileSystems."/boot" = { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; }; # Enable Swap on LUKS boot.initrd.luks.devices."SWAP" = { device = "/dev/nvme0n1p2"; keyFile = "/crypto_keyfile.bin"; }; # Set up the keyfile boot.initrd.secrets."/crypto_keyfile.bin" = null; # Hibernation resume device boot.resumeDevice = "/dev/disk/by-label/SWAP"; # Confirm the swap devices swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ]; networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; # Set your time zone. time.timeZone = "Asia/Tokyo"; # Set the networking hostname: networking.hostName = "nixos-laptop"; # Configure the fingerprint reader services.fprintd = { enable = true; tod.enable = true; tod.driver = pkgs.libfprint-2-tod1-vfs0090; }; # Enable nVidia PRIME Render Offload and OpenGL # https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/p1/3th-gen/nvidia.nix # https://libreddit.kavin.rocks/r/NixOS/comments/x04dyv/optimus_help/ # boot.kernelParams = [ "nomodeset" ]; # nVidia information: # https://github.com/NixOS/nixpkgs/pull/211300 # https://github.com/NixOS/nixpkgs/pull/244060 hardware = { opengl = { enable = true; driSupport32Bit = true; driSupport = true; }; nvidia = { open = false; nvidiaSettings = false; dynamicBoost.enable = true; package = config.boot.kernelPackages.nvidiaPackages.latest; powerManagement.finegrained = true; powerManagement.enable = true; modesetting.enable = true; prime = { offload = { enable = true; enableOffloadCmd = true; }; intelBusId = lib.mkDefault "PCI:0:2:0"; nvidiaBusId = lib.mkDefault "PCI:1:0:0"; }; }; }; environment.systemPackages = with pkgs; [ # Fingerprint software fprintd # nVidia graphics options vulkan-loader vulkan-validation-layers vulkan-tools gwe nvtop-nvidia # Game related things gamemode # WINE wineWowPackages.stable winetricks wineWowPackages.waylandFull ]; }