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

flake/nix-command based eval? #327

Open
GenericNerdyUsername opened this issue Apr 6, 2023 · 7 comments
Open

flake/nix-command based eval? #327

GenericNerdyUsername opened this issue Apr 6, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@GenericNerdyUsername
Copy link

would it be possible to use nix eval, so that the evaluation is cached? I feel it would speed up usage a fair bit

@figsoda figsoda added the enhancement New feature or request label Apr 6, 2023
@Mic92
Copy link
Owner

Mic92 commented Apr 7, 2023

I don't think that would work. nixpkgs currently does not expose all packages in the flake and legacyPackages is not cached afaik. Also as far as I know it might also slow down the first evaluation since for every attribute it would needs to create entries in the eval cache sqlite databases.

@GenericNerdyUsername
Copy link
Author

This is the first ive heard of not all packages being exposed

@Mic92
Copy link
Owner

Mic92 commented Apr 7, 2023

If you do $ nix flake show --legacy you see that it won't include any nested package sets such as python packages. It's probably possible to have an eval script that iterates over all packages in the same way nix-env does, but it likely also slower. And I don't think you will be able to use the eval cache in this case.

@GenericNerdyUsername
Copy link
Author

What would be the problem with writing a small expression that gives you all of the packages?

@Mic92
Copy link
Owner

Mic92 commented Apr 8, 2023

Than you won't benefit from any cache and just reimplement nix-env in a slower way. Also there are some exceptions thrown in nixpkgs every once in a while that you cannot catch from nix.
This is the script that I used before to go over all of nixpkgs. https://gist.github.com/Mic92/0a30fa6babd3eb9c8445fd877ae8781f

@GenericNerdyUsername
Copy link
Author

Why not put that script in a flake and modify the nixpkgs input?

@Mic92
Copy link
Owner

Mic92 commented Apr 8, 2023

I'd say it would be easier to just cache the nixpkgs package list that nix-env generates:

def list_packages(

and less error prone than those terrible nix expressions that has to use tons of tryEval.

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

No branches or pull requests

3 participants