From 094d206afc1d26fb6ebffb2073003edee64bff5d Mon Sep 17 00:00:00 2001 From: geekiot Date: Sat, 27 Sep 2025 13:56:58 +0500 Subject: [PATCH] fix (option laptop): change option to configure cpu for the laptop additional, fix laptop thinkbook config --- devices/thinkbook/default.nix | 5 ++- options/device/{desktop.nix => laptop.nix} | 41 ++++++++++++---------- 2 files changed, 27 insertions(+), 19 deletions(-) rename options/device/{desktop.nix => laptop.nix} (76%) diff --git a/devices/thinkbook/default.nix b/devices/thinkbook/default.nix index 003cf42..7893a7c 100644 --- a/devices/thinkbook/default.nix +++ b/devices/thinkbook/default.nix @@ -9,8 +9,11 @@ enable = true; battery.enable = true; bluetooth.enable = true; - cpu.type = "intel"; sound.enable = true; + cpu = { + enable = true; + type = "intel"; + }; }; device.zram.enable = false; diff --git a/options/device/desktop.nix b/options/device/laptop.nix similarity index 76% rename from options/device/desktop.nix rename to options/device/laptop.nix index 5aac714..5a066f2 100644 --- a/options/device/desktop.nix +++ b/options/device/laptop.nix @@ -29,13 +29,20 @@ in description = "Bluetooth configuration for the laptop."; }; - cpu.type = lib.mkOption { - type = lib.enum [ - "intel" - "amd" - ]; - default = "intel"; - description = "Laptop CPU type."; + cpu = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "CPU configuration for the laptop."; + }; + type = lib.mkOption { + type = lib.enum [ + "intel" + "amd" + ]; + default = "intel"; + description = "Laptop CPU type."; + }; }; sound.enable = lib.mkOption { @@ -85,18 +92,16 @@ in }; imports = lib.optional ( - cfg.cpu.type == "intel" + cfg.cpu.enable && cfg.cpu.type == "intel" ) inputs.nixos-hardware.nixosModules.common-cpu-intel; - services.thermald = - lib.mkIf cfg.cpu.type == "intel" { - enable = true; - package = pkgs.thermald; - }; - hardware.graphics = - lib.mkIf cfg.cpu.type == "intel" { - enable = true; - enable32Bit = true; - }; + services.thermald = lib.mkIf (cfg.cpu.enable && cfg.cpu.type == "intel") { + enable = true; + package = pkgs.thermald; + }; + hardware.graphics = lib.mkIf (cfg.cpu.enable && cfg.cpu.type == "intel") { + enable = true; + enable32Bit = true; + }; security.rtkit.enable = lib.mkIf cfg.sound.enable true; services.pulseaudio = lib.mkIf cfg.sound.enable {