mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
b960a217bd
Co-authored-by: h7x4 <h7x4@nani.wtf> Co-authored-by: Luke Granger-Brown <git@lukegb.com> Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
45 lines
967 B
Nix
45 lines
967 B
Nix
{ config
|
|
, lib
|
|
, pkgs
|
|
, ...
|
|
}:
|
|
with lib; let
|
|
cfg = config.services.handheld-daemon;
|
|
in
|
|
{
|
|
options.services.handheld-daemon = {
|
|
enable = mkEnableOption "Enable Handheld Daemon";
|
|
package = mkPackageOption pkgs "handheld-daemon" { };
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
description = lib.mdDoc ''
|
|
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 ];
|
|
}
|