-
-
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
support building only drvs that lack substitutes (aka nix-build-uncached
)
#3946
Comments
If I correctly recall |
Here's an idea: nix-build --store $remote_store --builders auto This flips things around so that the goal is just making paths exist in the remote store, but the local store ( I think that should do exactly what you want. it probably doesn't yet not yet work, but we should fix that. |
I'm not sure if we want to limit ourselves to one remote store here though. nix-build-uncached will look for any substitution, so we don't end up duplicating things in https://cache.nixos.org in or another cache too. I think a better way to do this is by augmenting Nix copy to be more specific in what is copied over:
It would add two new options:
Here's a command to get missing paths for a cache that works with flakes (at least in flake-compat mode):
|
@matthewbauer to solve the "don't duplicate stores" issue, I rather just be able to layer stores:
As that I think that is a generally useful concept, especially once Nix tries to deal with secrets in the store. |
Refs #3428 |
@matthewbauer What if I'm trying to just get a list of store paths and not actually do a copy (my final destination store is not supported natively by cachix/nix)? |
I'm starting on this. I think if it I put off splitting up |
I marked this as stale due to inactivity. → More info |
Still desirable. |
@Ericson2314 see #5025 |
Per #4364, which is closed as a duplicate of this, one should be able to do
to achieve this. |
I marked this as stale due to inactivity. → More info |
Still important, and stalebot is still a jerk. |
That doesn't work in the case of an s3 cache, which has no daemon |
stale bot in NixOS is configured to be purely informational and to help identify old and stale issues. It will not close issues and you do not need to comment on the issue just for the comment. |
Just realized that Perhaps one way we could do this and still ensure the derivation is a valid artifact would be to teach If we did that with the output of As a further optimization, we could easily guarantee we can do this in a single invocation with something like: #7437 |
I'd like to correct my previous comment a bit, I must have been misremembering or working with a different tool but there is no such Maybe an additional flag |
is still the right idea conceptually, and works. Rather than thinking of new work-arounds, we should just investigate what if anything about it doesn't work well and fix them. For example, it will fail with a read-only store because it doesn't know how to upload things. Fine. Then we should come up with a new solution like an "overlay store", or a way for people to tell nix how to do uploads for their substitutor store. |
I like the idea of querying the caches independant of building personally, but I don't see a problem with doing both either. In std-action, for example, we are doing all evaluation before hand in its own run, and produce a json that is used to build various job matrices. The runners in these matrices don't do any evaluation but use the json to know about the derivation paths ahead of time so they can skip any extra nix evaluation and get straight to work. If we had a simple way to query all caches during the eval phase, we could conditionally skip certain builds from even starting if they are already cached. That's why I suggest augmenting |
Not to mix issues but in a CI scenario with a "clean" builder, can you not rely on |
It depends on the scenario, but if there is any sort of IFD, even a small amount, I wanted a solution that is generally applicable. I definitely didn't want some inexperienced user accidentally adding some IFD to their project due to lack of experience and all of a sudden their CI runner is OOMing. Actually the eval is really not all that expensive even with IFD if basically all of the derivations that are produced during the eval (from IFD) are already reified before it starts. The difference is fairly drastic, from about 25m (no cache) to only 2m, for everything that will be run in CI in my current work project. If we could get the eval-cache working for Also, just in principal, I'd rather support fixing and augmenting upstream than working from a fork that may or may not be maintained in the long term. If it would be possible, I'd rather the official Nix evalautor itself learn how to use threads, and in a more efficient manner (some kind of shared state) than |
Resolves NixOS#3946 by providing an efficient means of querying cache status of the passed paths. For every path passed, it will be returned on standard output only if it is not available in any of the configured substituters.
Resolves NixOS#3946 by providing an efficient means of querying cache status of the passed paths. For every path passed, it will be returned on standard output only if it is not available in any of the configured substituters.
Just pinging here that you can use either #7587 or #7526 to resolve this. The latter may never be merged which is why I decided to split them up into separate PRs. With |
Resolves NixOS#3946 by providing an efficient means of querying cache status of the passed paths. For every path passed, it will be returned on standard output only if it is not available in any of the configured substituters.
Resolves NixOS#3946 by providing an efficient means of querying cache status of the passed paths. For every path passed, it will be returned on standard output only if it is not available in any of the configured substituters.
Resolves NixOS#3946 by providing an efficient means of querying cache status of the passed paths. For every path passed, it will be returned on standard output only if it is not available in any of the configured substituters.
Fixes NixOS#3946 Filters out any paths from the output which are already available in the configured substituters. Useful in CI environments, to avoid builds that are already cached.
I expanded the documentation off nix-eval-jobs also a bit w.r.t. to concurrency and memory usage: https://github.com/nix-community/nix-eval-jobs/pull/202/files |
https://github.com/Mic92/nix-fast-build is the spiritual successor of nix-build-uncached. Check the |
@Ericson2314: This almost works now, but I run into this:
when attempting:
I guess my local settings are not passing along trusted-public-keys? And I've not been able to convince the client/daemon to accept those keys via any combination of attempts so far. (@Mic92: while this isn't quite the UX we want, it is conceptually quite consistent with other notions. I'd like to ensure the underlying mechanism is good and then we can expose it in a more intuitive manner.) Edit: This seems to be due to the remote store not trusting pathInfo
makes things work. Likely we want this to either use global settings, or better would be for each store to have trust+policy settings apply to them. |
Try the trick from NixOS/nix#3946 (comment)
I tried the trick above but it doesn't seem to work with flakes:
|
Doing a |
Is your feature request related to a problem? Please describe.
Not necessarily, since
nix-build-uncached
exists, but it seems like a nice-to-have innix
itself. Also, I think the implementation innix
itself would likely be much more simple thannix-build-uncached
itself, just due to how it works.Describe the solution you'd like
nix build --lacking-substitutes .#packages
would build only the packages which can not be substituted from a known store or trusted binary cache.Also, a more-eloquent flag name would work, but I can't think of any :).
Describe alternatives you've considered
Just using
nix-build-uncached
.Additional context
This makes using Nix in CI scenarios a bit easier. For example,
nixpkgs-wayland
cuts down on wasted resources significantly by usingnix-build-uncached
. Otherwise the builder will download hundreds of MBs of store paths just to fulfill the build, even though in reality we only want to build binary artifacts that aren't already in our CI's binary cache.Alternatively
It seems like
nix-build-uncached
has to resolve unsubstitutable-derivations by parsing the output ofnix-build
supposedly becausenix build
's dry-run doesn't work; maybe that could be fixed.cc: @Mic92
The text was updated successfully, but these errors were encountered: