diff options
Diffstat (limited to 'share/hm-modules/tofi.nix')
| -rw-r--r-- | share/hm-modules/tofi.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/share/hm-modules/tofi.nix b/share/hm-modules/tofi.nix new file mode 100644 index 0000000..4d6dbee --- /dev/null +++ b/share/hm-modules/tofi.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.programs.tofi; + + format = pkgs.formats.keyValue { + mkKeyValue = generators.mkKeyValueDefault + { + mkValueString = v: + if builtins.isBool v then + if v then "true" else "false" + else if builtins.isString v then + ''"${v}"'' + else generators.mkValueStringDefault { } v; + } "="; + }; + + configFile = format.generate "config" cfg.settings; +in +{ + options.programs.tofi = { + enable = mkEnableOption + "tofi - An extremely fast and simple dmenu/rofi."; + + package = mkOption { + default = pkgs.tofi; + defaultText = literalExpression "pkgs.tofi"; + type = types.package; + example = literalExpression "pkgs.tofi"; + description = "The package to use for the tofi binaries."; + }; + + settings = mkOption { + inherit (format) type; + default = { }; + description = lib.mdDoc '' + Tofi configuration. Refer to tofi(5) for supported values. + ''; + example = { + font = "Fira Code"; + font-size = "22"; + + width = "1920"; + terminal = "kitty"; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg.configFile.tofi-config = { + enable = true; + target = "tofi/config"; + source = configFile; + }; + }; +} |
