nix/hardware/work.nix

123 lines
3.3 KiB
Nix

{user}: {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci"];
boot.initrd.kernelModules = ["uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1"];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7";
fsType = "btrfs";
options = ["subvol=@" "compress=zstd" "autodefrag"];
};
boot.initrd.postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -m 0755 -p /key
until cryptsetup luksOpen /dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0 usbkey
do
echo "Failed to unlock usbkey!"
echo "Found block devices:"
ls /dev/disk/by-id/
sleep 2
done
mount -n -t vfat -o ro /dev/mapper/usbkey /key
'';
boot.initrd.luks.devices."cryptroot" = {
device = "/dev/disk/by-uuid/570cc51f-bd5c-4bee-a18f-f6aabaf60881";
keyFileSize = 4096;
keyFile = "/key/keyfile";
preLVM = false;
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7";
fsType = "btrfs";
options = ["subvol=@home" "compress=zstd" "autodefrag"];
};
fileSystems."/swap" = {
device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7";
fsType = "btrfs";
options = ["subvol=@swap"];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/EED9-A165";
fsType = "vfat";
};
swapDevices = [{device = "/swap/swapfile";}];
# 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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp53s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp54s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
];
};
roles.laptop.enable = true;
networking.hostName = "FCS-Tristan-Nixbook";
system.stateVersion = "22.11"; # do not change
home-manager.users.${user}.imports = [
{
home.stateVersion = "22.05";
}
];
displays.displays = {
"asus" = {
enable = false;
};
"hp" = {
enable = true;
name = "HDMI-A-1";
wallpaper = ../images/nier2.jpg;
workspaces = {
start = 6;
end = 10;
};
};
"internal" = {
enable = true;
name = "eDP-1";
description = "BOE 0x07D8";
workspaces = {
start = 1;
};
position = {
x = 0;
y = 1080;
};
wallpaper = ../images/nix-soft.png;
};
};
}