From c674f26e69e334f124ca3337de5f8221c482c882 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sat, 13 Sep 2025 09:17:43 +0200 Subject: [PATCH] Update nixos system config --- flake.nix | 2 - hosts/nixos/hs/system.nix | 1 - .../nixos/thinkpad/hardware-configuration.nix | 49 ++++++++++------- hosts/nixos/thinkpad/system.nix | 53 +++++++++---------- hosts/nixos/vps/system.nix | 1 - 5 files changed, 57 insertions(+), 49 deletions(-) diff --git a/flake.nix b/flake.nix index 61d1406..f5ab6b3 100644 --- a/flake.nix +++ b/flake.nix @@ -56,9 +56,7 @@ nixosConfigurations."thinkpad" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - disko.nixosModules.disko ./hosts/nixos/thinkpad/system.nix - ./hosts/nixos/thinkpad/disk-config.nix ]; }; diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index b69ce61..cb36e95 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: { imports = [ ./hardware-configuration.nix - ./disk-config.nix ./containers.nix # Host-specific container definitions ./proxy.nix # Host-specific Traefik dynamic configuration ./disk-health.nix # Host-specific disk health monitoring diff --git a/hosts/nixos/thinkpad/hardware-configuration.nix b/hosts/nixos/thinkpad/hardware-configuration.nix index d836580..b598705 100644 --- a/hosts/nixos/thinkpad/hardware-configuration.nix +++ b/hosts/nixos/thinkpad/hardware-configuration.nix @@ -1,28 +1,41 @@ -# This file will be auto-generated by nixos-generate-config during installation -# It will contain the hardware scan results specific to your ThinkPad P14s Gen 2 -# -# DO NOT EDIT this file manually before installation! -# Run 'nixos-generate-config --show-hardware-config' on the target machine -# to generate the actual hardware configuration. - +# 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 = [ ]; + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - # This will be populated automatically during installation - boot.initrd.availableKernelModules = [ ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - # Filesystem configuration will be added here by nixos-generate-config - # based on your actual disk partitioning + fileSystems."/" = + { device = "/dev/disk/by-uuid/97aa0a15-1b4a-43b6-b424-65d1926cec73"; + fsType = "ext4"; + }; - # Swap configuration (if applicable) will be added here + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7C9B-24EC"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; - # CPU and platform configuration will be detected and added here + swapDevices = [ + { device = "/dev/disk/by-partlabel/disk-main-swap"; } + ]; - # The NixOS release version will be set here - system.stateVersion = "24.05"; -} \ No newline at end of file + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nixos/thinkpad/system.nix b/hosts/nixos/thinkpad/system.nix index 7ca3f2e..0afbbc7 100644 --- a/hosts/nixos/thinkpad/system.nix +++ b/hosts/nixos/thinkpad/system.nix @@ -1,7 +1,6 @@ { config, pkgs, lib, ... }: { imports = [ ./hardware-configuration.nix - ./disk-config.nix ]; # Bootloader - standard UEFI setup @@ -103,7 +102,7 @@ i18n.defaultLocale = "en_US.UTF-8"; # Sound configuration with PipeWire (better than PulseAudio) - hardware.pulseaudio.enable = false; + services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { enable = true; @@ -120,30 +119,30 @@ # Video drivers videoDrivers = [ "modesetting" "nvidia" ]; - # Display manager - displayManager.sddm = { - enable = true; - wayland.enable = true; - }; - - # Desktop environment - desktopManager.plasma6.enable = true; - # Keyboard layout xkb = { layout = "us"; variant = ""; }; - - # Touchpad configuration - libinput = { - enable = true; - touchpad = { - naturalScrolling = true; - tapping = true; - disableWhileTyping = true; - accelProfile = "adaptive"; - }; + }; + + # Display manager + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + + # Desktop environment + services.desktopManager.plasma6.enable = true; + + # Touchpad configuration + services.libinput = { + enable = true; + touchpad = { + naturalScrolling = true; + tapping = true; + disableWhileTyping = true; + accelProfile = "adaptive"; }; }; @@ -250,11 +249,11 @@ home-manager # KDE/Plasma utilities - kate - konsole - spectacle - filelight - ark + kdePackages.kate + kdePackages.konsole + kdePackages.spectacle + kdePackages.filelight + kdePackages.ark # System utilities pciutils @@ -293,4 +292,4 @@ # settings for stateful data, like file locations and database versions # on your system were taken. system.stateVersion = "24.05"; -} \ No newline at end of file +} diff --git a/hosts/nixos/vps/system.nix b/hosts/nixos/vps/system.nix index 6bc0e31..96a8703 100644 --- a/hosts/nixos/vps/system.nix +++ b/hosts/nixos/vps/system.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: { imports = [ ./hardware-configuration.nix - ./disk-config.nix ./containers.nix # Host-specific container definitions ./proxy.nix # Host-specific Traefik dynamic configuration ../../../modules/wireguard.nix