-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
hm-module.nix
120 lines (118 loc) · 3.95 KB
/
hm-module.nix
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{ crane
, fenix
,
}: { config
, lib
, pkgs
, ...
}:
with lib; let
inherit (attrsets) filterAttrs;
sss = import ./. {
inherit crane fenix pkgs lib;
system = pkgs.system;
};
cfgSSS = config.programs.sss;
tomlFormat = pkgs.formats.toml { };
configDir =
if pkgs.stdenv.isDarwin
then "Library/Application Support"
else config.xdg.configHome;
sharedConfig = import ./sharedConfig.nix { inherit lib; };
# Temp config
sssPackage = lists.optional cfgSSS.enable sss.packages.default;
codePackage = lists.optional cfgSSS.code.enable sss.packages.code;
filterConfig = cfg: filterAttrs (n: v: ((builtins.typeOf v) != "null") && n != "enable") cfg;
in
{
options.programs = {
sss =
{
enable = mkEnableOption "cli to take screenshots";
cli = mkOption {
description = "";
default = { };
type = types.submodule {
config = { };
options = {
current = mkEnableOption "Capture current screens";
screen = mkEnableOption "Capture all screens";
screen-id = mkOption {
type = types.str;
default = "";
description = "ID or Name of screen to capture";
};
};
};
};
code = mkOption {
description = "";
default = { };
type = types.submodule {
config = { };
options = {
enable = mkEnableOption "cli to take screenshots code";
# Code Configs
line-numbers = mkEnableOption "Show Line numbers";
code-background = mkOption {
type = types.str;
default = "";
description = "Background of code section. Support: '#RRGGBBAA' 'h;#RRGGBBAA;#RRGGBBAA' 'v;#RRGGBBAA;#RRGGBBAA' or file path";
};
theme = mkOption {
type = types.str;
default = "base16-ocean.dark";
example = "base16-ocean.dark";
description = "Theme file to use. May be a path, or an embedded theme. Embedded themes will take precendence.";
};
vim-theme = mkOption {
type = types.str;
default = "";
example = "";
description = "[Not recommended for manual use] Set theme from vim highlights, format: group,bg,fg,style;group,bg,fg,style;";
};
extra-syntaxes = mkOption {
type = types.str;
default = "";
example = "~/.config/extra-syntaxes";
description = "Additional folder to search for .sublime-syntax files in";
};
tab-width = mkOption {
type = types.int;
default = 4;
example = "4";
description = "Tab width";
};
indent-chars = mkOption {
type = types.listOf types.str;
default = [];
example = "['│' '┊']";
description = "List of characters to display in the indent levels";
};
hidden-chars = mkOption {
type = types.listOf types.str;
default = [];
example = "['space:·' 'eol:¶' 'tab:»']";
description = "List of hidden characters to display";
};
};
};
};
general = mkOption {
description = "Shared configuration";
default = { };
type = types.submodule {
config = { };
options = sharedConfig;
};
};
};
};
config = mkIf (cfgSSS.enable || cfgSSS.code.enable) {
home.packages = sssPackage ++ codePackage;
home.file."${configDir}/sss/config.toml" = mkIf (cfgSSS.enable || cfgSSS.code.enable) {
source =
tomlFormat.generate "config.toml" (filterConfig cfgSSS);
};
};
}