-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add nix nario
command to replace nix-store --export/--import
#13969
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed or replaced by a better comment what needs to be fixed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is great, but what does "
nario
" mean?
Just like
cpio
was derived from "copy in and out" (according to Wikipedia), one could imaginenario
being "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.
|
@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. |
Motivation
The new CLI still lacks equivalents for
nix-store --export
andnix-store --import
. This adds a subcommandnix nario
with the following operations:nix nario export
: Replacesnix-store --export
. It requires a--format
flag to specify the desirednario
version. Currently only1
is 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 suggestednario
analogously 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.