mirror of
https://github.com/NotAShelf/batmon.git
synced 2025-01-19 00:12:40 +00:00
nix: configuration and systemd service fixes (#2)
* remove the DynamicUser systemd serviceConfig option, it isn't used on user services * remove references to power-profiles-daemon.service in the user service, you can't reference sysemd services in a systemd user service * make --config reference path to config, not the config itself
This commit is contained in:
parent
51831ae23a
commit
cdf8a82c27
1 changed files with 5 additions and 4 deletions
|
@ -37,22 +37,23 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Create the batmon configuration file in /etc/batmon.json
|
||||
environment.etc."batmon.json".source = format.generate "batmon.json" cfg.settings;
|
||||
|
||||
environment.systemPackages = [cfg.package];
|
||||
|
||||
systemd.user.services.batmon = {
|
||||
description = "Simple, reactive power management service";
|
||||
documentation = ["https://github.com/NotAShelf/batmon"];
|
||||
wants = ["power-profiles-daemon.service"];
|
||||
requires = ["power-profiles-daemon.service"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
environment.PATH = mkForce "/run/wrappers/bin:${lib.makeBinPath [cfg.package]}";
|
||||
script = ''
|
||||
${lib.getExe cfg.package} --config ${builtins.toJSON cfg.settings}
|
||||
${lib.getExe cfg.package} --config /etc/batmon.json
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
DynamicUser = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue