Skip to content
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

Prevent nix-collect-garbage from invalidating cache #34

Open
unode opened this issue Mar 14, 2024 · 0 comments
Open

Prevent nix-collect-garbage from invalidating cache #34

unode opened this issue Mar 14, 2024 · 0 comments

Comments

@unode
Copy link

unode commented Mar 14, 2024

Hi everyone,

First thank you for this project. It completely removes the slowdown seen with nix-shell scripts so I'm relying on it a lot these days.
One issue I'm experiencing however is that the cache gets invalidated by nix-collect-garbage.

To avoid this I'm using nix-instantiate inside the script to pin (some of) the packages used.

A typical script looks like:

#!/usr/bin/env cached-nix-shell
#!nix-shell -i bash -p bash packageA packageB

nix-instantiate '<nixpkgs>' -A bash -A packageA -A packageB --indirect --add-root "$HOME/nix/pins/packageAB.drv"
(...)

However, this has the downside that for some packages nix-instantiate also takes some time to execute which removes some of the benefit of using cached-nix-shell.

Is there any way to pin the same packages that were used by the shell without this nix-instantiate hack?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant