1 { config, lib, pkgs, ... }:
3 cfg = config.services.auto-cpufreq;
4 cfgFilename = "auto-cpufreq.conf";
5 cfgFile = format.generate cfgFilename cfg.settings;
7 format = pkgs.formats.ini {};
10 services.auto-cpufreq = {
11 enable = lib.mkEnableOption "auto-cpufreq daemon";
13 settings = lib.mkOption {
15 Configuration for `auto-cpufreq`.
17 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).
21 type = lib.types.submodule { freeformType = format.type; };
26 config = lib.mkIf cfg.enable {
27 environment.systemPackages = [ pkgs.auto-cpufreq ];
30 packages = [ pkgs.auto-cpufreq ];
31 services.auto-cpufreq = {
32 # Workaround for https://github.com/NixOS/nixpkgs/issues/81138
33 wantedBy = [ "multi-user.target" ];
34 path = with pkgs; [ bash coreutils ];
36 serviceConfig.WorkingDirectory = "";
37 serviceConfig.ExecStart = [
39 "${lib.getExe pkgs.auto-cpufreq} --daemon --config ${cfgFile}"
45 # uses attributes of the linked package
47 buildDocsInSandbox = false;
48 maintainers = with lib.maintainers; [ nicoo ];