blob: 110c9d6a163aaebc38ae2c108eb525f0bd486dc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 ];
};
}
|