arrpc: add module

This commit is contained in:
NotAShelf 2024-01-27 13:05:49 +03:00 committed by Robert Helgesson
parent 13dbf2623d
commit 7b4ea8d82f
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 46 additions and 0 deletions

View file

@ -1401,6 +1401,12 @@ in {
'';
}
{
time = "2024-02-05T22:33:54+00:00";
message = ''
A new module is available: 'services.arrpc'
'';
}
];
};
}

View file

@ -251,6 +251,7 @@ let
./programs/zsh.nix
./programs/zsh/prezto.nix
./programs/zsh/zsh-abbr.nix
./services/arrpc.nix
./services/autorandr.nix
./services/avizo.nix
./services/barrier.nix

View file

@ -0,0 +1,39 @@
{ 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 {
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 ];
};
};
}