diff options
Diffstat (limited to 'modules/zcfan.nix')
-rw-r--r-- | modules/zcfan.nix | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/zcfan.nix b/modules/zcfan.nix new file mode 100644 index 0000000..d26c07d --- /dev/null +++ b/modules/zcfan.nix @@ -0,0 +1,25 @@ +{ lib, config, pkgs, ... }: + +let cfg = config.this.laptop.zcfan; + mkConf = c: lib.generators.toKeyValue { + mkKeyValue = lib.generators.mkKeyValueDefault {} " "; + } c; + conf = mkConf cfg.settings; +in +{ + options = { + this.laptop.zcfan.enable = lib.mkEnableOption "zcfan"; + this.laptop.zcfan.settings = lib.mkOption { + type = with lib.types; + attrsOf (oneOf [int str]); + default = { }; + description = "Settings for zcfan."; + }; + }; + + config = lib.mkIf cfg.enable { + environment.etc."zcfan.conf" = lib.mkIf (conf != "") { text = conf; }; + environment.systemPackages = [ pkgs.zcfan ]; + systemd.packages = [ pkgs.zcfan ]; + }; +} |