diff --git a/config/Powersave.nix b/config/Powersave.nix index c7402a1..d5afffe 100644 --- a/config/Powersave.nix +++ b/config/Powersave.nix @@ -34,28 +34,34 @@ let ''; in { - config = lib.mkIf cfg.enable { - services = { - tlp.enable = true; - upower.enable = true; - }; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + environment.systemPackages = [ script ]; + systemd = { + services.powersave-cpu = { + enable = true; + description = "disable CPU Boost"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "simple"; + RemainAfterExit = "yes"; + ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile}'"; + ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}'"; + }; + }; - environment.systemPackages = [ script ]; - systemd = { - services.powersave-cpu = { - enable = true; - description = "disable CPU Boost"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "simple"; - RemainAfterExit = "yes"; - ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.enableCmd} > ${cfg.cpu.boost.controlFile}'"; - ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${cfg.cpu.boost.disableCmd} > ${cfg.cpu.boost.controlFile}'"; + # HACK: Allow user access. + tmpfiles.rules = [ "z ${cfg.cpu.boost.controlFile} 0777 - - - -" ]; }; - }; + } - # HACK: Allow user access. - tmpfiles.rules = [ "z ${cfg.cpu.boost.controlFile} 0777 - - - -" ]; - }; - }; + (lib.mkIf cfg.laptop { + services = { + tlp.enable = true; + upower.enable = true; + }; + }) + ] + ); } diff --git a/home/program/thunderbird/default.nix b/home/program/thunderbird/default.nix index badaf80..5d0fed5 100644 --- a/home/program/thunderbird/default.nix +++ b/home/program/thunderbird/default.nix @@ -1,4 +1,10 @@ -{ __findFile, config, lib, pkgs, ... }: +{ + __findFile, + config, + lib, + pkgs, + ... +}: { enable = true; package = pkgs.thunderbird-esr; diff --git a/option/Powersave.nix b/option/Powersave.nix index b2fcd64..17020a2 100644 --- a/option/Powersave.nix +++ b/option/Powersave.nix @@ -1,7 +1,14 @@ -{ lib, ... }: +{ lib, config, ... }: +let + purpose = config.module.purpose; +in { options.module.powersave = { enable = lib.mkEnableOption "the powersave"; + laptop = lib.mkOption { + default = purpose.laptop; + type = lib.types.bool; + }; cpu.boost = { disableCmd = lib.mkOption { default = null;