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
Add nix-channels (preliminary) #49
Conversation
Script dependency: Python 3 with requests and pyquery, Nix version |
One thing I remembered: I have not contacted upstream about this! Please take care. |
File size data from https://groups.google.com/forum/#!msg/tuna-general/C1ljVn2xT78/XHHuFpgOCQAJ 一些实验数据下面是这几天对
|
# xargs can splits up the argument lists and invokes nix copy multiple | ||
# times to avoid E2BIG (Argument list too long) | ||
nix_process = subprocess.Popen( | ||
[ 'xargs', 'nix', 'copy', |
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.
What nix copy
does? Can we avoid some external commands. Otherwise you need to install it on the mirror server, or in the base docker image.
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 copy
is necessary for operate on a Nix store. I think docker image is a good approach.
NixOS provide a way to generate docker image via a nix expression, so a we can create a nix package for the sync script and create the docker image easily based on this package.
And install Nix on other Linux distro is not hard, so I think we can also create a docker image based on Alpine(need to try) if docker image generated by nix is too large.
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 copy
in this context is essentially the official way to mirror. (Its more general use is copying store paths from one store to another, and in this case we are copying all paths in a channel from upstream to a local binary cache.) If we implement this ourselves it will need to find dependencies recursively by parsing the metadata and skip already existing paths, so there's quite a bit of logic to duplicate.
I believe (but have not tried) that installing Nix in an existing docker image is as easy as copying Nix itself in (Nix and deps from /nix/store
). Nix wouldn't be a functioning package manager, but nix copy
should work.
Details of this script at: https://gist.github.com/dramforever/d2ff99318c70f44149db6070a87da5a0. |
Having written this:
I have been asked (in personal communication) to move forward with Nix mirroring. So I've decided to slightly polish the script I originally had using a suggestion from @oxalica, and posting it here. Following the final exams I might post details on how I want this to work (or you can infer some from the script).
Some TODOs I can think of: