nix/nixos/hosts/nixos-laptop/default.nix

112 lines
3.1 KiB
Nix
Raw Normal View History

2023-08-23 10:05:46 +02:00
{ config, lib, pkgs, modulesPath, desktop, username, ... }: {
2023-08-15 09:29:39 +02:00
imports = [
2023-08-23 12:30:28 +02:00
(modulesPath + "/installer/scan/not-detected.nix")
2023-08-23 08:09:52 +02:00
../../common/services/powertop.nix
../../common/modules/secureboot.nix
2023-08-15 09:29:39 +02:00
];
2023-08-23 10:31:41 +02:00
# steam, nvidia-x11, etc
nixpkgs.config.allowUnfree = true;
2023-08-23 07:30:15 +02:00
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;
2023-07-13 11:08:12 +02:00
# Set your time zone.
time.timeZone = "Asia/Tokyo";
2023-07-06 05:24:21 +02:00
2023-07-01 11:37:30 +02:00
# Set the networking hostname:
2023-07-01 11:38:21 +02:00
networking.hostName = "nixos-laptop";
2023-07-01 11:37:30 +02:00
2023-07-01 10:23:32 +02:00
# Configure the fingerprint reader
services.fprintd = {
enable = true;
tod.enable = true;
tod.driver = pkgs.libfprint-2-tod1-vfs0090;
};
2023-07-05 14:58:58 +02:00
# Enable nVidia PRIME Render Offload and OpenGL
2023-07-01 10:23:32 +02:00
# https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/p1/3th-gen/nvidia.nix
2023-07-16 10:35:23 +02:00
# https://libreddit.kavin.rocks/r/NixOS/comments/x04dyv/optimus_help/
2023-07-16 11:22:22 +02:00
# boot.kernelParams = [ "nomodeset" ];
2023-07-16 10:35:23 +02:00
2023-07-26 14:42:33 +02:00
# nVidia information:
# https://github.com/NixOS/nixpkgs/pull/211300
# https://github.com/NixOS/nixpkgs/pull/244060
2023-07-05 14:58:58 +02:00
hardware = {
2023-08-23 16:10:15 +02:00
opengl = {
enable = true;
driSupport32Bit = true;
driSupport = true;
};
2023-08-14 12:56:10 +02:00
nvidia = {
2023-08-22 15:16:23 +02:00
open = false;
2023-08-23 16:17:56 +02:00
# nvidiaSettings = false;
# dynamicBoost.enable = true;
2023-08-23 01:18:15 +02:00
# nvidiaPersistenced = false;
package = config.boot.kernelPackages.nvidiaPackages.latest;
2023-08-23 16:10:15 +02:00
# powerManagement.finegrained = true;
# powerManagement.enable = true;
2023-08-23 16:17:56 +02:00
# modesetting.enable = true;
2023-07-12 08:29:53 +02:00
prime = {
2023-07-14 16:59:52 +02:00
offload = {
enable = true;
enableOffloadCmd = true;
};
2023-08-23 16:17:56 +02:00
intelBusId = lib.mkDefault "PCI:0:2:0";
2023-07-12 08:29:53 +02:00
nvidiaBusId = lib.mkDefault "PCI:1:0:0";
};
2023-07-05 14:58:58 +02:00
};
2023-07-01 10:23:32 +02:00
};
2023-07-12 05:54:40 +02:00
environment.systemPackages = with pkgs; [
2023-07-12 08:08:57 +02:00
# Fingerprint software
2023-07-12 05:54:40 +02:00
fprintd
2023-08-17 07:45:29 +02:00
# nVidia graphics options
2023-07-15 15:31:06 +02:00
vulkan-loader
vulkan-validation-layers
vulkan-tools
2023-07-15 15:52:02 +02:00
gwe
2023-07-26 14:42:33 +02:00
nvtop-nvidia
# Game related things
gamemode
2023-08-23 07:30:15 +02:00
# WINE
2023-07-16 08:51:38 +02:00
wineWowPackages.stable
winetricks
wineWowPackages.waylandFull
2023-07-12 05:54:40 +02:00
];
2023-08-23 07:30:15 +02:00
}