summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/hardware/inputplumber.nix
blob: fa281b94261f45832a5fea01787c94da4b38da1d (plain)
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
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.services.inputplumber;
in
{
  options.services.inputplumber = {
    enable = lib.mkEnableOption "InputPlumber";
    package = lib.mkPackageOption pkgs "inputplumber" { };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [ cfg.package ];
    environment.pathsToLink = [ "/share/inputplumber" ];

    systemd.services.inputplumber = {
      description = "InputPlumber Service";
      wantedBy = [ "multi-user.target" ];
      environment = {
        XDG_DATA_DIRS = "/run/current-system/sw/share";
      };
      restartIfChanged = true;

      serviceConfig = {
        ExecStart = "${lib.getExe cfg.package}";
        Restart = "on-failure";
        RestartSec = "5";
      };
    };
  };

  meta.maintainers = with lib.maintainers; [ shadowapex ];
}