-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.nix
64 lines (57 loc) · 1.64 KB
/
module.nix
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
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.wayland-pipewire-idle-inhibit;
tomlFormat = pkgs.formats.toml { };
configFile = tomlFormat.generate "wayland-pipewire-idle-inhibit.toml" cfg.settings;
in
{
options.services.wayland-pipewire-idle-inhibit = {
enable = mkEnableOption "wayland-pipewire-idle-inhibit";
package = mkOption {
type = types.package;
default = pkgs.callPackage ./default.nix { };
description = ''
The wayland-pipewire-idle-inhibit package to use.
'';
};
settings = mkOption {
type = tomlFormat.type;
default = { };
example = literalExpression ''
{
verbosity = "WARN";
media_minimum_duration = 5;
node_blacklist = [
{ name = "spotify"; }
];
}
'';
description = ''
Configuration for wayland-pipewire-idle-inhibit.
'';
};
systemdTarget = mkOption {
type = types.str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
systemd target to bind to.
'';
};
};
config = mkIf cfg.enable {
systemd.user.services.wayland-pipewire-idle-inhibit = {
Unit = {
Description = "Inhibit Wayland idling when media is played through pipewire";
Documentation = "https://github.com/rafaelrc7/wayland-pipewire-idle-inhibit";
};
Install.WantedBy = [ cfg.systemdTarget ];
Service = {
ExecStart = "${cfg.package}/bin/wayland-pipewire-idle-inhibit --config ${configFile}";
Restart = "always";
RestartSec = 10;
};
};
};
}