blob: 2cf4a468377f044c2e6c04cb75c4a2aac483b2b5 (
plain) (
blame)
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
|
{
config,
options,
lib,
pkgs,
...
}: let
defaultApps = config.modules.desktop.defaultApplications;
in {
options.modules.desktop.defaultApplications = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
apps = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
options = {
package = lib.mkOption {type = lib.types.package;};
install = lib.mkOption {type = lib.types.bool; default = true;};
cmd = lib.mkOption {type = lib.types.path;};
desktop = lib.mkOption {type = lib.types.str;};
};
}));
};
};
config = lib.mkIf (defaultApps.enable) {
modules.desktop.apps.terminals.kitty.enable = true;
modules.desktop.apps.editors.neovim.enable = true;
modules.desktop.apps.mpv.enable = true;
env = {
EDITOR = defaultApps.apps.editor.desktop;
TERM = defaultApps.apps.terminal.desktop;
VIDEO = defaultApps.apps.video.desktop;
};
home.packages = lib.filter (elem: elem != null) (lib.mapAttrsToList (name: value:
if value.install
then value.package
else null)
defaultApps.apps);
};
}
|