Compare commits

..

No commits in common. "5ab065112744822a8cdae12899204736d14ccb2c" and "388dbc43229a7582485b50cb3f83ccff10d30360" have entirely different histories.

5 changed files with 154 additions and 38 deletions

View File

@ -6,8 +6,15 @@ with pkgs;
# Kernel configuration # Kernel configuration
boot = { boot = {
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = kernelParams = [
[ "zfs.zfs_arc_max=2147483648" "zfs.zfs_arc_meta_limit_percent=90" ]; "zfs.zfs_arc_max=2147483648"
"zfs.zfs_arc_meta_limit_percent=90"
"workqueue.power_efficient=y"
"ahci.mobile_lpm_policy=3"
"nmi_watchdog=0"
"msr.allow_writes=on"
];
kernelModules = [ "i915" ];
blacklistedKernelModules = [ "btusb" "bluetooth" ]; blacklistedKernelModules = [ "btusb" "bluetooth" ];
supportedFilesystems = [ "zfs" ]; supportedFilesystems = [ "zfs" ];
zfs = { zfs = {
@ -16,9 +23,14 @@ with pkgs;
}; };
}; };
# Device firmware updates # Intel CPU tweaks
hardware.enableRedistributableFirmware = true;
services.fwupd.enable = true; services.fwupd.enable = true;
# Hardware video acceleration
hardware.opengl.extraPackages =
[ intel-media-driver vaapiIntel vaapiVdpau libvdpau-va-gl ];
# Bootloader configuration # Bootloader configuration
boot.loader = { boot.loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
@ -67,7 +79,7 @@ with pkgs;
services.chrony.enable = true; services.chrony.enable = true;
# NixOS version # NixOS version
system.stateVersion = "24.05"; system.stateVersion = "22.05";
# Create coolneng user # Create coolneng user
users.users.coolneng = { users.users.coolneng = {

View File

@ -118,11 +118,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1701208414, "lastModified": 1703863825,
"narHash": "sha256-xrQ0FyhwTZK6BwKhahIkUVZhMNk21IEI1nUcWSONtpo=", "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-github-actions", "repo": "nix-github-actions",
"rev": "93e39cc1a087d65bcf7a132e75a650c44dd2b734", "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -138,11 +138,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703992163, "lastModified": 1700968077,
"narHash": "sha256-709CGmwU34dxv8DjSpRBZ+HibVJIVaFcA4JH+GFnhyM=", "narHash": "sha256-Lax+2g7G3Fe+ckMrHLYTl+97unbmNDmN1qS9MLBkxr4=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "d6510ce144f5da7dd9bac667ba3d5a4946c00d11", "rev": "bd3aec0ecb0fdde863a7ed2c6caa220c47e22c07",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -151,21 +151,6 @@
"type": "github" "type": "github"
} }
}, },
"nixos-hardware": {
"locked": {
"lastModified": 1704458188,
"narHash": "sha256-f6BYEuIqnbrs6J/9m1/1VdkJ6d63hO9kUC09kTPuOqE=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "172385318068519900a7d71c1024242fa6af75f0",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1704194953, "lastModified": 1704194953,
@ -231,11 +216,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1701105783, "lastModified": 1703546497,
"narHash": "sha256-5IOI0xXGbhAkUZNNcPId48V78Q+/JlW0hzlif0zxRmM=", "narHash": "sha256-CN/7HaEmHz+akXKejkRVhsxAm6HPGOmYBWMtgMkuROA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "poetry2nix", "repo": "poetry2nix",
"rev": "0b2bff39e9bd4e6db3208e09c276ca83a063b370", "rev": "528d500ea826383cc126a9be1e633fc92b19ce5d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -250,7 +235,6 @@
"cyrus-sasl-xoauth2": "cyrus-sasl-xoauth2", "cyrus-sasl-xoauth2": "cyrus-sasl-xoauth2",
"local-bitwig": "local-bitwig", "local-bitwig": "local-bitwig",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"openconnect-sso": "openconnect-sso" "openconnect-sso": "openconnect-sso"
} }
@ -293,11 +277,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1699786194, "lastModified": 1704233915,
"narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", "narHash": "sha256-GYDC4HjyVizxnyKRbkrh1GugGp8PP3+fJuh40RPCN7k=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", "rev": "e434da615ef74187ba003b529cc72f425f5d941e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -11,7 +11,6 @@
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
agenix = { agenix = {
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -34,8 +33,7 @@
}; };
}; };
outputs = outputs = { self, nixpkgs, agenix, nix-index-database, ... }@inputs:
{ self, nixpkgs, nixos-hardware, agenix, nix-index-database, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
@ -58,7 +56,6 @@
inherit system; inherit system;
modules = [ modules = [
(import ./configuration.nix) (import ./configuration.nix)
nixos-hardware.nixosModules.lenovo-thinkpad-e14-amd
agenix.nixosModules.age agenix.nixosModules.age
nix-index-database.nixosModules.nix-index nix-index-database.nixosModules.nix-index
]; ];

View File

@ -0,0 +1,72 @@
# 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.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "syscea/stateful/root";
fsType = "zfs";
};
fileSystems."/nix" =
{ device = "syscea/ephemeral/nix";
fsType = "zfs";
};
fileSystems."/ugent" =
{ device = "systemd-1";
fsType = "autofs";
};
fileSystems."/tmp" =
{ device = "syscea/ephemeral/tmp";
fsType = "zfs";
};
fileSystems."/home/coolneng" =
{ device = "syscea/stateful/home";
fsType = "zfs";
};
fileSystems."/home/coolneng/Downloads" =
{ device = "syscea/stateful/home/downloads";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4851-6B40";
fsType = "vfat";
};
fileSystems."/home/coolneng/Videos" =
{ device = "syscea/stateful/home/videos";
fsType = "zfs";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/1f0ea09c-e655-4a9f-83d4-9d396de01720"; }
];
# 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.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wg0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.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;
}

