Skip to content

Commit

Permalink
nix-gc: remove extraneous quotes from shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninja3047 authored Jul 31, 2024
1 parent 4fcd54d commit 58cef37
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/services/nix-gc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ in {
Unit = { Description = "Nix Garbage Collector"; };
Service = {
Type = "oneshot";
ExecStart = toString (pkgs.writeShellScript "nix-gc" ''
exec "${nixPackage}/bin/nix-collect-garbage ${
ExecStart = toString (pkgs.writeShellScript "nix-gc"
"exec ${nixPackage}/bin/nix-collect-garbage ${
lib.optionalString (cfg.options != null) cfg.options
}"'');
}");
};
};
systemd.user.timers.nix-gc = {
Expand Down
11 changes: 11 additions & 0 deletions tests/modules/services/nix-gc/basic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@
timerFile=$(normalizeStorePaths $timerFile)
assertFileContent $timerFile ${./expected.timer}
nixgcScriptFile=$(grep -o \
'/nix/store/.*-nix-gc' \
$TESTED/home-files/.config/systemd/user/nix-gc.service
)
assertFileExists $nixgcScriptFile
nixgcScriptFile=$(normalizeStorePaths $nixgcScriptFile)
assertFileContent $nixgcScriptFile ${./nix-gc-script-expected}
'';
}
2 changes: 2 additions & 0 deletions tests/modules/services/nix-gc/nix-gc-script-expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/nix/store/00000000000000000000000000000000-bash/bin/bash
exec @nix@/bin/nix-collect-garbage --delete-older-than 30d --max-freed $((64 * 1024**3))

0 comments on commit 58cef37

Please sign in to comment.