nixpkgs/nixos/modules/services/hardware/handheld-daemon.nix
Toast d5808aee19
handheld-daemon-ui: init at 3.2.3 (#305027)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Arne Keller <2012gdwu+github@posteo.de>
2024-11-19 11:17:59 +01:00

58 lines
1.3 KiB
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" { };
ui = {
enable = mkEnableOption "Handheld Daemon UI";
package = mkPackageOption pkgs "handheld-daemon-ui" { };
};
user = mkOption {
type = types.str;
description = ''
The user to run Handheld Daemon with.
'';
};
};
config = mkIf cfg.enable {
services.handheld-daemon.ui.enable = mkDefault true;
environment.systemPackages = [
cfg.package
] ++ lib.optional cfg.ui.enable cfg.ui.package;
services.udev.packages = [ cfg.package ];
systemd.packages = [ cfg.package ];
systemd.services.handheld-daemon = {
description = "Handheld Daemon";
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
path = mkIf cfg.ui.enable [
cfg.ui.package
pkgs.lsof
];
serviceConfig = {
ExecStart = "${ lib.getExe cfg.package } --user ${ cfg.user }";
Nice = "-12";
Restart = "on-failure";
RestartSec = "10";
};
};
};
meta.maintainers = [ maintainers.appsforartists ];
}