diff --git a/modules/hardware/core/firmware.nix b/modules/hardware/core/firmware.nix new file mode 100644 index 0000000..c670c5f --- /dev/null +++ b/modules/hardware/core/firmware.nix @@ -0,0 +1,4 @@ +{ ... }: { + hardware.enableRedistributableFirmware = true; # T480 WiFi firmware fix + services.fwupd.enable = true; +} \ No newline at end of file diff --git a/modules/hardware/hibernation.nix b/modules/hardware/core/hibernation.nix similarity index 100% rename from modules/hardware/hibernation.nix rename to modules/hardware/core/hibernation.nix diff --git a/modules/hardware/igpu.nix b/modules/hardware/core/igpu.nix similarity index 92% rename from modules/hardware/igpu.nix rename to modules/hardware/core/igpu.nix index 94b9c3c..2961bdf 100644 --- a/modules/hardware/igpu.nix +++ b/modules/hardware/core/igpu.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { hardware.graphics = { enable = true; enable32Bit = true; diff --git a/modules/hardware/core/tpm.nix b/modules/hardware/core/tpm.nix new file mode 100644 index 0000000..88d6554 --- /dev/null +++ b/modules/hardware/core/tpm.nix @@ -0,0 +1,7 @@ +{ ... }: { + security.tpm2 = { + enable = true; + pkcs11.enable = true; + tctiEnvironment.enable = true; + }; +} \ No newline at end of file diff --git a/modules/hardware/battery-power.nix b/modules/hardware/misc/battery-power.nix similarity index 97% rename from modules/hardware/battery-power.nix rename to modules/hardware/misc/battery-power.nix index e4a000b..d0d69e6 100644 --- a/modules/hardware/battery-power.nix +++ b/modules/hardware/misc/battery-power.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { powerManagement.powertop.enable = true; services = { diff --git a/modules/hardware/cpu-thermal.nix b/modules/hardware/misc/cpu-thermal.nix similarity index 74% rename from modules/hardware/cpu-thermal.nix rename to modules/hardware/misc/cpu-thermal.nix index 312d404..5cc0ef2 100644 --- a/modules/hardware/cpu-thermal.nix +++ b/modules/hardware/misc/cpu-thermal.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ ... }: { services = { thermald.enable = true; throttled.enable = true; @@ -15,9 +14,6 @@ governor = "powersave"; energy_performance_preference = "balance_power"; turbo = "never"; - enable_thresholds = "true"; - start_threshold = "80"; - stop_threshold = "85"; }; }; }; @@ -29,9 +25,6 @@ [ 7 65 75 ] [ "level full-speed" 75 100 ] ]; - # sensors = [ - # { type = "hwmon"; query = "/sys/devices/platform/coretemp.0/hwmon"; } - # ]; }; }; } diff --git a/modules/hardware/power-button.nix b/modules/hardware/misc/power-button.nix similarity index 90% rename from modules/hardware/power-button.nix rename to modules/hardware/misc/power-button.nix index 8b563bb..9f8be07 100644 --- a/modules/hardware/power-button.nix +++ b/modules/hardware/misc/power-button.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { services.logind.settings.Login = { HandleLidSwitch = "suspend"; HandlePowerKey = "ignore"; diff --git a/modules/hardware/tzupdate.nix b/modules/hardware/misc/tzupdate.nix similarity index 100% rename from modules/hardware/tzupdate.nix rename to modules/hardware/misc/tzupdate.nix diff --git a/modules/hardware/thinkpad.nix b/modules/hardware/thinkpad.nix index 32652b2..779a6f8 100644 --- a/modules/hardware/thinkpad.nix +++ b/modules/hardware/thinkpad.nix @@ -1,35 +1,21 @@ { pkgs, ... }: { imports = [ - ./tzupdate.nix - ./hibernation.nix - ./igpu.nix - ./cpu-thermal.nix - ./battery-power.nix - ./power-button.nix + ./misc/battery-power.nix + ./misc/power-button.nix + ./misc/cpu-thermal.nix + ./misc/tzupdate.nix + ./core/hibernation.nix + ./core/firmware.nix + ./core/igpu.nix + ./core/tpm.nix ]; - security = { - tpm2 = { - enable = true; - pkcs11.enable = true; - tctiEnvironment.enable = true; - }; - }; - - hardware = { - enableRedistributableFirmware = true; # T480 WiFi firmware fix - bluetooth = { - enable = true; - powerOnBoot = true; - }; - }; + hardware.bluetooth.enable = true; boot = { kernelPackages = pkgs.linuxPackages; kernel.sysctl."vm.laptop_mode" = 5; initrd.availableKernelModules = [ "thinkpad_acpi" ]; }; - - services.fwupd.enable = true; } diff --git a/modules/system/base.nix b/modules/system/base.nix index d64975b..88b2c13 100644 --- a/modules/system/base.nix +++ b/modules/system/base.nix @@ -1,8 +1,8 @@ { hostname, timezone, ... }: { system.stateVersion = "24.11"; imports = [ - ./utilities.nix - ./nix-conf.nix + ./misc/utilities.nix + ./misc/nix-conf.nix ]; networking.hostName = "${hostname}"; @@ -11,4 +11,4 @@ openssh.enable = true; tailscale.enable = true; }; -} \ No newline at end of file +} diff --git a/modules/system/bootloader.nix b/modules/system/core/bootloader.nix similarity index 100% rename from modules/system/bootloader.nix rename to modules/system/core/bootloader.nix diff --git a/modules/system/filesystem.nix b/modules/system/core/filesystem.nix similarity index 100% rename from modules/system/filesystem.nix rename to modules/system/core/filesystem.nix diff --git a/modules/system/kernel.nix b/modules/system/core/kernel.nix similarity index 100% rename from modules/system/kernel.nix rename to modules/system/core/kernel.nix diff --git a/modules/system/network.nix b/modules/system/core/network.nix similarity index 100% rename from modules/system/network.nix rename to modules/system/core/network.nix diff --git a/modules/system/virtualization.nix b/modules/system/core/virtualization.nix similarity index 100% rename from modules/system/virtualization.nix rename to modules/system/core/virtualization.nix diff --git a/modules/system/default.nix b/modules/system/default.nix index 2cf8d41..67b64ba 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -1,14 +1,14 @@ { pkgs, locale, ... }: { imports = [ + ./core/virtualization.nix + ./core/bootloader.nix + ./core/filesystem.nix + ./core/network.nix + ./core/kernel.nix + ./core/user.nix + ./misc/programs.nix + ./misc/desktop.nix ./base.nix - ./network.nix - ./user.nix - ./kernel.nix - ./bootloader.nix - ./filesystem.nix - ./virtualization.nix - ./desktop.nix - ./programs.nix ]; i18n.defaultLocale = locale; @@ -24,4 +24,4 @@ fonts.packages = with pkgs; [ corefonts ]; -} \ No newline at end of file +} diff --git a/modules/system/desktop.nix b/modules/system/misc/desktop.nix similarity index 100% rename from modules/system/desktop.nix rename to modules/system/misc/desktop.nix diff --git a/modules/system/nix-conf.nix b/modules/system/misc/nix-conf.nix similarity index 100% rename from modules/system/nix-conf.nix rename to modules/system/misc/nix-conf.nix diff --git a/modules/system/programs.nix b/modules/system/misc/programs.nix similarity index 100% rename from modules/system/programs.nix rename to modules/system/misc/programs.nix diff --git a/modules/system/utilities.nix b/modules/system/misc/utilities.nix similarity index 100% rename from modules/system/utilities.nix rename to modules/system/misc/utilities.nix diff --git a/modules/system/user.nix b/modules/system/user.nix index 95736c5..44910e9 100644 --- a/modules/system/user.nix +++ b/modules/system/user.nix @@ -1,23 +1,21 @@ { pkgs, username, ... }: { - users = { - users."${username}" = { - linger = true; - isNormalUser = true; - description = "${username}"; - initialPassword = "${username}"; - shell = pkgs.zsh; - extraGroups = [ - "networkmanager" - "wheel" - "dialout" - "libvirtd" - "docker" - "input" - "uinput" - "ydotool" - "adbusers" - "kvm" - ]; - }; + users.users."${username}" = { + linger = true; + isNormalUser = true; + description = "${username}"; + initialPassword = "${username}"; + shell = pkgs.zsh; + extraGroups = [ + "networkmanager" + "wheel" + "dialout" + "libvirtd" + "docker" + "input" + "uinput" + "plugdev" + "adbusers" + "kvm" + ]; }; }