dotfiles/hosts/dlaptop/hardware.nix
delta 27c9f432a5 linux-cachyos 6.9 kernel
unbound dns caching
some hyprland bash scripts
fix graphical glitches on laptop
tailsacle no accept dns
2024-06-18 22:29:17 +03:00

209 lines
6.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ stable, unstable, config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.prepend = lib.mkOrder 0 [ "${pkgs.fetchurl {
url = "https://gitlab.freedesktop.org/drm/amd/uploads/9fe228c7aa403b78c61fb1e29b3b35e3/slim7-ssdt";
sha256 = "sha256-Ef4QTxdjt33OJEPLAPEChvvSIXx3Wd/10RGvLfG5JUs=";
name = "slim7-ssdt";
}}" ];
hardware.firmware = [
(pkgs.runCommandNoCC "subwoofer" { } ''
mkdir -p $out/lib/firmware/
cp ${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/darinpp/yoga-slim-7/main/lib/firmware/TAS2XXX38BB.bin";
sha256 = "sha256-qyZxBlnWEnrgbh0crgFf//pKZMTtCqh+CkA+pUNU/+E=";
name = "TAS2XXX38BB.bin";
}} $out/lib/firmware/TAS2XXX38BB.bin
cp ${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/darinpp/yoga-slim-7/main/lib/firmware/TIAS2781RCA4.bin";
sha256 = "sha256-Zj7mwS8DsBinZ8BYvcySc753Aq/xid7vAeQOH/oir6Q=";
name = "TIAS2781RCA4.bin";
}} $out/lib/firmware/TIAS2781RCA4.bin
'')
pkgs.wireless-regdb
];
console = {
earlySetup = true;
font = "${pkgs.spleen}/share/consolefonts/spleen-16x32.psfu";
packages = with pkgs; [ spleen ];
keyMap = "us";
};
boot.initrd = {
preDeviceCommands = ''
cat << "EOF"
____
/\ \
/ \ \
/ \ \
/ \ \
/ /\ \ \
/ / \ \ \
/ / /\ \ \
/ / / \ \ \
/ / /____\___\ \
/ / / \
/ / /________________\
\ / /
\/_____________________/
EOF
echo kernel: $(uname -r | tr '[:upper:]' '[:lower:]')
'';
};
# boot.initrd = {
# preDeviceCommands = ''/bin/initrd.sh'';
# secrets."/bin/initrd.sh" = ./initrd.sh;
# };
# 5 GHZ wifi
boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom="RU"
'';
services.zfs.autoScrub.enable = true;
services.fstrim = {
enable = true;
interval = "weekly";
};
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 7d --keep 4";
};
boot.loader.systemd-boot.enable = true;
boot.kernelParams = [
"rtc_cmos.use_acpi_alarm=1"
"ideapad_laptop.allow_v4_dytc=1"
"amd_pstate=active"
"initcall_blacklist=acpi_cpufreq_init"
"nowatchdog"
"amd_pstate.shared_mem=1"
"zfs.zfs_arc_max=19327352832"
"resume=UUID=a2ff20bd-56f3-4c83-b1b4-933ba0c82f36"
# # Disable all mitigations
# "mitigations=off"
# "nopti"
# "tsx=on"
# https://www.phoronix.com/news/Linux-Splitlock-Hurts-Gaming
"split_lock_detect=off"
];
boot.zfs.allowHibernation = true;
boot.zfs.forceImportRoot = false;
boot.resumeDevice = "/dev/mapper/cryptroot0p2";
boot.kernelModules = [ "amd-pstate" "acpi_call" "amdgpu" "kvm-amd" "vfat" "nls_cp437" "nls_iso8859-1" ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" "vfat" "nls_cp437" "nls_iso8859-1" ];
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot";
boot.initrd.kernelModules = [ ];
# boot.extraModulePackages = with config.boot.kernelPackages; [ usbip.out acpi_call zfs];
# boot.kernelPackages =
# with builtins; with lib; let
# latestCompatibleVersion = config.boot.zfs.package.latestCompatibleLinuxPackages.kernel.version;
# xanPackages = filterAttrs (name: packages: hasSuffix "_xanmod" name && (tryEval packages).success) pkgs.linuxKernel.packages;
# compatiblePackages = filter (packages: compareVersions packages.kernel.version latestCompatibleVersion <= 0) (attrValues xanPackages);
# orderedCompatiblePackages = sort (x: y: compareVersions x.kernel.version y.kernel.version > 0) compatiblePackages;
# selectedKernelPackage = head orderedCompatiblePackages;
# in selectedKernelPackage // {
# extraPackages = with selectedKernelPackage; [ acpi_call ];
# };
boot.kernelPackages = lib.mkOverride 99 pkgs.linuxPackages_cachyos;
boot.zfs.package = lib.mkOverride 99 pkgs.zfs_cachyos;
chaotic.scx.scheduler = "scx_rusty";
boot.extraModulePackages = with config.boot.kernelPackages; [ usbip acpi_call ];
boot.plymouth.enable = false;
boot.supportedFilesystems = [ "zfs" ];
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.multipath-tools}/bin/kpartx
'';
boot.initrd.luks = {
yubikeySupport = true;
devices."cryptroot0" = {
device = "/dev/nvme0n1p2";
postOpenCommands = "
kpartx -u /dev/mapper/cryptroot0
kpartx -u /dev/mapper/cryptroot0p1
kpartx -u /dev/mapper/cryptroot0p2
";
yubikey = {
slot = 2;
gracePeriod = 7;
keyLength = 64;
saltLength = 16;
twoFactor = false;
storage = {
device = "/dev/nvme0n1p1";
fsType = "vfat";
path = "/crypt-storage/default";
};
};
};
};
sops.age.keyFile = lib.mkForce "/root/keys.txt";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/4E0B-6C2F";
fsType = "vfat";
};
fileSystems."/" =
{ device = "zroot/root";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "zroot/home";
fsType = "zfs";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/a2ff20bd-56f3-4c83-b1b4-933ba0c82f36"; }
];
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = [ pkgs.amdvlk ];
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
# package = inputs.hyprland.inputs.nixpkgs.legacyPackages."x86_64-linux".mesa.drivers;
# package32 = inputs.hyprland.inputs.nixpkgs.legacyPackages."x86_64-linux".pkgsi686Linux.mesa.drivers;
};
networking.useDHCP = lib.mkDefault true;
networking.hostId = "11C0FFEE";
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
#services.logind = {
# lidSwitch = "suspend";
# lidSwitchDocked = "ignore";
# lidSwitchExternalPower = "ignore";
# powerKey = "ignore";
# powerKeyLongPress = "reboot";
#};
}