Quickly add a non-leaf path to the nix store #555
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#555
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
I am the developer of nix-inst. one of the primary goals of the project is performance, however, there is a major bottleneck:
the only way to create a store object that contains references to other store objects is to build a derivation.
simply using
nix-store --add
with a directory containing symlinks to the nix store will not work correctly with garbage collection.Describe the solution you'd like
A
nix-store
flag that makes--add
recurse into the directory and look for symlinks to store pathsDescribe alternatives you've considered
change the default behavior of
nix-store
, add a new subcommand, or gate this feature behind the new cli.Additional context
this would allow me to nearly double the performance of nix-inst on lix systems.
you are looking for
nix-store --import
. you will have to create the format it expects manually because we have no writers for it, and considering that the thing we think you are asking for (scanning any directory for references and adding those as dependencies) is fundamentally unsound that's about as good as it gets.how so? do you just mean in terms of garbage collection, or...?
without a bound on which references to scan for the scan result depends on the current state of the store, which is entirely against the stated goal of making store objects reproducible.
do you think i mean just any file containing a store path? i'm specifically referring to absolute symlinks to /nix/store.
just scan all symlinks (without following symlinks!), and error if any of them point to a non-existent store path.
if an "upper bound" is needed, i can provide that, i mean, i can provide a full list of references too, even.
nix-store --import
requires building an intermediate NAR archive, which is an undesirable amount of I/O.that changes absolutely nothing about the soundness issue. no restriction on the path set makes the entire thing not reproducible, which is not something we should add as a feature.
great! format that as a dump archive and pipe it into
nix-store --import
. that archive doesn't need to hit the disk, and whether you do the reading and scanning or lix does is immaterial.ok, anywhere i can actually find a description of the format used by
nix-store --import
? i tried reading the relevant code but C++ code is really hard to grep through due to lack of a fn keyword.unfortunately we do not have good documentation on the formats for neither NARs nor the dump archive format of
nix-store --import
. at this point your best bet is to readarchive.cc
and (i'm guessing)import-export.cc
for the relevant functions.if this information isn't arriving too late to be useful to you, we have an implementation of a writer for that format as evil_nar.py or a similarly named Python file in the lix repo, along with a NAR implementation.
but yes, i think this should be wontfix because we can generate the desired thing very precisely today using an implementation of the import format. reference scanning assumes that we already know the subset of store paths that might appear and thus the idea as proposed cannot be implemented.