diff options
Diffstat (limited to 'home-manager/theme-st.nix')
-rw-r--r-- | home-manager/theme-st.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/home-manager/theme-st.nix b/home-manager/theme-st.nix new file mode 100644 index 0000000..110c9d6 --- /dev/null +++ b/home-manager/theme-st.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: let + cfg = config.programs._st; + toString = x: if lib.isBool x then (if x then "true" else "false") else builtins.toString x; + generateXftFontString = name: attrs: + name + lib.optionalString (attrs != {}) ( + ":" + lib.concatStringsSep ":" ( + lib.mapAttrsToList (key: value: "${key}=${toString value}") attrs + ) + ) + ; + themed-st = pkgs.st.overrideAttrs (old: { + buildInputs = old.buildInputs or [] ++ [ pkgs.makeWrapper ]; + postInstall = old.postInstall or "" + '' + wrapProgram $out/bin/st \ + --add-flags '-f"${generateXftFontString cfg.font.name cfg.font.attrs}"' + ''; + }); +in { + options.programs._st = { + enable = lib.mkEnableOption "enables theming st with home manager"; + font = { + name = lib.mkOption { + type = lib.types.str; + example = "JetBrainsMonoNL Nerd Font Mono"; + default = "monospace"; + }; + attrs = lib.mkOption { + type = lib.types.attrs; + default = {}; + example = { + size = 12; + antialias = true; + autohint = true; + }; + }; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ themed-st ]; + }; +} |