nix icon indicating copy to clipboard operation
nix copied to clipboard

path-info: implement --filter-substitutable

Open nrdxp opened this issue 2 years ago • 5 comments

Fixes #3946

Alternative to #7526 which implements the same logic in the new cli instead of the legacy nix-store

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • [ ] agreed on idea
  • [ ] agreed on implementation strategy
  • [ ] tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • [ ] documentation in the manual
  • [ ] code and comments are self-explanatory
  • [ ] commit message explains why the change was made
  • [ ] new feature or bug fix: updated release notes

nrdxp avatar Jan 11 '23 20:01 nrdxp

@roberth, it seems this implementation is fast, but it suffers from only every querying the official cache (cache.nixos.org). Trying to nail down why exactly that is has been sort of a PITA. Do you happen to have any insight into that?

Update Scratch that, I found a fix by manually running queryValidPaths on each substituter

nrdxp avatar Jan 12 '23 00:01 nrdxp

I'm starting to think that I am just gonna have to make a new sub-command for this functionality, as the BuiltPathsCommand doesn't seem like the right choice. It completely removes paths that don't exist locally from the input, which is sorta counterproductive to what we want here.

Also have some async refactor work here that I'd like to include, but that might be better off as a separate PR.

edit So I think I'd like to do something like this in a new subcommand: https://github.com/divnix/nix-uncached/pull/1

Running all queries asynchronously is faster than waiting to query subsequent caches based on results from previous caches in my benchmarks so far. In addition, returning a json of uncached output dependencies seems like the right move so that they can be easily passed to a build command.

I've also opted to filter out derivations with preferLocalBuild since these will likely never be pulled from a cache anyway. It can save hundreds of queries in some cases (like a NixOS system closure).

nrdxp avatar Jan 23 '23 08:01 nrdxp

That's awesome work @nrdxp

domenkozar avatar Jan 27 '23 08:01 domenkozar

@nrdxp please add a release note.

fricklerhandwerk avatar Feb 07 '23 22:02 fricklerhandwerk

Oops… misclick.

tomberek avatar Feb 11 '23 18:02 tomberek