New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/nix-gc: add persistent and randomizeDelaySec options #107959
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
I decided to give a try and test the PR to make sure everything is alright. My {
# Backport module from unstable.
imports = [
/home/thiagoko/Projects/nixpkgs/nixos/modules/services/misc/nix-gc.nix
];
disabledModules = [ "services/misc/nix-gc.nix" ];
# Enable NixOS auto-upgrade.
system.autoUpgrade = {
enable = true;
dates = "daily";
};
} And this is the result: ❯ systemctl cat nix-gc.timer
# /nix/store/4y61sz2gg2h7cs1bky41qaphbz08q0z2-unit-nix-gc.timer/nix-gc.timer
[Unit]
[Timer]
OnCalendar=weekly
Persistent=true
RandomizedDelaySec=0
~
❯ systemctl cat nix-gc.service
# /nix/store/4fhwmqacnq0vgx6x55j95jlyp5lh1ip4-unit-nix-gc.service/nix-gc.service
[Unit]
Description=Nix Garbage Collector
[Service]
Environment="LOCALE_ARCHIVE=/nix/store/a2px4kdz1jm03f8ifr1pzir0csfmyrlv-glibc-locales-2.31/lib/locale/locale-archive"
Environment="PATH=/nix/store/z1qvlavy35wanw5k54fvvfffws5bvigj-coreutils-8.31/bin:/nix/store/3fvzxz59gacagpwyzpfdiinc1yv46hw1-findutils-4>
Environment="TZDIR=/nix/store/w1g27pgslf28nh1py1szj7lk4xksdhqq-tzdata-2020c/share/zoneinfo"
ExecStart=/nix/store/9gvh04r9wsw0hhi2l1r2vzfs9pvg9a4b-unit-script-nix-gc-start/bin/nix-gc-start So, 💯 . |
@tex Can you fix the merge conflict? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@SuperSandro2000 Can we have this merged?
I don't know systemd that well. @Mic92 If you could take another look then I think it should be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Please merge when evaluation is finished.
dfc820c
to
2df04c5
Compare
Motivation for this change
I am complaining about nix-gc not correctly working in laptop environment where laptop is turned on and off unpredictable causing those timers never expire and this service never executed.
Here is my fix.
I think that current situation is making this service unusable on laptops.
One can add this to his configuration.nix: systemd.timers.nix-gc.timerConfig.Persistent = true; but it is not apparent for users...
#15689
#75861
#107805
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)