From 833b1eb0b18d323dfd51aba720346797dc09337c Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Wed, 22 Dec 2021 11:28:24 +0000
Subject: [PATCH] Start megacli2prom by timer, not with multi-user.target

Take what I learned from @tomprince in
https://whetstone.privatestorage.io/privatestorage/PrivateStorageio/-/merge_requests/220#note_17605 :
Assigning a service a `startAt' will make timer.target start it,
no need to also have it `wantedBy' multiuser.target.

Also add megacli2prom to the path even if it should be already because
of megacli2prom.  Better be safe than sorry.
---
 nixos/modules/monitoring/exporters/megacli2prom.nix | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nixos/modules/monitoring/exporters/megacli2prom.nix b/nixos/modules/monitoring/exporters/megacli2prom.nix
index a38f1ccc..c1f10aef 100644
--- a/nixos/modules/monitoring/exporters/megacli2prom.nix
+++ b/nixos/modules/monitoring/exporters/megacli2prom.nix
@@ -35,11 +35,10 @@ in {
 
   config =
     lib.mkIf cfg.enable {
-      environment.systemPackages = [ ourpkgs.megacli2prom ];
+      environment.systemPackages = [ ourpkgs.megacli2prom pkgs.megacli ];
       systemd.services.megacli2prom = {
         enable = true;
         description = "MegaCli2Prom metrics gathering service";
-        wantedBy = [ "multi-user.target" ];
         startAt = cfg.interval;
         path = [ pkgs.megacli ];
         # Save to a temp file and then move atomically so the
-- 
GitLab