Conversation
This replaces `nix-store --export` and `nix-store --import`.
| static const uint32_t exportMagicV1 = 0x4558494e; | ||
|
|
||
| void exportPaths(Store & store, const StorePathSet & paths, Sink & sink) | ||
| void exportPaths(Store & store, const StorePathSet & paths, Sink & sink, unsigned int version) |
There was a problem hiding this comment.
Could version be an enum instead? That would be slightly more self-documenting.
|
That is great, but what does " |
|
Just like |
| * Export the closure of building `nixpkgs#hello`: | ||
|
|
||
| ```console | ||
| # nix nario export --format 1 -r nixpkgs#hello > dump |
There was a problem hiding this comment.
Maybe useful?
| # nix nario export --format 1 -r nixpkgs#hello > dump | |
| # nix nario export --format 1 -r nixpkgs#hello > dump | |
| # nix nario export --format 1 -r nixpkgs#hello | zstd > dump.zst |
| It can be imported in another store: | ||
|
|
||
| ```console | ||
| # nix nario import < dump |
There was a problem hiding this comment.
| # nix nario import < dump | |
| # nix nario import < dump | |
| # zstd -d < dump | nix nario import |
|
|
||
| ref<Store> openStore() const override | ||
| { | ||
| abort(); |
There was a problem hiding this comment.
| abort(); | |
| throw Error('ListingStore cannot be opened'); |
| void run(ref<Store> store) override | ||
| { | ||
| FdSource source(getStandardInput()); | ||
| importPaths(*store, source, NoCheckSigs); // FIXME |
There was a problem hiding this comment.
Should be addressed or replaced by a better comment what needs to be fixed here.
There was a problem hiding this comment.
That is great, but what does "
nario" mean?
Just like
cpiowas derived from "copy in and out" (according to Wikipedia), one could imaginenariobeing "NAR in and out".
For cpio that works out, because it encodes all the things a cp command would copy.
In our case, that does not apply. A NAR only encodes a file system object; not a store object, so the name is misleading. It suggests that the command is only sufficient for nix nar operations, but it unlike those commands, it must interact with a store.
It's a different sce-nario. (Sorry, couldn't help it, but it wasn't enough to get rid of "it's a-me, nario")
Please consider assigning a more accurate name.
Ok, I'll admit defeat. I will embrace the Nario name.
|
|
@Mic92 I considered "nix-closure" or something like that, but the problem is that it's not necessarily a closure (namely if you don't pass |
|
The command could be
For the format, if it's not a closure, it's still a set, so a store path set. |
|
Please document the file format in the manual. |
|
You can now document binary formats in a formal/machine readable way! |
|
Would I expect to be able to take a devShell from one machine to another like this? Copy the flake source code and the And I'd have a shell? If so, it's worth adding Lines 656 to 664 in 091c0a9 |
|
@a-h Yes, something like that should work. Though you probably want to use |
| outPath=$(nix-build dependencies.nix --no-out-link) | ||
|
|
||
| nix-store --export $outPath > $TEST_ROOT/exp | ||
| nix nario export --format 1 "$outPath" > $TEST_ROOT/exp2 |
There was a problem hiding this comment.
Here and below, $TEST_ROOT is inconsistently quoted. See 230da1c .
| } | ||
| }; | ||
|
|
||
| struct ListingStore : Store |
Motivation
The new CLI still lacks equivalents for
nix-store --exportandnix-store --import. This adds a subcommandnix nariowith the following operations:nix nario export: Replacesnix-store --export. It requires a--formatflag to specify the desirednarioversion. Currently only1is supported. I have another PR incoming (DeterminateSystems@555b2a5) that introduces a new version that adds missing metadata (like signatures) and can be unpacked in constant memory.nix nario import: Replacesnix-store --import.nix nario list: Had no equivalent in the old CLI. It shows the contents of a nario file.In the old CLI, we lacked a name for the file format used by
nix-store --export/--import. @cole-h suggestednarioanalogously tocpio, since it's a concatenation of NARs with some metadata.Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.