Compare commits

..

5 Commits

Author SHA1 Message Date
coolneng 7eae8b6d83
Remove remnants of virtualization 2024-01-05 21:52:58 +01:00
coolneng 5ab0651127
Set system state version to latest 2024-01-05 21:32:05 +01:00
coolneng 2327c2d031
Import corresponding module from nixos-hardware 2024-01-05 21:31:08 +01:00
coolneng 5e0b44d6ff
Remove device specific tweaks 2024-01-05 21:30:49 +01:00
coolneng 48657ff49e
flake.lock: Update
Flake lock file updates:

• Updated input 'nix-index-database':
    'github:Mic92/nix-index-database/bd3aec0ecb0fdde863a7ed2c6caa220c47e22c07' (2023-11-26)
  → 'github:Mic92/nix-index-database/d6510ce144f5da7dd9bac667ba3d5a4946c00d11' (2023-12-31)
• Added input 'nixos-hardware':
    'github:NixOS/nixos-hardware/172385318068519900a7d71c1024242fa6af75f0' (2024-01-05)
• Updated input 'openconnect-sso/nix-github-actions':
    'github:nix-community/nix-github-actions/5163432afc817cf8bd1f031418d1869e4c9d5547' (2023-12-29)
  → 'github:nix-community/nix-github-actions/93e39cc1a087d65bcf7a132e75a650c44dd2b734' (2023-11-28)
• Updated input 'openconnect-sso/poetry2nix':
    'github:nix-community/poetry2nix/528d500ea826383cc126a9be1e633fc92b19ce5d' (2023-12-25)
  → 'github:nix-community/poetry2nix/0b2bff39e9bd4e6db3208e09c276ca83a063b370' (2023-11-27)
• Updated input 'openconnect-sso/treefmt-nix':
    'github:numtide/treefmt-nix/e434da615ef74187ba003b529cc72f425f5d941e' (2024-01-02)
  → 'github:numtide/treefmt-nix/e82f32aa7f06bbbd56d7b12186d555223dc399d1' (2023-11-12)
2024-01-05 21:17:41 +01:00
5 changed files with 39 additions and 155 deletions

View File

@ -6,15 +6,8 @@ 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_max=2147483648" "zfs.zfs_arc_meta_limit_percent=90" ];
"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 = {
@ -23,14 +16,9 @@ with pkgs;
}; };
}; };
# Intel CPU tweaks # Device firmware updates
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;
@ -79,13 +67,13 @@ with pkgs;
services.chrony.enable = true; services.chrony.enable = true;
# NixOS version # NixOS version
system.stateVersion = "22.05"; system.stateVersion = "24.05";
# Create coolneng user # Create coolneng user
users.users.coolneng = { users.users.coolneng = {
isNormalUser = true; isNormalUser = true;
home = "/home/coolneng"; home = "/home/coolneng";
extraGroups = [ "wheel" "video" "audio" "libvirtd" "lp" ]; extraGroups = [ "wheel" "video" "audio" "lp" ];
shell = fish; shell = fish;
}; };

View File

@ -118,11 +118,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703863825, "lastModified": 1701208414,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", "narHash": "sha256-xrQ0FyhwTZK6BwKhahIkUVZhMNk21IEI1nUcWSONtpo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-github-actions", "repo": "nix-github-actions",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", "rev": "93e39cc1a087d65bcf7a132e75a650c44dd2b734",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -138,11 +138,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1700968077, "lastModified": 1703992163,
"narHash": "sha256-Lax+2g7G3Fe+ckMrHLYTl+97unbmNDmN1qS9MLBkxr4=", "narHash": "sha256-709CGmwU34dxv8DjSpRBZ+HibVJIVaFcA4JH+GFnhyM=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "bd3aec0ecb0fdde863a7ed2c6caa220c47e22c07", "rev": "d6510ce144f5da7dd9bac667ba3d5a4946c00d11",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -151,6 +151,21 @@
"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,
@ -216,11 +231,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703546497, "lastModified": 1701105783,
"narHash": "sha256-CN/7HaEmHz+akXKejkRVhsxAm6HPGOmYBWMtgMkuROA=", "narHash": "sha256-5IOI0xXGbhAkUZNNcPId48V78Q+/JlW0hzlif0zxRmM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "poetry2nix", "repo": "poetry2nix",
"rev": "528d500ea826383cc126a9be1e633fc92b19ce5d", "rev": "0b2bff39e9bd4e6db3208e09c276ca83a063b370",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -235,6 +250,7 @@
"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"
} }
@ -277,11 +293,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1704233915, "lastModified": 1699786194,
"narHash": "sha256-GYDC4HjyVizxnyKRbkrh1GugGp8PP3+fJuh40RPCN7k=", "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "e434da615ef74187ba003b529cc72f425f5d941e", "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -11,6 +11,7 @@
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";
@ -33,7 +34,8 @@
}; };
}; };
outputs = { self, nixpkgs, agenix, nix-index-database, ... }@inputs: outputs =
{ self, nixpkgs, nixos-hardware, agenix, nix-index-database, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
@ -56,6 +58,7 @@
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

@ -1,72 +0,0 @@
# 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,18 +1,8 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
# Enable the TLP daemon # Enable power-profiles-daemon
services.tlp = { services.power-profiles-daemon.enable = true;
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 = ''
@ -20,45 +10,4 @@
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
'';
} }