View File

@ -1,8 +1,18 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
# Enable power-profiles-daemon # Enable the TLP daemon
services.power-profiles-daemon.enable = true; services.tlp = {
enable = true;
settings = {
PCIE_ASPM_ON_AC = "performance";
PCIE_ASPM_ON_BAT = "powersave";
USB_AUTOSUSPEND = 1;
};
};
# Enable the auto-cpufreq daemon
services.auto-cpufreq.enable = true;
# Suspend when the battery is critical and autosuspend USB and PCI # Suspend when the battery is critical and autosuspend USB and PCI
services.udev.extraRules = '' services.udev.extraRules = ''
@ -10,4 +20,45 @@
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"
''; '';
# Undervolt CPU and GPU
services.undervolt = {
enable = true;
coreOffset = -100;
gpuOffset = -75;
};
# Prevent overheating of the CPU
services.thermald.enable = true;
# HACK Enable internal microphone when headphones are plugged in and add workaround for frequent WiFi disconnects
hardware.firmware = [
(pkgs.writeTextDir "/lib/firmware/hda-jack-retask.fw" ''
[codec]
0x10ec0293 0x17aa2233 0
[pincfg]
0x12 0x90a60130
0x13 0x40000000
0x14 0x90170110
0x15 0x03211040
0x16 0x21211010
0x18 0x411111f0
0x19 0x21a11010
0x1a 0x40f000f0
0x1b 0x411111f0
0x1d 0x40738105
0x1e 0x411111f0
'')
];
# Power saving features for multiple devices
boot.extraModprobeConfig = ''
options snd-hda-intel patch=hda-jack-retask.fw power_save=1
options mac80211 beacon_loss_count=500
options iwlwifi power_save=1
options iwlmvm power_scheme=3
options i915 enable_guc=2
'';
} }