]> git.scottworley.com Git - nix-profile-gc/blobdiff - modules/profile-gc.nix
profile-gc: No unbound variable references
[nix-profile-gc] / modules / profile-gc.nix
index 488bc0ad00162ee134bacd56e239a518d1365c6e..02b723829fba668014722f18faa633a647781d70 100644 (file)
@@ -50,7 +50,7 @@ in {
           keepLast won't protect them) while trying to get up to date.
 
           This is approximate and has a useful granularity of an hour
           keepLast won't protect them) while trying to get up to date.
 
           This is approximate and has a useful granularity of an hour
-          (config.systemd.timers.profile-gc-log-active.timerConfig.OnActiveSec).
+          (config.systemd.timers.profile-gc-log-active.timerConfig.OnUnitActiveSec).
           Do not set less than this.
         '';
         # We admonish the user "Do not set less than this." and check it at runtime rather
           Do not set less than this.
         '';
         # We admonish the user "Do not set less than this." and check it at runtime rather
@@ -98,7 +98,7 @@ in {
       fi
 
       alive_threshold="$(< ${parse-duration cfg.activeThreshold})"
       fi
 
       alive_threshold="$(< ${parse-duration cfg.activeThreshold})"
-      alive_loginterval="$(< ${parse-duration config.systemd.timers.profile-gc-log-active.timerConfig.OnActiveSec})"
+      alive_loginterval="$(< ${parse-duration config.systemd.timers.profile-gc-log-active.timerConfig.OnUnitActiveSec})"
       if (( alive_threshold < alive_loginterval ));then
         echo "Liveness threshold is too low.  Not doing any profile garbage collection." >&2
         exit 0
       if (( alive_threshold < alive_loginterval ));then
         echo "Liveness threshold is too low.  Not doing any profile garbage collection." >&2
         exit 0
@@ -161,11 +161,11 @@ in {
             echo "Keeeping current profile $p" >&2
             continue
           fi
             echo "Keeeping current profile $p" >&2
             continue
           fi
-          if [[ "''${active_targets[$(${pkgs.coreutils}/bin/readlink "$p")]}" ]];then
+          if [[ "''${active_targets[$(${pkgs.coreutils}/bin/readlink "$p")]:-}" ]];then
             echo "Keeeping active system/boot profile $p" >&2
             continue
           fi
             echo "Keeeping active system/boot profile $p" >&2
             continue
           fi
-          if [[ "''${active[$p]}" ]];then
+          if [[ "''${active[$p]:-}" ]];then
             echo "Keeeping active profile $p" >&2
             continue
           fi
             echo "Keeeping active profile $p" >&2
             continue
           fi
@@ -190,7 +190,7 @@ in {
     '';
     systemd.timers.profile-gc-log-active = {
       wantedBy = [ "timers.target" ];
     '';
     systemd.timers.profile-gc-log-active = {
       wantedBy = [ "timers.target" ];
-      timerConfig.OnActiveSec = "1 hour";
+      timerConfig.OnUnitActiveSec = "1 hour";
     };
     systemd.services.profile-gc-log-active = {
       description =
     };
     systemd.services.profile-gc-log-active = {
       description =