Skip to content

Commit 67ef565

Browse files
committed
modules/swayosd: init
1 parent 3c61eca commit 67ef565

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

modules/swayosd/check.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
pkgs,
3+
self,
4+
}:
5+
6+
let
7+
swayosdWrapped =
8+
(self.wrapperModules.swayosd.apply {
9+
inherit pkgs;
10+
11+
settings = {
12+
server = {
13+
max_volume = 150;
14+
min_brightness = 5;
15+
};
16+
};
17+
}).wrapper;
18+
19+
in
20+
pkgs.runCommand "swayosd-test" { } ''
21+
test -x "${swayosdWrapped}/bin/swayosd-server"
22+
23+
touch $out
24+
''

modules/swayosd/module.nix

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
config,
3+
lib,
4+
wlib,
5+
...
6+
}:
7+
let
8+
tomlFmt = config.pkgs.formats.toml { };
9+
in
10+
{
11+
_class = "wrapper";
12+
options = {
13+
settings = lib.mkOption {
14+
type = tomlFmt.type;
15+
default = { };
16+
description = ''
17+
SwayOSD server configuration.
18+
See https://github.com/ErikReider/SwayOSD for available options.
19+
'';
20+
example = lib.literalExpression ''
21+
{
22+
server = {
23+
max_volume = 150;
24+
min_brightness = 5;
25+
top_margin = 0.85;
26+
show_percentage = true;
27+
};
28+
}
29+
'';
30+
};
31+
"config.toml" = lib.mkOption {
32+
type = wlib.types.file config.pkgs;
33+
default.path = tomlFmt.generate "config.toml" config.settings;
34+
description = "Generated SwayOSD configuration file.";
35+
};
36+
style = lib.mkOption {
37+
type = wlib.types.file config.pkgs;
38+
default.content = "";
39+
description = ''
40+
CSS stylesheet for SwayOSD appearance.
41+
See the SwayOSD repository for styling examples.
42+
'';
43+
};
44+
};
45+
46+
config.flags = {
47+
"--config" = "${config."config.toml".path}";
48+
"--style" = if (config.style.content != "") then "${config.style.path}" else false;
49+
};
50+
51+
config.exePath = lib.getExe' config.pkgs.swayosd "swayosd-server";
52+
53+
config.package = config.pkgs.swayosd;
54+
55+
config.meta.maintainers = [ lib.maintainers.adeci ];
56+
config.meta.platforms = lib.platforms.linux;
57+
}

0 commit comments

Comments
 (0)