Skip to content

Commit 3208b3b

Browse files
committed
tofi: init module
1 parent 7a0c544 commit 3208b3b

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

modules/collection/programs/tofi.nix

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}: let
7+
inherit (lib.modules) mkIf;
8+
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
9+
inherit (lib.generators) toKeyValue;
10+
inherit (lib.rum.types) tofiSettingsType;
11+
12+
cfg = config.rum.programs.tofi;
13+
in {
14+
options.rum.programs.tofi = {
15+
enable = mkEnableOption "tofi";
16+
17+
package = mkPackageOption pkgs "tofi" {};
18+
19+
settings = mkOption {
20+
type = tofiSettingsType;
21+
default = {};
22+
example = {
23+
text-color = "#FFFFFF";
24+
num-results = 0;
25+
horizontal = false;
26+
};
27+
description = ''
28+
The configuration converted into "key = value" and written to
29+
`${config.directory}/.config/tofi/config`.
30+
Please reference tofi(5) (manpage) at https://github.com/philj56/tofi/blob/master/doc/tofi.5.md,
31+
or see an example at https://github.com/philj56/tofi/blob/master/doc/config.
32+
'';
33+
};
34+
};
35+
36+
config = mkIf cfg.enable {
37+
packages = [cfg.package];
38+
files.".config/tofi/config".text = mkIf (cfg.settings != {}) (toKeyValue cfg.settings);
39+
};
40+
}

modules/lib/types/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{lib}: {
22
gtkType = import ./gtkType.nix {inherit lib;};
3+
tofiSettingsType = import ./tofiSettingsType.nix {inherit lib;};
34
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{lib}: let
2+
inherit (lib.types) attrsOf oneOf str path bool int float;
3+
in (
4+
attrsOf (oneOf [
5+
str
6+
path
7+
bool
8+
int
9+
float
10+
])
11+
)

0 commit comments

Comments
 (0)