mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
Only has systemd support, so don't let darwin users think they are enabling something. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
55 lines
1.1 KiB
Nix
55 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkIf
|
|
mkOption
|
|
mkPackageOption
|
|
mkEnableOption
|
|
types
|
|
;
|
|
|
|
cfg = config.services.arrpc;
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.NotAShelf ];
|
|
|
|
options.services.arrpc = {
|
|
enable = mkEnableOption "arrpc";
|
|
package = mkPackageOption pkgs "arrpc" { };
|
|
|
|
systemdTarget = mkOption {
|
|
type = types.str;
|
|
default = "graphical-session.target";
|
|
example = "sway-session.target";
|
|
description = ''
|
|
Systemd target to bind to.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
# NOTE: Currently only systemd implemented
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "services.arrpc" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
systemd.user.services.arRPC = {
|
|
Unit = {
|
|
Description = "Discord Rich Presence for browsers, and some custom clients";
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = lib.getExe cfg.package;
|
|
Restart = "always";
|
|
};
|
|
|
|
Install.WantedBy = [ cfg.systemdTarget ];
|
|
};
|
|
};
|
|
}
|