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
{
lib,
pkgs,
config,
npins,
...
}:
let
inherit (lib) types;
cfg = config.zpha.programs.niri;
niri-nix = import "${npins.niri-nix}/lib" {
self = npins.niri-nix;
inherit lib;
nixpkgs.legacyPackages."${pkgs.stdenv.hostPlatform.system}" = pkgs;
};
in
{
options.zpha.programs.niri = {
enable = lib.mkEnableOption "niri";
settings = lib.mkOption {
type =
with lib.types;
let
valueType =
nullOr (oneOf [
bool
int
float
str
path
(attrsOf valueType)
(listOf valueType)
])
// {
description = "Niri configuration value";
};
in
types.submodule {
freeformType = valueType;
};
default = { };
};
extraConfig = lib.mkOption {
type = types.lines;
default = "";
};
finalConfig = lib.mkOption {
type = types.lines;
default = (niri-nix.mkNiriKDL cfg.settings) + "\n" + cfg.extraConfig;
};
};
config = lib.mkIf cfg.enable {
common.programs.niri.enable = true;
users.users.zaphyra.maid = {
file.xdg_config."niri/config.kdl".source =
niri-nix.validatedConfigFor config.programs.niri.package cfg.finalConfig;
};
};
}