Files
nixpkgs/nixos/modules/services/hardware/auto-cpufreq.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

60 lines
1.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.auto-cpufreq;
cfgFilename = "auto-cpufreq.conf";
cfgFile = format.generate cfgFilename cfg.settings;
format = pkgs.formats.ini { };
in
{
options = {
services.auto-cpufreq = {
enable = lib.mkEnableOption "auto-cpufreq daemon";
settings = lib.mkOption {
description = ''
Configuration for `auto-cpufreq`.
The available options can be found in [the example configuration file](https://github.com/AdnanHodzic/auto-cpufreq/blob/v${pkgs.auto-cpufreq.version}/auto-cpufreq.conf-example).
'';
default = { };
type = lib.types.submodule { freeformType = format.type; };
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.auto-cpufreq ];
systemd = {
packages = [ pkgs.auto-cpufreq ];
services.auto-cpufreq = {
# Workaround for https://github.com/NixOS/nixpkgs/issues/81138
wantedBy = [ "multi-user.target" ];
path = with pkgs; [
bash
coreutils
];
serviceConfig.WorkingDirectory = "";
serviceConfig.ExecStart = [
""
"${lib.getExe pkgs.auto-cpufreq} --daemon --config ${cfgFile}"
];
};
};
};
# uses attributes of the linked package
meta = {
buildDocsInSandbox = false;
maintainers = with lib.maintainers; [ nicoo ];
};
}