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

nix print-dev-env --profile should include flake inputs #3913

Open
Mic92 opened this issue Aug 9, 2020 · 6 comments
Open

nix print-dev-env --profile should include flake inputs #3913

Mic92 opened this issue Aug 9, 2020 · 6 comments

Comments

@Mic92
Copy link
Member

Mic92 commented Aug 9, 2020

Is your feature request related to a problem? Please describe.

When using nix print-dev-env in tools like direnv the nix shell is cached and --profile adds a gc root to prevent garbage collection. However all inputs are still garbage collected every 15 minutes (?), which makes working with bad/no internet harder/impossible.

Describe the solution you'd like

the --profile parameter should also add a garbage collection root for all (evaluated?) flake inputs.

Describe alternatives you've considered

Do it manually using some script doing: nix flake archive --json | grep -P -o -m1 '(?<="path":")/nix/store[^"]+' and then add a gc root for all inputs.

@stale
Copy link

stale bot commented Feb 12, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 12, 2021
@Mic92
Copy link
Member Author

Mic92 commented Feb 12, 2021

I sort of fixed this for nix-direnv: nix-community/nix-direnv@763d572

@stale stale bot removed the stale label Feb 12, 2021
@stale
Copy link

stale bot commented Aug 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Aug 13, 2021
@Mic92
Copy link
Member Author

Mic92 commented Aug 15, 2021

Still an issue. Only with nix-direnv it is possible to get an development environment that works off-the-grid (no internet).

@stale stale bot removed the stale label Aug 15, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Apr 17, 2022
@nrdxp
Copy link
Contributor

nrdxp commented May 22, 2022

Perhaps to make this more general, and because print-dev-env is basically just building a devShell output and exporting it in a special format anyway, we should probably rename this to "add flake inputs to --profile closure" or something along those lines. It'd be great if registering a profile (and gc root) for any package would also give us any flake inputs required to build that package.

I have a few flakes where even nix-direnv doesn't seem to cache all flake inputs. Much better if nix was internally aware of what was required to fetch to build something and include all of that in the profile closure

@stale stale bot removed the stale label May 22, 2022
nrdxp added a commit to divnix/std that referenced this issue May 22, 2022
Unfortunately it is impossible to guarantee that required flake inputs
are included in the profile closure until we have a solution for
NixOS/nix#3913

Until that time, we can build the entire devshell package and add it as
a root as this ensures more of the dependencies of the build are kept
in the profile gc root.

Also add `--keep-outputs` for the same reason.
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

3 participants