-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Offline flake development #4250
Comments
Yeah, this has been gone for a while (1b49479). It will need to be revived in a way that doesn't require fetching all flake inputs eagerly. |
The best way to keep a
The latter command doesn't require any fetching/building. |
I discovered this independently and meant to update this issue and this indeed solves the problem, almost. The flake inputs themselves don't seem to be considered as part of the profile (e.g. the downloaded nixpkgs tarball), so if a GC cycle is run that file has to be fetched, though nothing else has to be built and it's a quick operation. I've worked around this by including a text file with the input paths as a build input so the inputs are considered runtime dependencies and thus kept. Then the profile truly points to everything and I can garbage collect without fear. I wonder if this could/should be done automatically in Nix itself? It feels like an oversight to me. |
I marked this as stale due to inactivity. → More info |
I am still interested in this being fixed. But I guess my solution was equivalent to the solution that was incompatible with lazy fetching. |
I think I'm seeing this sometimes even without a GC having occurred. Literally just Note though that this machine is running a Hydra instance, so possible Hydra is running GC on me? |
I download nixpkgs at least every day because garbage collection always collects it. Any workaround for that? |
The exact implementation depends on which type of flake output you want to keep around, but this is how I work around the problem for |
I have also written this yesterday: gc_root_prefix="/nix/var/nix/gcroots/per-user/$USER/$(systemd-escape -p "$PWD")-flake-"
nix flake update "$@"
echo "Adding per-user gcroots..."
rm -f "$gc_root_prefix"*
nix flake archive --json 2>/dev/null | jq -r '.inputs | to_entries[] | "ln -fsT "+.value.path+" \"'"$gc_root_prefix"'"+.key+"\""' | while read -r line; do
eval "$line"
done |
I think it's impossible to do offline development at the moment due to #8953 |
In #2890, the flake system was fixed to stop built flakes from being garbage collected. However, "nix develop" outputs still are it seems. I can't figure out how to set it up so I can develop offline if a garbage collection has run.
The text was updated successfully, but these errors were encountered: