Skip to content

Commit 77a58f7

Browse files
committed
way-displays-stateful: add module
1 parent d23d20f commit 77a58f7

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

modules/modules.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ let
471471
./services/unison.nix
472472
./services/vdirsyncer.nix
473473
./services/volnoti.nix
474+
./services/way-displays-stateful.nix
474475
./services/way-displays.nix
475476
./services/wayvnc.nix
476477
./services/window-managers/awesome.nix
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
lib,
3+
pkgs,
4+
config,
5+
...
6+
}:
7+
let
8+
cfg = config.services.way-displays-stateful;
9+
in
10+
{
11+
meta.maintainers = [ lib.maintainers.mightyiam ];
12+
13+
options.services.way-displays-stateful = {
14+
enable = lib.mkOption {
15+
type = lib.types.bool;
16+
default = false;
17+
description = ''
18+
A stateful way-displays setup where the configuration file is not linked to the store.
19+
This allows using `way-displays --set <arguments>` and then `way-displays --write`.
20+
21+
A way-displays service is _not_ started automatically. Instead, a window manager should execute `systemctl --user start "way-displays@$XDG_VTNR".service` on startup.
22+
'';
23+
};
24+
package = lib.mkPackageOption pkgs "way-displays" { };
25+
};
26+
27+
config = {
28+
assertions = [
29+
(lib.hm.assertions.assertPlatform "services.way-displays-stateful" pkgs lib.platforms.linux)
30+
];
31+
32+
home.packages = [ cfg.package ];
33+
34+
systemd.user.services."way-displays@" = {
35+
Unit.Description = "way-displays XDG_VTNR=%i";
36+
37+
Service = {
38+
Environment = "XDG_VTNR=%i";
39+
ExecStart = lib.getExe cfg.package;
40+
Restart = "on-failure";
41+
RestartSec = "10";
42+
};
43+
};
44+
};
45+
}

0 commit comments

Comments
 (0)