TL;DR: nixos.org๋ ๋จ์ผ ์คํจ ์ง์ ์ ๋๋ค.
์ด์ nix๋ฅผ ์ฌ์ฉํ๊ธฐ ์์ํ์ฌ ๋ด ์์ ์ ํจํค์ง๋ฅผ ์์ฑํ๋ ค๊ณ ํ์ต๋๋ค(Mac OSX์์).
nixpkgs๋ฅผ ๋ณต์ ํ๊ณ ํดํน์ ์์ํ์ต๋๋ค.
โญ nix-build --version
nix-build (Nix) 1.3
์ค๋ ์์นจ nixos.org๊ฐ ๋ค์ด๋์์ต๋๋ค. ๊ด์ฐฎ์ต๋๋ค. ์๋ง์กด๋ ๊ฐ๋์ฉ ์คํ๋ผ์ธ ์ํ๊ฐ ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ๋๋ nixos.org๋ฅผ ๋ฌด์ํ๋๋ก nix-build๋ฅผ ์ป์ ์ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ํ์ ๋ง์น:
time sudo nix-build pkgs/top-level/all-packages.nix -A jzmq --fallback -vvv -K
๋ฌธ์ ๊ทธ๋๋ก ๊ธฐ๋ค๋ฆฐ ํ:
2,91s user 0,75s system 0% cpu 25:19,63 total
๋ค์ ์ค๋ฅ์ ํจ๊ป ๋น๋๊ฐ ๊ณ์๋์ง ์์ต๋๋ค.
*** Downloading โhttp://nixos.org/binary-cache/nar/0xl2pl3raiig8zc9d6nq374ixc3cacyf4nsf9l1vcdanbxy5j3qr.nar.bz2โ to โ/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82โ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:02:31 --:--:-- 0curl: (7) couldn't connect to host
bzip2: Compressed file ends unexpectedly;
perhaps it is corrupted? *Possible* reason follows.
bzip2: Inappropriate ioctl for device
Input file = (stdin), output file = (stdout)
It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
error: unexpected end-of-file
download of `http://nixos.org/binary-cache/nar/0xl2pl3raiig8zc9d6nq374ixc3cacyf4nsf9l1vcdanbxy5j3qr.nar.bz2' failed: No such file or directory
could not download โ/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82โ from any binary cache
--fallback _not_ ์ ์์ ์ ๋ฐ์ด๋๋ฆฌ ์บ์๊ฐ ํ์ํ์ง ์์ต๋๊น?
๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ ๋ง์ด ์ถ๋ ฅ๋ฉ๋๋ค.
| | substitution of `/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82': got EOF
| | substitution of `/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82': woken up
| | substitution of `/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82': substitute finished
| | substitution of `/nix/store/3i1yircxji7aa9n9i4zrlrv5lvsh9a9l-zeromq-2.1.10': woken up
| | substitution of `/nix/store/jn33ykljd38iap3sk5xhyvbfh0alczxm-pkg-config-0.23': woken up
| | substitution of `/nix/store/1xbw8dkqy3schdq3pxx1fgbkh7vhfz4x-openjdk6-b16-24_apr_2009-r1': woken up
| | substitution of `/nix/store/673bzl40yrkaxsl00yg3dgld94md29z5-diffutils-3.2': woken up
| | substitution of `/nix/store/ad9hfdv0780w4cmb176ahpskyr3xyxnc-ed-1.5': woken up
| | substitution of `/nix/store/h20nwkpjdh17713swin8nkgh0087ywaf-gawk-4.0.0': woken up
| | substitution of `/nix/store/jgzcrf62crlzqj5n3rwyw1wxafnq0ps8-gzip-1.4': woken up
| | substitution of `/nix/store/q4fwa9yi7k2hygg17yl7nn5spdvmrlsz-findutils-4.4.2': woken up
| | substitution of `/nix/store/yq5barc33nbn7jp98qcc8ls6ziym9ljl-gnused-4.2.1': woken up
| | substitution of `/nix/store/jgwvnghydgimvjpfbly6q7h8anq5zfj7-pcre-8.21': woken up
| | substitution of `/nix/store/v47z8y0igawvy6vf3m2npw2ykj250yvj-libiconv-1.13.1': woken up
| | substitution of `/nix/store/8rqgqrn1a1zskmnyfgpwdlgv9n2iwpgh-expat-2.1.0': woken up
| | substitution of `/nix/store/yhjy4fy1w0bwlqn528pffxfyfhrq1dgg-python-2.7.3': woken up
| | substitution of `/nix/store/maf2xvaf7xq4krn4w54r42cppz8zg79l-libiconv-1.13.1': woken up
| building of `/nix/store/wb8dn0x2kyslmxgjypw7bjd389hnpixg-jzmq-2.1.0.drv': goal destroyed
| building of `/nix/store/lmkvbjyrxpis61sl3kfhwiccy6ai1kcb-git-export.drv': goal destroyed
| building of `/nix/store/fz5wi1gmshai7m3sdxv0594gk12z6k1b-git-1.8.1.drv': goal destroyed
| substitution of `/nix/store/k7r91gak4q4yirmnx6bimfva3imw309g-git-1.8.1': goal destroyed
| substitution of `/nix/store/yhjy4fy1w0bwlqn528pffxfyfhrq1dgg-python-2.7.3': goal destroyed
| substitution of `/nix/store/nhfh2qfh14gviv93my60nd1kpyn1cpgn-gettext-0.18.1.1': goal destroyed
| substitution of `/nix/store/maf2xvaf7xq4krn4w54r42cppz8zg79l-libiconv-1.13.1': goal destroyed
| substitution of `/nix/store/8rqgqrn1a1zskmnyfgpwdlgv9n2iwpgh-expat-2.1.0': goal destroyed
| building of `/nix/store/3xxi6mdmzlm1n1zmcw4i717mrd4vwfh6-cacert-20120628.drv': goal destroyed
| building of `/nix/store/5armkqw9dvx2vnhx7f2nh0d7sfl07pn5-cacert-20120628.pem.bz2.drv': goal destroyed
| building of `/nix/store/rm3cqk01n4ivgmhiv44xbhm0q2ibxbha-mirrors-list.drv': goal destroyed
| building of `/nix/store/cbbhkdjb526nyf709gr65hqjs5mmk82h-openjdk6-b16-24_apr_2009-r1.drv': goal destroyed
| substitution of `/nix/store/1xbw8dkqy3schdq3pxx1fgbkh7vhfz4x-openjdk6-b16-24_apr_2009-r1': goal destroyed
| building of `/nix/store/3c24kg1jsi1ck5wll20gqx1hgcywvic7-pkg-config-0.23.drv': goal destroyed
| substitution of `/nix/store/jn33ykljd38iap3sk5xhyvbfh0alczxm-pkg-config-0.23': goal destroyed
| building of `/nix/store/c3q9vhg9cm054cs7n75ka64w4m8zar6y-zeromq-2.1.10.drv': goal destroyed
| substitution of `/nix/store/3i1yircxji7aa9n9i4zrlrv5lvsh9a9l-zeromq-2.1.10': goal destroyed
| building of `/nix/store/clwd5v42l8m65iqvqjbxrckfi17q4am2-stdenv.drv': goal destroyed
| substitution of `/nix/store/zyilsch6gvrfxfmr8j37bjgvh21n65yf-stdenv': goal destroyed
| substitution of `/nix/store/yq5barc33nbn7jp98qcc8ls6ziym9ljl-gnused-4.2.1': goal destroyed
| substitution of `/nix/store/xczvmbi8rxchb1wz01ii2iwphimgdxfv-gnugrep-2.10': goal destroyed
| substitution of `/nix/store/v47z8y0igawvy6vf3m2npw2ykj250yvj-libiconv-1.13.1': goal destroyed
| substitution of `/nix/store/jgwvnghydgimvjpfbly6q7h8anq5zfj7-pcre-8.21': goal destroyed
| substitution of `/nix/store/q4fwa9yi7k2hygg17yl7nn5spdvmrlsz-findutils-4.4.2': goal destroyed
| substitution of `/nix/store/kqbdpd16yjpangakz575wcsfrgbljcbb-patch-2.6.1': goal destroyed
| substitution of `/nix/store/ad9hfdv0780w4cmb176ahpskyr3xyxnc-ed-1.5': goal destroyed
| substitution of `/nix/store/jgzcrf62crlzqj5n3rwyw1wxafnq0ps8-gzip-1.4': goal destroyed
| substitution of `/nix/store/h20nwkpjdh17713swin8nkgh0087ywaf-gawk-4.0.0': goal destroyed
| lock released on `/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82.lock'
| substitution of `/nix/store/d83wfy078cq9x6ljr1x7ba6cp287xsg9-gnumake-3.82': goal destroyed
| substitution of `/nix/store/673bzl40yrkaxsl00yg3dgld94md29z5-diffutils-3.2': goal destroyed
error: unexpected EOF reading a line
๊ทธ๋ฐ ๋ค์ ํธ์ง์ ์๋ํ์ต๋๋ค.
sudo nano /nix/store/4czrvlsn3a8ava9p3axl7wzy3j1l8746-nix-1.3/libexec/nix/substituters/download-from-binary-cache.pl
processRequests
์ while ๋ฃจํ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ์ต๋๋ค.
while (0 && $activeRequests) {
์คํฌ๋ฆฝํธ๊ฐ ์ฆ์ ์ข ๋ฃ๋๋๋ก ํฉ๋๋ค.
์ด ๋ณ๊ฒฝ์ผ๋ก
time sudo nix-build pkgs/top-level/all-packages.nix -A jzmq --fallback -vvv -K
ํจ์ฌ ๋น ๋ฅด๊ฒ ์๋ฃ๋์์ง๋ง ๋ฐ์ด๋๋ฆฌ ์บ์์์ gnumake
๋ฅผ ๋ค์ ๋ค์ด๋ก๋ํ๋ ค๊ณ ์๋ํ๊ณ 2๋ถ 32์ด ํ์ ํฌ๊ธฐํ์ต๋๋ค.
--fallback์ ๋ค์ ๋ฌด์์ ํฉ๋๊น?
๊ทธ๋ผ ๋ ํด๋ดค์ด (์ฌ๊ธฐ์ ํ์ฌ์ ์ผ๋ก)
time sudo nix-build pkgs/top-level/all-packages.nix --option binary-caches '' --fallback -vvv -K -A jzmq
์ด๋ค ์ด์ ๋ก ๋ฐ์ด๋๋ฆฌ ์บ์ ์ต์
์ ๋ณ๊ฒฝํ ๋ nix-build๋ curl๊ณผ ๊ฐ์ ํจ์ฌ ๋ ๋ง์ ํจํค์ง๋ฅผ ๋น๋ํ๋ ค๊ณ ํฉ๋๋ค. /nix/store/
์ ์ด๋ฏธ ์กด์ฌํ๋ ๋ชจ๋ ์ข
์์ฑ์ ๋ฌด์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค ?!
๋น๋๊ฐ ๋งค์ฐ ๋๋ฆฌ๊ฒ ์งํ๋๊ณ ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ์ธ์๋ฉ๋๋ค.
error checking the existence of http://nixos.org/tarballs/sha256/b7f510db60f520ba0bc8a39cccee7e913362205b4a7709e16af2cba14093099b:
curl: (7) couldn't connect to host
์ด ๋ฌธ์ ๊ฐ ๋นจ๋ฆฌ ํด๊ฒฐ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ํ๋ก๋์
ํ๊ฒฝ์์ disnix๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ง ์๊ณ nixos.org๊ฐ ๋ค์ด๋์์ ๋ ์๋ฒ๋ฅผ ๊ณ ์น ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค! ๊ทธ๊ฒ์ ์ฌ๊ฐํ ๋จ์ผ ์คํจ ์ง์ ์
๋๋ค!
--fallback์ด ์ ๋๋ก ์๋ํ๋๋ผ๋ HTTP ์ฐ๊ฒฐ ์๊ฐ ์ด๊ณผ๊ฐ ๋๋ฌด ๋์ต๋๋ค.
์ด์ $NIX_CONNECT_TIMEOUT ๋๋ --option connect-timeout N
๋ฅผ ํตํด ์ฐ๊ฒฐ ์๊ฐ ์ด๊ณผ๋ฅผ ์ค์ ํ ์ ์์ต๋๋ค. --option use-binary-caches false
๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ด๋๋ฆฌ ์บ์ ์ฌ์ฉ์ ๋นํ์ฑํํ๋ ๊ฒ์ด ์ด๋ฏธ ๊ฐ๋ฅํ์ต๋๋ค.
--fallback ์ผ๋ก ๋ฌธ์ ๋ฅผ ์ฌํํ ์๋ ์์ง๋ง,
๋ด ์์คํ
์ ์ ํํ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. cache.nixos.org๊ฐ ๋ค์ด๋์๊ณ ๋ชจ๋ ์ต์
( -option use-binary-caches false
, --option connect-timeout N
, --fallback
)์ ์๋ํ์ง๋ง ํญ์ ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. :
error: unable to download โhttps://cache.nixos.org/ffkdlmsag787xjdc55v4yi4vbbc0irrc.narinfoโ: Couldn't connect to server (7)
์ต์ ์ ๊ณ ๋ คํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ช ๊ฐ์ง ์ธ๋ถ์ ๋ณด:
ํ์์ ์ํด: --option build-use-substitutes false
์ด์ด์ผ ํฉ๋๋ค.
use-binary-caches
์ต์
์ด ์ฌ๋ผ์ง ๊ฒ ๊ฐ๊ณ connect-timetout
์ต์
์ ์ถ๊ฐํ๋ฉด ์ด๋ฆ ํ์ธ ์ค๋ฅ์ ๋ํ ์ฌ์๋ ๋๋ฌธ์ ์์ํ๊ธฐ ์ ์ ๋น๋๊ฐ ์ฌ์ ํ ๋ง์ด ๊ธฐ๋ค๋ฆฌ๊ฒ ๋ฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํ์์ ์ํด:
--option build-use-substitutes false
์ด์ด์ผ ํฉ๋๋ค.use-binary-caches
์ต์ ์ด ์ฌ๋ผ์ง ๊ฒ ๊ฐ๊ณconnect-timetout
์ต์ ์ ์ถ๊ฐํ๋ฉด ์ด๋ฆ ํ์ธ ์ค๋ฅ์ ๋ํ ์ฌ์๋ ๋๋ฌธ์ ์์ํ๊ธฐ ์ ์ ๋น๋๊ฐ ์ฌ์ ํ ๋ง์ด ๊ธฐ๋ค๋ฆฌ๊ฒ ๋ฉ๋๋ค.