depot/third_party/nixpkgs/nixos/modules/services/hardware/handheld-daemon.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

44 lines
950 B
Nix

{ config
, lib
, pkgs
, ...
}:
with lib; let
cfg = config.services.handheld-daemon;
in
{
options.services.handheld-daemon = {
enable = mkEnableOption "Handheld Daemon";
package = mkPackageOption pkgs "handheld-daemon" { };
user = mkOption {
type = types.str;
description = ''
The user to run Handheld Daemon with.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
systemd.packages = [ cfg.package ];
systemd.services.handheld-daemon = {
description = "Handheld Daemon";
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
serviceConfig = {
ExecStart = "${ lib.getExe cfg.package } --user ${ cfg.user }";
Nice = "-12";
Restart = "on-failure";
RestartSec = "10";
};
};
};
meta.maintainers = [ maintainers.appsforartists ];
}