nixos/atop: Split up restart triggers between atop and netatop
This commit is contained in:
parent
526bc6a4d5
commit
563ba07543
@ -107,7 +107,6 @@ in
|
|||||||
(cfg.package.override { withAtopgpu = true; })
|
(cfg.package.override { withAtopgpu = true; })
|
||||||
else
|
else
|
||||||
cfg.package;
|
cfg.package;
|
||||||
packages = [ atop (lib.mkIf cfg.netatop.enable cfg.netatop.package) ];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
environment.etc = mkIf (cfg.settings != { }) {
|
environment.etc = mkIf (cfg.settings != { }) {
|
||||||
@ -118,13 +117,13 @@ in
|
|||||||
'')
|
'')
|
||||||
cfg.settings);
|
cfg.settings);
|
||||||
};
|
};
|
||||||
environment.systemPackages = packages;
|
environment.systemPackages = [ atop (lib.mkIf cfg.netatop.enable cfg.netatop.package) ];
|
||||||
boot.extraModulePackages = [ (lib.mkIf cfg.netatop.enable cfg.netatop.package) ];
|
boot.extraModulePackages = [ (lib.mkIf cfg.netatop.enable cfg.netatop.package) ];
|
||||||
systemd =
|
systemd =
|
||||||
let
|
let
|
||||||
mkSystemd = type: cond: name: {
|
mkSystemd = type: cond: name: restartTriggers: {
|
||||||
${name} = lib.mkIf cond {
|
${name} = lib.mkIf cond {
|
||||||
restartTriggers = packages;
|
inherit restartTriggers;
|
||||||
wantedBy = [ (if type == "services" then "multi-user.target" else if type == "timers" then "timers.target" else null) ];
|
wantedBy = [ (if type == "services" then "multi-user.target" else if type == "timers" then "timers.target" else null) ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -132,13 +131,13 @@ in
|
|||||||
mkTimer = mkSystemd "timers";
|
mkTimer = mkSystemd "timers";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit packages;
|
packages = [ atop (lib.mkIf cfg.netatop.enable cfg.netatop.package) ];
|
||||||
services =
|
services =
|
||||||
mkService cfg.atopService.enable "atop"
|
mkService cfg.atopService.enable "atop" [ atop ]
|
||||||
// mkService cfg.atopacctService.enable "atopacct"
|
// mkService cfg.atopacctService.enable "atopacct" [ atop ]
|
||||||
// mkService cfg.netatop.enable "netatop"
|
// mkService cfg.netatop.enable "netatop" [ cfg.netatop.package ]
|
||||||
// mkService cfg.atopgpu.enable "atopgpu";
|
// mkService cfg.atopgpu.enable "atopgpu" [ atop ];
|
||||||
timers = mkTimer cfg.atopRotateTimer.enable "atop-rotate";
|
timers = mkTimer cfg.atopRotateTimer.enable "atop-rotate" [ atop ];
|
||||||
};
|
};
|
||||||
security.wrappers =
|
security.wrappers =
|
||||||
lib.mkIf cfg.setuidWrapper.enable { atop = { source = "${atop}/bin/atop"; }; };
|
lib.mkIf cfg.setuidWrapper.enable { atop = { source = "${atop}/bin/atop"; }; };
|
||||||
|
Loading…
Reference in New Issue
Block a user