Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8b2dbf272 | ||
|
|
437614b479 | ||
|
|
649c2db308 | ||
|
|
27d34ef770 | ||
|
|
259ff74bde | ||
|
|
e917332d63 | ||
|
|
da310fac62 | ||
|
|
4c3c638a05 | ||
|
|
0884f180f5 | ||
|
|
e0c19ee620 | ||
|
|
91ddee6bf0 | ||
|
|
14a3a62bfc | ||
|
|
1ad71bc62c | ||
|
|
b0e9b07e80 | ||
|
|
ff394ff206 | ||
|
|
80f4b7b6f8 | ||
|
|
672985531c | ||
|
|
85c1932c94 | ||
|
|
2f8ee4578f | ||
|
|
74a1bfdcab | ||
|
|
272c4ba36d | ||
|
|
02c5914ea4 | ||
|
|
fd4911269f | ||
|
|
6f3244ce45 | ||
|
|
909b4a8820 | ||
|
|
f132d82a79 | ||
|
|
e2fc575c61 | ||
|
|
a721a0b114 | ||
|
|
e9f10beed1 | ||
|
|
3ebfbecdd1 | ||
|
|
4769eea5e2 | ||
|
|
f16e24f95e | ||
|
|
2aeb874e83 | ||
|
|
c089c52d5f | ||
|
|
2852a486f8 | ||
|
|
d6b4047c2f | ||
|
|
5eebc4ad1d | ||
|
|
941f95284a | ||
|
|
404a94ab69 | ||
|
|
93874cc18a | ||
|
|
2a434fc62b | ||
|
|
30616d8e86 | ||
|
|
536512d273 | ||
|
|
533343628d | ||
|
|
0038bbafde | ||
|
|
f459ca547f | ||
|
|
625868b33d | ||
|
|
a15f918cba | ||
|
|
0135fd6ec4 | ||
|
|
efe6c186ea | ||
|
|
2fcfc6c2c6 | ||
|
|
df8e9d691c | ||
|
|
5d8504b978 | ||
|
|
d1229859c2 | ||
|
|
2e5be2a749 | ||
|
|
7afcb5af98 | ||
|
|
aeb406dd1b | ||
|
|
9570036146 | ||
|
|
9c4e05766b | ||
|
|
ca93b26db6 | ||
|
|
70bcd6a55c | ||
|
|
5a34a473dd | ||
|
|
5ada0831cf | ||
|
|
06849c3090 | ||
|
|
6d40fe573c | ||
|
|
52a3ca823d | ||
|
|
6a8cba83bb | ||
|
|
ee754f0f41 | ||
|
|
6521c92ce8 | ||
|
|
829dcb35d5 | ||
|
|
c05e20daa1 | ||
|
|
9e95b95a5d | ||
|
|
a3bc695e7d | ||
|
|
b51dff431c | ||
|
|
b4e23dcd9e | ||
|
|
f59404e1a6 | ||
|
|
0469795978 | ||
|
|
ef4d3fc111 | ||
|
|
c9d0cf7e02 | ||
|
|
7114f088fc | ||
|
|
16e3bf4537 | ||
|
|
2ea4d45449 | ||
|
|
4a2a45f53d | ||
|
|
c7af247bea | ||
|
|
c0d940978a | ||
|
|
8c75621da6 | ||
|
|
b69323f8c9 | ||
|
|
42a12f9232 | ||
|
|
539a9c1c5f | ||
|
|
0725ab2fd7 | ||
|
|
3738bcb05e | ||
|
|
25ed842725 | ||
|
|
69cb9f7eee | ||
|
|
aaa109565e | ||
|
|
bdb3226607 | ||
|
|
aa34c0ef51 | ||
|
|
9ea4f93f88 | ||
|
|
a6c4fd044c | ||
|
|
12b7eefbc5 | ||
|
|
7a9687ba30 | ||
|
|
3b489e8843 | ||
|
|
29043e7e9e | ||
|
|
12814806ef | ||
|
|
c277231b7d | ||
|
|
f89349f07e | ||
|
|
0858738355 | ||
|
|
efaffaa9d1 | ||
|
|
67a5941472 | ||
|
|
fcd048a526 | ||
|
|
96262e744e | ||
|
|
9f46f54de4 | ||
|
|
10e17eaa58 | ||
|
|
b3e5eea4a9 | ||
|
|
1290411c2d | ||
|
|
8f41847394 | ||
|
|
696c026006 | ||
|
|
b865b5b40c | ||
|
|
057e5b6b2e | ||
|
|
adf03b0b8e | ||
|
|
2f9789c2e6 | ||
|
|
a118293bd0 | ||
|
|
895516cadf | ||
|
|
3729df34da | ||
|
|
c0c2cb871d | ||
|
|
d2c371927e | ||
|
|
512753f824 | ||
|
|
4d9db420ff | ||
|
|
ea2148f47c | ||
|
|
fc144242d5 | ||
|
|
fc14213d2d | ||
|
|
e8bd1bc732 | ||
|
|
8132d0a12e | ||
|
|
3abf6d03c6 | ||
|
|
e5ea01c1a8 | ||
|
|
db25a6d7bb | ||
|
|
16a4864759 | ||
|
|
f46cb682f1 | ||
|
|
04bedda0b6 | ||
|
|
3aaceeb7e2 | ||
|
|
d103c79144 | ||
|
|
30d4618cc9 | ||
|
|
a364b1551a | ||
|
|
a693a9fa4b | ||
|
|
74f94d6640 | ||
|
|
7867685dcd | ||
|
|
f5095594e7 | ||
|
|
c330109bfa | ||
|
|
7848372b0f | ||
|
|
a0c5931208 | ||
|
|
c4c1ae0a00 | ||
|
|
213d124277 | ||
|
|
cd391206e6 | ||
|
|
2df2741ec6 | ||
|
|
142ed7fe45 | ||
|
|
e5cc53beec | ||
|
|
741e9012d3 | ||
|
|
65ef57e0cb | ||
|
|
5449ff7d8a | ||
|
|
805ffe1bc9 | ||
|
|
8c2bf15c4f | ||
|
|
bf81b31559 | ||
|
|
555baa8fb0 | ||
|
|
54f91923c8 | ||
|
|
96f3c36709 | ||
|
|
47ed067d45 | ||
|
|
9ed097db7b | ||
|
|
1ab8d6ac18 | ||
|
|
00c507cc52 | ||
|
|
20c0984a46 | ||
|
|
03a4a3c95c | ||
|
|
54955867a6 | ||
|
|
9d04b5da17 | ||
|
|
55cefd41d6 | ||
|
|
f32a9b354d | ||
|
|
cd39709003 | ||
|
|
26aeeb7653 | ||
|
|
a6dfa3cb85 | ||
|
|
f58a9b0e62 | ||
|
|
670feb000a | ||
|
|
462421d345 | ||
|
|
55c96b64e4 | ||
|
|
ec449c8450 | ||
|
|
2248cc6716 | ||
|
|
85f14c4582 | ||
|
|
216263c36f | ||
|
|
68b43e01dd | ||
|
|
ce3173edc1 | ||
|
|
2f494531b7 | ||
|
|
ebb20a5356 | ||
|
|
c976cb0b8a | ||
|
|
1221ae3dd0 | ||
|
|
9a8b3e9747 | ||
|
|
3473b1950a | ||
|
|
9bb528d392 | ||
|
|
5e7ccdc9e3 | ||
|
|
63fa92605b | ||
|
|
e35d83d1fc | ||
|
|
bf70a047a0 | ||
|
|
7b7801d3f0 | ||
|
|
6e7f252ea6 | ||
|
|
9c78f7f196 | ||
|
|
47c568ee32 | ||
|
|
c6b3fcddb0 | ||
|
|
1c329ca433 | ||
|
|
b85ba3e30d | ||
|
|
bb39f2bb8a | ||
|
|
485a87f22f | ||
|
|
a6ff66b658 | ||
|
|
78ad5b3d91 | ||
|
|
e1fc9f6690 | ||
|
|
ab47868639 | ||
|
|
6d6467d376 | ||
|
|
4fc4eb6c93 | ||
|
|
6cf91d6fbd | ||
|
|
12f9379123 | ||
|
|
00e1400eb7 | ||
|
|
021634e3e3 | ||
|
|
ed13457dbf | ||
|
|
c34e96f7e0 | ||
|
|
e697884f65 | ||
|
|
dd7b8183a5 | ||
|
|
8713aeac5e | ||
|
|
74024515a3 | ||
|
|
bd10a07d17 | ||
|
|
77ffaea4fa | ||
|
|
a72b6b2ec8 | ||
|
|
36c34c3b1f | ||
|
|
4fdec5f61d | ||
|
|
03b56e96bf | ||
|
|
5b3aefff85 | ||
|
|
9e7b89bf10 | ||
|
|
09652f597c | ||
|
|
a7540294cf | ||
|
|
d4d456c6b1 | ||
|
|
3166b97174 | ||
|
|
12556e5709 | ||
|
|
e1a94ad852 | ||
|
|
28d073e810 | ||
|
|
35c7bab09a | ||
|
|
367577d9a6 | ||
|
|
d15d91cad1 | ||
|
|
e322a16523 | ||
|
|
3e7aab81ce | ||
|
|
2c692a3b14 | ||
|
|
e0a0ae0467 | ||
|
|
4ba4c7ff66 | ||
|
|
2287cc6486 | ||
|
|
40c023ecfe | ||
|
|
f686efeed4 | ||
|
|
cc522d0d23 | ||
|
|
b306b7039e | ||
|
|
be84049baf | ||
|
|
369fffd6f1 | ||
|
|
6864ad7cf5 | ||
|
|
587e259bfd | ||
|
|
002a3a95dc | ||
|
|
cc4fe977e5 | ||
|
|
6c00a9545f | ||
|
|
435366ed3c | ||
|
|
c846abb5cc | ||
|
|
c8d33de777 | ||
|
|
ea861be292 | ||
|
|
c2a24c2b88 | ||
|
|
f58604ac32 | ||
|
|
4989c04dd2 | ||
|
|
2fccef0c59 | ||
|
|
2287e2f279 | ||
|
|
5f75d56c9b | ||
|
|
bf0b7e5423 | ||
|
|
015f8f1c13 | ||
|
|
759f39800b | ||
|
|
00eb3fcb7a | ||
|
|
a3ef00be6c | ||
|
|
3fa1e7dace | ||
|
|
d44c9c5581 | ||
|
|
3582dc3c88 | ||
|
|
eb1911e277 | ||
|
|
7313aa267b | ||
|
|
fc310eda3a | ||
|
|
657c08c852 | ||
|
|
0166e7ab6d | ||
|
|
4171ab4bbd | ||
|
|
0a10854f85 | ||
|
|
c85097da7c | ||
|
|
6b824c78f1 | ||
|
|
777e21e596 | ||
|
|
7a8de57d3e | ||
|
|
4260a22a55 | ||
|
|
f9611c7ae4 | ||
|
|
76e7d958ed | ||
|
|
231a8aa2c2 | ||
|
|
c1ca4f0acc | ||
|
|
1eb952d27a | ||
|
|
edc34cc1a2 | ||
|
|
5a7e7fc35f | ||
|
|
c34a20e1f6 | ||
|
|
ddc6aaa8b2 | ||
|
|
e40e01c1dd | ||
|
|
aadd59d005 | ||
|
|
7abe3bde8a | ||
|
|
160edd3f5d | ||
|
|
5885e20404 | ||
|
|
26851dd2c2 | ||
|
|
f694f43d7d | ||
|
|
7bc1961e1f | ||
|
|
9450dece24 | ||
|
|
2e9bc1245c | ||
|
|
f6c122aaeb | ||
|
|
7f2df903d9 | ||
|
|
afb78ebd34 | ||
|
|
4e67f89f38 | ||
|
|
bc5d4843a9 | ||
|
|
1537e270fb | ||
|
|
1e6e673eb7 | ||
|
|
4ef43198f3 | ||
|
|
c5a488afc0 | ||
|
|
ef74fafc03 | ||
|
|
b244e65cdb | ||
|
|
8aa354fdfd | ||
|
|
1c127e6a82 | ||
|
|
f6ddf48882 | ||
|
|
c5ec95e2c7 | ||
|
|
1b49479836 | ||
|
|
1e7ce1d6da | ||
|
|
38e360154d | ||
|
|
d1165d8791 | ||
|
|
2a4e4f6a6e | ||
|
|
fbcb897e21 | ||
|
|
34c7645a58 | ||
|
|
b79b81dd2d | ||
|
|
68fe0d9809 | ||
|
|
779ef8f5ef | ||
|
|
59c37112a9 | ||
|
|
7304f9f145 | ||
|
|
5392884eb1 | ||
|
|
db34445c5e | ||
|
|
3e1abf4f05 | ||
|
|
a692f90c80 | ||
|
|
7c39201bcb | ||
|
|
b6d794fb8d | ||
|
|
073650db01 | ||
|
|
ea1803efdc | ||
|
|
0c2088d438 | ||
|
|
eab7d790a3 | ||
|
|
c0a3ff7d47 | ||
|
|
858ad7a4b3 | ||
|
|
90b805ef25 | ||
|
|
30962d21be | ||
|
|
9c7e90f414 | ||
|
|
cc5c81822d | ||
|
|
b816515f61 | ||
|
|
ae9119167e | ||
|
|
d048577909 | ||
|
|
3f55f8a8fb | ||
|
|
15edd2349e | ||
|
|
9080d5d924 | ||
|
|
e188fe7c6d | ||
|
|
35f6651735 | ||
|
|
9950cdec35 | ||
|
|
e02481ded2 | ||
|
|
97d1c7f932 | ||
|
|
e063c71a79 | ||
|
|
cfc38257cf | ||
|
|
8a1d8701f6 | ||
|
|
983fab7ea9 | ||
|
|
5e086ba8c3 | ||
|
|
73769b28e3 | ||
|
|
5a1514adb8 | ||
|
|
73b6d87e17 | ||
|
|
d37dc71e3c | ||
|
|
887030f211 | ||
|
|
75db069f92 | ||
|
|
401b5bc541 | ||
|
|
d700eecea9 | ||
|
|
22a754c091 | ||
|
|
f443d5ca19 | ||
|
|
2672a28bb4 | ||
|
|
7cd9859e41 | ||
|
|
4a4521f462 | ||
|
|
73c9840569 | ||
|
|
d068f9ffff | ||
|
|
890df325c7 | ||
|
|
f6fd01bd19 | ||
|
|
2e953b567e | ||
|
|
4ad5826a18 | ||
|
|
f2a03acf3f | ||
|
|
1d99c4ab25 | ||
|
|
c169ea5904 | ||
|
|
2ba67da053 | ||
|
|
2a14c28669 | ||
|
|
f3505a7899 | ||
|
|
e3e8ee0471 | ||
|
|
30c8297ded | ||
|
|
906afedd23 | ||
|
|
16e9a75287 | ||
|
|
15ed4137e2 | ||
|
|
c4d3674de6 | ||
|
|
82de90961b | ||
|
|
95468e3c1e | ||
|
|
50cf77cecd | ||
|
|
dd032f624c | ||
|
|
edee6169bf | ||
|
|
1351101c28 | ||
|
|
583d06385d | ||
|
|
f46bc0e8eb | ||
|
|
553e584f92 | ||
|
|
d8fd31f50f | ||
|
|
8f9dcfc671 | ||
|
|
5921ca89f9 | ||
|
|
b5e3c04c03 | ||
|
|
6529490cc1 | ||
|
|
8a78bcf6a2 | ||
|
|
b0336e7cf7 | ||
|
|
c6e63065f3 | ||
|
|
144bb3ef7d | ||
|
|
7072b8649a | ||
|
|
762febafe2 | ||
|
|
eb19ff3b82 | ||
|
|
4c24263967 | ||
|
|
e375da6899 | ||
|
|
46a284263f | ||
|
|
6208d24c38 | ||
|
|
3e347220c8 | ||
|
|
d78141a886 | ||
|
|
9af10b753c | ||
|
|
d8972317fc | ||
|
|
9659940659 | ||
|
|
26dacc0983 | ||
|
|
d4df99a334 | ||
|
|
442e665d6d | ||
|
|
94c9343702 | ||
|
|
1b56de8cd1 | ||
|
|
d2032edb2f | ||
|
|
0b013a54dc | ||
|
|
84a3a5c3cd | ||
|
|
d82b78bf51 | ||
|
|
379852a152 | ||
|
|
be2580be01 | ||
|
|
022287060b | ||
|
|
750c993f00 | ||
|
|
9d7fb62db6 | ||
|
|
e2213d77a2 | ||
|
|
db88cb401b | ||
|
|
8745c63d3c | ||
|
|
fa467de090 | ||
|
|
0a4e911cf4 | ||
|
|
a2628b43bb | ||
|
|
d070e1c532 | ||
|
|
44d6421160 | ||
|
|
d5334c466b | ||
|
|
f83acbbfe3 | ||
|
|
86748d3571 | ||
|
|
af35b318f3 | ||
|
|
a9ebc3ea5d | ||
|
|
90ada8e31a | ||
|
|
94a94da075 | ||
|
|
fad9faf354 | ||
|
|
7bcc9f2aaf | ||
|
|
958ec5de56 | ||
|
|
b270869466 | ||
|
|
887730aab3 | ||
|
|
b9d64f9318 | ||
|
|
8451298b35 | ||
|
|
c5319e5d0b | ||
|
|
5d70b454be | ||
|
|
9640208d00 | ||
|
|
54037f4e2d | ||
|
|
185c3c8240 | ||
|
|
8414685c0f | ||
|
|
dbefe9e6b8 | ||
|
|
e91f32f2b5 | ||
|
|
678301072f | ||
|
|
a6e2b6b360 | ||
|
|
ebfbfe9515 | ||
|
|
3c54e9ba01 | ||
|
|
b9f93e7386 | ||
|
|
b9fb372075 | ||
|
|
88b44b1e94 | ||
|
|
68e0ca608f | ||
|
|
26f895a26d | ||
|
|
f68bed7f67 | ||
|
|
7be1a07a45 | ||
|
|
48ddb8e481 | ||
|
|
e53c89a643 | ||
|
|
5bbe793abf | ||
|
|
99c8e7a48d | ||
|
|
ab41e9d543 | ||
|
|
6be04476dc | ||
|
|
1af7b94c1d | ||
|
|
c39c2503f7 | ||
|
|
5046233b5a | ||
|
|
46992e71a1 | ||
|
|
cc22cf662b | ||
|
|
2b8ca654b0 | ||
|
|
cd973fa07f | ||
|
|
2242be83c6 | ||
|
|
f8dbde0813 | ||
|
|
a413594baf | ||
|
|
b430a81a1f | ||
|
|
9a5ca802c7 | ||
|
|
d506bd587a | ||
|
|
872a22fa23 | ||
|
|
b5c9dbc84f | ||
|
|
90d55ed275 | ||
|
|
32f31a8c63 | ||
|
|
543288b649 | ||
|
|
ad6e55d777 | ||
|
|
b33b94748c | ||
|
|
9f4d8c6170 | ||
|
|
1bf9eb21b7 | ||
|
|
6fadb3fc03 | ||
|
|
aef635da78 | ||
|
|
8b09105db3 | ||
|
|
e74b221a25 | ||
|
|
5d24e18e29 | ||
|
|
8b3217f832 | ||
|
|
c3181e21e7 | ||
|
|
bfaa4db7bd | ||
|
|
d64ab5131c | ||
|
|
c86c71c2b1 | ||
|
|
835e541144 | ||
|
|
30c9ca3b05 | ||
|
|
307bcb9a8e | ||
|
|
6f046fa39e | ||
|
|
72a50756bb | ||
|
|
3895e78794 | ||
|
|
7ccfa7ca4f | ||
|
|
a350d0beb0 | ||
|
|
f1fac0b5c3 | ||
|
|
04bbfa692f | ||
|
|
52a8f9295b | ||
|
|
cb2d348d48 | ||
|
|
bc22a7ee6a | ||
|
|
e2988f48a1 | ||
|
|
62f712c8ae | ||
|
|
1dc29df1d3 | ||
|
|
66fccd5832 | ||
|
|
0486e87791 | ||
|
|
cb90e382b5 | ||
|
|
7d448bc966 | ||
|
|
b33fefcb92 | ||
|
|
0de33cc81b | ||
|
|
c65a6fa86a | ||
|
|
3ad4a332eb | ||
|
|
515c0a263e | ||
|
|
3469062e76 | ||
|
|
c502831a1d | ||
|
|
b0cadf547b | ||
|
|
43eb7b6756 | ||
|
|
aaf57c983d | ||
|
|
7dcfa8042e | ||
|
|
10414d467b | ||
|
|
d25923263e | ||
|
|
c7866733d7 | ||
|
|
c84c843e33 | ||
|
|
2550c11373 | ||
|
|
be32da0ed0 | ||
|
|
ee235e764c | ||
|
|
9f7b4d068c | ||
|
|
4511f09b49 | ||
|
|
4da1cd59ba | ||
|
|
dbb4bec003 | ||
|
|
87873d0d65 | ||
|
|
f8abbdd456 | ||
|
|
31c240ee8b | ||
|
|
ad6b738ed8 | ||
|
|
54bf5ba422 | ||
|
|
14d82baba4 | ||
|
|
410acd29c0 | ||
|
|
acb71aa5c6 | ||
|
|
2b0365753a | ||
|
|
8656a2de56 | ||
|
|
ba6d2093c7 | ||
|
|
4947e0a91a | ||
|
|
b8a38fa521 | ||
|
|
a70706b025 | ||
|
|
ac9cc2ec08 | ||
|
|
b4edc3ca61 | ||
|
|
e6bd88878e | ||
|
|
ca87707c90 | ||
|
|
5a6d6da7ae | ||
|
|
4581159e3f | ||
|
|
d89d9958a7 | ||
|
|
e8aa2290ed | ||
|
|
3e787423c2 | ||
|
|
d1b238ec3c | ||
|
|
2da4c61049 | ||
|
|
c6295a3afd | ||
|
|
38b29fb72c | ||
|
|
a045f93396 | ||
|
|
ecb3a1afa2 | ||
|
|
f800d450b7 | ||
|
|
f64b58b45e | ||
|
|
bbe97dff8b | ||
|
|
ebd89999c2 | ||
|
|
bca0afb943 | ||
|
|
9e565781c6 | ||
|
|
14aa0c3259 | ||
|
|
a6f0bef0a7 | ||
|
|
7f08975050 | ||
|
|
6317f0f7a0 | ||
|
|
cce218f950 | ||
|
|
a1ff43045b | ||
|
|
ce3c41aef0 | ||
|
|
d832a355ea | ||
|
|
dd5d76e2ed | ||
|
|
98ef11677c | ||
|
|
61cc9f34d2 | ||
|
|
f765e44123 | ||
|
|
3663a8a7e9 | ||
|
|
b232eea40a | ||
|
|
eba82b7c88 | ||
|
|
28ee687adf | ||
|
|
fe7ec70e6b | ||
|
|
1355554d12 | ||
|
|
f54c168031 | ||
|
|
232b390766 | ||
|
|
9ff5f6492f | ||
|
|
ab88f4bbd4 | ||
|
|
3b9c9d34e5 | ||
|
|
80ab95315d | ||
|
|
048ef27326 | ||
|
|
47a937d512 | ||
|
|
0678e4d56a | ||
|
|
79142cbbe1 | ||
|
|
0d118ef0c9 | ||
|
|
50d483a2c1 | ||
|
|
5e449b43ed | ||
|
|
ac67685606 | ||
|
|
f964f428fe | ||
|
|
f1b5c76c1a | ||
|
|
092af3c826 | ||
|
|
603b2f583c | ||
|
|
334b8f8af1 | ||
|
|
f4b9495854 | ||
|
|
90d2cf6ff9 | ||
|
|
1789c56f43 | ||
|
|
c3c23a52ee | ||
|
|
c1d18050b4 | ||
|
|
7923e22276 | ||
|
|
7395e091c5 | ||
|
|
e721f99817 | ||
|
|
e59e2b2951 | ||
|
|
0456a4ec65 | ||
|
|
ac2bc721d8 | ||
|
|
062012eee1 | ||
|
|
ec364582eb | ||
|
|
8737980e75 | ||
|
|
f102d793f1 | ||
|
|
39954a9586 | ||
|
|
895ed4cef0 | ||
|
|
2d6f1ddbb5 | ||
|
|
895ce1bb6c | ||
|
|
f553a8bdea | ||
|
|
949dc84894 | ||
|
|
dbc4f9d478 | ||
|
|
ca8caaec5e | ||
|
|
e6c1d1b474 | ||
|
|
88f8063917 | ||
|
|
8918bae098 | ||
|
|
f2bd847092 | ||
|
|
d33dd6e6c0 | ||
|
|
d14b1c261c | ||
|
|
b7fba16613 | ||
|
|
f738cd4d97 | ||
|
|
8110b4ebb2 | ||
|
|
343ebcc048 | ||
|
|
afb021893b | ||
|
|
d722e2175e | ||
|
|
0dbb249b36 | ||
|
|
87b7b25e13 | ||
|
|
6a9c815734 | ||
|
|
045708db43 | ||
|
|
e60f6bd4ce | ||
|
|
11da5b2816 | ||
|
|
abb8ef619b | ||
|
|
313106d549 | ||
|
|
425991883a | ||
|
|
7c8d7c17f8 | ||
|
|
0be8d7784f | ||
|
|
73efc1e8e7 | ||
|
|
ec5e7b44ff | ||
|
|
96e1c39bb7 | ||
|
|
872740cf60 | ||
|
|
c13193017f | ||
|
|
89db9353d7 | ||
|
|
1ec6e6e11e | ||
|
|
fc62caa4a5 | ||
|
|
4e70652ee3 | ||
|
|
cdadbf7708 | ||
|
|
cd55f91ad2 | ||
|
|
d12d69ea1a | ||
|
|
ec9dd9a5ae | ||
|
|
1c3ccba0f5 | ||
|
|
ba87b08f85 | ||
|
|
2c6dbcd5e7 | ||
|
|
fd8ee94ab2 | ||
|
|
8beedd4486 | ||
|
|
9b8cb6809b | ||
|
|
3e2c77d001 | ||
|
|
b8bddb63e6 | ||
|
|
fd900c45b5 | ||
|
|
0352c1a4f8 | ||
|
|
8d2eb1ff56 | ||
|
|
804910fb0e | ||
|
|
5ee23c35b9 | ||
|
|
8669db1dcc | ||
|
|
07294e988c | ||
|
|
4c34054673 | ||
|
|
96e6e680c1 | ||
|
|
1f174226d1 | ||
|
|
2ba9f22715 | ||
|
|
6c041e8413 | ||
|
|
d1db7fa952 | ||
|
|
a08f353922 | ||
|
|
2c1e05ae93 | ||
|
|
0d6774468c | ||
|
|
0bc0d35b6b | ||
|
|
6419f5028b | ||
|
|
75c897cf3d | ||
|
|
693e8b1286 | ||
|
|
d2438f86d5 | ||
|
|
48f0a76372 | ||
|
|
4145cd2da0 | ||
|
|
0ba8a4e942 | ||
|
|
e5bf81256c | ||
|
|
6d2605500f | ||
|
|
f730841db4 | ||
|
|
99af822004 | ||
|
|
04bf9acd22 | ||
|
|
f5b7991e59 | ||
|
|
5ff4d77f55 | ||
|
|
52ffe2797a | ||
|
|
39a2e166dd | ||
|
|
850f73045f | ||
|
|
f01304b573 | ||
|
|
e491efe9fb | ||
|
|
d5f1cc3e94 | ||
|
|
88c452d160 | ||
|
|
35732a95bc | ||
|
|
7614a127a0 | ||
|
|
69326f3637 | ||
|
|
c119ab9db0 | ||
|
|
2af9561316 | ||
|
|
c921074c19 | ||
|
|
c4d7c76b64 | ||
|
|
b874272f7a | ||
|
|
d823381c0a | ||
|
|
b4e260d887 | ||
|
|
81a9b93689 | ||
|
|
852554bb16 | ||
|
|
7876027071 | ||
|
|
9ff4060d26 | ||
|
|
72748b4088 | ||
|
|
78b8203e50 | ||
|
|
376802c9b8 | ||
|
|
e1725ba946 | ||
|
|
6b708711f5 | ||
|
|
1b600ecd14 | ||
|
|
3770f5c944 | ||
|
|
b81d9d26f5 | ||
|
|
cea05e5ee7 | ||
|
|
f5a46ef0b1 | ||
|
|
8ec1b1e7b8 | ||
|
|
c935ad3f02 | ||
|
|
dcd7a26063 | ||
|
|
808cb6444e | ||
|
|
3e85c57a6c | ||
|
|
f1d4ba2afd | ||
|
|
06f9364e5f | ||
|
|
b811bd2172 | ||
|
|
d865085c7e | ||
|
|
6c8d0133ef | ||
|
|
f1782642d3 | ||
|
|
6bff1aa46d | ||
|
|
4e840fc541 | ||
|
|
80d5ec6ff4 | ||
|
|
99aac72a16 | ||
|
|
0e9b72e097 | ||
|
|
e34b317bbf | ||
|
|
2d1d1e3083 | ||
|
|
e5319a87ce | ||
|
|
992a2ad475 | ||
|
|
05819d013f | ||
|
|
63b99af85a | ||
|
|
2d37e88319 | ||
|
|
95c727caef | ||
|
|
e0bcacf79f | ||
|
|
9a25059656 | ||
|
|
d407f4d15f | ||
|
|
3774fe55fd | ||
|
|
ec448f8bb6 | ||
|
|
f7ce80f90a | ||
|
|
f1c0b2c0e1 | ||
|
|
3913afdd69 | ||
|
|
0e459d79a6 | ||
|
|
9d612c393a | ||
|
|
e012384fe9 | ||
|
|
e583df5280 | ||
|
|
70cab0587d | ||
|
|
2f96a89646 | ||
|
|
59c7249769 | ||
|
|
207a537343 | ||
|
|
b421895c1e | ||
|
|
dfe1fdf9e8 | ||
|
|
73ff84f6a8 | ||
|
|
c92ea927e5 | ||
|
|
9cac895406 | ||
|
|
ac9b427541 | ||
|
|
af786432c5 | ||
|
|
e30a0155d4 | ||
|
|
555ca59f2b | ||
|
|
ce27920936 | ||
|
|
91a88f3acb | ||
|
|
f107a27002 | ||
|
|
1e23b82a53 | ||
|
|
b7a936224e | ||
|
|
9be7787ec0 | ||
|
|
45b740c18b | ||
|
|
cb1a79a96a | ||
|
|
9a18f544ac | ||
|
|
629b9b0049 | ||
|
|
e68736936a | ||
|
|
d77970fde7 | ||
|
|
0abb3ad537 | ||
|
|
b82f75464d | ||
|
|
a7aabd7cc7 | ||
|
|
a07da2fd7a | ||
|
|
4a1cd10495 | ||
|
|
aabf5c86c9 | ||
|
|
389a2cebed | ||
|
|
37e45dac8c | ||
|
|
d8730fb86f | ||
|
|
8426d99b0e | ||
|
|
f0ec4b4ce4 | ||
|
|
7c568d4c6e | ||
|
|
ab4dd1d783 | ||
|
|
8e478c2341 | ||
|
|
a56036fa87 | ||
|
|
0ab64729e9 | ||
|
|
14a89aa8cd | ||
|
|
7d38060a0d | ||
|
|
0bc8f1669d | ||
|
|
96c84937c4 | ||
|
|
499b038875 | ||
|
|
906d56a96b | ||
|
|
7d8c99eb43 | ||
|
|
5446eae949 | ||
|
|
90df25ef7e | ||
|
|
95cf23ee7c | ||
|
|
e99bb91217 | ||
|
|
c3aaf3b8da | ||
|
|
bda64a2b0f | ||
|
|
94dfb6b1fe | ||
|
|
20eec802ff | ||
|
|
9277e72cb0 | ||
|
|
d7bae5680f | ||
|
|
c9159f86cc | ||
|
|
61a6176aca | ||
|
|
9348f9291e | ||
|
|
26762ceb86 | ||
|
|
c43d9f6131 | ||
|
|
5a303093dc | ||
|
|
4331eeb13d | ||
|
|
55bba8e4f5 | ||
|
|
926d3e5bb0 | ||
|
|
99b73fb507 | ||
|
|
e6e61f0a54 | ||
|
|
08ad9714e1 | ||
|
|
7c74f075f4 | ||
|
|
64d8872900 | ||
|
|
335504a58e | ||
|
|
8c4a5e7ba1 | ||
|
|
7bb5ddbe15 | ||
|
|
6b3a6fe5a2 | ||
|
|
199e888785 | ||
|
|
65f6d5db6f | ||
|
|
d4e51aac08 | ||
|
|
0847f2f1b3 | ||
|
|
a7e9286359 | ||
|
|
d343c03edb | ||
|
|
00a567588e | ||
|
|
a0bd088d84 | ||
|
|
21304c11f9 | ||
|
|
519aa479d7 | ||
|
|
33b3a0e477 | ||
|
|
d24bfe29a1 | ||
|
|
a15f9b37eb | ||
|
|
8ccae55dab | ||
|
|
ce2c755d2a | ||
|
|
6f6cb5e388 | ||
|
|
c5bd564c69 | ||
|
|
a323b7826c | ||
|
|
21e2088c1b | ||
|
|
93b1ce1ac5 | ||
|
|
204291f059 | ||
|
|
90d6018509 | ||
|
|
15e70c662e | ||
|
|
780c1a8f27 | ||
|
|
b1c34152fe | ||
|
|
74b4737d8f | ||
|
|
4e60c5ec65 | ||
|
|
168a887916 | ||
|
|
2d2769f68c | ||
|
|
043365c2fb | ||
|
|
a3bb929798 | ||
|
|
9b9de3a5e3 | ||
|
|
15b888c9a5 | ||
|
|
454e3a541a | ||
|
|
c32bba7489 | ||
|
|
10bfc5c0d0 | ||
|
|
5038e1bec4 | ||
|
|
02b4632e77 | ||
|
|
3a022d4599 | ||
|
|
bd79c1f6f6 | ||
|
|
382aa05ff7 | ||
|
|
893be6f5e3 | ||
|
|
e63c9e73e3 | ||
|
|
c6a542f22a | ||
|
|
14d3f45009 | ||
|
|
5a0e98d1e5 | ||
|
|
5961c94097 | ||
|
|
68e0f23edc | ||
|
|
99e8e58f2d | ||
|
|
5573365dff | ||
|
|
7f9a0033c7 | ||
|
|
aeb7148afd | ||
|
|
619cc4af85 | ||
|
|
c67407172d | ||
|
|
092ee24627 | ||
|
|
c6a0f4c393 | ||
|
|
9533d85ce0 | ||
|
|
6b83174fff | ||
|
|
a25c022af3 | ||
|
|
cf4c31c872 | ||
|
|
ae244af242 | ||
|
|
92ede15dd9 | ||
|
|
55e55b34e6 | ||
|
|
1f631ac85b | ||
|
|
f0e77c8a6c | ||
|
|
f3f854dac1 | ||
|
|
4b9dee6bcc | ||
|
|
dc3f52a144 | ||
|
|
f97d3753a1 | ||
|
|
c87840ae14 | ||
|
|
2fa7f2a56a | ||
|
|
a56b51a0ba | ||
|
|
b9d6c6f000 | ||
|
|
5dafde28db | ||
|
|
d20f814cde | ||
|
|
252c78b288 | ||
|
|
6f88fed819 | ||
|
|
4caeefaf00 | ||
|
|
e302ba0e65 | ||
|
|
e4ea3e0306 | ||
|
|
2dbd69dbf4 | ||
|
|
aeb695c007 | ||
|
|
c693f80b81 | ||
|
|
61fdb16aac | ||
|
|
5ec2a1ed82 | ||
|
|
a49b6761a5 | ||
|
|
80c36d4562 | ||
|
|
30ccf4e52d | ||
|
|
0588d72286 | ||
|
|
d749f5132b | ||
|
|
2341f30ec6 | ||
|
|
89468410d5 | ||
|
|
ebc4dae517 | ||
|
|
662db921e2 | ||
|
|
ab16b3d076 | ||
|
|
1d750e0587 | ||
|
|
336afe4d5f | ||
|
|
13604318ad | ||
|
|
aa82f8b2d2 | ||
|
|
731bc65ec0 | ||
|
|
7ba928116e | ||
|
|
990b5b2dcf | ||
|
|
b45628a172 | ||
|
|
b29cec7697 | ||
|
|
bd62290c23 | ||
|
|
0802e006f2 | ||
|
|
ad42a78469 | ||
|
|
4205234f26 | ||
|
|
b0c220c02e | ||
|
|
cc218b15ba | ||
|
|
e5f881a7e4 | ||
|
|
2cc248c4fd | ||
|
|
a67cf5a358 | ||
|
|
15fa70cd1b | ||
|
|
96c6b08ed7 | ||
|
|
d4fe9daed6 | ||
|
|
aa2846198f | ||
|
|
d132d057a8 | ||
|
|
4f6a7c8621 | ||
|
|
29c2dfd0a9 | ||
|
|
29ccb2e969 | ||
|
|
d0a769cb06 | ||
|
|
e3552f2bcf | ||
|
|
e75ffbf04a | ||
|
|
59714a15e0 | ||
|
|
5d8ec94d7f | ||
|
|
a0de58f471 | ||
|
|
eb18aedccb | ||
|
|
d4a48b12fa | ||
|
|
3871131308 | ||
|
|
8a6704d826 | ||
|
|
556f33422d | ||
|
|
f2fcc163fa | ||
|
|
9d1207c02c | ||
|
|
3b2ebd029c | ||
|
|
0d69f7f3f0 | ||
|
|
2467c98375 | ||
|
|
d6c4fe55db | ||
|
|
04a5976996 | ||
|
|
615a9d031d | ||
|
|
8ea842260b | ||
|
|
415fc233e3 | ||
|
|
06010eaf19 | ||
|
|
506b6263ef | ||
|
|
e2d7569685 | ||
|
|
69b047f4ce | ||
|
|
c4d740115e | ||
|
|
c47d2dac6c | ||
|
|
6644b6099b | ||
|
|
671f16aee0 | ||
|
|
54aff8430c | ||
|
|
1b05792988 | ||
|
|
ce225615c3 | ||
|
|
087530dec4 | ||
|
|
4d31cf83f2 | ||
|
|
1e53a07712 | ||
|
|
1c5067b9a7 | ||
|
|
45b5c606ac | ||
|
|
4ec1a9ab40 | ||
|
|
5fe7be2409 | ||
|
|
9e99b5205c | ||
|
|
278114d559 | ||
|
|
6dbd5c26e6 | ||
|
|
c7c562416c | ||
|
|
653c4e439b | ||
|
|
412684f9dc | ||
|
|
d9a6a75ed2 | ||
|
|
507c150034 | ||
|
|
5fbd9fee0b | ||
|
|
fb692e5f7b | ||
|
|
a2f86ac647 | ||
|
|
95bdfaa8bd | ||
|
|
15f241775a | ||
|
|
8cb3bbd504 | ||
|
|
8abb8647a3 | ||
|
|
ccb1bad612 | ||
|
|
7adb10d29b | ||
|
|
9169046e64 | ||
|
|
b971e406de | ||
|
|
63c5c91cc0 | ||
|
|
134942f56a | ||
|
|
094539ef4a | ||
|
|
65e88694c2 | ||
|
|
49436bdbb7 | ||
|
|
3488fa7c6c | ||
|
|
b70fc8f30c | ||
|
|
a9d3524e1f | ||
|
|
0e32b32fa3 | ||
|
|
e0aaf05f4f | ||
|
|
de00ed15d3 | ||
|
|
6ae4437acb | ||
|
|
6e4a8c47f4 | ||
|
|
c356d034f3 | ||
|
|
6636808e90 | ||
|
|
315f1980ca | ||
|
|
ae7b56cd9a | ||
|
|
0f840483c7 | ||
|
|
479757dc15 | ||
|
|
444786e6d3 | ||
|
|
46294d60cd | ||
|
|
ecee759b80 | ||
|
|
e7e7a03baf | ||
|
|
fdf06ce72f | ||
|
|
25e497bf9c | ||
|
|
dda4f7167b | ||
|
|
4846304541 | ||
|
|
894e007445 | ||
|
|
6d7efcfaeb | ||
|
|
de36cf3db9 | ||
|
|
4d030a8d96 | ||
|
|
2950014535 | ||
|
|
6fb7545fa1 | ||
|
|
638c56caed | ||
|
|
981f686259 | ||
|
|
90fe1dfd2f | ||
|
|
6b77bfc28d | ||
|
|
6e984431dd | ||
|
|
013f4928c8 | ||
|
|
2f162feb0f | ||
|
|
a4ba6e5590 | ||
|
|
f0d6d67af9 | ||
|
|
df3f5a78d5 | ||
|
|
66f1d7ee95 | ||
|
|
55a0451e51 | ||
|
|
7c7105e0f8 | ||
|
|
e414bde6f9 | ||
|
|
3cecf3f39c | ||
|
|
3e8ef9eb22 | ||
|
|
70136a9bf4 | ||
|
|
bc0fb109a9 | ||
|
|
2468672e30 | ||
|
|
8e5c86befc | ||
|
|
5990b86391 | ||
|
|
20a1a65d37 | ||
|
|
818c8da5b8 | ||
|
|
ef6ae61503 | ||
|
|
98f20dee41 | ||
|
|
d9ad3723d5 | ||
|
|
b531695331 | ||
|
|
666fac2ba3 | ||
|
|
b0fc5bcee9 | ||
|
|
0f5032c5a4 | ||
|
|
5c34d66538 | ||
|
|
38b87dea62 | ||
|
|
696a98af5a | ||
|
|
10f68923c6 | ||
|
|
4c9ebd20d7 | ||
|
|
74389370c6 | ||
|
|
156e3a9daa | ||
|
|
5a80cccc70 | ||
|
|
68b17ef731 | ||
|
|
3a4b744d9c | ||
|
|
d209bdcd08 | ||
|
|
391e1f511d | ||
|
|
a746dc64d2 | ||
|
|
cead210e66 | ||
|
|
8fc1c3f413 | ||
|
|
455aa8d9ea | ||
|
|
cb5ebc5c11 | ||
|
|
2bc55aba1e | ||
|
|
a887892eb6 | ||
|
|
54e54db2e2 | ||
|
|
2fc8a29a9c | ||
|
|
77e1f9010c | ||
|
|
0d1c2e5bae | ||
|
|
9d07c3717b | ||
|
|
2d5a219688 | ||
|
|
ddd42b7e94 | ||
|
|
2a41a567e2 | ||
|
|
3c171851a8 | ||
|
|
c38c726eb5 | ||
|
|
b9c016abc1 | ||
|
|
201f92e02c | ||
|
|
f8c4742c2f | ||
|
|
2aafa6901e | ||
|
|
f662850b60 | ||
|
|
7ba0f98e64 | ||
|
|
8ec77614f6 | ||
|
|
dea18ff999 | ||
|
|
2919c496ea | ||
|
|
7dcf5b011a | ||
|
|
2b8c63f303 | ||
|
|
e0d4aa75fc | ||
|
|
5d6e8c008b | ||
|
|
a37436d792 | ||
|
|
fa88f71520 | ||
|
|
ab9e47284a | ||
|
|
43408d3cd6 | ||
|
|
00db8d4549 | ||
|
|
9b3069a88c | ||
|
|
eba85e2367 | ||
|
|
4588a6ff3c | ||
|
|
33bd10549e | ||
|
|
24b35bf9e7 | ||
|
|
35d1c95f7f | ||
|
|
e6109ec765 | ||
|
|
514117a6bb | ||
|
|
d867e1804a | ||
|
|
e9c42c06ef | ||
|
|
21d5abfc14 | ||
|
|
cc51e37ad0 | ||
|
|
4fb594a375 | ||
|
|
7ec7bad2f8 | ||
|
|
fc46f8fc5e | ||
|
|
f8a52cc598 | ||
|
|
cbfdea6857 | ||
|
|
3392f1b778 | ||
|
|
e51abb6631 | ||
|
|
50ec2bed9e | ||
|
|
bc259192b4 | ||
|
|
0cbda84f5b | ||
|
|
160ce18a0e | ||
|
|
6960ee929d | ||
|
|
46cb15df9b | ||
|
|
6e4210d8ce | ||
|
|
160b974fb0 | ||
|
|
b42ba08fc8 | ||
|
|
939bee06cd | ||
|
|
3ddb6d1833 | ||
|
|
260527a90c | ||
|
|
3c28cb1b8f | ||
|
|
54ca4b4e81 | ||
|
|
3d0e81051f | ||
|
|
8c4e759efd | ||
|
|
cfca793a20 | ||
|
|
60834492ae | ||
|
|
7b312a8762 | ||
|
|
e1d73edb10 | ||
|
|
ed9d725392 | ||
|
|
ba66455636 | ||
|
|
aecf07b1d6 | ||
|
|
035ac44354 | ||
|
|
529acfd24f | ||
|
|
d8fa2fc429 | ||
|
|
3a5493bfe8 | ||
|
|
dd935404b2 | ||
|
|
7587d62d02 | ||
|
|
b3d33b02e3 | ||
|
|
b4e367bf4a | ||
|
|
c179f668e5 | ||
|
|
f6d684b5e2 | ||
|
|
84c12dbd7c | ||
|
|
a12cd53567 | ||
|
|
be757d88d9 | ||
|
|
4bf3a8226b | ||
|
|
4ad4e48668 | ||
|
|
c64f98b883 | ||
|
|
f39670c631 | ||
|
|
3ec0c82fab | ||
|
|
641db127be | ||
|
|
18c019b616 | ||
|
|
87033f2c4e | ||
|
|
c996e04aca | ||
|
|
507da65900 | ||
|
|
47727252ff | ||
|
|
ee1254d4f5 | ||
|
|
6a4c7fb975 | ||
|
|
a9ceeeb4b0 | ||
|
|
4023ae4cdf | ||
|
|
d2875f6782 | ||
|
|
101d964a59 | ||
|
|
9b7eac332b | ||
|
|
154244adc6 | ||
|
|
6b0ca8e803 | ||
|
|
c101b29133 | ||
|
|
be7fd63595 | ||
|
|
f9c7176a87 | ||
|
|
42be60c6af | ||
|
|
edb3836696 | ||
|
|
b5565a7081 | ||
|
|
a554f523db | ||
|
|
5e4d92d267 | ||
|
|
e007f367bd | ||
|
|
d4ee8afd59 | ||
|
|
6542de98c2 | ||
|
|
9ff1a9ea65 | ||
|
|
cfb6ab80ce | ||
|
|
d342de02b9 | ||
|
|
529add316c | ||
|
|
6e9182fbc2 | ||
|
|
e38ec77de8 | ||
|
|
beab05851b | ||
|
|
272b58220d | ||
|
|
ba05f29838 | ||
|
|
91a6a47b0e | ||
|
|
0cd7f2cd8d | ||
|
|
c8a0b9d5cb | ||
|
|
52419f8db3 | ||
|
|
dcae46ab14 | ||
|
|
ef4cf4e681 | ||
|
|
7a5cf31060 | ||
|
|
f216c76c56 | ||
|
|
c02da99757 | ||
|
|
f70434b1fb | ||
|
|
15a16e5c05 | ||
|
|
aa0e2a2e70 | ||
|
|
58a85fa462 | ||
|
|
41f38fbb4b |
No files matched your search
@@ -13,4 +13,5 @@
|
|||||||
(eval . (c-set-offset 'arglist-cont-nonempty '+))
|
(eval . (c-set-offset 'arglist-cont-nonempty '+))
|
||||||
(eval . (c-set-offset 'substatement-open 0))
|
(eval . (c-set-offset 'substatement-open 0))
|
||||||
(eval . (c-set-offset 'access-label '-))
|
(eval . (c-set-offset 'access-label '-))
|
||||||
|
(eval . (c-set-offset 'inlambda 0))
|
||||||
)))
|
)))
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<!--
|
|
||||||
|
|
||||||
# Filing a Nix issue
|
|
||||||
|
|
||||||
*WAIT* Are you sure you're filing your issue in the right repository?
|
|
||||||
|
|
||||||
We appreciate you taking the time to tell us about issues you encounter, but routing the issue to the right place will get you help sooner and save everyone time.
|
|
||||||
|
|
||||||
This is the Nix repository, and issues here should be about Nix the build and package management *_tool_*.
|
|
||||||
|
|
||||||
If you have a problem with a specific package on NixOS or when using Nix, you probably want to file an issue with _nixpkgs_, whose issue tracker is over at https://github.com/NixOS/nixpkgs/issues.
|
|
||||||
|
|
||||||
Examples of _Nix_ issues:
|
|
||||||
|
|
||||||
- Nix segfaults when I run `nix-build -A blahblah`
|
|
||||||
- The Nix language needs a new builtin: `builtins.foobar`
|
|
||||||
- Regression in the behavior of `nix-env` in Nix 2.0
|
|
||||||
|
|
||||||
Examples of _nixpkgs_ issues:
|
|
||||||
|
|
||||||
- glibc is b0rked on aarch64
|
|
||||||
- chromium in NixOS doesn't support U2F but google-chrome does!
|
|
||||||
- The OpenJDK package on macOS is missing a key component
|
|
||||||
|
|
||||||
Chances are if you're a newcomer to the Nix world, you'll probably want the [nixpkgs tracker](https://github.com/NixOS/nixpkgs/issues). It also gets a lot more eyeball traffic so you'll probably get a response a lot more quickly.
|
|
||||||
|
|
||||||
-->
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
If you have a problem with a specific package or NixOS,
|
||||||
|
you probably want to file an issue at https://github.com/NixOS/nixpkgs/issues.
|
||||||
|
|
||||||
|
**Steps To Reproduce**
|
||||||
|
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**`nix-env --version` output**
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
|
||||||
|
Add any other context about the problem here.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: improvement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: "Test"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-18.04, macos]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: cachix/install-nix-action@v8
|
||||||
|
#- run: nix flake check
|
||||||
|
- run: nix-build -A checks.$(if [[ `uname` = Linux ]]; then echo x86_64-linux; else echo x86_64-darwin; fi)
|
||||||
@@ -4,9 +4,10 @@ perl/Makefile.config
|
|||||||
# /
|
# /
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
|
/precompiled-headers.h.gch
|
||||||
|
/precompiled-headers.h.pch
|
||||||
/config.*
|
/config.*
|
||||||
/configure
|
/configure
|
||||||
/nix.spec
|
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
/svn-revision
|
/svn-revision
|
||||||
/libtool
|
/libtool
|
||||||
@@ -46,7 +47,7 @@ perl/Makefile.config
|
|||||||
/src/libexpr/nix.tbl
|
/src/libexpr/nix.tbl
|
||||||
|
|
||||||
# /src/libstore/
|
# /src/libstore/
|
||||||
/src/libstore/*.gen.hh
|
*.gen.*
|
||||||
|
|
||||||
/src/nix/nix
|
/src/nix/nix
|
||||||
|
|
||||||
@@ -74,6 +75,8 @@ perl/Makefile.config
|
|||||||
|
|
||||||
/src/nix-copy-closure/nix-copy-closure
|
/src/nix-copy-closure/nix-copy-closure
|
||||||
|
|
||||||
|
/src/error-demo/error-demo
|
||||||
|
|
||||||
/src/build-remote/build-remote
|
/src/build-remote/build-remote
|
||||||
|
|
||||||
# /tests/
|
# /tests/
|
||||||
@@ -84,6 +87,7 @@ perl/Makefile.config
|
|||||||
/tests/restricted-innocent
|
/tests/restricted-innocent
|
||||||
/tests/shell
|
/tests/shell
|
||||||
/tests/shell.drv
|
/tests/shell.drv
|
||||||
|
/tests/config.nix
|
||||||
|
|
||||||
# /tests/lang/
|
# /tests/lang/
|
||||||
/tests/lang/*.out
|
/tests/lang/*.out
|
||||||
@@ -117,3 +121,5 @@ GPATH
|
|||||||
GRTAGS
|
GRTAGS
|
||||||
GSYMS
|
GSYMS
|
||||||
GTAGS
|
GTAGS
|
||||||
|
|
||||||
|
nix-rust/target
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
os: osx
|
|
||||||
script: ./tests/install-darwin.sh
|
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
makefiles = \
|
makefiles = \
|
||||||
|
mk/precompiled-headers.mk \
|
||||||
local.mk \
|
local.mk \
|
||||||
|
nix-rust/local.mk \
|
||||||
src/libutil/local.mk \
|
src/libutil/local.mk \
|
||||||
src/libstore/local.mk \
|
src/libstore/local.mk \
|
||||||
|
src/libfetchers/local.mk \
|
||||||
src/libmain/local.mk \
|
src/libmain/local.mk \
|
||||||
src/libexpr/local.mk \
|
src/libexpr/local.mk \
|
||||||
src/nix/local.mk \
|
src/nix/local.mk \
|
||||||
src/resolve-system-dependencies/local.mk \
|
src/resolve-system-dependencies/local.mk \
|
||||||
scripts/local.mk \
|
scripts/local.mk \
|
||||||
corepkgs/local.mk \
|
corepkgs/local.mk \
|
||||||
|
misc/bash/local.mk \
|
||||||
misc/systemd/local.mk \
|
misc/systemd/local.mk \
|
||||||
misc/launchd/local.mk \
|
misc/launchd/local.mk \
|
||||||
misc/upstart/local.mk \
|
misc/upstart/local.mk \
|
||||||
@@ -15,8 +19,16 @@ makefiles = \
|
|||||||
tests/local.mk \
|
tests/local.mk \
|
||||||
tests/plugins/local.mk
|
tests/plugins/local.mk
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS += -g -Wall -include config.h
|
|
||||||
|
|
||||||
-include Makefile.config
|
-include Makefile.config
|
||||||
|
|
||||||
|
OPTIMIZE = 1
|
||||||
|
|
||||||
|
ifeq ($(OPTIMIZE), 1)
|
||||||
|
GLOBAL_CXXFLAGS += -O3
|
||||||
|
else
|
||||||
|
GLOBAL_CXXFLAGS += -O0
|
||||||
|
endif
|
||||||
|
|
||||||
include mk/lib.mk
|
include mk/lib.mk
|
||||||
|
|
||||||
|
GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++17
|
||||||
@@ -18,6 +18,7 @@ SODIUM_LIBS = @SODIUM_LIBS@
|
|||||||
LIBLZMA_LIBS = @LIBLZMA_LIBS@
|
LIBLZMA_LIBS = @LIBLZMA_LIBS@
|
||||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||||
LIBBROTLI_LIBS = @LIBBROTLI_LIBS@
|
LIBBROTLI_LIBS = @LIBBROTLI_LIBS@
|
||||||
|
LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@
|
||||||
EDITLINE_LIBS = @EDITLINE_LIBS@
|
EDITLINE_LIBS = @EDITLINE_LIBS@
|
||||||
bash = @bash@
|
bash = @bash@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
@@ -36,6 +37,7 @@ prefix = @prefix@
|
|||||||
sandbox_shell = @sandbox_shell@
|
sandbox_shell = @sandbox_shell@
|
||||||
storedir = @storedir@
|
storedir = @storedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
|
system = @system@
|
||||||
doc_generate = @doc_generate@
|
doc_generate = @doc_generate@
|
||||||
xmllint = @xmllint@
|
xmllint = @xmllint@
|
||||||
xsltproc = @xsltproc@
|
xsltproc = @xsltproc@
|
||||||
@@ -1,24 +1,54 @@
|
|||||||
|
# Nix
|
||||||
|
|
||||||
[](https://opencollective.com/nixos)
|
[](https://opencollective.com/nixos)
|
||||||
|
[](https://github.com/NixOS/nix/actions)
|
||||||
|
|
||||||
Nix, the purely functional package manager
|
Nix is a powerful package manager for Linux and other Unix systems that makes package
|
||||||
------------------------------------------
|
management reliable and reproducible. Please refer to the [Nix manual](https://nixos.org/nix/manual)
|
||||||
|
for more details.
|
||||||
|
|
||||||
Nix is a new take on package management that is fairly unique. Because of its
|
## Installation
|
||||||
purity aspects, a lot of issues found in traditional package managers don't
|
|
||||||
appear with Nix.
|
|
||||||
|
|
||||||
To find out more about the tool, usage and installation instructions, please
|
On Linux and macOS the easiest way to Install Nix is to run the following shell command
|
||||||
read the manual, which is available on the Nix website at
|
(as a user other than root):
|
||||||
<http://nixos.org/nix/manual>.
|
|
||||||
|
|
||||||
## Contributing
|
```
|
||||||
|
$ curl -L https://nixos.org/nix/install | sh
|
||||||
|
```
|
||||||
|
|
||||||
Take a look at the [Hacking Section](http://nixos.org/nix/manual/#chap-hacking)
|
Information on additional installation methods is available on the [Nix download page](https://nixos.org/download.html).
|
||||||
of the manual. It helps you to get started with building Nix from source.
|
|
||||||
|
## Building And Developing
|
||||||
|
|
||||||
|
### Building Nix
|
||||||
|
|
||||||
|
You can build Nix using one of the targets provided by [release.nix](./release.nix):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nix-build ./release.nix -A build.aarch64-linux
|
||||||
|
$ nix-build ./release.nix -A build.x86_64-darwin
|
||||||
|
$ nix-build ./release.nix -A build.i686-linux
|
||||||
|
$ nix-build ./release.nix -A build.x86_64-linux
|
||||||
|
```
|
||||||
|
|
||||||
|
### Development Environment
|
||||||
|
|
||||||
|
You can use the provided `shell.nix` to get a working development environment:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nix-shell
|
||||||
|
$ ./bootstrap.sh
|
||||||
|
$ ./configure
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- [Nix manual](https://nixos.org/nix/manual)
|
||||||
|
- [Nix jobsets on hydra.nixos.org](https://hydra.nixos.org/project/nix)
|
||||||
|
- [NixOS Discourse](https://discourse.nixos.org/)
|
||||||
|
- [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Nix is released under the LGPL v2.1
|
Nix is released under the [LGPL v2.1](./COPYING).
|
||||||
|
|
||||||
This product includes software developed by the OpenSSL Project for
|
|
||||||
use in the [OpenSSL Toolkit](http://www.OpenSSL.org/).
|
|
||||||
@@ -50,14 +50,11 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier ('cpu-os')])
|
|||||||
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
|
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
|
||||||
|
|
||||||
|
|
||||||
# Set default flags for nix (as per AC_PROG_CC/CXX docs),
|
CFLAGS=
|
||||||
# while still allowing the user to override them from the command line.
|
CXXFLAGS=
|
||||||
: ${CFLAGS="-O3"}
|
|
||||||
: ${CXXFLAGS="-O3"}
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
|
|
||||||
|
|
||||||
AC_CHECK_TOOL([AR], [ar])
|
AC_CHECK_TOOL([AR], [ar])
|
||||||
|
|
||||||
@@ -120,26 +117,16 @@ fi
|
|||||||
])
|
])
|
||||||
|
|
||||||
NEED_PROG(bash, bash)
|
NEED_PROG(bash, bash)
|
||||||
NEED_PROG(patch, patch)
|
|
||||||
AC_PATH_PROG(xmllint, xmllint, false)
|
AC_PATH_PROG(xmllint, xmllint, false)
|
||||||
AC_PATH_PROG(xsltproc, xsltproc, false)
|
AC_PATH_PROG(xsltproc, xsltproc, false)
|
||||||
AC_PATH_PROG(flex, flex, false)
|
AC_PATH_PROG(flex, flex, false)
|
||||||
AC_PATH_PROG(bison, bison, false)
|
AC_PATH_PROG(bison, bison, false)
|
||||||
NEED_PROG(sed, sed)
|
|
||||||
NEED_PROG(tar, tar)
|
|
||||||
NEED_PROG(bzip2, bzip2)
|
|
||||||
NEED_PROG(gzip, gzip)
|
|
||||||
NEED_PROG(xz, xz)
|
|
||||||
AC_PATH_PROG(dot, dot)
|
AC_PATH_PROG(dot, dot)
|
||||||
AC_PATH_PROG(lsof, lsof, lsof)
|
AC_PATH_PROG(lsof, lsof, lsof)
|
||||||
|
NEED_PROG(jq, jq)
|
||||||
|
|
||||||
|
|
||||||
NEED_PROG(cat, cat)
|
AC_SUBST(coreutils, [$(dirname $(type -p cat))])
|
||||||
NEED_PROG(tr, tr)
|
|
||||||
AC_ARG_WITH(coreutils-bin, AC_HELP_STRING([--with-coreutils-bin=PATH],
|
|
||||||
[path of cat, mkdir, etc.]),
|
|
||||||
coreutils=$withval, coreutils=$(dirname $cat))
|
|
||||||
AC_SUBST(coreutils)
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
|
AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
|
||||||
@@ -157,8 +144,33 @@ AX_BOOST_BASE([1.66], [CXXFLAGS="$BOOST_CPPFLAGS $CXXFLAGS"], [AC_MSG_ERROR([Nix
|
|||||||
# ends up with LDFLAGS being empty, so we set it afterwards.
|
# ends up with LDFLAGS being empty, so we set it afterwards.
|
||||||
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
|
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
|
||||||
|
|
||||||
|
# On some platforms, new-style atomics need a helper library
|
||||||
|
AC_MSG_CHECKING(whether -latomic is needed)
|
||||||
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||||
|
#include <stdint.h>
|
||||||
|
uint64_t v;
|
||||||
|
int main() {
|
||||||
|
return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
|
||||||
|
}]])], GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=no, GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=yes)
|
||||||
|
AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC)
|
||||||
|
if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
|
||||||
|
LIBS="-latomic $LIBS"
|
||||||
|
fi
|
||||||
|
|
||||||
# Look for OpenSSL, a required dependency.
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared],
|
||||||
|
[Build shared libraries for Nix [default=yes]]),
|
||||||
|
shared=$enableval, shared=yes)
|
||||||
|
if test "$shared" = yes; then
|
||||||
|
AC_SUBST(BUILD_SHARED_LIBS, 1, [Whether to build shared libraries.])
|
||||||
|
else
|
||||||
|
AC_SUBST(BUILD_SHARED_LIBS, 0, [Whether to build shared libraries.])
|
||||||
|
PKG_CONFIG="$PKG_CONFIG --static"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Look for OpenSSL, a required dependency. FIXME: this is only (maybe)
|
||||||
|
# used by S3BinaryCacheStore.
|
||||||
PKG_CHECK_MODULES([OPENSSL], [libcrypto], [CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"])
|
PKG_CHECK_MODULES([OPENSSL], [libcrypto], [CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"])
|
||||||
|
|
||||||
|
|
||||||
@@ -167,12 +179,12 @@ AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
|
|||||||
[AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See https://web.archive.org/web/20180624184756/http://www.bzip.org/.])])
|
[AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See https://web.archive.org/web/20180624184756/http://www.bzip.org/.])])
|
||||||
AC_CHECK_HEADERS([bzlib.h], [true],
|
AC_CHECK_HEADERS([bzlib.h], [true],
|
||||||
[AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See https://web.archive.org/web/20180624184756/http://www.bzip.org/.])])
|
[AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See https://web.archive.org/web/20180624184756/http://www.bzip.org/.])])
|
||||||
|
# Checks for libarchive
|
||||||
|
PKG_CHECK_MODULES([LIBARCHIVE], [libarchive >= 3.1.2], [CXXFLAGS="$LIBARCHIVE_CFLAGS $CXXFLAGS"])
|
||||||
|
|
||||||
# Look for SQLite, a required dependency.
|
# Look for SQLite, a required dependency.
|
||||||
PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"])
|
PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"])
|
||||||
|
|
||||||
|
|
||||||
# Look for libcurl, a required dependency.
|
# Look for libcurl, a required dependency.
|
||||||
PKG_CHECK_MODULES([LIBCURL], [libcurl], [CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"])
|
PKG_CHECK_MODULES([LIBCURL], [libcurl], [CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"])
|
||||||
|
|
||||||
@@ -195,12 +207,15 @@ PKG_CHECK_MODULES([SODIUM], [libsodium],
|
|||||||
have_sodium=1], [have_sodium=])
|
have_sodium=1], [have_sodium=])
|
||||||
AC_SUBST(HAVE_SODIUM, [$have_sodium])
|
AC_SUBST(HAVE_SODIUM, [$have_sodium])
|
||||||
|
|
||||||
|
|
||||||
# Look for liblzma, a required dependency.
|
# Look for liblzma, a required dependency.
|
||||||
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [CXXFLAGS="$LIBLZMA_CFLAGS $CXXFLAGS"])
|
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [CXXFLAGS="$LIBLZMA_CFLAGS $CXXFLAGS"])
|
||||||
AC_CHECK_LIB([lzma], [lzma_stream_encoder_mt],
|
AC_CHECK_LIB([lzma], [lzma_stream_encoder_mt],
|
||||||
[AC_DEFINE([HAVE_LZMA_MT], [1], [xz multithreaded compression support])])
|
[AC_DEFINE([HAVE_LZMA_MT], [1], [xz multithreaded compression support])])
|
||||||
|
|
||||||
|
# Look for zlib, a required dependency.
|
||||||
|
PKG_CHECK_MODULES([ZLIB], [zlib], [CXXFLAGS="$ZLIB_CFLAGS $CXXFLAGS"])
|
||||||
|
AC_CHECK_HEADER([zlib.h],[:],[AC_MSG_ERROR([could not find the zlib.h header])])
|
||||||
|
LDFLAGS="-lz $LDFLAGS"
|
||||||
|
|
||||||
# Look for libbrotli{enc,dec}.
|
# Look for libbrotli{enc,dec}.
|
||||||
PKG_CHECK_MODULES([LIBBROTLI], [libbrotlienc libbrotlidec], [CXXFLAGS="$LIBBROTLI_CFLAGS $CXXFLAGS"])
|
PKG_CHECK_MODULES([LIBBROTLI], [libbrotlienc libbrotlidec], [CXXFLAGS="$LIBBROTLI_CFLAGS $CXXFLAGS"])
|
||||||
@@ -243,8 +258,8 @@ fi
|
|||||||
|
|
||||||
# Whether to use the Boehm garbage collector.
|
# Whether to use the Boehm garbage collector.
|
||||||
AC_ARG_ENABLE(gc, AC_HELP_STRING([--enable-gc],
|
AC_ARG_ENABLE(gc, AC_HELP_STRING([--enable-gc],
|
||||||
[enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=no]]),
|
[enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=yes]]),
|
||||||
gc=$enableval, gc=no)
|
gc=$enableval, gc=yes)
|
||||||
if test "$gc" = yes; then
|
if test "$gc" = yes; then
|
||||||
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
||||||
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
||||||
@@ -290,16 +305,6 @@ AC_ARG_WITH(sandbox-shell, AC_HELP_STRING([--with-sandbox-shell=PATH],
|
|||||||
sandbox_shell=$withval)
|
sandbox_shell=$withval)
|
||||||
AC_SUBST(sandbox_shell)
|
AC_SUBST(sandbox_shell)
|
||||||
|
|
||||||
AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared],
|
|
||||||
[Build shared libraries for Nix [default=yes]]),
|
|
||||||
shared=$enableval, shared=yes)
|
|
||||||
if test "$shared" = yes; then
|
|
||||||
AC_SUBST(BUILD_SHARED_LIBS, 1, [Whether to build shared libraries.])
|
|
||||||
else
|
|
||||||
AC_SUBST(BUILD_SHARED_LIBS, 0, [Whether to build shared libraries.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Expand all variables in config.status.
|
# Expand all variables in config.status.
|
||||||
test "$prefix" = NONE && prefix=$ac_default_prefix
|
test "$prefix" = NONE && prefix=$ac_default_prefix
|
||||||
test "$exec_prefix" = NONE && exec_prefix='${prefix}'
|
test "$exec_prefix" = NONE && exec_prefix='${prefix}'
|
||||||
|
|||||||
@@ -1,29 +1,13 @@
|
|||||||
|
# FIXME: remove this file?
|
||||||
let
|
let
|
||||||
fromEnv = var: def:
|
fromEnv = var: def:
|
||||||
let val = builtins.getEnv var; in
|
let val = builtins.getEnv var; in
|
||||||
if val != "" then val else def;
|
if val != "" then val else def;
|
||||||
in rec {
|
in rec {
|
||||||
shell = "@bash@";
|
|
||||||
coreutils = "@coreutils@";
|
|
||||||
bzip2 = "@bzip2@";
|
|
||||||
gzip = "@gzip@";
|
|
||||||
xz = "@xz@";
|
|
||||||
tar = "@tar@";
|
|
||||||
tarFlags = "@tarFlags@";
|
|
||||||
tr = "@tr@";
|
|
||||||
nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@";
|
nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@";
|
||||||
nixPrefix = "@prefix@";
|
nixPrefix = "@prefix@";
|
||||||
nixLibexecDir = fromEnv "NIX_LIBEXEC_DIR" "@libexecdir@";
|
nixLibexecDir = fromEnv "NIX_LIBEXEC_DIR" "@libexecdir@";
|
||||||
nixLocalstateDir = "@localstatedir@";
|
nixLocalstateDir = "@localstatedir@";
|
||||||
nixSysconfDir = "@sysconfdir@";
|
nixSysconfDir = "@sysconfdir@";
|
||||||
nixStoreDir = fromEnv "NIX_STORE_DIR" "@storedir@";
|
nixStoreDir = fromEnv "NIX_STORE_DIR" "@storedir@";
|
||||||
|
|
||||||
# If Nix is installed in the Nix store, then automatically add it as
|
|
||||||
# a dependency to the core packages. This ensures that they work
|
|
||||||
# properly in a chroot.
|
|
||||||
chrootDeps =
|
|
||||||
if dirOf nixPrefix == builtins.storeDir then
|
|
||||||
[ (builtins.storePath nixPrefix) ]
|
|
||||||
else
|
|
||||||
[ ];
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
corepkgs_FILES = buildenv.nix unpack-channel.nix derivation.nix fetchurl.nix imported-drv-to-derivation.nix
|
corepkgs_FILES = \
|
||||||
|
unpack-channel.nix \
|
||||||
|
derivation.nix \
|
||||||
|
fetchurl.nix
|
||||||
|
|
||||||
$(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/corepkgs)))
|
$(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/corepkgs)))
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,12 @@
|
|||||||
with import <nix/config.nix>;
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
builder = builtins.toFile "unpack-channel.sh"
|
|
||||||
''
|
|
||||||
mkdir $out
|
|
||||||
cd $out
|
|
||||||
xzpat="\.xz\$"
|
|
||||||
gzpat="\.gz\$"
|
|
||||||
if [[ "$src" =~ $xzpat ]]; then
|
|
||||||
${xz} -d < $src | ${tar} xf - ${tarFlags}
|
|
||||||
elif [[ "$src" =~ $gzpat ]]; then
|
|
||||||
${gzip} -d < $src | ${tar} xf - ${tarFlags}
|
|
||||||
else
|
|
||||||
${bzip2} -d < $src | ${tar} xf - ${tarFlags}
|
|
||||||
fi
|
|
||||||
if [ * != $channelName ]; then
|
|
||||||
mv * $out/$channelName
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{ name, channelName, src }:
|
{ name, channelName, src }:
|
||||||
|
|
||||||
derivation {
|
derivation {
|
||||||
system = builtins.currentSystem;
|
builder = "builtin:unpack-channel";
|
||||||
builder = shell;
|
|
||||||
args = [ "-e" builder ];
|
|
||||||
inherit name channelName src;
|
|
||||||
|
|
||||||
PATH = "${nixBinDir}:${coreutils}";
|
system = "builtin";
|
||||||
|
|
||||||
|
inherit name channelName src;
|
||||||
|
|
||||||
# No point in doing this remotely.
|
# No point in doing this remotely.
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
inherit chrootDeps;
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
||||||
|
src = builtins.fetchGit ./.;
|
||||||
|
}).defaultNix
|
||||||
@@ -36,8 +36,8 @@ to <xref linkend="conf-cores" />, unless <xref linkend="conf-cores" />
|
|||||||
equals <literal>0</literal>, in which case <envar>NIX_BUILD_CORES</envar>
|
equals <literal>0</literal>, in which case <envar>NIX_BUILD_CORES</envar>
|
||||||
will be the total number of cores in the system.</para>
|
will be the total number of cores in the system.</para>
|
||||||
|
|
||||||
<para>The total number of consumed cores is a simple multiplication,
|
<para>The maximum number of consumed cores is a simple multiplication,
|
||||||
<xref linkend="conf-cores" /> * <envar>NIX_BUILD_CORES</envar>.</para>
|
<xref linkend="conf-max-jobs" /> * <envar>NIX_BUILD_CORES</envar>.</para>
|
||||||
|
|
||||||
<para>The balance on how to set these two independent variables depends
|
<para>The balance on how to set these two independent variables depends
|
||||||
upon each builder's workload and hardware. Here are a few example
|
upon each builder's workload and hardware. Here are a few example
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
version="5.0"
|
version="5.0"
|
||||||
>
|
>
|
||||||
|
|
||||||
<title>Using the <xref linkend="conf-post-build-hook" /></title>
|
<title>Using the <option linkend="conf-post-build-hook">post-build-hook</option></title>
|
||||||
<subtitle>Uploading to an S3-compatible binary cache after each build</subtitle>
|
<subtitle>Uploading to an S3-compatible binary cache after each build</subtitle>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,26 +19,30 @@
|
|||||||
|
|
||||||
<refsection><title>Description</title>
|
<refsection><title>Description</title>
|
||||||
|
|
||||||
<para>Nix reads settings from two configuration files:</para>
|
<para>By default Nix reads settings from the following places:</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<para>The system-wide configuration file
|
||||||
|
<filename><replaceable>sysconfdir</replaceable>/nix/nix.conf</filename>
|
||||||
|
(i.e. <filename>/etc/nix/nix.conf</filename> on most systems), or
|
||||||
|
<filename>$NIX_CONF_DIR/nix.conf</filename> if
|
||||||
|
<envar>NIX_CONF_DIR</envar> is set. Values loaded in this file are not forwarded to the Nix daemon. The
|
||||||
|
client assumes that the daemon has already loaded them.
|
||||||
|
</para>
|
||||||
|
|
||||||
<listitem>
|
<para>User-specific configuration files:</para>
|
||||||
<para>The system-wide configuration file
|
|
||||||
<filename><replaceable>sysconfdir</replaceable>/nix/nix.conf</filename>
|
|
||||||
(i.e. <filename>/etc/nix/nix.conf</filename> on most systems), or
|
|
||||||
<filename>$NIX_CONF_DIR/nix.conf</filename> if
|
|
||||||
<envar>NIX_CONF_DIR</envar> is set.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
<para>
|
||||||
<para>The user configuration file
|
If <envar>NIX_USER_CONF_FILES</envar> is set, then each path separated by
|
||||||
<filename>$XDG_CONFIG_HOME/nix/nix.conf</filename>, or
|
<literal>:</literal> will be loaded in reverse order.
|
||||||
<filename>~/.config/nix/nix.conf</filename> if
|
</para>
|
||||||
<envar>XDG_CONFIG_HOME</envar> is not set.</para>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
</itemizedlist>
|
<para>
|
||||||
|
Otherwise it will look for <filename>nix/nix.conf</filename> files in
|
||||||
|
<envar>XDG_CONFIG_DIRS</envar> and <envar>XDG_CONFIG_HOME</envar>.
|
||||||
|
|
||||||
|
The default location is <filename>$HOME/.config/nix.conf</filename> if
|
||||||
|
those environment variables are unset.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>The configuration files consist of
|
<para>The configuration files consist of
|
||||||
<literal><replaceable>name</replaceable> =
|
<literal><replaceable>name</replaceable> =
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
will cause Nix to look for paths relative to
|
will cause Nix to look for paths relative to
|
||||||
<filename>/home/eelco/Dev</filename> and
|
<filename>/home/eelco/Dev</filename> and
|
||||||
<filename>/etc/nixos</filename>, in that order. It is also
|
<filename>/etc/nixos</filename>, in this order. It is also
|
||||||
possible to match paths against a prefix. For example, the value
|
possible to match paths against a prefix. For example, the value
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
@@ -59,7 +59,7 @@ nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-15.09.tar.gz</sc
|
|||||||
15.09 channel.</para>
|
15.09 channel.</para>
|
||||||
|
|
||||||
<para>A following shorthand can be used to refer to the official channels:
|
<para>A following shorthand can be used to refer to the official channels:
|
||||||
|
|
||||||
<screen>nixpkgs=channel:nixos-15.09</screen>
|
<screen>nixpkgs=channel:nixos-15.09</screen>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -137,12 +137,19 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
|
|||||||
|
|
||||||
<varlistentry><term><envar>NIX_CONF_DIR</envar></term>
|
<varlistentry><term><envar>NIX_CONF_DIR</envar></term>
|
||||||
|
|
||||||
<listitem><para>Overrides the location of the Nix configuration
|
<listitem><para>Overrides the location of the system Nix configuration
|
||||||
directory (default
|
directory (default
|
||||||
<filename><replaceable>prefix</replaceable>/etc/nix</filename>).</para></listitem>
|
<filename><replaceable>prefix</replaceable>/etc/nix</filename>).</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry><term><envar>NIX_USER_CONF_FILES</envar></term>
|
||||||
|
|
||||||
|
<listitem><para>Overrides the location of the user Nix configuration files
|
||||||
|
to load from (defaults to the XDG spec locations). The variable is treated
|
||||||
|
as a list separated by the <literal>:</literal> token.</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><envar>TMPDIR</envar></term>
|
<varlistentry><term><envar>TMPDIR</envar></term>
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ also <xref linkend="sec-common-options" />.</phrase></para>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--dry-run</option></term>
|
<varlistentry><term><option>--dry-run</option></term>
|
||||||
<listitem><para>Show what store paths would be built or downloaded</para></listitem>
|
<listitem><para>Show what store paths would be built or downloaded.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry xml:id='opt-out-link'><term><option>--out-link</option> /
|
<varlistentry xml:id='opt-out-link'><term><option>--out-link</option> /
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ stay up-to-date with a set of pre-built Nix expressions. A Nix
|
|||||||
channel is just a URL that points to a place containing a set of Nix
|
channel is just a URL that points to a place containing a set of Nix
|
||||||
expressions. <phrase condition="manual">See also <xref
|
expressions. <phrase condition="manual">See also <xref
|
||||||
linkend="sec-channels" />.</phrase></para>
|
linkend="sec-channels" />.</phrase></para>
|
||||||
|
|
||||||
|
<para>To see the list of official NixOS channels, visit <link
|
||||||
|
xlink:href="https://nixos.org/channels" />.</para>
|
||||||
|
|
||||||
<para>This command has the following operations:
|
<para>This command has the following operations:
|
||||||
|
|
||||||
@@ -111,13 +114,13 @@ $ nix-env -iA nixpkgs.hello</screen>
|
|||||||
<para>You can revert channel updates using <option>--rollback</option>:</para>
|
<para>You can revert channel updates using <option>--rollback</option>:</para>
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.nixpkgsVersion'
|
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
||||||
"14.04.527.0e935f1"
|
"14.04.527.0e935f1"
|
||||||
|
|
||||||
$ nix-channel --rollback
|
$ nix-channel --rollback
|
||||||
switching from generation 483 to 482
|
switching from generation 483 to 482
|
||||||
|
|
||||||
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.nixpkgsVersion'
|
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
||||||
"14.04.526.dbadfad"
|
"14.04.526.dbadfad"
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
|
|||||||
@@ -1066,7 +1066,8 @@ user environment elements, etc. -->
|
|||||||
the derivation, which can be used to unambiguously select it using
|
the derivation, which can be used to unambiguously select it using
|
||||||
the <link linkend="opt-attr"><option>--attr</option> option</link>
|
the <link linkend="opt-attr"><option>--attr</option> option</link>
|
||||||
available in commands that install derivations like
|
available in commands that install derivations like
|
||||||
<literal>nix-env --install</literal>.</para></listitem>
|
<literal>nix-env --install</literal>. This option only works
|
||||||
|
together with <option>--available</option></para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,12 @@
|
|||||||
<arg choice='plain'><option>--packages</option></arg>
|
<arg choice='plain'><option>--packages</option></arg>
|
||||||
<arg choice='plain'><option>-p</option></arg>
|
<arg choice='plain'><option>-p</option></arg>
|
||||||
</group>
|
</group>
|
||||||
<arg choice='plain' rep='repeat'><replaceable>packages</replaceable></arg>
|
<arg choice='plain' rep='repeat'>
|
||||||
|
<group choice='req'>
|
||||||
|
<arg choice="plain"><replaceable>packages</replaceable></arg>
|
||||||
|
<arg choice="plain"><replaceable>expressions</replaceable></arg>
|
||||||
|
</group>
|
||||||
|
</arg>
|
||||||
</arg>
|
</arg>
|
||||||
<arg><replaceable>path</replaceable></arg>
|
<arg><replaceable>path</replaceable></arg>
|
||||||
</group>
|
</group>
|
||||||
@@ -189,8 +194,8 @@ also <xref linkend="sec-common-options" />.</phrase></para>
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><envar>NIX_BUILD_SHELL</envar></term>
|
<varlistentry><term><envar>NIX_BUILD_SHELL</envar></term>
|
||||||
|
|
||||||
<listitem><para>Shell used to start the interactive environment.
|
<listitem><para>Shell used to start the interactive environment.
|
||||||
Defaults to the <command>bash</command> found in <envar>PATH</envar>.</para></listitem>
|
Defaults to the <command>bash</command> found in <envar>PATH</envar>.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -222,8 +227,9 @@ $ nix-shell '<nixpkgs>' -A pan --pure \
|
|||||||
--command 'export NIX_DEBUG=1; export NIX_CORES=8; return'
|
--command 'export NIX_DEBUG=1; export NIX_CORES=8; return'
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
Nix expressions can also be given on the command line. For instance,
|
Nix expressions can also be given on the command line using the
|
||||||
the following starts a shell containing the packages
|
<command>-E</command> and <command>-p</command> flags.
|
||||||
|
For instance, the following starts a shell containing the packages
|
||||||
<literal>sqlite</literal> and <literal>libX11</literal>:
|
<literal>sqlite</literal> and <literal>libX11</literal>:
|
||||||
|
|
||||||
<screen>
|
<screen>
|
||||||
@@ -238,6 +244,14 @@ $ nix-shell -p sqlite xorg.libX11
|
|||||||
… -L/nix/store/j1zg5v…-sqlite-3.8.0.2/lib -L/nix/store/0gmcz9…-libX11-1.6.1/lib …
|
… -L/nix/store/j1zg5v…-sqlite-3.8.0.2/lib -L/nix/store/0gmcz9…-libX11-1.6.1/lib …
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
|
Note that <command>-p</command> accepts multiple full nix expressions that
|
||||||
|
are valid in the <literal>buildInputs = [ ... ]</literal> shown above,
|
||||||
|
not only package names. So the following is also legal:
|
||||||
|
|
||||||
|
<screen>
|
||||||
|
$ nix-shell -p sqlite 'git.override { withManual = false; }'
|
||||||
|
</screen>
|
||||||
|
|
||||||
The <command>-p</command> flag looks up Nixpkgs in the Nix search
|
The <command>-p</command> flag looks up Nixpkgs in the Nix search
|
||||||
path. You can override it by passing <option>-I</option> or setting
|
path. You can override it by passing <option>-I</option> or setting
|
||||||
<envar>NIX_PATH</envar>. For example, the following gives you a shell
|
<envar>NIX_PATH</envar>. For example, the following gives you a shell
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ EOF
|
|||||||
<arg choice='plain'><option>--print-roots</option></arg>
|
<arg choice='plain'><option>--print-roots</option></arg>
|
||||||
<arg choice='plain'><option>--print-live</option></arg>
|
<arg choice='plain'><option>--print-live</option></arg>
|
||||||
<arg choice='plain'><option>--print-dead</option></arg>
|
<arg choice='plain'><option>--print-dead</option></arg>
|
||||||
<arg choice='plain'><option>--delete</option></arg>
|
|
||||||
</group>
|
</group>
|
||||||
<arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg>
|
<arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
@@ -407,14 +406,6 @@ the Nix store not reachable via file system references from a set of
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--delete</option></term>
|
|
||||||
|
|
||||||
<listitem><para>This operation performs an actual garbage
|
|
||||||
collection. All dead paths are removed from the
|
|
||||||
store. This is the default.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>By default, all unreachable paths are deleted. The following
|
<para>By default, all unreachable paths are deleted. The following
|
||||||
@@ -444,10 +435,10 @@ and <link
|
|||||||
linkend="conf-keep-derivations"><literal>keep-derivations</literal></link>
|
linkend="conf-keep-derivations"><literal>keep-derivations</literal></link>
|
||||||
variables in the Nix configuration file.</para>
|
variables in the Nix configuration file.</para>
|
||||||
|
|
||||||
<para>With <option>--delete</option>, the collector prints the total
|
<para>By default, the collector prints the total number of freed bytes
|
||||||
number of freed bytes when it finishes (or when it is interrupted).
|
when it finishes (or when it is interrupted). With
|
||||||
With <option>--print-dead</option>, it prints the number of bytes that
|
<option>--print-dead</option>, it prints the number of bytes that would
|
||||||
would be freed.</para>
|
be freed.</para>
|
||||||
|
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
@@ -1148,7 +1139,7 @@ the information that Nix considers important. For instance,
|
|||||||
timestamps are elided because all files in the Nix store have their
|
timestamps are elided because all files in the Nix store have their
|
||||||
timestamp set to 0 anyway. Likewise, all permissions are left out
|
timestamp set to 0 anyway. Likewise, all permissions are left out
|
||||||
except for the execute bit, because all files in the Nix store have
|
except for the execute bit, because all files in the Nix store have
|
||||||
644 or 755 permission.</para>
|
444 or 555 permission.</para>
|
||||||
|
|
||||||
<para>Also, a NAR archive is <emphasis>canonical</emphasis>, meaning
|
<para>Also, a NAR archive is <emphasis>canonical</emphasis>, meaning
|
||||||
that “equal” paths always produce the same NAR archive. For instance,
|
that “equal” paths always produce the same NAR archive. For instance,
|
||||||
|
|||||||
@@ -243,9 +243,10 @@
|
|||||||
<varlistentry><term><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
<varlistentry><term><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
||||||
|
|
||||||
<listitem><para>This option is accepted by
|
<listitem><para>This option is accepted by
|
||||||
<command>nix-env</command>, <command>nix-instantiate</command> and
|
<command>nix-env</command>, <command>nix-instantiate</command>,
|
||||||
<command>nix-build</command>. When evaluating Nix expressions, the
|
<command>nix-shell</command> and <command>nix-build</command>.
|
||||||
expression evaluator will automatically try to call functions that
|
When evaluating Nix expressions, the expression evaluator will
|
||||||
|
automatically try to call functions that
|
||||||
it encounters. It can automatically call functions for which every
|
it encounters. It can automatically call functions for which every
|
||||||
argument has a <link linkend='ss-functions'>default value</link>
|
argument has a <link linkend='ss-functions'>default value</link>
|
||||||
(e.g., <literal>{ <replaceable>argName</replaceable> ?
|
(e.g., <literal>{ <replaceable>argName</replaceable> ?
|
||||||
@@ -322,7 +323,14 @@
|
|||||||
Nix expressions to be parsed and evaluated, rather than as a list
|
Nix expressions to be parsed and evaluated, rather than as a list
|
||||||
of file names of Nix expressions.
|
of file names of Nix expressions.
|
||||||
(<command>nix-instantiate</command>, <command>nix-build</command>
|
(<command>nix-instantiate</command>, <command>nix-build</command>
|
||||||
and <command>nix-shell</command> only.)</para></listitem>
|
and <command>nix-shell</command> only.)</para>
|
||||||
|
|
||||||
|
<para>For <command>nix-shell</command>, this option is commonly used
|
||||||
|
to give you a shell in which you can build the packages returned
|
||||||
|
by the expression. If you want to get a shell which contain the
|
||||||
|
<emphasis>built</emphasis> packages ready for use, give your
|
||||||
|
expression to the <command>nix-shell -p</command> convenience flag
|
||||||
|
instead.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ attributes.</para>
|
|||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><varname>allowedReferences</varname></term>
|
<varlistentry xml:id="adv-attr-allowedReferences"><term><varname>allowedReferences</varname></term>
|
||||||
|
|
||||||
<listitem><para>The optional attribute
|
<listitem><para>The optional attribute
|
||||||
<varname>allowedReferences</varname> specifies a list of legal
|
<varname>allowedReferences</varname> specifies a list of legal
|
||||||
@@ -32,7 +32,7 @@ allowedReferences = [];
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>allowedRequisites</varname></term>
|
<varlistentry xml:id="adv-attr-allowedRequisites"><term><varname>allowedRequisites</varname></term>
|
||||||
|
|
||||||
<listitem><para>This attribute is similar to
|
<listitem><para>This attribute is similar to
|
||||||
<varname>allowedReferences</varname>, but it specifies the legal
|
<varname>allowedReferences</varname>, but it specifies the legal
|
||||||
@@ -50,7 +50,7 @@ allowedRequisites = [ foobar ];
|
|||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><varname>disallowedReferences</varname></term>
|
<varlistentry xml:id="adv-attr-disallowedReferences"><term><varname>disallowedReferences</varname></term>
|
||||||
|
|
||||||
<listitem><para>The optional attribute
|
<listitem><para>The optional attribute
|
||||||
<varname>disallowedReferences</varname> specifies a list of illegal
|
<varname>disallowedReferences</varname> specifies a list of illegal
|
||||||
@@ -67,7 +67,7 @@ disallowedReferences = [ foo ];
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>disallowedRequisites</varname></term>
|
<varlistentry xml:id="adv-attr-disallowedRequisites"><term><varname>disallowedRequisites</varname></term>
|
||||||
|
|
||||||
<listitem><para>This attribute is similar to
|
<listitem><para>This attribute is similar to
|
||||||
<varname>disallowedReferences</varname>, but it specifies illegal
|
<varname>disallowedReferences</varname>, but it specifies illegal
|
||||||
@@ -85,7 +85,7 @@ disallowedRequisites = [ foobar ];
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>exportReferencesGraph</varname></term>
|
<varlistentry xml:id="adv-attr-exportReferencesGraph"><term><varname>exportReferencesGraph</varname></term>
|
||||||
|
|
||||||
<listitem><para>This attribute allows builders access to the
|
<listitem><para>This attribute allows builders access to the
|
||||||
references graph of their inputs. The attribute is a list of
|
references graph of their inputs. The attribute is a list of
|
||||||
@@ -124,7 +124,7 @@ derivation {
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>impureEnvVars</varname></term>
|
<varlistentry xml:id="adv-attr-impureEnvVars"><term><varname>impureEnvVars</varname></term>
|
||||||
|
|
||||||
<listitem><para>This attribute allows you to specify a list of
|
<listitem><para>This attribute allows you to specify a list of
|
||||||
environment variables that should be passed from the environment
|
environment variables that should be passed from the environment
|
||||||
@@ -158,9 +158,9 @@ impureEnvVars = [ "http_proxy" "https_proxy" <replaceable>...</replaceable> ];
|
|||||||
|
|
||||||
|
|
||||||
<varlistentry xml:id="fixed-output-drvs">
|
<varlistentry xml:id="fixed-output-drvs">
|
||||||
<term><varname>outputHash</varname></term>
|
<term xml:id="adv-attr-outputHash"><varname>outputHash</varname></term>
|
||||||
<term><varname>outputHashAlgo</varname></term>
|
<term xml:id="adv-attr-outputHashAlgo"><varname>outputHashAlgo</varname></term>
|
||||||
<term><varname>outputHashMode</varname></term>
|
<term xml:id="adv-attr-outputHashMode"><varname>outputHashMode</varname></term>
|
||||||
|
|
||||||
<listitem><para>These attributes declare that the derivation is a
|
<listitem><para>These attributes declare that the derivation is a
|
||||||
so-called <emphasis>fixed-output derivation</emphasis>, which
|
so-called <emphasis>fixed-output derivation</emphasis>, which
|
||||||
@@ -282,7 +282,7 @@ stdenv.mkDerivation {
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>passAsFile</varname></term>
|
<varlistentry xml:id="adv-attr-passAsFile"><term><varname>passAsFile</varname></term>
|
||||||
|
|
||||||
<listitem><para>A list of names of attributes that should be
|
<listitem><para>A list of names of attributes that should be
|
||||||
passed via files rather than environment variables. For example,
|
passed via files rather than environment variables. For example,
|
||||||
@@ -309,7 +309,7 @@ big = "a very long string";
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>preferLocalBuild</varname></term>
|
<varlistentry xml:id="adv-attr-preferLocalBuild"><term><varname>preferLocalBuild</varname></term>
|
||||||
|
|
||||||
<listitem><para>If this attribute is set to
|
<listitem><para>If this attribute is set to
|
||||||
<literal>true</literal> and <link
|
<literal>true</literal> and <link
|
||||||
@@ -323,14 +323,25 @@ big = "a very long string";
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>allowSubstitutes</varname></term>
|
<varlistentry xml:id="adv-attr-allowSubstitutes"><term><varname>allowSubstitutes</varname></term>
|
||||||
|
|
||||||
<listitem><para>If this attribute is set to
|
<listitem>
|
||||||
|
<para>If this attribute is set to
|
||||||
<literal>false</literal>, then Nix will always build this
|
<literal>false</literal>, then Nix will always build this
|
||||||
derivation; it will not try to substitute its outputs. This is
|
derivation; it will not try to substitute its outputs. This is
|
||||||
useful for very trivial derivations (such as
|
useful for very trivial derivations (such as
|
||||||
<function>writeText</function> in Nixpkgs) that are cheaper to
|
<function>writeText</function> in Nixpkgs) that are cheaper to
|
||||||
build than to substitute from a binary cache.</para></listitem>
|
build than to substitute from a binary cache.</para>
|
||||||
|
|
||||||
|
<note><para>You need to have a builder configured which satisfies
|
||||||
|
the derivation’s <literal>system</literal> attribute, since the
|
||||||
|
derivation cannot be substituted. Thus it is usually a good idea
|
||||||
|
to align <literal>system</literal> with
|
||||||
|
<literal>builtins.currentSystem</literal> when setting
|
||||||
|
<literal>allowSubstitutes</literal> to <literal>false</literal>.
|
||||||
|
For most trivial derivations this should be the case.
|
||||||
|
</para></note>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -422,6 +422,16 @@ stdenv.mkDerivation { … }
|
|||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>submodules</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
A Boolean parameter that specifies whether submodules
|
||||||
|
should be checked out. Defaults to
|
||||||
|
<literal>false</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 889 B |
|
Before Width: | Height: | Size: 929 B |
|
Before Width: | Height: | Size: 202 B |
|
Before Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 914 B |
|
Before Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 916 B |
|
Before Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 907 B |
|
Before Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 923 B |
@@ -142,7 +142,7 @@ sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
|||||||
<para>
|
<para>
|
||||||
NixOS.org hosts version-specific installation URLs for all Nix
|
NixOS.org hosts version-specific installation URLs for all Nix
|
||||||
versions since 1.11.16, at
|
versions since 1.11.16, at
|
||||||
<literal>https://nixos.org/releases/nix/nix-VERSION/install</literal>.
|
<literal>https://releases.nixos.org/nix/nix-<replaceable>version</replaceable>/install</literal>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -8,6 +8,14 @@
|
|||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
|
||||||
|
<listitem><para>GNU Autoconf
|
||||||
|
(<link xlink:href="https://www.gnu.org/software/autoconf/"/>)
|
||||||
|
and the autoconf-archive macro collection
|
||||||
|
(<link xlink:href="https://www.gnu.org/software/autoconf-archive/"/>).
|
||||||
|
These are only needed to run the bootstrap script, and are not necessary
|
||||||
|
if your source distribution came with a pre-built
|
||||||
|
<literal>./configure</literal> script.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>GNU Make.</para></listitem>
|
<listitem><para>GNU Make.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Bash Shell. The <literal>./configure</literal> script
|
<listitem><para>Bash Shell. The <literal>./configure</literal> script
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ XSLTPROC = $(xsltproc) --nonet $(xmlflags) \
|
|||||||
--param xref.with.number.and.title 1 \
|
--param xref.with.number.and.title 1 \
|
||||||
--param toc.section.depth 3 \
|
--param toc.section.depth 3 \
|
||||||
--param admon.style \'\' \
|
--param admon.style \'\' \
|
||||||
--param callout.graphics.extension \'.gif\' \
|
--param callout.graphics 0 \
|
||||||
--param contrib.inline.enabled 0 \
|
--param contrib.inline.enabled 0 \
|
||||||
--stringparam generate.toc "book toc" \
|
--stringparam generate.toc "book toc" \
|
||||||
--param keep.relative.image.uris 0
|
--param keep.relative.image.uris 0
|
||||||
@@ -69,8 +69,6 @@ $(foreach file, $(d)/manual.html, $(eval $(call install-data-in, $(file), $(docd
|
|||||||
|
|
||||||
$(foreach file, $(wildcard $(d)/figures/*.png), $(eval $(call install-data-in, $(file), $(docdir)/manual/figures)))
|
$(foreach file, $(wildcard $(d)/figures/*.png), $(eval $(call install-data-in, $(file), $(docdir)/manual/figures)))
|
||||||
|
|
||||||
$(foreach file, $(wildcard $(d)/images/callouts/*.gif), $(eval $(call install-data-in, $(file), $(docdir)/manual/images/callouts)))
|
|
||||||
|
|
||||||
$(eval $(call install-symlink, manual.html, $(docdir)/manual/index.html))
|
$(eval $(call install-symlink, manual.html, $(docdir)/manual/index.html))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ a set of Nix expressions and a manifest. Using the command <link
|
|||||||
linkend="sec-nix-channel"><command>nix-channel</command></link> you
|
linkend="sec-nix-channel"><command>nix-channel</command></link> you
|
||||||
can automatically stay up to date with whatever is available at that
|
can automatically stay up to date with whatever is available at that
|
||||||
URL.</para>
|
URL.</para>
|
||||||
|
|
||||||
|
<para>To see the list of official NixOS channels, visit <link
|
||||||
|
xlink:href="https://nixos.org/channels" />.</para>
|
||||||
|
|
||||||
<para>You can “subscribe” to a channel using
|
<para>You can “subscribe” to a channel using
|
||||||
<command>nix-channel --add</command>, e.g.,
|
<command>nix-channel --add</command>, e.g.,
|
||||||
|
|||||||
@@ -503,14 +503,14 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para><emphasis>Pure evaluation mode</emphasis>. This is a variant
|
<para><emphasis>Pure evaluation mode</emphasis>. With the
|
||||||
of the existing restricted evaluation mode. In pure mode, the Nix
|
<literal>--pure-eval</literal> flag, Nix enables a variant of the existing
|
||||||
evaluator forbids access to anything that could cause different
|
restricted evaluation mode that forbids access to anything that could cause
|
||||||
evaluations of the same command line arguments to produce a
|
different evaluations of the same command line arguments to produce a
|
||||||
different result. This includes builtin functions such as
|
different result. This includes builtin functions such as
|
||||||
<function>builtins.getEnv</function>, but more importantly,
|
<function>builtins.getEnv</function>, but more importantly,
|
||||||
<emphasis>all</emphasis> filesystem or network access unless a
|
<emphasis>all</emphasis> filesystem or network access unless a content hash
|
||||||
content hash or commit hash is specified. For example, calls to
|
or commit hash is specified. For example, calls to
|
||||||
<function>builtins.fetchGit</function> are only allowed if a
|
<function>builtins.fetchGit</function> are only allowed if a
|
||||||
<varname>rev</varname> attribute is specified.</para>
|
<varname>rev</varname> attribute is specified.</para>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"info": {
|
||||||
|
"lastModified": 1585405475,
|
||||||
|
"narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE="
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-20.03-small",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 5
|
||||||
|
}
|
||||||
@@ -0,0 +1,510 @@
|
|||||||
|
{
|
||||||
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
|
edition = 201909; # FIXME: remove
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "nixpkgs/nixos-20.03-small";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
version = builtins.readFile ./.version + versionSuffix;
|
||||||
|
versionSuffix =
|
||||||
|
if officialRelease
|
||||||
|
then ""
|
||||||
|
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified)}_${self.shortRev or "dirty"}";
|
||||||
|
|
||||||
|
officialRelease = false;
|
||||||
|
|
||||||
|
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
|
||||||
|
|
||||||
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||||
|
|
||||||
|
# Memoize nixpkgs for different platforms for efficiency.
|
||||||
|
nixpkgsFor = forAllSystems (system:
|
||||||
|
import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ self.overlay ];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
commonDeps = pkgs: with pkgs; rec {
|
||||||
|
# Use "busybox-sandbox-shell" if present,
|
||||||
|
# if not (legacy) fallback and hope it's sufficient.
|
||||||
|
sh = pkgs.busybox-sandbox-shell or (busybox.override {
|
||||||
|
useMusl = true;
|
||||||
|
enableStatic = true;
|
||||||
|
enableMinimal = true;
|
||||||
|
extraConfig = ''
|
||||||
|
CONFIG_FEATURE_FANCY_ECHO y
|
||||||
|
CONFIG_FEATURE_SH_MATH y
|
||||||
|
CONFIG_FEATURE_SH_MATH_64 y
|
||||||
|
|
||||||
|
CONFIG_ASH y
|
||||||
|
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
||||||
|
|
||||||
|
CONFIG_ASH_ALIAS y
|
||||||
|
CONFIG_ASH_BASH_COMPAT y
|
||||||
|
CONFIG_ASH_CMDCMD y
|
||||||
|
CONFIG_ASH_ECHO y
|
||||||
|
CONFIG_ASH_GETOPTS y
|
||||||
|
CONFIG_ASH_INTERNAL_GLOB y
|
||||||
|
CONFIG_ASH_JOB_CONTROL y
|
||||||
|
CONFIG_ASH_PRINTF y
|
||||||
|
CONFIG_ASH_TEST y
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
configureFlags =
|
||||||
|
lib.optionals stdenv.isLinux [
|
||||||
|
"--with-sandbox-shell=${sh}/bin/busybox"
|
||||||
|
];
|
||||||
|
|
||||||
|
buildDeps =
|
||||||
|
[ bison
|
||||||
|
flex
|
||||||
|
libxml2
|
||||||
|
libxslt
|
||||||
|
docbook5
|
||||||
|
docbook_xsl_ns
|
||||||
|
autoconf-archive
|
||||||
|
autoreconfHook
|
||||||
|
|
||||||
|
curl
|
||||||
|
bzip2 xz brotli zlib editline
|
||||||
|
openssl pkgconfig sqlite
|
||||||
|
libarchive
|
||||||
|
boost
|
||||||
|
(if lib.versionAtLeast lib.version "20.03pre"
|
||||||
|
then nlohmann_json
|
||||||
|
else nlohmann_json.override { multipleHeaders = true; })
|
||||||
|
nlohmann_json
|
||||||
|
rustc cargo
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
git
|
||||||
|
mercurial
|
||||||
|
jq
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.isLinux [libseccomp utillinuxMinimal]
|
||||||
|
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
|
||||||
|
++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
|
||||||
|
(aws-sdk-cpp.override {
|
||||||
|
apis = ["s3" "transfer"];
|
||||||
|
customMemoryManagement = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
propagatedDeps =
|
||||||
|
[ (boehmgc.override { enableLargeConfig = true; })
|
||||||
|
];
|
||||||
|
|
||||||
|
perlDeps =
|
||||||
|
[ perl
|
||||||
|
perlPackages.DBDSQLite
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
# A Nixpkgs overlay that overrides the 'nix' and
|
||||||
|
# 'nix.perl-bindings' packages.
|
||||||
|
overlay = final: prev: {
|
||||||
|
|
||||||
|
nix = with final; with commonDeps pkgs; (stdenv.mkDerivation {
|
||||||
|
name = "nix-${version}";
|
||||||
|
|
||||||
|
src = self;
|
||||||
|
|
||||||
|
VERSION_SUFFIX = versionSuffix;
|
||||||
|
|
||||||
|
outputs = [ "out" "dev" "doc" ];
|
||||||
|
|
||||||
|
buildInputs = buildDeps;
|
||||||
|
|
||||||
|
propagatedBuildInputs = propagatedDeps;
|
||||||
|
|
||||||
|
preConfigure =
|
||||||
|
''
|
||||||
|
# Copy libboost_context so we don't get all of Boost in our closure.
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/45462
|
||||||
|
mkdir -p $out/lib
|
||||||
|
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
||||||
|
rm -f $out/lib/*.a
|
||||||
|
${lib.optionalString stdenv.isLinux ''
|
||||||
|
chmod u+w $out/lib/*.so.*
|
||||||
|
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
||||||
|
''}
|
||||||
|
|
||||||
|
ln -sfn ${final.nixVendoredCrates}/vendor/ nix-rust/vendor
|
||||||
|
'';
|
||||||
|
|
||||||
|
configureFlags = configureFlags ++
|
||||||
|
[ "--sysconfdir=/etc" ];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
makeFlags = "profiledir=$(out)/etc/profile.d";
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
|
separateDebugInfo = true;
|
||||||
|
|
||||||
|
preDist = ''
|
||||||
|
mkdir -p $doc/nix-support
|
||||||
|
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
}) // {
|
||||||
|
|
||||||
|
perl-bindings = with final; stdenv.mkDerivation {
|
||||||
|
name = "nix-perl-${version}";
|
||||||
|
|
||||||
|
src = self;
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
[ autoconf-archive
|
||||||
|
autoreconfHook
|
||||||
|
nix
|
||||||
|
curl
|
||||||
|
bzip2
|
||||||
|
xz
|
||||||
|
pkgconfig
|
||||||
|
pkgs.perl
|
||||||
|
boost
|
||||||
|
]
|
||||||
|
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium;
|
||||||
|
|
||||||
|
configureFlags = ''
|
||||||
|
--with-dbi=${perlPackages.DBI}/${pkgs.perl.libPrefix}
|
||||||
|
--with-dbd-sqlite=${perlPackages.DBDSQLite}/${pkgs.perl.libPrefix}
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
postUnpack = "sourceRoot=$sourceRoot/perl";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create a "vendor" directory that contains the crates listed in
|
||||||
|
# Cargo.lock, and include it in the Nix tarball. This allows Nix
|
||||||
|
# to be built without network access.
|
||||||
|
nixVendoredCrates =
|
||||||
|
let
|
||||||
|
lockFile = builtins.fromTOML (builtins.readFile nix-rust/Cargo.lock);
|
||||||
|
|
||||||
|
files = map (pkg: import <nix/fetchurl.nix> {
|
||||||
|
url = "https://crates.io/api/v1/crates/${pkg.name}/${pkg.version}/download";
|
||||||
|
sha256 = lockFile.metadata."checksum ${pkg.name} ${pkg.version} (registry+https://github.com/rust-lang/crates.io-index)";
|
||||||
|
}) (builtins.filter (pkg: pkg.source or "" == "registry+https://github.com/rust-lang/crates.io-index") lockFile.package);
|
||||||
|
|
||||||
|
in final.runCommand "cargo-vendor-dir" {}
|
||||||
|
''
|
||||||
|
mkdir -p $out/vendor
|
||||||
|
|
||||||
|
cat > $out/vendor/config <<EOF
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "vendor"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
${toString (builtins.map (file: ''
|
||||||
|
mkdir $out/vendor/tmp
|
||||||
|
tar xvf ${file} -C $out/vendor/tmp
|
||||||
|
dir=$(echo $out/vendor/tmp/*)
|
||||||
|
|
||||||
|
# Add just enough metadata to keep Cargo happy.
|
||||||
|
printf '{"files":{},"package":"${file.outputHash}"}' > "$dir/.cargo-checksum.json"
|
||||||
|
|
||||||
|
# Clean up some cruft from the winapi crates. FIXME: find
|
||||||
|
# a way to remove winapi* from our dependencies.
|
||||||
|
if [[ $dir =~ /winapi ]]; then
|
||||||
|
find $dir -name "*.a" -print0 | xargs -0 rm -f --
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv "$dir" $out/vendor/
|
||||||
|
|
||||||
|
rm -rf $out/vendor/tmp
|
||||||
|
'') files)}
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
hydraJobs = {
|
||||||
|
|
||||||
|
vendoredCrates =
|
||||||
|
with nixpkgsFor.x86_64-linux;
|
||||||
|
|
||||||
|
runCommand "vendored-crates" {}
|
||||||
|
''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
name=nix-vendored-crates-${version}
|
||||||
|
fn=$out/$name.tar.xz
|
||||||
|
tar cvfJ $fn -C ${nixVendoredCrates} vendor \
|
||||||
|
--owner=0 --group=0 --mode=u+rw,uga+r \
|
||||||
|
--transform "s,vendor,$name,"
|
||||||
|
echo "file crates-tarball $fn" >> $out/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Binary package for various platforms.
|
||||||
|
build = nixpkgs.lib.genAttrs systems (system: nixpkgsFor.${system}.nix);
|
||||||
|
|
||||||
|
# Perl bindings for various platforms.
|
||||||
|
perlBindings = nixpkgs.lib.genAttrs systems (system: nixpkgsFor.${system}.nix.perl-bindings);
|
||||||
|
|
||||||
|
# Binary tarball for various platforms, containing a Nix store
|
||||||
|
# with the closure of 'nix' package, and the second half of
|
||||||
|
# the installation script.
|
||||||
|
binaryTarball = nixpkgs.lib.genAttrs systems (system:
|
||||||
|
|
||||||
|
with nixpkgsFor.${system};
|
||||||
|
|
||||||
|
let
|
||||||
|
installerClosureInfo = closureInfo { rootPaths = [ nix cacert ]; };
|
||||||
|
in
|
||||||
|
|
||||||
|
runCommand "nix-binary-tarball-${version}"
|
||||||
|
{ #nativeBuildInputs = lib.optional (system != "aarch64-linux") shellcheck;
|
||||||
|
meta.description = "Distribution-independent Nix bootstrap binaries for ${system}";
|
||||||
|
}
|
||||||
|
''
|
||||||
|
cp ${installerClosureInfo}/registration $TMPDIR/reginfo
|
||||||
|
substitute ${./scripts/install-nix-from-closure.sh} $TMPDIR/install \
|
||||||
|
--subst-var-by nix ${nix} \
|
||||||
|
--subst-var-by cacert ${cacert}
|
||||||
|
|
||||||
|
substitute ${./scripts/install-darwin-multi-user.sh} $TMPDIR/install-darwin-multi-user.sh \
|
||||||
|
--subst-var-by nix ${nix} \
|
||||||
|
--subst-var-by cacert ${cacert}
|
||||||
|
substitute ${./scripts/install-systemd-multi-user.sh} $TMPDIR/install-systemd-multi-user.sh \
|
||||||
|
--subst-var-by nix ${nix} \
|
||||||
|
--subst-var-by cacert ${cacert}
|
||||||
|
substitute ${./scripts/install-multi-user.sh} $TMPDIR/install-multi-user \
|
||||||
|
--subst-var-by nix ${nix} \
|
||||||
|
--subst-var-by cacert ${cacert}
|
||||||
|
|
||||||
|
if type -p shellcheck; then
|
||||||
|
# SC1090: Don't worry about not being able to find
|
||||||
|
# $nix/etc/profile.d/nix.sh
|
||||||
|
shellcheck --exclude SC1090 $TMPDIR/install
|
||||||
|
shellcheck $TMPDIR/install-darwin-multi-user.sh
|
||||||
|
shellcheck $TMPDIR/install-systemd-multi-user.sh
|
||||||
|
|
||||||
|
# SC1091: Don't panic about not being able to source
|
||||||
|
# /etc/profile
|
||||||
|
# SC2002: Ignore "useless cat" "error", when loading
|
||||||
|
# .reginfo, as the cat is a much cleaner
|
||||||
|
# implementation, even though it is "useless"
|
||||||
|
# SC2116: Allow ROOT_HOME=$(echo ~root) for resolving
|
||||||
|
# root's home directory
|
||||||
|
shellcheck --external-sources \
|
||||||
|
--exclude SC1091,SC2002,SC2116 $TMPDIR/install-multi-user
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x $TMPDIR/install
|
||||||
|
chmod +x $TMPDIR/install-darwin-multi-user.sh
|
||||||
|
chmod +x $TMPDIR/install-systemd-multi-user.sh
|
||||||
|
chmod +x $TMPDIR/install-multi-user
|
||||||
|
dir=nix-${version}-${system}
|
||||||
|
fn=$out/$dir.tar.xz
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file binary-dist $fn" >> $out/nix-support/hydra-build-products
|
||||||
|
tar cvfJ $fn \
|
||||||
|
--owner=0 --group=0 --mode=u+rw,uga+r \
|
||||||
|
--absolute-names \
|
||||||
|
--hard-dereference \
|
||||||
|
--transform "s,$TMPDIR/install,$dir/install," \
|
||||||
|
--transform "s,$TMPDIR/reginfo,$dir/.reginfo," \
|
||||||
|
--transform "s,$NIX_STORE,$dir/store,S" \
|
||||||
|
$TMPDIR/install $TMPDIR/install-darwin-multi-user.sh \
|
||||||
|
$TMPDIR/install-systemd-multi-user.sh \
|
||||||
|
$TMPDIR/install-multi-user $TMPDIR/reginfo \
|
||||||
|
$(cat ${installerClosureInfo}/store-paths)
|
||||||
|
'');
|
||||||
|
|
||||||
|
# The first half of the installation script. This is uploaded
|
||||||
|
# to https://nixos.org/nix/install. It downloads the binary
|
||||||
|
# tarball for the user's system and calls the second half of the
|
||||||
|
# installation script.
|
||||||
|
installerScript =
|
||||||
|
with nixpkgsFor.x86_64-linux;
|
||||||
|
runCommand "installer-script"
|
||||||
|
{ buildInputs = [ nix ];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
|
||||||
|
substitute ${./scripts/install.in} $out/install \
|
||||||
|
${pkgs.lib.concatMapStrings
|
||||||
|
(system: "--replace '@binaryTarball_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${self.hydraJobs.binaryTarball.${system}}/*.tar.xz) ")
|
||||||
|
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
|
||||||
|
} \
|
||||||
|
--replace '@nixVersion@' ${version}
|
||||||
|
|
||||||
|
echo "file installer $out/install" >> $out/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Line coverage analysis.
|
||||||
|
coverage =
|
||||||
|
with nixpkgsFor.x86_64-linux;
|
||||||
|
with commonDeps pkgs;
|
||||||
|
|
||||||
|
releaseTools.coverageAnalysis {
|
||||||
|
name = "nix-coverage-${version}";
|
||||||
|
|
||||||
|
src = self;
|
||||||
|
|
||||||
|
preConfigure =
|
||||||
|
''
|
||||||
|
ln -sfn ${nixVendoredCrates}/vendor/ nix-rust/vendor
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
buildInputs = buildDeps ++ propagatedDeps;
|
||||||
|
|
||||||
|
dontInstall = false;
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
|
lcovFilter = [ "*/boost/*" "*-tab.*" ];
|
||||||
|
|
||||||
|
# We call `dot', and even though we just use it to
|
||||||
|
# syntax-check generated dot files, it still requires some
|
||||||
|
# fonts. So provide those.
|
||||||
|
FONTCONFIG_FILE = texFunctions.fontsConf;
|
||||||
|
|
||||||
|
# To test building without precompiled headers.
|
||||||
|
makeFlagsArray = [ "PRECOMPILE_HEADERS=0" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# System tests.
|
||||||
|
tests.remoteBuilds = import ./tests/remote-builds.nix {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
inherit nixpkgs;
|
||||||
|
inherit (self) overlay;
|
||||||
|
};
|
||||||
|
|
||||||
|
tests.nix-copy-closure = import ./tests/nix-copy-closure.nix {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
inherit nixpkgs;
|
||||||
|
inherit (self) overlay;
|
||||||
|
};
|
||||||
|
|
||||||
|
tests.githubFlakes = (import ./tests/github-flakes.nix rec {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
inherit nixpkgs;
|
||||||
|
inherit (self) overlay;
|
||||||
|
});
|
||||||
|
|
||||||
|
tests.setuid = nixpkgs.lib.genAttrs
|
||||||
|
["i686-linux" "x86_64-linux"]
|
||||||
|
(system:
|
||||||
|
import ./tests/setuid.nix rec {
|
||||||
|
inherit nixpkgs system;
|
||||||
|
inherit (self) overlay;
|
||||||
|
});
|
||||||
|
|
||||||
|
# Test whether the binary tarball works in an Ubuntu system.
|
||||||
|
tests.binaryTarball =
|
||||||
|
with nixpkgsFor.x86_64-linux;
|
||||||
|
vmTools.runInLinuxImage (runCommand "nix-binary-tarball-test"
|
||||||
|
{ diskImage = vmTools.diskImages.ubuntu1204x86_64;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
set -x
|
||||||
|
useradd -m alice
|
||||||
|
su - alice -c 'tar xf ${self.hydraJobs.binaryTarball.x86_64-linux}/*.tar.*'
|
||||||
|
mkdir /dest-nix
|
||||||
|
mount -o bind /dest-nix /nix # Provide a writable /nix.
|
||||||
|
chown alice /nix
|
||||||
|
su - alice -c '_NIX_INSTALLER_TEST=1 ./nix-*/install'
|
||||||
|
su - alice -c 'nix-store --verify'
|
||||||
|
su - alice -c 'PAGER= nix-store -qR ${self.hydraJobs.build.x86_64-linux}'
|
||||||
|
|
||||||
|
# Check whether 'nix upgrade-nix' works.
|
||||||
|
cat > /tmp/paths.nix <<EOF
|
||||||
|
{
|
||||||
|
x86_64-linux = "${self.hydraJobs.build.x86_64-linux}";
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
su - alice -c 'nix --experimental-features nix-command upgrade-nix -vvv --nix-store-paths-url file:///tmp/paths.nix'
|
||||||
|
(! [ -L /home/alice/.profile-1-link ])
|
||||||
|
su - alice -c 'PAGER= nix-store -qR ${self.hydraJobs.build.x86_64-linux}'
|
||||||
|
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
touch $out/nix-support/hydra-build-products
|
||||||
|
umount /nix
|
||||||
|
'');
|
||||||
|
|
||||||
|
/*
|
||||||
|
# Check whether we can still evaluate all of Nixpkgs.
|
||||||
|
tests.evalNixpkgs =
|
||||||
|
import (nixpkgs + "/pkgs/top-level/make-tarball.nix") {
|
||||||
|
# FIXME: fix pkgs/top-level/make-tarball.nix in NixOS to not require a revCount.
|
||||||
|
inherit nixpkgs;
|
||||||
|
pkgs = nixpkgsFor.x86_64-linux;
|
||||||
|
officialRelease = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Check whether we can still evaluate NixOS.
|
||||||
|
tests.evalNixOS =
|
||||||
|
with nixpkgsFor.x86_64-linux;
|
||||||
|
runCommand "eval-nixos" { buildInputs = [ nix ]; }
|
||||||
|
''
|
||||||
|
export NIX_STATE_DIR=$TMPDIR
|
||||||
|
|
||||||
|
nix-instantiate ${nixpkgs}/nixos/release-combined.nix -A tested --dry-run \
|
||||||
|
--arg nixpkgs '{ outPath = ${nixpkgs}; revCount = 123; shortRev = "abcdefgh"; }'
|
||||||
|
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
checks = forAllSystems (system: {
|
||||||
|
binaryTarball = self.hydraJobs.binaryTarball.${system};
|
||||||
|
perlBindings = self.hydraJobs.perlBindings.${system};
|
||||||
|
});
|
||||||
|
|
||||||
|
packages = forAllSystems (system: {
|
||||||
|
inherit (nixpkgsFor.${system}) nix;
|
||||||
|
});
|
||||||
|
|
||||||
|
defaultPackage = forAllSystems (system: self.packages.${system}.nix);
|
||||||
|
|
||||||
|
devShell = forAllSystems (system:
|
||||||
|
with nixpkgsFor.${system};
|
||||||
|
with commonDeps pkgs;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "nix";
|
||||||
|
|
||||||
|
buildInputs = buildDeps ++ propagatedDeps ++ perlDeps ++ [ pkgs.rustfmt ];
|
||||||
|
|
||||||
|
inherit configureFlags;
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
|
shellHook =
|
||||||
|
''
|
||||||
|
export prefix=$(pwd)/inst
|
||||||
|
configureFlags+=" --prefix=$prefix"
|
||||||
|
PKG_CONFIG_PATH=$prefix/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
PATH=$prefix/bin:$PATH
|
||||||
|
unset PYTHONPATH
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,11 +2,15 @@ ifeq ($(MAKECMDGOALS), dist)
|
|||||||
dist-files += $(shell cat .dist-files)
|
dist-files += $(shell cat .dist-files)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dist-files += configure config.h.in nix.spec perl/configure
|
dist-files += configure config.h.in perl/configure
|
||||||
|
|
||||||
clean-files += Makefile.config
|
clean-files += Makefile.config
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr -I src/nix
|
GLOBAL_CXXFLAGS += -Wno-deprecated-declarations
|
||||||
|
|
||||||
$(foreach i, config.h $(call rwildcard, src/lib*, *.hh), \
|
$(foreach i, config.h $(wildcard src/lib*/*.hh), \
|
||||||
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
||||||
|
|
||||||
|
$(GCH) $(PCH): src/libutil/util.hh config.h
|
||||||
|
|
||||||
|
GCH_CXXFLAGS = -I src/libutil
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i perl -p perl perlPackages.LWPUserAgent perlPackages.LWPProtocolHttps perlPackages.FileSlurp gnupg1
|
#! nix-shell -i perl -p perl perlPackages.LWPUserAgent perlPackages.LWPProtocolHttps perlPackages.FileSlurp perlPackages.NetAmazonS3 gnupg1
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
@@ -9,12 +9,16 @@ use File::Slurp;
|
|||||||
use File::Copy;
|
use File::Copy;
|
||||||
use JSON::PP;
|
use JSON::PP;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
|
use Net::Amazon::S3;
|
||||||
|
|
||||||
my $evalId = $ARGV[0] or die "Usage: $0 EVAL-ID\n";
|
my $evalId = $ARGV[0] or die "Usage: $0 EVAL-ID\n";
|
||||||
|
|
||||||
my $releasesDir = "/home/eelco/mnt/releases";
|
my $releasesBucketName = "nix-releases";
|
||||||
|
my $channelsBucketName = "nix-channels";
|
||||||
my $nixpkgsDir = "/home/eelco/Dev/nixpkgs-pristine";
|
my $nixpkgsDir = "/home/eelco/Dev/nixpkgs-pristine";
|
||||||
|
|
||||||
|
my $TMPDIR = $ENV{'TMPDIR'} // "/tmp";
|
||||||
|
|
||||||
# FIXME: cut&paste from nixos-channel-scripts.
|
# FIXME: cut&paste from nixos-channel-scripts.
|
||||||
sub fetch {
|
sub fetch {
|
||||||
my ($url, $type) = @_;
|
my ($url, $type) = @_;
|
||||||
@@ -42,13 +46,31 @@ my $version = $1;
|
|||||||
|
|
||||||
print STDERR "Nix revision is $nixRev, version is $version\n";
|
print STDERR "Nix revision is $nixRev, version is $version\n";
|
||||||
|
|
||||||
File::Path::make_path($releasesDir);
|
my $releaseDir = "nix/$releaseName";
|
||||||
if (system("mountpoint -q $releasesDir") != 0) {
|
|
||||||
system("sshfs hydra-mirror:/releases $releasesDir") == 0 or die;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $releaseDir = "$releasesDir/nix/$releaseName";
|
my $tmpDir = "$TMPDIR/nix-release/$releaseName";
|
||||||
File::Path::make_path($releaseDir);
|
File::Path::make_path($tmpDir);
|
||||||
|
|
||||||
|
# S3 setup.
|
||||||
|
my $aws_access_key_id = $ENV{'AWS_ACCESS_KEY_ID'} or die "No AWS_ACCESS_KEY_ID given.";
|
||||||
|
my $aws_secret_access_key = $ENV{'AWS_SECRET_ACCESS_KEY'} or die "No AWS_SECRET_ACCESS_KEY given.";
|
||||||
|
|
||||||
|
my $s3 = Net::Amazon::S3->new(
|
||||||
|
{ aws_access_key_id => $aws_access_key_id,
|
||||||
|
aws_secret_access_key => $aws_secret_access_key,
|
||||||
|
retry => 1,
|
||||||
|
host => "s3-eu-west-1.amazonaws.com",
|
||||||
|
});
|
||||||
|
|
||||||
|
my $releasesBucket = $s3->bucket($releasesBucketName) or die;
|
||||||
|
|
||||||
|
my $s3_us = Net::Amazon::S3->new(
|
||||||
|
{ aws_access_key_id => $aws_access_key_id,
|
||||||
|
aws_secret_access_key => $aws_secret_access_key,
|
||||||
|
retry => 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
my $channelsBucket = $s3_us->bucket($channelsBucketName) or die;
|
||||||
|
|
||||||
sub downloadFile {
|
sub downloadFile {
|
||||||
my ($jobName, $productNr, $dstName) = @_;
|
my ($jobName, $productNr, $dstName) = @_;
|
||||||
@@ -57,40 +79,49 @@ sub downloadFile {
|
|||||||
|
|
||||||
my $srcFile = $buildInfo->{buildproducts}->{$productNr}->{path} or die "job '$jobName' lacks product $productNr\n";
|
my $srcFile = $buildInfo->{buildproducts}->{$productNr}->{path} or die "job '$jobName' lacks product $productNr\n";
|
||||||
$dstName //= basename($srcFile);
|
$dstName //= basename($srcFile);
|
||||||
my $dstFile = "$releaseDir/" . $dstName;
|
my $tmpFile = "$tmpDir/$dstName";
|
||||||
|
|
||||||
if (! -e $dstFile) {
|
if (!-e $tmpFile) {
|
||||||
print STDERR "downloading $srcFile to $dstFile...\n";
|
print STDERR "downloading $srcFile to $tmpFile...\n";
|
||||||
system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$dstFile.tmp'") == 0
|
system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$tmpFile'") == 0
|
||||||
or die "unable to fetch $srcFile\n";
|
or die "unable to fetch $srcFile\n";
|
||||||
rename("$dstFile.tmp", $dstFile) or die;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sha256_expected = $buildInfo->{buildproducts}->{$productNr}->{sha256hash} or die;
|
my $sha256_expected = $buildInfo->{buildproducts}->{$productNr}->{sha256hash} or die;
|
||||||
my $sha256_actual = `nix hash-file --base16 --type sha256 '$dstFile'`;
|
my $sha256_actual = `nix hash-file --base16 --type sha256 '$tmpFile'`;
|
||||||
chomp $sha256_actual;
|
chomp $sha256_actual;
|
||||||
if ($sha256_expected ne $sha256_actual) {
|
if ($sha256_expected ne $sha256_actual) {
|
||||||
print STDERR "file $dstFile is corrupt, got $sha256_actual, expected $sha256_expected\n";
|
print STDERR "file $tmpFile is corrupt, got $sha256_actual, expected $sha256_expected\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_file("$dstFile.sha256", $sha256_expected);
|
write_file("$tmpFile.sha256", $sha256_expected);
|
||||||
|
|
||||||
if (! -e "$dstFile.asc") {
|
if (! -e "$tmpFile.asc") {
|
||||||
system("gpg2 --detach-sign --armor $dstFile") == 0 or die "unable to sign $dstFile\n";
|
system("gpg2 --detach-sign --armor $tmpFile") == 0 or die "unable to sign $tmpFile\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($dstFile, $sha256_expected);
|
return $sha256_expected;
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFile("tarball", "2"); # .tar.bz2
|
downloadFile("tarball", "2"); # .tar.bz2
|
||||||
my ($tarball, $tarballHash) = downloadFile("tarball", "3"); # .tar.xz
|
my $tarballHash = downloadFile("tarball", "3"); # .tar.xz
|
||||||
downloadFile("binaryTarball.i686-linux", "1");
|
downloadFile("binaryTarball.i686-linux", "1");
|
||||||
downloadFile("binaryTarball.x86_64-linux", "1");
|
downloadFile("binaryTarball.x86_64-linux", "1");
|
||||||
downloadFile("binaryTarball.aarch64-linux", "1");
|
downloadFile("binaryTarball.aarch64-linux", "1");
|
||||||
downloadFile("binaryTarball.x86_64-darwin", "1");
|
downloadFile("binaryTarball.x86_64-darwin", "1");
|
||||||
downloadFile("installerScript", "1");
|
downloadFile("installerScript", "1");
|
||||||
|
|
||||||
|
for my $fn (glob "$tmpDir/*") {
|
||||||
|
my $name = basename($fn);
|
||||||
|
my $dstKey = "$releaseDir/" . $name;
|
||||||
|
unless (defined $releasesBucket->head_key($dstKey)) {
|
||||||
|
print STDERR "uploading $fn to s3://$releasesBucketName/$dstKey...\n";
|
||||||
|
$releasesBucket->add_key_filename($dstKey, $fn)
|
||||||
|
or die $releasesBucket->err . ": " . $releasesBucket->errstr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exit if $version =~ /pre/;
|
exit if $version =~ /pre/;
|
||||||
|
|
||||||
# Update Nixpkgs in a very hacky way.
|
# Update Nixpkgs in a very hacky way.
|
||||||
@@ -125,18 +156,11 @@ write_file("$nixpkgsDir/nixos/modules/installer/tools/nix-fallback-paths.nix",
|
|||||||
|
|
||||||
system("cd $nixpkgsDir && git commit -a -m 'nix: $oldName -> $version'") == 0 or die;
|
system("cd $nixpkgsDir && git commit -a -m 'nix: $oldName -> $version'") == 0 or die;
|
||||||
|
|
||||||
# Extract the HTML manual.
|
|
||||||
File::Path::make_path("$releaseDir/manual");
|
|
||||||
|
|
||||||
system("tar xvf $tarball --strip-components=3 -C $releaseDir/manual --wildcards '*/doc/manual/*.html' '*/doc/manual/*.css' '*/doc/manual/*.gif' '*/doc/manual/*.png'") == 0 or die;
|
|
||||||
|
|
||||||
if (! -e "$releaseDir/manual/index.html") {
|
|
||||||
symlink("manual.html", "$releaseDir/manual/index.html") or die;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update the "latest" symlink.
|
# Update the "latest" symlink.
|
||||||
symlink("$releaseName", "$releasesDir/nix/latest-tmp") or die;
|
$channelsBucket->add_key(
|
||||||
rename("$releasesDir/nix/latest-tmp", "$releasesDir/nix/latest") or die;
|
"nix-latest/install", "",
|
||||||
|
{ "x-amz-website-redirect-location" => "https://releases.nixos.org/$releaseDir/install" })
|
||||||
|
or die $channelsBucket->err . ": " . $channelsBucket->errstr;
|
||||||
|
|
||||||
# Tag the release in Git.
|
# Tag the release in Git.
|
||||||
chdir("/home/eelco/Dev/nix-pristine") or die;
|
chdir("/home/eelco/Dev/nix-pristine") or die;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
function _complete_nix {
|
||||||
|
local -a words
|
||||||
|
local cword cur
|
||||||
|
_get_comp_words_by_ref -n ':=&' words cword cur
|
||||||
|
local have_type
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ -z $have_type ]]; then
|
||||||
|
have_type=1
|
||||||
|
if [[ $line = filenames ]]; then
|
||||||
|
compopt -o filenames
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
COMPREPLY+=("$line")
|
||||||
|
fi
|
||||||
|
done < <(NIX_GET_COMPLETIONS=$cword "${words[@]}")
|
||||||
|
__ltrim_colon_completions "$cur"
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _complete_nix nix
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
$(eval $(call install-file-as, $(d)/completion.sh, $(datarootdir)/bash-completion/completions/_nix3, 0644))
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
$(buildprefix)%.o: %.cc
|
$(buildprefix)%.o: %.cc
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
|
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS_PCH) $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
|
||||||
|
|
||||||
$(buildprefix)%.o: %.cpp
|
$(buildprefix)%.o: %.cpp
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
|
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS_PCH) $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
|
||||||
|
|
||||||
$(buildprefix)%.o: %.c
|
$(buildprefix)%.o: %.c
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
PRECOMPILE_HEADERS ?= 1
|
||||||
|
|
||||||
|
print-var-help += \
|
||||||
|
echo " PRECOMPILE_HEADERS ($(PRECOMPILE_HEADERS)): Whether to use precompiled headers to speed up the build";
|
||||||
|
|
||||||
|
GCH = $(buildprefix)precompiled-headers.h.gch
|
||||||
|
|
||||||
|
$(GCH): precompiled-headers.h
|
||||||
|
@rm -f $@
|
||||||
|
@mkdir -p "$(dir $@)"
|
||||||
|
$(trace-gen) $(CXX) -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS) $(GCH_CXXFLAGS)
|
||||||
|
|
||||||
|
PCH = $(buildprefix)precompiled-headers.h.pch
|
||||||
|
|
||||||
|
$(PCH): precompiled-headers.h
|
||||||
|
@rm -f $@
|
||||||
|
@mkdir -p "$(dir $@)"
|
||||||
|
$(trace-gen) $(CXX) -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS) $(GCH_CXXFLAGS)
|
||||||
|
|
||||||
|
clean-files += $(GCH) $(PCH)
|
||||||
|
|
||||||
|
ifeq ($(PRECOMPILE_HEADERS), 1)
|
||||||
|
|
||||||
|
ifeq ($(CXX), g++)
|
||||||
|
|
||||||
|
GLOBAL_CXXFLAGS_PCH += -include $(buildprefix)precompiled-headers.h -Winvalid-pch
|
||||||
|
|
||||||
|
GLOBAL_ORDER_AFTER += $(GCH)
|
||||||
|
|
||||||
|
else ifeq ($(CXX), clang++)
|
||||||
|
|
||||||
|
GLOBAL_CXXFLAGS_PCH += -include-pch $(PCH) -Winvalid-pch
|
||||||
|
|
||||||
|
GLOBAL_ORDER_AFTER += $(PCH)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
$(error Don't know how to precompile headers on $(CXX))
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -0,0 +1,399 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "assert_matches"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-set"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-vec"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "c2-chacha"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "0.1.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cloudabi"
|
||||||
|
version = "0.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fuchsia-cprng"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.66"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix-rust"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proptest"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rusty-fork 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-error"
|
||||||
|
version = "1.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_hc"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_hc"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_isaac"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_jitter"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_os"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_pcg"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_xorshift"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rdrand"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.1.56"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.6.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "remove_dir_all"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rusty-fork"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempfile"
|
||||||
|
version = "3.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wait-timeout"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5"
|
||||||
|
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||||
|
"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80"
|
||||||
|
"checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb"
|
||||||
|
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
|
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||||
|
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
|
||||||
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||||
|
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||||
|
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||||
|
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
|
||||||
|
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||||
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||||
|
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
|
||||||
|
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
||||||
|
"checksum proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf147e022eacf0c8a054ab864914a7602618adba841d800a9a9868a5237a529f"
|
||||||
|
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
||||||
|
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||||
|
"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
|
||||||
|
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||||
|
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||||
|
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||||
|
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||||
|
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||||
|
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||||
|
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||||
|
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||||
|
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||||
|
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
||||||
|
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
|
||||||
|
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
|
||||||
|
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||||
|
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||||
|
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
|
||||||
|
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
|
||||||
|
"checksum rusty-fork 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd93264e10c577503e926bd1430193eeb5d21b059148910082245309b424fae"
|
||||||
|
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||||
|
"checksum wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
|
||||||
|
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
|
||||||
|
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||||
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
[package]
|
||||||
|
name = "nix-rust"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Eelco Dolstra <edolstra@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "nixrust"
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libc = "0.2"
|
||||||
|
#futures-preview = { version = "=0.3.0-alpha.19" }
|
||||||
|
#hyper = "0.13.0-alpha.4"
|
||||||
|
#http = "0.1"
|
||||||
|
#tokio = { version = "0.2.0-alpha.6", default-features = false, features = ["rt-full"] }
|
||||||
|
lazy_static = "1.4"
|
||||||
|
#byteorder = "1.3"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
hex = "0.3"
|
||||||
|
assert_matches = "1.3"
|
||||||
|
proptest = "0.9"
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
ifeq ($(OPTIMIZE), 1)
|
||||||
|
RUST_MODE = --release
|
||||||
|
RUST_DIR = release
|
||||||
|
else
|
||||||
|
RUST_MODE =
|
||||||
|
RUST_DIR = debug
|
||||||
|
endif
|
||||||
|
|
||||||
|
libnixrust_PATH := $(d)/target/$(RUST_DIR)/libnixrust.$(SO_EXT)
|
||||||
|
libnixrust_INSTALL_PATH := $(libdir)/libnixrust.$(SO_EXT)
|
||||||
|
libnixrust_LDFLAGS_USE := -L$(d)/target/$(RUST_DIR) -lnixrust -ldl
|
||||||
|
libnixrust_LDFLAGS_USE_INSTALLED := -L$(libdir) -lnixrust -ldl
|
||||||
|
|
||||||
|
ifeq ($(OS), Darwin)
|
||||||
|
libnixrust_BUILD_FLAGS = NIX_LDFLAGS="-undefined dynamic_lookup"
|
||||||
|
else
|
||||||
|
libnixrust_LDFLAGS_USE += -Wl,-rpath,$(abspath $(d)/target/$(RUST_DIR))
|
||||||
|
libnixrust_LDFLAGS_USE_INSTALLED += -Wl,-rpath,$(libdir)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(libnixrust_PATH): $(call rwildcard, $(d)/src, *.rs) $(d)/Cargo.toml
|
||||||
|
$(trace-gen) cd nix-rust && CARGO_HOME=$$(if [[ -d vendor ]]; then echo vendor; fi) \
|
||||||
|
$(libnixrust_BUILD_FLAGS) \
|
||||||
|
cargo build $(RUST_MODE) $$(if [[ -d vendor ]]; then echo --offline; fi) \
|
||||||
|
&& touch target/$(RUST_DIR)/libnixrust.$(SO_EXT)
|
||||||
|
|
||||||
|
$(libnixrust_INSTALL_PATH): $(libnixrust_PATH)
|
||||||
|
$(target-gen) cp $^ $@
|
||||||
|
ifeq ($(OS), Darwin)
|
||||||
|
install_name_tool -id $@ $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
dist-files += $(d)/vendor
|
||||||
|
|
||||||
|
clean: clean-rust
|
||||||
|
|
||||||
|
clean-rust:
|
||||||
|
$(suppress) rm -rfv nix-rust/target
|
||||||
|
|
||||||
|
ifneq ($(OS), Darwin)
|
||||||
|
check: rust-tests
|
||||||
|
|
||||||
|
rust-tests:
|
||||||
|
cd nix-rust && CARGO_HOME=$$(if [[ -d vendor ]]; then echo vendor; fi) cargo test --release $$(if [[ -d vendor ]]; then echo --offline; fi)
|
||||||
|
endif
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
use super::{error, store::path, store::StorePath, util};
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn ffi_String_new(s: &str, out: *mut String) {
|
||||||
|
// FIXME: check whether 's' is valid UTF-8?
|
||||||
|
out.write(s.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn ffi_String_drop(self_: *mut String) {
|
||||||
|
std::ptr::drop_in_place(self_);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_new(
|
||||||
|
path: &str,
|
||||||
|
store_dir: &str,
|
||||||
|
) -> Result<StorePath, error::CppException> {
|
||||||
|
StorePath::new(std::path::Path::new(path), std::path::Path::new(store_dir))
|
||||||
|
.map_err(|err| err.into())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_new2(
|
||||||
|
hash: &[u8; crate::store::path::STORE_PATH_HASH_BYTES],
|
||||||
|
name: &str,
|
||||||
|
) -> Result<StorePath, error::CppException> {
|
||||||
|
StorePath::from_parts(*hash, name).map_err(|err| err.into())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_fromBaseName(
|
||||||
|
base_name: &str,
|
||||||
|
) -> Result<StorePath, error::CppException> {
|
||||||
|
StorePath::new_from_base_name(base_name).map_err(|err| err.into())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn ffi_StorePath_drop(self_: *mut StorePath) {
|
||||||
|
std::ptr::drop_in_place(self_);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_to_string(self_: &StorePath) -> Vec<u8> {
|
||||||
|
let mut buf = vec![0; path::STORE_PATH_HASH_CHARS + 1 + self_.name.name().len()];
|
||||||
|
util::base32::encode_into(self_.hash.hash(), &mut buf[0..path::STORE_PATH_HASH_CHARS]);
|
||||||
|
buf[path::STORE_PATH_HASH_CHARS] = b'-';
|
||||||
|
buf[path::STORE_PATH_HASH_CHARS + 1..].clone_from_slice(self_.name.name().as_bytes());
|
||||||
|
buf
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_less_than(a: &StorePath, b: &StorePath) -> bool {
|
||||||
|
a < b
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_eq(a: &StorePath, b: &StorePath) -> bool {
|
||||||
|
a == b
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_clone(self_: &StorePath) -> StorePath {
|
||||||
|
self_.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_name(self_: &StorePath) -> &str {
|
||||||
|
self_.name.name()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn ffi_StorePath_hash_data(
|
||||||
|
self_: &StorePath,
|
||||||
|
) -> &[u8; crate::store::path::STORE_PATH_HASH_BYTES] {
|
||||||
|
self_.hash.hash()
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Error {
|
||||||
|
InvalidPath(crate::store::StorePath),
|
||||||
|
BadStorePath(std::path::PathBuf),
|
||||||
|
NotInStore(std::path::PathBuf),
|
||||||
|
BadNarInfo,
|
||||||
|
BadBase32,
|
||||||
|
StorePathNameEmpty,
|
||||||
|
StorePathNameTooLong,
|
||||||
|
BadStorePathName,
|
||||||
|
NarSizeFieldTooBig,
|
||||||
|
BadNarString,
|
||||||
|
BadNarPadding,
|
||||||
|
BadNarVersionMagic,
|
||||||
|
MissingNarOpenTag,
|
||||||
|
MissingNarCloseTag,
|
||||||
|
MissingNarField,
|
||||||
|
BadNarField(String),
|
||||||
|
BadExecutableField,
|
||||||
|
IOError(std::io::Error),
|
||||||
|
#[cfg(unused)]
|
||||||
|
HttpError(hyper::error::Error),
|
||||||
|
Misc(String),
|
||||||
|
#[cfg(not(test))]
|
||||||
|
Foreign(CppException),
|
||||||
|
BadTarFileMemberName(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<std::io::Error> for Error {
|
||||||
|
fn from(err: std::io::Error) -> Self {
|
||||||
|
Error::IOError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(unused)]
|
||||||
|
impl From<hyper::error::Error> for Error {
|
||||||
|
fn from(err: hyper::error::Error) -> Self {
|
||||||
|
Error::HttpError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Error {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Error::InvalidPath(_) => write!(f, "invalid path"),
|
||||||
|
Error::BadNarInfo => write!(f, ".narinfo file is corrupt"),
|
||||||
|
Error::BadStorePath(path) => write!(f, "path '{}' is not a store path", path.display()),
|
||||||
|
Error::NotInStore(path) => {
|
||||||
|
write!(f, "path '{}' is not in the Nix store", path.display())
|
||||||
|
}
|
||||||
|
Error::BadBase32 => write!(f, "invalid base32 string"),
|
||||||
|
Error::StorePathNameEmpty => write!(f, "store path name is empty"),
|
||||||
|
Error::StorePathNameTooLong => {
|
||||||
|
write!(f, "store path name is longer than 211 characters")
|
||||||
|
}
|
||||||
|
Error::BadStorePathName => write!(f, "store path name contains forbidden character"),
|
||||||
|
Error::NarSizeFieldTooBig => write!(f, "size field in NAR is too big"),
|
||||||
|
Error::BadNarString => write!(f, "NAR string is not valid UTF-8"),
|
||||||
|
Error::BadNarPadding => write!(f, "NAR padding is not zero"),
|
||||||
|
Error::BadNarVersionMagic => write!(f, "unsupported NAR version"),
|
||||||
|
Error::MissingNarOpenTag => write!(f, "NAR open tag is missing"),
|
||||||
|
Error::MissingNarCloseTag => write!(f, "NAR close tag is missing"),
|
||||||
|
Error::MissingNarField => write!(f, "expected NAR field is missing"),
|
||||||
|
Error::BadNarField(s) => write!(f, "unrecognized NAR field '{}'", s),
|
||||||
|
Error::BadExecutableField => write!(f, "bad 'executable' field in NAR"),
|
||||||
|
Error::IOError(err) => write!(f, "I/O error: {}", err),
|
||||||
|
#[cfg(unused)]
|
||||||
|
Error::HttpError(err) => write!(f, "HTTP error: {}", err),
|
||||||
|
#[cfg(not(test))]
|
||||||
|
Error::Foreign(_) => write!(f, "<C++ exception>"), // FIXME
|
||||||
|
Error::Misc(s) => write!(f, "{}", s),
|
||||||
|
Error::BadTarFileMemberName(s) => {
|
||||||
|
write!(f, "tar archive contains illegal file name '{}'", s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
impl From<Error> for CppException {
|
||||||
|
fn from(err: Error) -> Self {
|
||||||
|
match err {
|
||||||
|
Error::Foreign(ex) => ex,
|
||||||
|
_ => CppException::new(&err.to_string()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct CppException(*const libc::c_void); // == std::exception_ptr*
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
impl CppException {
|
||||||
|
fn new(s: &str) -> Self {
|
||||||
|
Self(unsafe { make_error(s) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
impl Drop for CppException {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
destroy_error(self.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
extern "C" {
|
||||||
|
#[allow(improper_ctypes)] // YOLO
|
||||||
|
fn make_error(s: &str) -> *const libc::c_void;
|
||||||
|
|
||||||
|
fn destroy_error(exc: *const libc::c_void);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#[cfg(not(test))]
|
||||||
|
mod c;
|
||||||
|
mod error;
|
||||||
|
#[cfg(unused)]
|
||||||
|
mod nar;
|
||||||
|
mod store;
|
||||||
|
mod util;
|
||||||
|
|
||||||
|
pub use error::Error;
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
use crate::Error;
|
||||||
|
use byteorder::{LittleEndian, ReadBytesExt};
|
||||||
|
use std::convert::TryFrom;
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
pub fn parse<R: Read>(input: &mut R) -> Result<(), Error> {
|
||||||
|
if String::read(input)? != NAR_VERSION_MAGIC {
|
||||||
|
return Err(Error::BadNarVersionMagic);
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_file(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
const NAR_VERSION_MAGIC: &str = "nix-archive-1";
|
||||||
|
|
||||||
|
fn parse_file<R: Read>(input: &mut R) -> Result<(), Error> {
|
||||||
|
if String::read(input)? != "(" {
|
||||||
|
return Err(Error::MissingNarOpenTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if String::read(input)? != "type" {
|
||||||
|
return Err(Error::MissingNarField);
|
||||||
|
}
|
||||||
|
|
||||||
|
match String::read(input)?.as_ref() {
|
||||||
|
"regular" => {
|
||||||
|
let mut _executable = false;
|
||||||
|
let mut tag = String::read(input)?;
|
||||||
|
if tag == "executable" {
|
||||||
|
_executable = true;
|
||||||
|
if String::read(input)? != "" {
|
||||||
|
return Err(Error::BadExecutableField);
|
||||||
|
}
|
||||||
|
tag = String::read(input)?;
|
||||||
|
}
|
||||||
|
if tag != "contents" {
|
||||||
|
return Err(Error::MissingNarField);
|
||||||
|
}
|
||||||
|
let _contents = Vec::<u8>::read(input)?;
|
||||||
|
if String::read(input)? != ")" {
|
||||||
|
return Err(Error::MissingNarCloseTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"directory" => loop {
|
||||||
|
match String::read(input)?.as_ref() {
|
||||||
|
"entry" => {
|
||||||
|
if String::read(input)? != "(" {
|
||||||
|
return Err(Error::MissingNarOpenTag);
|
||||||
|
}
|
||||||
|
if String::read(input)? != "name" {
|
||||||
|
return Err(Error::MissingNarField);
|
||||||
|
}
|
||||||
|
let _name = String::read(input)?;
|
||||||
|
if String::read(input)? != "node" {
|
||||||
|
return Err(Error::MissingNarField);
|
||||||
|
}
|
||||||
|
parse_file(input)?;
|
||||||
|
let tag = String::read(input)?;
|
||||||
|
if tag != ")" {
|
||||||
|
return Err(Error::MissingNarCloseTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
")" => break,
|
||||||
|
s => return Err(Error::BadNarField(s.into())),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"symlink" => {
|
||||||
|
if String::read(input)? != "target" {
|
||||||
|
return Err(Error::MissingNarField);
|
||||||
|
}
|
||||||
|
let _target = String::read(input)?;
|
||||||
|
if String::read(input)? != ")" {
|
||||||
|
return Err(Error::MissingNarCloseTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s => return Err(Error::BadNarField(s.into())),
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Deserialize: Sized {
|
||||||
|
fn read<R: Read>(input: &mut R) -> Result<Self, Error>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deserialize for String {
|
||||||
|
fn read<R: Read>(input: &mut R) -> Result<Self, Error> {
|
||||||
|
let buf = Deserialize::read(input)?;
|
||||||
|
Ok(String::from_utf8(buf).map_err(|_| Error::BadNarString)?)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deserialize for Vec<u8> {
|
||||||
|
fn read<R: Read>(input: &mut R) -> Result<Self, Error> {
|
||||||
|
let n: usize = Deserialize::read(input)?;
|
||||||
|
let mut buf = vec![0; n];
|
||||||
|
input.read_exact(&mut buf)?;
|
||||||
|
skip_padding(input, n)?;
|
||||||
|
Ok(buf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn skip_padding<R: Read>(input: &mut R, len: usize) -> Result<(), Error> {
|
||||||
|
if len % 8 != 0 {
|
||||||
|
let mut buf = [0; 8];
|
||||||
|
let buf = &mut buf[0..8 - (len % 8)];
|
||||||
|
input.read_exact(buf)?;
|
||||||
|
if !buf.iter().all(|b| *b == 0) {
|
||||||
|
return Err(Error::BadNarPadding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deserialize for u64 {
|
||||||
|
fn read<R: Read>(input: &mut R) -> Result<Self, Error> {
|
||||||
|
Ok(input.read_u64::<LittleEndian>()?)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deserialize for usize {
|
||||||
|
fn read<R: Read>(input: &mut R) -> Result<Self, Error> {
|
||||||
|
let n: u64 = Deserialize::read(input)?;
|
||||||
|
Ok(usize::try_from(n).map_err(|_| Error::NarSizeFieldTooBig)?)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
use super::{PathInfo, Store, StorePath};
|
||||||
|
use crate::Error;
|
||||||
|
use hyper::client::Client;
|
||||||
|
|
||||||
|
pub struct BinaryCacheStore {
|
||||||
|
base_uri: String,
|
||||||
|
client: Client<hyper::client::HttpConnector, hyper::Body>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BinaryCacheStore {
|
||||||
|
pub fn new(base_uri: String) -> Self {
|
||||||
|
Self {
|
||||||
|
base_uri,
|
||||||
|
client: Client::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Store for BinaryCacheStore {
|
||||||
|
fn query_path_info(
|
||||||
|
&self,
|
||||||
|
path: &StorePath,
|
||||||
|
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<PathInfo, Error>> + Send>> {
|
||||||
|
let uri = format!("{}/{}.narinfo", self.base_uri.clone(), path.hash);
|
||||||
|
let path = path.clone();
|
||||||
|
let client = self.client.clone();
|
||||||
|
let store_dir = self.store_dir().to_string();
|
||||||
|
|
||||||
|
Box::pin(async move {
|
||||||
|
let response = client.get(uri.parse::<hyper::Uri>().unwrap()).await?;
|
||||||
|
|
||||||
|
if response.status() == hyper::StatusCode::NOT_FOUND
|
||||||
|
|| response.status() == hyper::StatusCode::FORBIDDEN
|
||||||
|
{
|
||||||
|
return Err(Error::InvalidPath(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut body = response.into_body();
|
||||||
|
|
||||||
|
let mut bytes = Vec::new();
|
||||||
|
while let Some(next) = body.next().await {
|
||||||
|
bytes.extend(next?);
|
||||||
|
}
|
||||||
|
|
||||||
|
PathInfo::parse_nar_info(std::str::from_utf8(&bytes).unwrap(), &store_dir)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
pub mod path;
|
||||||
|
|
||||||
|
#[cfg(unused)]
|
||||||
|
mod binary_cache_store;
|
||||||
|
#[cfg(unused)]
|
||||||
|
mod path_info;
|
||||||
|
#[cfg(unused)]
|
||||||
|
mod store;
|
||||||
|
|
||||||
|
pub use path::{StorePath, StorePathHash, StorePathName};
|
||||||
|
|
||||||
|
#[cfg(unused)]
|
||||||
|
pub use binary_cache_store::BinaryCacheStore;
|
||||||
|
#[cfg(unused)]
|
||||||
|
pub use path_info::PathInfo;
|
||||||
|
#[cfg(unused)]
|
||||||
|
pub use store::Store;
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
use crate::error::Error;
|
||||||
|
use crate::util::base32;
|
||||||
|
use std::fmt;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||||
|
pub struct StorePath {
|
||||||
|
pub hash: StorePathHash,
|
||||||
|
pub name: StorePathName,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const STORE_PATH_HASH_BYTES: usize = 20;
|
||||||
|
pub const STORE_PATH_HASH_CHARS: usize = 32;
|
||||||
|
|
||||||
|
impl StorePath {
|
||||||
|
pub fn new(path: &Path, store_dir: &Path) -> Result<Self, Error> {
|
||||||
|
if path.parent() != Some(store_dir) {
|
||||||
|
return Err(Error::NotInStore(path.into()));
|
||||||
|
}
|
||||||
|
Self::new_from_base_name(
|
||||||
|
path.file_name()
|
||||||
|
.ok_or(Error::BadStorePath(path.into()))?
|
||||||
|
.to_str()
|
||||||
|
.ok_or(Error::BadStorePath(path.into()))?,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_parts(hash: [u8; STORE_PATH_HASH_BYTES], name: &str) -> Result<Self, Error> {
|
||||||
|
Ok(StorePath {
|
||||||
|
hash: StorePathHash(hash),
|
||||||
|
name: StorePathName::new(name)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_from_base_name(base_name: &str) -> Result<Self, Error> {
|
||||||
|
if base_name.len() < STORE_PATH_HASH_CHARS + 1
|
||||||
|
|| base_name.as_bytes()[STORE_PATH_HASH_CHARS] != '-' as u8
|
||||||
|
{
|
||||||
|
return Err(Error::BadStorePath(base_name.into()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(StorePath {
|
||||||
|
hash: StorePathHash::new(&base_name[0..STORE_PATH_HASH_CHARS])?,
|
||||||
|
name: StorePathName::new(&base_name[STORE_PATH_HASH_CHARS + 1..])?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for StorePath {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}-{}", self.hash, self.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
|
pub struct StorePathHash([u8; STORE_PATH_HASH_BYTES]);
|
||||||
|
|
||||||
|
impl StorePathHash {
|
||||||
|
pub fn new(s: &str) -> Result<Self, Error> {
|
||||||
|
assert_eq!(s.len(), STORE_PATH_HASH_CHARS);
|
||||||
|
let v = base32::decode(s)?;
|
||||||
|
assert_eq!(v.len(), STORE_PATH_HASH_BYTES);
|
||||||
|
let mut bytes: [u8; 20] = Default::default();
|
||||||
|
bytes.copy_from_slice(&v[0..STORE_PATH_HASH_BYTES]);
|
||||||
|
Ok(Self(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn hash<'a>(&'a self) -> &'a [u8; STORE_PATH_HASH_BYTES] {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for StorePathHash {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let mut buf = vec![0; STORE_PATH_HASH_CHARS];
|
||||||
|
base32::encode_into(&self.0, &mut buf);
|
||||||
|
f.write_str(std::str::from_utf8(&buf).unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ord for StorePathHash {
|
||||||
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
|
// Historically we've sorted store paths by their base32
|
||||||
|
// serialization, but our base32 encodes bytes in reverse
|
||||||
|
// order. So compare them in reverse order as well.
|
||||||
|
self.0.iter().rev().cmp(other.0.iter().rev())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for StorePathHash {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||||
|
pub struct StorePathName(String);
|
||||||
|
|
||||||
|
impl StorePathName {
|
||||||
|
pub fn new(s: &str) -> Result<Self, Error> {
|
||||||
|
if s.len() == 0 {
|
||||||
|
return Err(Error::StorePathNameEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.len() > 211 {
|
||||||
|
return Err(Error::StorePathNameTooLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.starts_with('.')
|
||||||
|
|| !s.chars().all(|c| {
|
||||||
|
c.is_ascii_alphabetic()
|
||||||
|
|| c.is_ascii_digit()
|
||||||
|
|| c == '+'
|
||||||
|
|| c == '-'
|
||||||
|
|| c == '.'
|
||||||
|
|| c == '_'
|
||||||
|
|| c == '?'
|
||||||
|
|| c == '='
|
||||||
|
})
|
||||||
|
{
|
||||||
|
return Err(Error::BadStorePathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Self(s.to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name<'a>(&'a self) -> &'a str {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for StorePathName {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.write_str(&self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use assert_matches::assert_matches;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-konsole-18.12.3";
|
||||||
|
let p = StorePath::new_from_base_name(&s).unwrap();
|
||||||
|
assert_eq!(p.name.0, "konsole-18.12.3");
|
||||||
|
assert_eq!(
|
||||||
|
p.hash.0,
|
||||||
|
[
|
||||||
|
0x9f, 0x76, 0x49, 0x20, 0xf6, 0x5d, 0xe9, 0x71, 0xc4, 0xca, 0x46, 0x21, 0xab, 0xff,
|
||||||
|
0x9b, 0x44, 0xef, 0x87, 0x0f, 0x3c
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_no_name() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::StorePathNameEmpty)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_no_dash() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::BadStorePath(_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_short_hash() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxl-konsole-18.12.3";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::BadStorePath(_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_invalid_hash() {
|
||||||
|
let s = "7h7qgvs4kgzsn8e6rb273saxyqh4jxlz-konsole-18.12.3";
|
||||||
|
assert_matches!(StorePath::new_from_base_name(&s), Err(Error::BadBase32));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_long_name() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||||
|
assert_matches!(StorePath::new_from_base_name(&s), Ok(_));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_too_long_name() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::StorePathNameTooLong)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bad_name() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-foo bar";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::BadStorePathName)
|
||||||
|
);
|
||||||
|
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-kónsole";
|
||||||
|
assert_matches!(
|
||||||
|
StorePath::new_from_base_name(&s),
|
||||||
|
Err(Error::BadStorePathName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_roundtrip() {
|
||||||
|
let s = "7h7qgvs4kgzsn8a6rb273saxyqh4jxlz-konsole-18.12.3";
|
||||||
|
assert_eq!(StorePath::new_from_base_name(&s).unwrap().to_string(), s);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
use crate::store::StorePath;
|
||||||
|
use crate::Error;
|
||||||
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct PathInfo {
|
||||||
|
pub path: StorePath,
|
||||||
|
pub references: BTreeSet<StorePath>,
|
||||||
|
pub nar_size: u64,
|
||||||
|
pub deriver: Option<StorePath>,
|
||||||
|
|
||||||
|
// Additional binary cache info.
|
||||||
|
pub url: Option<String>,
|
||||||
|
pub compression: Option<String>,
|
||||||
|
pub file_size: Option<u64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PathInfo {
|
||||||
|
pub fn parse_nar_info(nar_info: &str, store_dir: &str) -> Result<Self, Error> {
|
||||||
|
let mut path = None;
|
||||||
|
let mut references = BTreeSet::new();
|
||||||
|
let mut nar_size = None;
|
||||||
|
let mut deriver = None;
|
||||||
|
let mut url = None;
|
||||||
|
let mut compression = None;
|
||||||
|
let mut file_size = None;
|
||||||
|
|
||||||
|
for line in nar_info.lines() {
|
||||||
|
let colon = line.find(':').ok_or(Error::BadNarInfo)?;
|
||||||
|
|
||||||
|
let (name, value) = line.split_at(colon);
|
||||||
|
|
||||||
|
if !value.starts_with(": ") {
|
||||||
|
return Err(Error::BadNarInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
let value = &value[2..];
|
||||||
|
|
||||||
|
if name == "StorePath" {
|
||||||
|
path = Some(StorePath::new(std::path::Path::new(value), store_dir)?);
|
||||||
|
} else if name == "NarSize" {
|
||||||
|
nar_size = Some(u64::from_str_radix(value, 10).map_err(|_| Error::BadNarInfo)?);
|
||||||
|
} else if name == "References" {
|
||||||
|
if !value.is_empty() {
|
||||||
|
for r in value.split(' ') {
|
||||||
|
references.insert(StorePath::new_from_base_name(r)?);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if name == "Deriver" {
|
||||||
|
deriver = Some(StorePath::new_from_base_name(value)?);
|
||||||
|
} else if name == "URL" {
|
||||||
|
url = Some(value.into());
|
||||||
|
} else if name == "Compression" {
|
||||||
|
compression = Some(value.into());
|
||||||
|
} else if name == "FileSize" {
|
||||||
|
file_size = Some(u64::from_str_radix(value, 10).map_err(|_| Error::BadNarInfo)?);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(PathInfo {
|
||||||
|
path: path.ok_or(Error::BadNarInfo)?,
|
||||||
|
references,
|
||||||
|
nar_size: nar_size.ok_or(Error::BadNarInfo)?,
|
||||||
|
deriver,
|
||||||
|
url: Some(url.ok_or(Error::BadNarInfo)?),
|
||||||
|
compression,
|
||||||
|
file_size,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
use super::{PathInfo, StorePath};
|
||||||
|
use crate::Error;
|
||||||
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub trait Store: Send + Sync {
|
||||||
|
fn store_dir(&self) -> &str {
|
||||||
|
"/nix/store"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn query_path_info(
|
||||||
|
&self,
|
||||||
|
store_path: &StorePath,
|
||||||
|
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<PathInfo, Error>> + Send>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl dyn Store {
|
||||||
|
pub fn parse_store_path(&self, path: &Path) -> Result<StorePath, Error> {
|
||||||
|
StorePath::new(path, self.store_dir())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn compute_path_closure(
|
||||||
|
&self,
|
||||||
|
roots: BTreeSet<StorePath>,
|
||||||
|
) -> Result<BTreeMap<StorePath, PathInfo>, Error> {
|
||||||
|
let mut done = BTreeSet::new();
|
||||||
|
let mut result = BTreeMap::new();
|
||||||
|
let mut pending = vec![];
|
||||||
|
|
||||||
|
for root in roots {
|
||||||
|
pending.push(self.query_path_info(&root));
|
||||||
|
done.insert(root);
|
||||||
|
}
|
||||||
|
|
||||||
|
while !pending.is_empty() {
|
||||||
|
let (info, _, remaining) = futures::future::select_all(pending).await;
|
||||||
|
pending = remaining;
|
||||||
|
|
||||||
|
let info = info?;
|
||||||
|
|
||||||
|
for path in &info.references {
|
||||||
|
if !done.contains(path) {
|
||||||
|
pending.push(self.query_path_info(&path));
|
||||||
|
done.insert(path.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.insert(info.path.clone(), info);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
use crate::error::Error;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
pub fn encoded_len(input_len: usize) -> usize {
|
||||||
|
if input_len == 0 {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
(input_len * 8 - 1) / 5 + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn decoded_len(input_len: usize) -> usize {
|
||||||
|
input_len * 5 / 8
|
||||||
|
}
|
||||||
|
|
||||||
|
static BASE32_CHARS: &'static [u8; 32] = &b"0123456789abcdfghijklmnpqrsvwxyz";
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref BASE32_CHARS_REVERSE: Box<[u8; 256]> = {
|
||||||
|
let mut xs = [0xffu8; 256];
|
||||||
|
for (n, c) in BASE32_CHARS.iter().enumerate() {
|
||||||
|
xs[*c as usize] = n as u8;
|
||||||
|
}
|
||||||
|
Box::new(xs)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn encode(input: &[u8]) -> String {
|
||||||
|
let mut buf = vec![0; encoded_len(input.len())];
|
||||||
|
encode_into(input, &mut buf);
|
||||||
|
std::str::from_utf8(&buf).unwrap().to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn encode_into(input: &[u8], output: &mut [u8]) {
|
||||||
|
let len = encoded_len(input.len());
|
||||||
|
assert_eq!(len, output.len());
|
||||||
|
|
||||||
|
let mut nr_bits_left: usize = 0;
|
||||||
|
let mut bits_left: u16 = 0;
|
||||||
|
let mut pos = len;
|
||||||
|
|
||||||
|
for b in input {
|
||||||
|
bits_left |= (*b as u16) << nr_bits_left;
|
||||||
|
nr_bits_left += 8;
|
||||||
|
while nr_bits_left > 5 {
|
||||||
|
output[pos - 1] = BASE32_CHARS[(bits_left & 0x1f) as usize];
|
||||||
|
pos -= 1;
|
||||||
|
bits_left >>= 5;
|
||||||
|
nr_bits_left -= 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if nr_bits_left > 0 {
|
||||||
|
output[pos - 1] = BASE32_CHARS[(bits_left & 0x1f) as usize];
|
||||||
|
pos -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_eq!(pos, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn decode(input: &str) -> Result<Vec<u8>, crate::Error> {
|
||||||
|
let mut res = Vec::with_capacity(decoded_len(input.len()));
|
||||||
|
|
||||||
|
let mut nr_bits_left: usize = 0;
|
||||||
|
let mut bits_left: u16 = 0;
|
||||||
|
|
||||||
|
for c in input.chars().rev() {
|
||||||
|
let b = BASE32_CHARS_REVERSE[c as usize];
|
||||||
|
if b == 0xff {
|
||||||
|
return Err(Error::BadBase32);
|
||||||
|
}
|
||||||
|
bits_left |= (b as u16) << nr_bits_left;
|
||||||
|
nr_bits_left += 5;
|
||||||
|
if nr_bits_left >= 8 {
|
||||||
|
res.push((bits_left & 0xff) as u8);
|
||||||
|
bits_left >>= 8;
|
||||||
|
nr_bits_left -= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if nr_bits_left > 0 && bits_left != 0 {
|
||||||
|
return Err(Error::BadBase32);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use assert_matches::assert_matches;
|
||||||
|
use hex;
|
||||||
|
use proptest::proptest;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_encode() {
|
||||||
|
assert_eq!(encode(&[]), "");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
encode(&hex::decode("0839703786356bca59b0f4a32987eb2e6de43ae8").unwrap()),
|
||||||
|
"x0xf8v9fxf3jk8zln1cwlsrmhqvp0f88"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
encode(
|
||||||
|
&hex::decode("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")
|
||||||
|
.unwrap()
|
||||||
|
),
|
||||||
|
"1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
encode(
|
||||||
|
&hex::decode("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f")
|
||||||
|
.unwrap()
|
||||||
|
),
|
||||||
|
"2gs8k559z4rlahfx0y688s49m2vvszylcikrfinm30ly9rak69236nkam5ydvly1ai7xac99vxfc4ii84hawjbk876blyk1jfhkbbyx"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_decode() {
|
||||||
|
assert_eq!(hex::encode(decode("").unwrap()), "");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
hex::encode(decode("x0xf8v9fxf3jk8zln1cwlsrmhqvp0f88").unwrap()),
|
||||||
|
"0839703786356bca59b0f4a32987eb2e6de43ae8"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
hex::encode(decode("1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s").unwrap()),
|
||||||
|
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
hex::encode(decode("2gs8k559z4rlahfx0y688s49m2vvszylcikrfinm30ly9rak69236nkam5ydvly1ai7xac99vxfc4ii84hawjbk876blyk1jfhkbbyx").unwrap()),
|
||||||
|
"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_matches!(
|
||||||
|
decode("xoxf8v9fxf3jk8zln1cwlsrmhqvp0f88"),
|
||||||
|
Err(Error::BadBase32)
|
||||||
|
);
|
||||||
|
assert_matches!(
|
||||||
|
decode("2b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s"),
|
||||||
|
Err(Error::BadBase32)
|
||||||
|
);
|
||||||
|
assert_matches!(decode("2"), Err(Error::BadBase32));
|
||||||
|
assert_matches!(decode("2gs"), Err(Error::BadBase32));
|
||||||
|
assert_matches!(decode("2gs8"), Err(Error::BadBase32));
|
||||||
|
}
|
||||||
|
|
||||||
|
proptest! {
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn roundtrip(s: Vec<u8>) {
|
||||||
|
assert_eq!(s, decode(&encode(&s)).unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pub mod base32;
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
%undefine _hardened_build
|
|
||||||
|
|
||||||
%global nixbld_user "nix-builder-"
|
|
||||||
%global nixbld_group "nixbld"
|
|
||||||
|
|
||||||
# NOTE: BUILD on EL7 requires
|
|
||||||
# - Centos / RHEL7 software collection repository
|
|
||||||
# yum install centos-release-scl
|
|
||||||
#
|
|
||||||
# - Recent boost backport
|
|
||||||
# curl https://copr.fedorainfracloud.org/coprs/whosthere/boost/repo/epel-7/whosthere-boost-epel-7.repo -o /etc/yum.repos.d/whosthere-boost-epel-7.repo
|
|
||||||
#
|
|
||||||
|
|
||||||
# Disable documentation generation
|
|
||||||
# necessary on some platforms
|
|
||||||
%bcond_without docgen
|
|
||||||
|
|
||||||
Summary: The Nix software deployment system
|
|
||||||
Name: nix
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Release: 2%{?dist}
|
|
||||||
License: LGPLv2+
|
|
||||||
Group: Applications/System
|
|
||||||
URL: http://nixos.org/
|
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
|
||||||
|
|
||||||
Requires: curl
|
|
||||||
Requires: bzip2
|
|
||||||
Requires: gzip
|
|
||||||
Requires: xz
|
|
||||||
BuildRequires: bison
|
|
||||||
BuildRequires: boost-devel >= 1.60
|
|
||||||
BuildRequires: bzip2-devel
|
|
||||||
|
|
||||||
# for RHEL <= 7, we need software collections for a C++14 compatible compatible compiler
|
|
||||||
%if 0%{?rhel}
|
|
||||||
BuildRequires: devtoolset-7-gcc
|
|
||||||
BuildRequires: devtoolset-7-gcc-c++
|
|
||||||
%endif
|
|
||||||
|
|
||||||
BuildRequires: flex
|
|
||||||
BuildRequires: libcurl-devel
|
|
||||||
BuildRequires: libseccomp-devel
|
|
||||||
BuildRequires: openssl-devel
|
|
||||||
BuildRequires: sqlite-devel
|
|
||||||
BuildRequires: xz-devel
|
|
||||||
|
|
||||||
%description
|
|
||||||
Nix is a purely functional package manager. It allows multiple
|
|
||||||
versions of a package to be installed side-by-side, ensures that
|
|
||||||
dependency specifications are complete, supports atomic upgrades and
|
|
||||||
rollbacks, allows non-root users to install software, and has many
|
|
||||||
other features. It is the basis of the NixOS Linux distribution, but
|
|
||||||
it can be used equally well under other Unix systems.
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Development files for %{name}
|
|
||||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
The %{name}-devel package contains libraries and header files for
|
|
||||||
developing applications that use %{name}.
|
|
||||||
|
|
||||||
|
|
||||||
%package doc
|
|
||||||
Summary: Documentation files for %{name}
|
|
||||||
BuildArch: noarch
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description doc
|
|
||||||
The %{name}-doc package contains documentation files for %{name}.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
%if 0%{?rhel}
|
|
||||||
source /opt/rh/devtoolset-7/enable
|
|
||||||
%endif
|
|
||||||
extraFlags=
|
|
||||||
# - override docdir so large documentation files are owned by the
|
|
||||||
# -doc subpackage
|
|
||||||
# - set localstatedir by hand to the preferred nix value
|
|
||||||
%configure --localstatedir=/nix/var \
|
|
||||||
%{!?without_docgen:--disable-doc-gen} \
|
|
||||||
--docdir=%{_defaultdocdir}/%{name}-doc-%{version} \
|
|
||||||
$extraFlags
|
|
||||||
make V=1 %{?_smp_mflags}
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
%if 0%{?rhel}
|
|
||||||
source /opt/rh/devtoolset-7/enable
|
|
||||||
%endif
|
|
||||||
|
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
|
||||||
|
|
||||||
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
|
|
||||||
|
|
||||||
# make the store
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/nix/store
|
|
||||||
chmod 1775 $RPM_BUILD_ROOT/nix/store
|
|
||||||
|
|
||||||
# make per-user directories
|
|
||||||
for d in profiles gcroots;
|
|
||||||
do
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/nix/var/nix/$d/per-user
|
|
||||||
chmod 755 $RPM_BUILD_ROOT/nix/var/nix/$d/per-user
|
|
||||||
done
|
|
||||||
|
|
||||||
# fix permission of nix profile
|
|
||||||
# (until this is fixed in the relevant Makefile)
|
|
||||||
chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh
|
|
||||||
|
|
||||||
# we ship this file in the base package
|
|
||||||
rm -f $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}-doc-%{version}/README
|
|
||||||
|
|
||||||
# Get rid of Upstart job.
|
|
||||||
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init
|
|
||||||
|
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
|
|
||||||
%pre
|
|
||||||
getent group %{nixbld_group} >/dev/null || groupadd -r %{nixbld_group}
|
|
||||||
for i in $(seq 10);
|
|
||||||
do
|
|
||||||
getent passwd %{nixbld_user}$i >/dev/null || \
|
|
||||||
useradd -r -g %{nixbld_group} -G %{nixbld_group} -d /var/empty \
|
|
||||||
-s %{_sbindir}/nologin \
|
|
||||||
-c "Nix build user $i" %{nixbld_user}$i
|
|
||||||
done
|
|
||||||
|
|
||||||
%post
|
|
||||||
chgrp %{nixbld_group} /nix/store
|
|
||||||
%if ! 0%{?rhel} || 0%{?rhel} >= 7
|
|
||||||
# Enable and start Nix worker
|
|
||||||
systemctl enable nix-daemon.socket nix-daemon.service
|
|
||||||
systemctl start nix-daemon.socket
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%files
|
|
||||||
%license COPYING
|
|
||||||
%{_bindir}/nix*
|
|
||||||
%{_libdir}/*.so
|
|
||||||
%{_prefix}/libexec/*
|
|
||||||
%if ! 0%{?rhel} || 0%{?rhel} >= 7
|
|
||||||
%{_prefix}/lib/systemd/system/nix-daemon.socket
|
|
||||||
%{_prefix}/lib/systemd/system/nix-daemon.service
|
|
||||||
%endif
|
|
||||||
%{_datadir}/nix
|
|
||||||
#%if ! %{without docgen}
|
|
||||||
#%{_mandir}/man1/*.1*
|
|
||||||
#%{_mandir}/man5/*.5*
|
|
||||||
#%{_mandir}/man8/*.8*
|
|
||||||
#%endif
|
|
||||||
%config(noreplace) %{_sysconfdir}/profile.d/nix.sh
|
|
||||||
%config(noreplace) %{_sysconfdir}/profile.d/nix-daemon.sh
|
|
||||||
/nix
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%{_includedir}/nix
|
|
||||||
%{_prefix}/lib/pkgconfig/*.pc
|
|
||||||
|
|
||||||
|
|
||||||
#%if ! %{without docgen}
|
|
||||||
#%files doc
|
|
||||||
#%docdir %{_defaultdocdir}/%{name}-doc-%{version}
|
|
||||||
#%{_defaultdocdir}/%{name}-doc-%{version}
|
|
||||||
#%endif
|
|
||||||
@@ -4,4 +4,12 @@ GLOBAL_CXXFLAGS += -g -Wall
|
|||||||
|
|
||||||
-include Makefile.config
|
-include Makefile.config
|
||||||
|
|
||||||
|
OPTIMIZE = 1
|
||||||
|
|
||||||
|
ifeq ($(OPTIMIZE), 1)
|
||||||
|
GLOBAL_CXXFLAGS += -O3
|
||||||
|
else
|
||||||
|
GLOBAL_CXXFLAGS += -O0
|
||||||
|
endif
|
||||||
|
|
||||||
include mk/lib.mk
|
include mk/lib.mk
|
||||||
@@ -2,13 +2,10 @@ AC_INIT(nix-perl, m4_esyscmd([bash -c "echo -n $(cat ../.version)$VERSION_SUFFIX
|
|||||||
AC_CONFIG_SRCDIR(MANIFEST)
|
AC_CONFIG_SRCDIR(MANIFEST)
|
||||||
AC_CONFIG_AUX_DIR(../config)
|
AC_CONFIG_AUX_DIR(../config)
|
||||||
|
|
||||||
# Set default flags for nix (as per AC_PROG_CC/CXX docs),
|
CFLAGS=
|
||||||
# while still allowing the user to override them from the command line.
|
CXXFLAGS=
|
||||||
: ${CFLAGS="-O3"}
|
|
||||||
: ${CXXFLAGS="-O3"}
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AX_CXX_COMPILE_STDCXX_11
|
|
||||||
|
|
||||||
# Use 64-bit file system calls so that we can support files > 2 GiB.
|
# Use 64-bit file system calls so that we can support files > 2 GiB.
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
@@ -71,14 +68,15 @@ AC_SUBST(perlFlags)
|
|||||||
|
|
||||||
PKG_CHECK_MODULES([NIX], [nix-store])
|
PKG_CHECK_MODULES([NIX], [nix-store])
|
||||||
|
|
||||||
NEED_PROG([NIX_INSTANTIATE_PROGRAM], [nix-instantiate])
|
NEED_PROG([NIX], [nix])
|
||||||
|
|
||||||
# Get nix configure values
|
# Get nix configure values
|
||||||
nixbindir=$("$NIX_INSTANTIATE_PROGRAM" --eval '<nix/config.nix>' -A nixBinDir | tr -d \")
|
export NIX_REMOTE=daemon
|
||||||
nixlibexecdir=$("$NIX_INSTANTIATE_PROGRAM" --eval '<nix/config.nix>' -A nixLibexecDir | tr -d \")
|
nixbindir=$("$NIX" --experimental-features nix-command eval --raw -f '<nix/config.nix>' nixBinDir)
|
||||||
nixlocalstatedir=$("$NIX_INSTANTIATE_PROGRAM" --eval '<nix/config.nix>' -A nixLocalstateDir | tr -d \")
|
nixlibexecdir=$("$NIX" --experimental-features nix-command eval --raw -f '<nix/config.nix>' nixLibexecDir)
|
||||||
nixsysconfdir=$("$NIX_INSTANTIATE_PROGRAM" --eval '<nix/config.nix>' -A nixSysconfDir | tr -d \")
|
nixlocalstatedir=$("$NIX" --experimental-features nix-command eval --raw -f '<nix/config.nix>' nixLocalstateDir)
|
||||||
nixstoredir=$("$NIX_INSTANTIATE_PROGRAM" --eval '<nix/config.nix>' -A nixStoreDir | tr -d \")
|
nixsysconfdir=$("$NIX" --experimental-features nix-command eval --raw -f '<nix/config.nix>' nixSysconfDir)
|
||||||
|
nixstoredir=$("$NIX" --experimental-features nix-command eval --raw -f '<nix/config.nix>' nixStoreDir)
|
||||||
AC_SUBST(nixbindir)
|
AC_SUBST(nixbindir)
|
||||||
AC_SUBST(nixlibexecdir)
|
AC_SUBST(nixlibexecdir)
|
||||||
AC_SUBST(nixlocalstatedir)
|
AC_SUBST(nixlocalstatedir)
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ $logDir = $ENV{"NIX_LOG_DIR"} || "@nixlocalstatedir@/log/nix";
|
|||||||
$confDir = $ENV{"NIX_CONF_DIR"} || "@nixsysconfdir@/nix";
|
$confDir = $ENV{"NIX_CONF_DIR"} || "@nixsysconfdir@/nix";
|
||||||
$storeDir = $ENV{"NIX_STORE_DIR"} || "@nixstoredir@";
|
$storeDir = $ENV{"NIX_STORE_DIR"} || "@nixstoredir@";
|
||||||
|
|
||||||
$bzip2 = "@bzip2@";
|
|
||||||
$xz = "@xz@";
|
|
||||||
$curl = "@curl@";
|
|
||||||
|
|
||||||
$useBindings = 1;
|
$useBindings = 1;
|
||||||
|
|
||||||
%config = ();
|
%config = ();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void setVerbosity(int level)
|
|||||||
int isValidPath(char * path)
|
int isValidPath(char * path)
|
||||||
CODE:
|
CODE:
|
||||||
try {
|
try {
|
||||||
RETVAL = store()->isValidPath(path);
|
RETVAL = store()->isValidPath(store()->parseStorePath(path));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,8 @@ int isValidPath(char * path)
|
|||||||
SV * queryReferences(char * path)
|
SV * queryReferences(char * path)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
PathSet paths = store()->queryPathInfo(path)->references;
|
for (auto & i : store()->queryPathInfo(store()->parseStorePath(path))->references)
|
||||||
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i)
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
||||||
XPUSHs(sv_2mortal(newSVpv(i->c_str(), 0)));
|
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -81,7 +80,7 @@ SV * queryReferences(char * path)
|
|||||||
SV * queryPathHash(char * path)
|
SV * queryPathHash(char * path)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
auto s = store()->queryPathInfo(path)->narHash.to_string();
|
auto s = store()->queryPathInfo(store()->parseStorePath(path))->narHash.to_string();
|
||||||
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
@@ -91,9 +90,9 @@ SV * queryPathHash(char * path)
|
|||||||
SV * queryDeriver(char * path)
|
SV * queryDeriver(char * path)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
auto deriver = store()->queryPathInfo(path)->deriver;
|
auto info = store()->queryPathInfo(store()->parseStorePath(path));
|
||||||
if (deriver == "") XSRETURN_UNDEF;
|
if (!info->deriver) XSRETURN_UNDEF;
|
||||||
XPUSHs(sv_2mortal(newSVpv(deriver.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(*info->deriver).c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -102,18 +101,18 @@ SV * queryDeriver(char * path)
|
|||||||
SV * queryPathInfo(char * path, int base32)
|
SV * queryPathInfo(char * path, int base32)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
auto info = store()->queryPathInfo(path);
|
auto info = store()->queryPathInfo(store()->parseStorePath(path));
|
||||||
if (info->deriver == "")
|
if (!info->deriver)
|
||||||
XPUSHs(&PL_sv_undef);
|
XPUSHs(&PL_sv_undef);
|
||||||
else
|
else
|
||||||
XPUSHs(sv_2mortal(newSVpv(info->deriver.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(*info->deriver).c_str(), 0)));
|
||||||
auto s = info->narHash.to_string(base32 ? Base32 : Base16);
|
auto s = info->narHash.to_string(base32 ? Base32 : Base16);
|
||||||
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
||||||
mXPUSHi(info->registrationTime);
|
mXPUSHi(info->registrationTime);
|
||||||
mXPUSHi(info->narSize);
|
mXPUSHi(info->narSize);
|
||||||
AV * arr = newAV();
|
AV * arr = newAV();
|
||||||
for (PathSet::iterator i = info->references.begin(); i != info->references.end(); ++i)
|
for (auto & i : info->references)
|
||||||
av_push(arr, newSVpv(i->c_str(), 0));
|
av_push(arr, newSVpv(store()->printStorePath(i).c_str(), 0));
|
||||||
XPUSHs(sv_2mortal(newRV((SV *) arr)));
|
XPUSHs(sv_2mortal(newRV((SV *) arr)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
@@ -123,8 +122,8 @@ SV * queryPathInfo(char * path, int base32)
|
|||||||
SV * queryPathFromHashPart(char * hashPart)
|
SV * queryPathFromHashPart(char * hashPart)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
Path path = store()->queryPathFromHashPart(hashPart);
|
auto path = store()->queryPathFromHashPart(hashPart);
|
||||||
XPUSHs(sv_2mortal(newSVpv(path.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(path ? store()->printStorePath(*path).c_str() : "", 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -133,11 +132,11 @@ SV * queryPathFromHashPart(char * hashPart)
|
|||||||
SV * computeFSClosure(int flipDirection, int includeOutputs, ...)
|
SV * computeFSClosure(int flipDirection, int includeOutputs, ...)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
PathSet paths;
|
StorePathSet paths;
|
||||||
for (int n = 2; n < items; ++n)
|
for (int n = 2; n < items; ++n)
|
||||||
store()->computeFSClosure(SvPV_nolen(ST(n)), paths, flipDirection, includeOutputs);
|
store()->computeFSClosure(store()->parseStorePath(SvPV_nolen(ST(n))), paths, flipDirection, includeOutputs);
|
||||||
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i)
|
for (auto & i : paths)
|
||||||
XPUSHs(sv_2mortal(newSVpv(i->c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -146,11 +145,11 @@ SV * computeFSClosure(int flipDirection, int includeOutputs, ...)
|
|||||||
SV * topoSortPaths(...)
|
SV * topoSortPaths(...)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
PathSet paths;
|
StorePathSet paths;
|
||||||
for (int n = 0; n < items; ++n) paths.insert(SvPV_nolen(ST(n)));
|
for (int n = 0; n < items; ++n) paths.insert(store()->parseStorePath(SvPV_nolen(ST(n))));
|
||||||
Paths sorted = store()->topoSortPaths(paths);
|
auto sorted = store()->topoSortPaths(paths);
|
||||||
for (Paths::iterator i = sorted.begin(); i != sorted.end(); ++i)
|
for (auto & i : sorted)
|
||||||
XPUSHs(sv_2mortal(newSVpv(i->c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -159,7 +158,7 @@ SV * topoSortPaths(...)
|
|||||||
SV * followLinksToStorePath(char * path)
|
SV * followLinksToStorePath(char * path)
|
||||||
CODE:
|
CODE:
|
||||||
try {
|
try {
|
||||||
RETVAL = newSVpv(store()->followLinksToStorePath(path).c_str(), 0);
|
RETVAL = newSVpv(store()->printStorePath(store()->followLinksToStorePath(path)).c_str(), 0);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -170,8 +169,8 @@ SV * followLinksToStorePath(char * path)
|
|||||||
void exportPaths(int fd, ...)
|
void exportPaths(int fd, ...)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
Paths paths;
|
StorePathSet paths;
|
||||||
for (int n = 1; n < items; ++n) paths.push_back(SvPV_nolen(ST(n)));
|
for (int n = 1; n < items; ++n) paths.insert(store()->parseStorePath(SvPV_nolen(ST(n))));
|
||||||
FdSink sink(fd);
|
FdSink sink(fd);
|
||||||
store()->exportPaths(paths, sink);
|
store()->exportPaths(paths, sink);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
@@ -275,8 +274,8 @@ int checkSignature(SV * publicKey_, SV * sig_, char * msg)
|
|||||||
SV * addToStore(char * srcPath, int recursive, char * algo)
|
SV * addToStore(char * srcPath, int recursive, char * algo)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
Path path = store()->addToStore(baseNameOf(srcPath), srcPath, recursive, parseHashType(algo));
|
auto path = store()->addToStore(std::string(baseNameOf(srcPath)), srcPath, recursive, parseHashType(algo));
|
||||||
XPUSHs(sv_2mortal(newSVpv(path.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -286,8 +285,8 @@ SV * makeFixedOutputPath(int recursive, char * algo, char * hash, char * name)
|
|||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
Hash h(hash, parseHashType(algo));
|
Hash h(hash, parseHashType(algo));
|
||||||
Path path = store()->makeFixedOutputPath(recursive, h, name);
|
auto path = store()->makeFixedOutputPath(recursive, h, name);
|
||||||
XPUSHs(sv_2mortal(newSVpv(path.c_str(), 0)));
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -298,35 +297,35 @@ SV * derivationFromPath(char * drvPath)
|
|||||||
HV *hash;
|
HV *hash;
|
||||||
CODE:
|
CODE:
|
||||||
try {
|
try {
|
||||||
Derivation drv = store()->derivationFromPath(drvPath);
|
Derivation drv = store()->derivationFromPath(store()->parseStorePath(drvPath));
|
||||||
hash = newHV();
|
hash = newHV();
|
||||||
|
|
||||||
HV * outputs = newHV();
|
HV * outputs = newHV();
|
||||||
for (DerivationOutputs::iterator i = drv.outputs.begin(); i != drv.outputs.end(); ++i)
|
for (auto & i : drv.outputs)
|
||||||
hv_store(outputs, i->first.c_str(), i->first.size(), newSVpv(i->second.path.c_str(), 0), 0);
|
hv_store(outputs, i.first.c_str(), i.first.size(), newSVpv(store()->printStorePath(i.second.path).c_str(), 0), 0);
|
||||||
hv_stores(hash, "outputs", newRV((SV *) outputs));
|
hv_stores(hash, "outputs", newRV((SV *) outputs));
|
||||||
|
|
||||||
AV * inputDrvs = newAV();
|
AV * inputDrvs = newAV();
|
||||||
for (DerivationInputs::iterator i = drv.inputDrvs.begin(); i != drv.inputDrvs.end(); ++i)
|
for (auto & i : drv.inputDrvs)
|
||||||
av_push(inputDrvs, newSVpv(i->first.c_str(), 0)); // !!! ignores i->second
|
av_push(inputDrvs, newSVpv(store()->printStorePath(i.first).c_str(), 0)); // !!! ignores i->second
|
||||||
hv_stores(hash, "inputDrvs", newRV((SV *) inputDrvs));
|
hv_stores(hash, "inputDrvs", newRV((SV *) inputDrvs));
|
||||||
|
|
||||||
AV * inputSrcs = newAV();
|
AV * inputSrcs = newAV();
|
||||||
for (PathSet::iterator i = drv.inputSrcs.begin(); i != drv.inputSrcs.end(); ++i)
|
for (auto & i : drv.inputSrcs)
|
||||||
av_push(inputSrcs, newSVpv(i->c_str(), 0));
|
av_push(inputSrcs, newSVpv(store()->printStorePath(i).c_str(), 0));
|
||||||
hv_stores(hash, "inputSrcs", newRV((SV *) inputSrcs));
|
hv_stores(hash, "inputSrcs", newRV((SV *) inputSrcs));
|
||||||
|
|
||||||
hv_stores(hash, "platform", newSVpv(drv.platform.c_str(), 0));
|
hv_stores(hash, "platform", newSVpv(drv.platform.c_str(), 0));
|
||||||
hv_stores(hash, "builder", newSVpv(drv.builder.c_str(), 0));
|
hv_stores(hash, "builder", newSVpv(drv.builder.c_str(), 0));
|
||||||
|
|
||||||
AV * args = newAV();
|
AV * args = newAV();
|
||||||
for (Strings::iterator i = drv.args.begin(); i != drv.args.end(); ++i)
|
for (auto & i : drv.args)
|
||||||
av_push(args, newSVpv(i->c_str(), 0));
|
av_push(args, newSVpv(i.c_str(), 0));
|
||||||
hv_stores(hash, "args", newRV((SV *) args));
|
hv_stores(hash, "args", newRV((SV *) args));
|
||||||
|
|
||||||
HV * env = newHV();
|
HV * env = newHV();
|
||||||
for (StringPairs::iterator i = drv.env.begin(); i != drv.env.end(); ++i)
|
for (auto & i : drv.env)
|
||||||
hv_store(env, i->first.c_str(), i->first.size(), newSVpv(i->second.c_str(), 0), 0);
|
hv_store(env, i.first.c_str(), i.first.size(), newSVpv(i.second.c_str(), 0), 0);
|
||||||
hv_stores(hash, "env", newRV((SV *) env));
|
hv_stores(hash, "env", newRV((SV *) env));
|
||||||
|
|
||||||
RETVAL = newRV_noinc((SV *)hash);
|
RETVAL = newRV_noinc((SV *)hash);
|
||||||
@@ -340,7 +339,7 @@ SV * derivationFromPath(char * drvPath)
|
|||||||
void addTempRoot(char * storePath)
|
void addTempRoot(char * storePath)
|
||||||
PPCODE:
|
PPCODE:
|
||||||
try {
|
try {
|
||||||
store()->addTempRoot(storePath);
|
store()->addTempRoot(store()->parseStorePath(storePath));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
croak("%s", e.what());
|
croak("%s", e.what());
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
#include <atomic>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cctype>
|
||||||
|
#include <chrono>
|
||||||
|
#include <climits>
|
||||||
|
#include <cmath>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <exception>
|
||||||
|
#include <functional>
|
||||||
|
#include <future>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <list>
|
||||||
|
#include <locale>
|
||||||
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <numeric>
|
||||||
|
#include <optional>
|
||||||
|
#include <queue>
|
||||||
|
#include <random>
|
||||||
|
#include <regex>
|
||||||
|
#include <set>
|
||||||
|
#include <sstream>
|
||||||
|
#include <stack>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <grp.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
{ pkgs }:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
rec {
|
|
||||||
# Use "busybox-sandbox-shell" if present,
|
|
||||||
# if not (legacy) fallback and hope it's sufficient.
|
|
||||||
sh = pkgs.busybox-sandbox-shell or (busybox.override {
|
|
||||||
useMusl = true;
|
|
||||||
enableStatic = true;
|
|
||||||
enableMinimal = true;
|
|
||||||
extraConfig = ''
|
|
||||||
CONFIG_FEATURE_FANCY_ECHO y
|
|
||||||
CONFIG_FEATURE_SH_MATH y
|
|
||||||
CONFIG_FEATURE_SH_MATH_64 y
|
|
||||||
|
|
||||||
CONFIG_ASH y
|
|
||||||
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
|
||||||
|
|
||||||
CONFIG_ASH_ALIAS y
|
|
||||||
CONFIG_ASH_BASH_COMPAT y
|
|
||||||
CONFIG_ASH_CMDCMD y
|
|
||||||
CONFIG_ASH_ECHO y
|
|
||||||
CONFIG_ASH_GETOPTS y
|
|
||||||
CONFIG_ASH_INTERNAL_GLOB y
|
|
||||||
CONFIG_ASH_JOB_CONTROL y
|
|
||||||
CONFIG_ASH_PRINTF y
|
|
||||||
CONFIG_ASH_TEST y
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
configureFlags =
|
|
||||||
[
|
|
||||||
"--enable-gc"
|
|
||||||
] ++ lib.optionals stdenv.isLinux [
|
|
||||||
"--with-sandbox-shell=${sh}/bin/busybox"
|
|
||||||
];
|
|
||||||
|
|
||||||
tarballDeps =
|
|
||||||
[ bison
|
|
||||||
flex
|
|
||||||
libxml2
|
|
||||||
libxslt
|
|
||||||
docbook5
|
|
||||||
docbook_xsl_ns
|
|
||||||
autoconf-archive
|
|
||||||
autoreconfHook
|
|
||||||
];
|
|
||||||
|
|
||||||
buildDeps =
|
|
||||||
[ curl
|
|
||||||
bzip2 xz brotli editline
|
|
||||||
openssl pkgconfig sqlite
|
|
||||||
boost
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
git
|
|
||||||
mercurial
|
|
||||||
]
|
|
||||||
++ lib.optionals stdenv.isLinux [libseccomp utillinuxMinimal]
|
|
||||||
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
|
|
||||||
++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
|
|
||||||
((aws-sdk-cpp.override {
|
|
||||||
apis = ["s3" "transfer"];
|
|
||||||
customMemoryManagement = false;
|
|
||||||
}).overrideDerivation (args: {
|
|
||||||
/*
|
|
||||||
patches = args.patches or [] ++ [ (fetchpatch {
|
|
||||||
url = https://github.com/edolstra/aws-sdk-cpp/commit/3e07e1f1aae41b4c8b340735ff9e8c735f0c063f.patch;
|
|
||||||
sha256 = "1pij0v449p166f9l29x7ppzk8j7g9k9mp15ilh5qxp29c7fnvxy2";
|
|
||||||
}) ];
|
|
||||||
*/
|
|
||||||
}));
|
|
||||||
|
|
||||||
propagatedDeps =
|
|
||||||
[ (boehmgc.override { enableLargeConfig = true; })
|
|
||||||
];
|
|
||||||
|
|
||||||
perlDeps =
|
|
||||||
[ perl
|
|
||||||
perlPackages.DBDSQLite
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,397 +0,0 @@
|
|||||||
{ nix ? builtins.fetchGit ./.
|
|
||||||
, nixpkgs ? builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz
|
|
||||||
, officialRelease ? false
|
|
||||||
, systems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
pkgs = import nixpkgs { system = builtins.currentSystem or "x86_64-linux"; };
|
|
||||||
|
|
||||||
jobs = rec {
|
|
||||||
|
|
||||||
|
|
||||||
tarball =
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
with import ./release-common.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
releaseTools.sourceTarball {
|
|
||||||
name = "nix-tarball";
|
|
||||||
version = builtins.readFile ./.version;
|
|
||||||
versionSuffix = if officialRelease then "" else "pre${toString nix.revCount}_${nix.shortRev}";
|
|
||||||
src = nix;
|
|
||||||
inherit officialRelease;
|
|
||||||
|
|
||||||
buildInputs = tarballDeps ++ buildDeps ++ propagatedDeps;
|
|
||||||
|
|
||||||
configureFlags = "--enable-gc";
|
|
||||||
|
|
||||||
postUnpack = ''
|
|
||||||
(cd $sourceRoot && find . -type f) | cut -c3- > $sourceRoot/.dist-files
|
|
||||||
cat $sourceRoot/.dist-files
|
|
||||||
'';
|
|
||||||
|
|
||||||
preConfigure = ''
|
|
||||||
(cd perl ; autoreconf --install --force --verbose)
|
|
||||||
# TeX needs a writable font cache.
|
|
||||||
export VARTEXFONTS=$TMPDIR/texfonts
|
|
||||||
'';
|
|
||||||
|
|
||||||
distPhase =
|
|
||||||
''
|
|
||||||
runHook preDist
|
|
||||||
make dist
|
|
||||||
mkdir -p $out/tarballs
|
|
||||||
cp *.tar.* $out/tarballs
|
|
||||||
'';
|
|
||||||
|
|
||||||
preDist = ''
|
|
||||||
make install docdir=$out/share/doc/nix makefiles=doc/manual/local.mk
|
|
||||||
echo "doc manual $out/share/doc/nix/manual" >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
build = pkgs.lib.genAttrs systems (system:
|
|
||||||
|
|
||||||
let pkgs = import nixpkgs { inherit system; }; in
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
with import ./release-common.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
releaseTools.nixBuild {
|
|
||||||
name = "nix";
|
|
||||||
src = tarball;
|
|
||||||
|
|
||||||
buildInputs = buildDeps;
|
|
||||||
|
|
||||||
propagatedBuildInputs = propagatedDeps;
|
|
||||||
|
|
||||||
preConfigure =
|
|
||||||
# Copy libboost_context so we don't get all of Boost in our closure.
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
|
||||||
''
|
|
||||||
mkdir -p $out/lib
|
|
||||||
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
|
||||||
rm -f $out/lib/*.a
|
|
||||||
${lib.optionalString stdenv.isLinux ''
|
|
||||||
chmod u+w $out/lib/*.so.*
|
|
||||||
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
|
||||||
''}
|
|
||||||
'';
|
|
||||||
|
|
||||||
configureFlags = configureFlags ++
|
|
||||||
[ "--sysconfdir=/etc" ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
makeFlags = "profiledir=$(out)/etc/profile.d";
|
|
||||||
|
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
|
||||||
|
|
||||||
doInstallCheck = true;
|
|
||||||
installCheckFlags = "sysconfdir=$(out)/etc";
|
|
||||||
|
|
||||||
separateDebugInfo = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
perlBindings = pkgs.lib.genAttrs systems (system:
|
|
||||||
|
|
||||||
let pkgs = import nixpkgs { inherit system; }; in with pkgs;
|
|
||||||
|
|
||||||
releaseTools.nixBuild {
|
|
||||||
name = "nix-perl";
|
|
||||||
src = tarball;
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[ jobs.build.${system} curl bzip2 xz pkgconfig pkgs.perl boost ]
|
|
||||||
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium;
|
|
||||||
|
|
||||||
configureFlags = ''
|
|
||||||
--with-dbi=${perlPackages.DBI}/${pkgs.perl.libPrefix}
|
|
||||||
--with-dbd-sqlite=${perlPackages.DBDSQLite}/${pkgs.perl.libPrefix}
|
|
||||||
'';
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
postUnpack = "sourceRoot=$sourceRoot/perl";
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
binaryTarball = pkgs.lib.genAttrs systems (system:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
let
|
|
||||||
toplevel = builtins.getAttr system jobs.build;
|
|
||||||
version = toplevel.src.version;
|
|
||||||
installerClosureInfo = closureInfo { rootPaths = [ toplevel cacert ]; };
|
|
||||||
in
|
|
||||||
|
|
||||||
runCommand "nix-binary-tarball-${version}"
|
|
||||||
{ #nativeBuildInputs = lib.optional (system != "aarch64-linux") shellcheck;
|
|
||||||
meta.description = "Distribution-independent Nix bootstrap binaries for ${system}";
|
|
||||||
}
|
|
||||||
''
|
|
||||||
cp ${installerClosureInfo}/registration $TMPDIR/reginfo
|
|
||||||
substitute ${./scripts/install-nix-from-closure.sh} $TMPDIR/install \
|
|
||||||
--subst-var-by nix ${toplevel} \
|
|
||||||
--subst-var-by cacert ${cacert}
|
|
||||||
|
|
||||||
substitute ${./scripts/install-darwin-multi-user.sh} $TMPDIR/install-darwin-multi-user.sh \
|
|
||||||
--subst-var-by nix ${toplevel} \
|
|
||||||
--subst-var-by cacert ${cacert}
|
|
||||||
substitute ${./scripts/install-systemd-multi-user.sh} $TMPDIR/install-systemd-multi-user.sh \
|
|
||||||
--subst-var-by nix ${toplevel} \
|
|
||||||
--subst-var-by cacert ${cacert}
|
|
||||||
substitute ${./scripts/install-multi-user.sh} $TMPDIR/install-multi-user \
|
|
||||||
--subst-var-by nix ${toplevel} \
|
|
||||||
--subst-var-by cacert ${cacert}
|
|
||||||
|
|
||||||
if type -p shellcheck; then
|
|
||||||
# SC1090: Don't worry about not being able to find
|
|
||||||
# $nix/etc/profile.d/nix.sh
|
|
||||||
shellcheck --exclude SC1090 $TMPDIR/install
|
|
||||||
shellcheck $TMPDIR/install-darwin-multi-user.sh
|
|
||||||
shellcheck $TMPDIR/install-systemd-multi-user.sh
|
|
||||||
|
|
||||||
# SC1091: Don't panic about not being able to source
|
|
||||||
# /etc/profile
|
|
||||||
# SC2002: Ignore "useless cat" "error", when loading
|
|
||||||
# .reginfo, as the cat is a much cleaner
|
|
||||||
# implementation, even though it is "useless"
|
|
||||||
# SC2116: Allow ROOT_HOME=$(echo ~root) for resolving
|
|
||||||
# root's home directory
|
|
||||||
shellcheck --external-sources \
|
|
||||||
--exclude SC1091,SC2002,SC2116 $TMPDIR/install-multi-user
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod +x $TMPDIR/install
|
|
||||||
chmod +x $TMPDIR/install-darwin-multi-user.sh
|
|
||||||
chmod +x $TMPDIR/install-systemd-multi-user.sh
|
|
||||||
chmod +x $TMPDIR/install-multi-user
|
|
||||||
dir=nix-${version}-${system}
|
|
||||||
fn=$out/$dir.tar.xz
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist $fn" >> $out/nix-support/hydra-build-products
|
|
||||||
tar cvfJ $fn \
|
|
||||||
--owner=0 --group=0 --mode=u+rw,uga+r \
|
|
||||||
--absolute-names \
|
|
||||||
--hard-dereference \
|
|
||||||
--transform "s,$TMPDIR/install,$dir/install," \
|
|
||||||
--transform "s,$TMPDIR/reginfo,$dir/.reginfo," \
|
|
||||||
--transform "s,$NIX_STORE,$dir/store,S" \
|
|
||||||
$TMPDIR/install $TMPDIR/install-darwin-multi-user.sh \
|
|
||||||
$TMPDIR/install-systemd-multi-user.sh \
|
|
||||||
$TMPDIR/install-multi-user $TMPDIR/reginfo \
|
|
||||||
$(cat ${installerClosureInfo}/store-paths)
|
|
||||||
'');
|
|
||||||
|
|
||||||
|
|
||||||
coverage =
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
with import ./release-common.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
releaseTools.coverageAnalysis {
|
|
||||||
name = "nix-build";
|
|
||||||
src = tarball;
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
buildInputs = buildDeps ++ propagatedDeps;
|
|
||||||
|
|
||||||
dontInstall = false;
|
|
||||||
|
|
||||||
doInstallCheck = true;
|
|
||||||
|
|
||||||
lcovFilter = [ "*/boost/*" "*-tab.*" "*/nlohmann/*" "*/linenoise/*" ];
|
|
||||||
|
|
||||||
# We call `dot', and even though we just use it to
|
|
||||||
# syntax-check generated dot files, it still requires some
|
|
||||||
# fonts. So provide those.
|
|
||||||
FONTCONFIG_FILE = texFunctions.fontsConf;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#rpm_fedora27x86_64 = makeRPM_x86_64 (diskImageFunsFun: diskImageFunsFun.fedora27x86_64) [ ];
|
|
||||||
|
|
||||||
|
|
||||||
#deb_debian8i386 = makeDeb_i686 (diskImageFuns: diskImageFuns.debian8i386) [ "libsodium-dev" ] [ "libsodium13" ];
|
|
||||||
#deb_debian8x86_64 = makeDeb_x86_64 (diskImageFunsFun: diskImageFunsFun.debian8x86_64) [ "libsodium-dev" ] [ "libsodium13" ];
|
|
||||||
|
|
||||||
#deb_ubuntu1710i386 = makeDeb_i686 (diskImageFuns: diskImageFuns.ubuntu1710i386) [ ] [ "libsodium18" ];
|
|
||||||
#deb_ubuntu1710x86_64 = makeDeb_x86_64 (diskImageFuns: diskImageFuns.ubuntu1710x86_64) [ ] [ "libsodium18" "libboost-context1.62.0" ];
|
|
||||||
|
|
||||||
|
|
||||||
# System tests.
|
|
||||||
tests.remoteBuilds = (import ./tests/remote-builds.nix rec {
|
|
||||||
inherit nixpkgs;
|
|
||||||
nix = build.x86_64-linux; system = "x86_64-linux";
|
|
||||||
});
|
|
||||||
|
|
||||||
tests.nix-copy-closure = (import ./tests/nix-copy-closure.nix rec {
|
|
||||||
inherit nixpkgs;
|
|
||||||
nix = build.x86_64-linux; system = "x86_64-linux";
|
|
||||||
});
|
|
||||||
|
|
||||||
tests.setuid = pkgs.lib.genAttrs
|
|
||||||
["i686-linux" "x86_64-linux"]
|
|
||||||
(system:
|
|
||||||
import ./tests/setuid.nix rec {
|
|
||||||
inherit nixpkgs;
|
|
||||||
nix = build.${system}; inherit system;
|
|
||||||
});
|
|
||||||
|
|
||||||
tests.binaryTarball =
|
|
||||||
with import nixpkgs { system = "x86_64-linux"; };
|
|
||||||
vmTools.runInLinuxImage (runCommand "nix-binary-tarball-test"
|
|
||||||
{ diskImage = vmTools.diskImages.ubuntu1204x86_64;
|
|
||||||
}
|
|
||||||
''
|
|
||||||
set -x
|
|
||||||
useradd -m alice
|
|
||||||
su - alice -c 'tar xf ${binaryTarball.x86_64-linux}/*.tar.*'
|
|
||||||
mkdir /dest-nix
|
|
||||||
mount -o bind /dest-nix /nix # Provide a writable /nix.
|
|
||||||
chown alice /nix
|
|
||||||
su - alice -c '_NIX_INSTALLER_TEST=1 ./nix-*/install'
|
|
||||||
su - alice -c 'nix-store --verify'
|
|
||||||
su - alice -c 'PAGER= nix-store -qR ${build.x86_64-linux}'
|
|
||||||
|
|
||||||
# Check whether 'nix upgrade-nix' works.
|
|
||||||
cat > /tmp/paths.nix <<EOF
|
|
||||||
{
|
|
||||||
x86_64-linux = "${build.x86_64-linux}";
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
su - alice -c 'nix upgrade-nix -vvv --nix-store-paths-url file:///tmp/paths.nix'
|
|
||||||
(! [ -L /home/alice/.profile-1-link ])
|
|
||||||
su - alice -c 'PAGER= nix-store -qR ${build.x86_64-linux}'
|
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
touch $out/nix-support/hydra-build-products
|
|
||||||
umount /nix
|
|
||||||
''); # */
|
|
||||||
|
|
||||||
/*
|
|
||||||
tests.evalNixpkgs =
|
|
||||||
import (nixpkgs + "/pkgs/top-level/make-tarball.nix") {
|
|
||||||
inherit nixpkgs;
|
|
||||||
inherit pkgs;
|
|
||||||
nix = build.x86_64-linux;
|
|
||||||
officialRelease = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
tests.evalNixOS =
|
|
||||||
pkgs.runCommand "eval-nixos" { buildInputs = [ build.x86_64-linux ]; }
|
|
||||||
''
|
|
||||||
export NIX_STATE_DIR=$TMPDIR
|
|
||||||
|
|
||||||
nix-instantiate ${nixpkgs}/nixos/release-combined.nix -A tested --dry-run \
|
|
||||||
--arg nixpkgs '{ outPath = ${nixpkgs}; revCount = 123; shortRev = "abcdefgh"; }'
|
|
||||||
|
|
||||||
touch $out
|
|
||||||
'';
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
installerScript =
|
|
||||||
pkgs.runCommand "installer-script"
|
|
||||||
{ buildInputs = [ build.x86_64-linux ];
|
|
||||||
}
|
|
||||||
''
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
|
|
||||||
substitute ${./scripts/install.in} $out/install \
|
|
||||||
${pkgs.lib.concatMapStrings
|
|
||||||
(system: "--replace '@binaryTarball_${system}@' $(nix hash-file --base16 --type sha256 ${binaryTarball.${system}}/*.tar.xz) ")
|
|
||||||
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
|
|
||||||
} \
|
|
||||||
--replace '@nixVersion@' ${build.x86_64-linux.src.version}
|
|
||||||
|
|
||||||
echo "file installer $out/install" >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
|
||||||
# Aggregate job containing the release-critical jobs.
|
|
||||||
release = pkgs.releaseTools.aggregate {
|
|
||||||
name = "nix-${tarball.version}";
|
|
||||||
meta.description = "Release-critical builds";
|
|
||||||
constituents =
|
|
||||||
[ tarball
|
|
||||||
build.i686-linux
|
|
||||||
build.x86_64-darwin
|
|
||||||
build.x86_64-linux
|
|
||||||
build.aarch64-linux
|
|
||||||
binaryTarball.i686-linux
|
|
||||||
binaryTarball.x86_64-darwin
|
|
||||||
binaryTarball.x86_64-linux
|
|
||||||
binaryTarball.aarch64-linux
|
|
||||||
tests.remoteBuilds
|
|
||||||
tests.nix-copy-closure
|
|
||||||
tests.binaryTarball
|
|
||||||
#tests.evalNixpkgs
|
|
||||||
#tests.evalNixOS
|
|
||||||
installerScript
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
makeRPM_i686 = makeRPM "i686-linux";
|
|
||||||
makeRPM_x86_64 = makeRPM "x86_64-linux";
|
|
||||||
|
|
||||||
makeRPM =
|
|
||||||
system: diskImageFun: extraPackages:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
releaseTools.rpmBuild rec {
|
|
||||||
name = "nix-rpm";
|
|
||||||
src = jobs.tarball;
|
|
||||||
diskImage = (diskImageFun vmTools.diskImageFuns)
|
|
||||||
{ extraPackages =
|
|
||||||
[ "sqlite" "sqlite-devel" "bzip2-devel" "libcurl-devel" "openssl-devel" "xz-devel" "libseccomp-devel" "libsodium-devel" "boost-devel" "bison" "flex" ]
|
|
||||||
++ extraPackages; };
|
|
||||||
# At most 2047MB can be simulated in qemu-system-i386
|
|
||||||
memSize = 2047;
|
|
||||||
meta.schedulingPriority = 50;
|
|
||||||
postRPMInstall = "cd /tmp/rpmout/BUILD/nix-* && make installcheck";
|
|
||||||
#enableParallelBuilding = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
makeDeb_i686 = makeDeb "i686-linux";
|
|
||||||
makeDeb_x86_64 = makeDeb "x86_64-linux";
|
|
||||||
|
|
||||||
makeDeb =
|
|
||||||
system: diskImageFun: extraPackages: extraDebPackages:
|
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
releaseTools.debBuild {
|
|
||||||
name = "nix-deb";
|
|
||||||
src = jobs.tarball;
|
|
||||||
diskImage = (diskImageFun vmTools.diskImageFuns)
|
|
||||||
{ extraPackages =
|
|
||||||
[ "libsqlite3-dev" "libbz2-dev" "libcurl-dev" "libcurl3-nss" "libssl-dev" "liblzma-dev" "libseccomp-dev" "libsodium-dev" "libboost-all-dev" ]
|
|
||||||
++ extraPackages; };
|
|
||||||
memSize = 2047;
|
|
||||||
meta.schedulingPriority = 50;
|
|
||||||
postInstall = "make installcheck";
|
|
||||||
configureFlags = "--sysconfdir=/etc";
|
|
||||||
debRequires =
|
|
||||||
[ "curl" "libsqlite3-0" "libbz2-1.0" "bzip2" "xz-utils" "libssl1.0.0" "liblzma5" "libseccomp2" ]
|
|
||||||
++ extraDebPackages;
|
|
||||||
debMaintainer = "Eelco Dolstra <eelco.dolstra@logicblox.com>";
|
|
||||||
doInstallCheck = true;
|
|
||||||
#enableParallelBuilding = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
in jobs
|
|
||||||
@@ -275,73 +275,9 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if type nix-env 2> /dev/null >&2; then
|
if type nix-env 2> /dev/null >&2; then
|
||||||
failure <<EOF
|
warning <<EOF
|
||||||
Nix already appears to be installed, and this tool assumes it is
|
Nix already appears to be installed. This installer may run into issues.
|
||||||
_not_ yet installed.
|
If an error occurs, try manually uninstalling, then rerunning this script.
|
||||||
|
|
||||||
$(uninstall_directions)
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${NIX_REMOTE:-}" != "" ]; then
|
|
||||||
failure <<EOF
|
|
||||||
For some reason, \$NIX_REMOTE is set. It really should not be set
|
|
||||||
before this installer runs, and it hints that Nix is currently
|
|
||||||
installed. Please delete the old Nix installation and start again.
|
|
||||||
|
|
||||||
Note: You might need to close your shell window and open a new shell
|
|
||||||
to clear the variable.
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if echo "${SSL_CERT_FILE:-}" | grep -qE "(nix/var/nix|nix-profile)"; then
|
|
||||||
failure <<EOF
|
|
||||||
It looks like \$SSL_CERT_FILE is set to a path that used to be part of
|
|
||||||
the old Nix installation. Please unset that variable and try again:
|
|
||||||
|
|
||||||
$ unset SSL_CERT_FILE
|
|
||||||
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in ~/.bash_profile ~/.bash_login ~/.profile ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin; do
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
if grep -l "^[^#].*.nix-profile" "$file"; then
|
|
||||||
failure <<EOF
|
|
||||||
I found a reference to a ".nix-profile" in $file.
|
|
||||||
This has a high chance of breaking a new nix installation. It was most
|
|
||||||
likely put there by a previous Nix installer.
|
|
||||||
|
|
||||||
Please remove this reference and try running this again. You should
|
|
||||||
also look for similar references in:
|
|
||||||
|
|
||||||
- ~/.bash_profile
|
|
||||||
- ~/.bash_login
|
|
||||||
- ~/.profile
|
|
||||||
|
|
||||||
or other shell init files that you may have.
|
|
||||||
|
|
||||||
$(uninstall_directions)
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -d /nix/store ] || [ -d /nix/var ]; then
|
|
||||||
failure <<EOF
|
|
||||||
There are some relics of a previous installation of Nix at /nix, and
|
|
||||||
this scripts assumes Nix is _not_ yet installed. Please delete the old
|
|
||||||
Nix installation and start again.
|
|
||||||
|
|
||||||
$(uninstall_directions)
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /etc/nix ]; then
|
|
||||||
failure <<EOF
|
|
||||||
There are some relics of a previous installation of Nix at /etc/nix, and
|
|
||||||
this scripts assumes Nix is _not_ yet installed. Please delete the old
|
|
||||||
Nix installation and start again.
|
|
||||||
|
|
||||||
$(uninstall_directions)
|
$(uninstall_directions)
|
||||||
EOF
|
EOF
|
||||||
@@ -349,7 +285,7 @@ EOF
|
|||||||
|
|
||||||
for profile_target in "${PROFILE_TARGETS[@]}"; do
|
for profile_target in "${PROFILE_TARGETS[@]}"; do
|
||||||
if [ -e "$profile_target$PROFILE_BACKUP_SUFFIX" ]; then
|
if [ -e "$profile_target$PROFILE_BACKUP_SUFFIX" ]; then
|
||||||
failure <<EOF
|
failure <<EOF
|
||||||
When this script runs, it backs up the current $profile_target to
|
When this script runs, it backs up the current $profile_target to
|
||||||
$profile_target$PROFILE_BACKUP_SUFFIX. This backup file already exists, though.
|
$profile_target$PROFILE_BACKUP_SUFFIX. This backup file already exists, though.
|
||||||
|
|
||||||
@@ -361,38 +297,10 @@ in case.
|
|||||||
2. Take care to make sure that $profile_target$PROFILE_BACKUP_SUFFIX doesn't look like
|
2. Take care to make sure that $profile_target$PROFILE_BACKUP_SUFFIX doesn't look like
|
||||||
it has anything nix-related in it. If it does, something is probably
|
it has anything nix-related in it. If it does, something is probably
|
||||||
quite wrong. Please open an issue or get in touch immediately.
|
quite wrong. Please open an issue or get in touch immediately.
|
||||||
|
|
||||||
3. Take care to make sure that $profile_target doesn't look like it has
|
|
||||||
anything nix-related in it. If it does, and $profile_target _did not_,
|
|
||||||
run:
|
|
||||||
|
|
||||||
$ /usr/bin/sudo /bin/mv $profile_target$PROFILE_BACKUP_SUFFIX $profile_target
|
|
||||||
|
|
||||||
and try again.
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "$profile_target" ] && grep -qi "nix" "$profile_target"; then
|
|
||||||
failure <<EOF
|
|
||||||
It looks like $profile_target already has some Nix configuration in
|
|
||||||
there. There should be no reason to run this again. If you're having
|
|
||||||
trouble, please open an issue.
|
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
danger_paths=("$ROOT_HOME/.nix-defexpr" "$ROOT_HOME/.nix-channels" "$ROOT_HOME/.nix-profile")
|
|
||||||
for danger_path in "${danger_paths[@]}"; do
|
|
||||||
if _sudo "making sure that $danger_path doesn't exist" \
|
|
||||||
test -e "$danger_path"; then
|
|
||||||
failure <<EOF
|
|
||||||
I found a file at $danger_path, which is a relic of a previous
|
|
||||||
installation. You must first delete this file before continuing.
|
|
||||||
|
|
||||||
$(uninstall_directions)
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_report() {
|
setup_report() {
|
||||||
@@ -659,7 +567,7 @@ install_from_extracted_nix() {
|
|||||||
cd "$EXTRACTED_NIX_PATH"
|
cd "$EXTRACTED_NIX_PATH"
|
||||||
|
|
||||||
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
|
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
|
||||||
rsync -rlpt ./store/* "$NIX_ROOT/store/"
|
rsync -rlpt --chmod=-w ./store/* "$NIX_ROOT/store/"
|
||||||
|
|
||||||
if [ -d "$NIX_INSTALLED_NIX" ]; then
|
if [ -d "$NIX_INSTALLED_NIX" ]; then
|
||||||
echo " Alright! We have our first nix at $NIX_INSTALLED_NIX"
|
echo " Alright! We have our first nix at $NIX_INSTALLED_NIX"
|
||||||
@@ -762,9 +670,7 @@ main() {
|
|||||||
welcome_to_nix
|
welcome_to_nix
|
||||||
chat_about_sudo
|
chat_about_sudo
|
||||||
|
|
||||||
if [ "${ALLOW_PREEXISTING_INSTALLATION:-}" = "" ]; then
|
validate_starting_assumptions
|
||||||
validate_starting_assumptions
|
|
||||||
fi
|
|
||||||
|
|
||||||
setup_report
|
setup_report
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ if ! [ -e $dest ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -w $dest ]; then
|
if ! [ -w $dest ]; then
|
||||||
echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see http://nixos.org/nix/manual/#ssec-multi-user. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
|
echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see https://nixos.org/nix/manual/#ssec-multi-user. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ for i in $(cd "$self/store" >/dev/null && echo ./*); do
|
|||||||
rm -rf "$i_tmp"
|
rm -rf "$i_tmp"
|
||||||
fi
|
fi
|
||||||
if ! [ -e "$dest/store/$i" ]; then
|
if ! [ -e "$dest/store/$i" ]; then
|
||||||
cp -Rp "$self/store/$i" "$i_tmp"
|
cp -RPp "$self/store/$i" "$i_tmp"
|
||||||
chmod -R a-w "$i_tmp"
|
chmod -R a-w "$i_tmp"
|
||||||
chmod +w "$i_tmp"
|
chmod +w "$i_tmp"
|
||||||
mv "$i_tmp" "$dest/store/$i"
|
mv "$i_tmp" "$dest/store/$i"
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ poly_configure_nix_daemon_service() {
|
|||||||
systemctl start nix-daemon.socket
|
systemctl start nix-daemon.socket
|
||||||
|
|
||||||
_sudo "to start the nix-daemon.service" \
|
_sudo "to start the nix-daemon.service" \
|
||||||
systemctl start nix-daemon.service
|
systemctl restart nix-daemon.service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,13 @@ case "$(uname -s).$(uname -m)" in
|
|||||||
*) oops "sorry, there is no binary distribution of Nix for your platform";;
|
*) oops "sorry, there is no binary distribution of Nix for your platform";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
url="https://nixos.org/releases/nix/nix-@nixVersion@/nix-@nixVersion@-$system.tar.xz"
|
url="https://releases.nixos.org/nix/nix-@nixVersion@/nix-@nixVersion@-$system.tar.xz"
|
||||||
|
|
||||||
tarball="$tmpDir/$(basename "$tmpDir/nix-@nixVersion@-$system.tar.xz")"
|
tarball="$tmpDir/$(basename "$tmpDir/nix-@nixVersion@-$system.tar.xz")"
|
||||||
|
|
||||||
require_util curl "download the binary tarball"
|
require_util curl "download the binary tarball"
|
||||||
require_util tar "unpack the binary tarball"
|
require_util tar "unpack the binary tarball"
|
||||||
|
require_util xz "unpack the binary tarball"
|
||||||
|
|
||||||
echo "downloading Nix @nixVersion@ binary tarball for $system from '$url' to '$tmpDir'..."
|
echo "downloading Nix @nixVersion@ binary tarball for $system from '$url' to '$tmpDir'..."
|
||||||
curl -L "$url" -o "$tarball" || oops "failed to download '$url'"
|
curl -L "$url" -o "$tarball" || oops "failed to download '$url'"
|
||||||
@@ -56,7 +57,7 @@ fi
|
|||||||
|
|
||||||
unpack=$tmpDir/unpack
|
unpack=$tmpDir/unpack
|
||||||
mkdir -p "$unpack"
|
mkdir -p "$unpack"
|
||||||
tar -xf "$tarball" -C "$unpack" || oops "failed to unpack '$url'"
|
tar -xJf "$tarball" -C "$unpack" || oops "failed to unpack '$url'"
|
||||||
|
|
||||||
script=$(echo "$unpack"/*/install)
|
script=$(echo "$unpack"/*/install)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi
|
if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi
|
||||||
__ETC_PROFILE_NIX_SOURCED=1
|
__ETC_PROFILE_NIX_SOURCED=1
|
||||||
|
|
||||||
export NIX_USER_PROFILE_DIR="@localstatedir@/nix/profiles/per-user/$USER"
|
|
||||||
export NIX_PROFILES="@localstatedir@/nix/profiles/default $HOME/.nix-profile"
|
export NIX_PROFILES="@localstatedir@/nix/profiles/default $HOME/.nix-profile"
|
||||||
|
|
||||||
# Set $NIX_SSL_CERT_FILE so that Nixpkgs applications like curl work.
|
# Set $NIX_SSL_CERT_FILE so that Nixpkgs applications like curl work.
|
||||||
@@ -25,5 +24,4 @@ else
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export NIX_PATH="nixpkgs=@localstatedir@/nix/profiles/per-user/root/channels/nixpkgs:@localstatedir@/nix/profiles/per-user/root/channels"
|
|
||||||
export PATH="$HOME/.nix-profile/bin:@localstatedir@/nix/profiles/default/bin:$PATH"
|
export PATH="$HOME/.nix-profile/bin:@localstatedir@/nix/profiles/default/bin:$PATH"
|
||||||
@@ -5,12 +5,6 @@ if [ -n "$HOME" ] && [ -n "$USER" ]; then
|
|||||||
|
|
||||||
NIX_LINK=$HOME/.nix-profile
|
NIX_LINK=$HOME/.nix-profile
|
||||||
|
|
||||||
NIX_USER_PROFILE_DIR=@localstatedir@/nix/profiles/per-user/$USER
|
|
||||||
|
|
||||||
# Append ~/.nix-defexpr/channels to $NIX_PATH so that <nixpkgs>
|
|
||||||
# paths work when the user has fetched the Nixpkgs channel.
|
|
||||||
export NIX_PATH=${NIX_PATH:+$NIX_PATH:}$HOME/.nix-defexpr/channels
|
|
||||||
|
|
||||||
# Set up environment.
|
# Set up environment.
|
||||||
# This part should be kept in sync with nixpkgs:nixos/modules/programs/environment.nix
|
# This part should be kept in sync with nixpkgs:nixos/modules/programs/environment.nix
|
||||||
export NIX_PROFILES="@localstatedir@/nix/profiles/default $HOME/.nix-profile"
|
export NIX_PROFILES="@localstatedir@/nix/profiles/default $HOME/.nix-profile"
|
||||||
@@ -35,5 +29,5 @@ if [ -n "$HOME" ] && [ -n "$USER" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$NIX_LINK/bin:$PATH"
|
export PATH="$NIX_LINK/bin:$PATH"
|
||||||
unset NIX_LINK NIX_USER_PROFILE_DIR
|
unset NIX_LINK
|
||||||
fi
|
fi
|
||||||
@@ -1,25 +1,3 @@
|
|||||||
{ useClang ? false }:
|
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
||||||
|
src = builtins.fetchGit ./.;
|
||||||
with import (builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz) {};
|
}).shellNix
|
||||||
|
|
||||||
with import ./release-common.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
(if useClang then clangStdenv else stdenv).mkDerivation {
|
|
||||||
name = "nix";
|
|
||||||
|
|
||||||
buildInputs = buildDeps ++ propagatedDeps ++ tarballDeps ++ perlDeps;
|
|
||||||
|
|
||||||
inherit configureFlags;
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
|
||||||
|
|
||||||
shellHook =
|
|
||||||
''
|
|
||||||
export prefix=$(pwd)/inst
|
|
||||||
configureFlags+=" --prefix=$prefix"
|
|
||||||
PKG_CONFIG_PATH=$prefix/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
PATH=$prefix/bin:$PATH
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "local-store.hh"
|
#include "local-store.hh"
|
||||||
#include "legacy.hh"
|
#include "../nix/legacy.hh"
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
using std::cin;
|
using std::cin;
|
||||||
@@ -88,7 +88,7 @@ static int _main(int argc, char * * argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string drvPath;
|
std::optional<StorePath> drvPath;
|
||||||
string storeUri;
|
string storeUri;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -100,7 +100,7 @@ static int _main(int argc, char * * argv)
|
|||||||
|
|
||||||
auto amWilling = readInt(source);
|
auto amWilling = readInt(source);
|
||||||
auto neededSystem = readString(source);
|
auto neededSystem = readString(source);
|
||||||
source >> drvPath;
|
drvPath = store->parseStorePath(readString(source));
|
||||||
auto requiredFeatures = readStrings<std::set<std::string>>(source);
|
auto requiredFeatures = readStrings<std::set<std::string>>(source);
|
||||||
|
|
||||||
auto canBuildLocally = amWilling
|
auto canBuildLocally = amWilling
|
||||||
@@ -188,7 +188,7 @@ static int _main(int argc, char * * argv)
|
|||||||
|
|
||||||
Store::Params storeParams;
|
Store::Params storeParams;
|
||||||
if (hasPrefix(bestMachine->storeUri, "ssh://")) {
|
if (hasPrefix(bestMachine->storeUri, "ssh://")) {
|
||||||
storeParams["max-connections"] ="1";
|
storeParams["max-connections"] = "1";
|
||||||
storeParams["log-fd"] = "4";
|
storeParams["log-fd"] = "4";
|
||||||
if (bestMachine->sshKey != "")
|
if (bestMachine->sshKey != "")
|
||||||
storeParams["ssh-key"] = bestMachine->sshKey;
|
storeParams["ssh-key"] = bestMachine->sshKey;
|
||||||
@@ -236,26 +236,27 @@ connected:
|
|||||||
|
|
||||||
{
|
{
|
||||||
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying dependencies to '%s'", storeUri));
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying dependencies to '%s'", storeUri));
|
||||||
copyPaths(store, ref<Store>(sshStore), inputs, NoRepair, NoCheckSigs, substitute);
|
copyPaths(store, ref<Store>(sshStore), store->parseStorePathSet(inputs), NoRepair, NoCheckSigs, substitute);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadLock = -1;
|
uploadLock = -1;
|
||||||
|
|
||||||
BasicDerivation drv(readDerivation(store->realStoreDir + "/" + baseNameOf(drvPath)));
|
BasicDerivation drv(readDerivation(*store, store->realStoreDir + "/" + std::string(drvPath->to_string())));
|
||||||
drv.inputSrcs = inputs;
|
drv.inputSrcs = store->parseStorePathSet(inputs);
|
||||||
|
|
||||||
auto result = sshStore->buildDerivation(drvPath, drv);
|
auto result = sshStore->buildDerivation(*drvPath, drv);
|
||||||
|
|
||||||
if (!result.success())
|
if (!result.success())
|
||||||
throw Error("build of '%s' on '%s' failed: %s", drvPath, storeUri, result.errorMsg);
|
throw Error("build of '%s' on '%s' failed: %s", store->printStorePath(*drvPath), storeUri, result.errorMsg);
|
||||||
|
|
||||||
PathSet missing;
|
StorePathSet missing;
|
||||||
for (auto & path : outputs)
|
for (auto & path : outputs)
|
||||||
if (!store->isValidPath(path)) missing.insert(path);
|
if (!store->isValidPath(store->parseStorePath(path))) missing.insert(store->parseStorePath(path));
|
||||||
|
|
||||||
if (!missing.empty()) {
|
if (!missing.empty()) {
|
||||||
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri));
|
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri));
|
||||||
store->locksHeld.insert(missing.begin(), missing.end()); /* FIXME: ugly */
|
for (auto & i : missing)
|
||||||
|
store->locksHeld.insert(store->printStorePath(i)); /* FIXME: ugly */
|
||||||
copyPaths(ref<Store>(sshStore), store, missing, NoRepair, NoCheckSigs, NoSubstitute);
|
copyPaths(ref<Store>(sshStore), store, missing, NoRepair, NoCheckSigs, NoSubstitute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#include "error.hh"
|
||||||
|
#include "nixexpr.hh"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace nix;
|
||||||
|
|
||||||
|
// In each program where errors occur, this has to be set.
|
||||||
|
ErrorInfo::programName = std::optional("error-demo");
|
||||||
|
|
||||||
|
// Error in a program; no hint and no nix code.
|
||||||
|
printErrorInfo(
|
||||||
|
ErrorInfo { .level = elError,
|
||||||
|
.name = "name",
|
||||||
|
.description = "error description",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Warning with name, description, and hint.
|
||||||
|
// The hintfmt function makes all the substituted text yellow.
|
||||||
|
printErrorInfo(
|
||||||
|
ErrorInfo { .level = elWarning,
|
||||||
|
.name = "name",
|
||||||
|
.description = "error description",
|
||||||
|
.hint = std::optional(
|
||||||
|
hintfmt("there was a %1%", "warning")),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Warning with nix file, line number, column, and the lines of
|
||||||
|
// code where a warning occurred.
|
||||||
|
SymbolTable testTable;
|
||||||
|
auto problem_file = testTable.create("myfile.nix");
|
||||||
|
|
||||||
|
printErrorInfo(
|
||||||
|
ErrorInfo{
|
||||||
|
.level = elWarning,
|
||||||
|
.name = "warning name",
|
||||||
|
.description = "warning description",
|
||||||
|
.hint = hintfmt("this hint has %1% templated %2%!!", "yellow", "values"),
|
||||||
|
.nixCode = NixCode {
|
||||||
|
.errPos = Pos(problem_file, 40, 13),
|
||||||
|
.prevLineOfCode = std::nullopt,
|
||||||
|
.errLineOfCode = "this is the problem line of code",
|
||||||
|
.nextLineOfCode = std::nullopt
|
||||||
|
}});
|
||||||
|
|
||||||
|
// Error with previous and next lines of code.
|
||||||
|
printErrorInfo(
|
||||||
|
ErrorInfo{
|
||||||
|
.level = elError,
|
||||||
|
.name = "error name",
|
||||||
|
.description = "error description",
|
||||||
|
.hint = hintfmt("this hint has %1% templated %2%!!", "yellow", "values"),
|
||||||
|
.nixCode = NixCode {
|
||||||
|
.errPos = Pos(problem_file, 40, 13),
|
||||||
|
.prevLineOfCode = std::optional("previous line of code"),
|
||||||
|
.errLineOfCode = "this is the problem line of code",
|
||||||
|
.nextLineOfCode = std::optional("next line of code"),
|
||||||
|
}});
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
programs += error-demo
|
||||||
|
|
||||||
|
error-demo_DIR := $(d)
|
||||||
|
|
||||||
|
error-demo_SOURCES := \
|
||||||
|
$(wildcard $(d)/*.cc) \
|
||||||
|
|
||||||
|
error-demo_CXXFLAGS += -I src/libutil -I src/libexpr
|
||||||
|
|
||||||
|
error-demo_LIBS = libutil libexpr
|
||||||
|
|
||||||
|
error-demo_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) -lboost_context -lboost_thread -lboost_system
|
||||||
@@ -6,11 +6,11 @@
|
|||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
||||||
static Strings parseAttrPath(const string & s)
|
static Strings parseAttrPath(std::string_view s)
|
||||||
{
|
{
|
||||||
Strings res;
|
Strings res;
|
||||||
string cur;
|
string cur;
|
||||||
string::const_iterator i = s.begin();
|
auto i = s.begin();
|
||||||
while (i != s.end()) {
|
while (i != s.end()) {
|
||||||
if (*i == '.') {
|
if (*i == '.') {
|
||||||
res.push_back(cur);
|
res.push_back(cur);
|
||||||
@@ -32,15 +32,22 @@ static Strings parseAttrPath(const string & s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Value * findAlongAttrPath(EvalState & state, const string & attrPath,
|
std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s)
|
||||||
|
{
|
||||||
|
std::vector<Symbol> res;
|
||||||
|
for (auto & a : parseAttrPath(s))
|
||||||
|
res.push_back(state.symbols.create(a));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||||
Bindings & autoArgs, Value & vIn)
|
Bindings & autoArgs, Value & vIn)
|
||||||
{
|
{
|
||||||
Strings tokens = parseAttrPath(attrPath);
|
Strings tokens = parseAttrPath(attrPath);
|
||||||
|
|
||||||
Error attrError =
|
|
||||||
Error(format("attribute selection path '%1%' does not match expression") % attrPath);
|
|
||||||
|
|
||||||
Value * v = &vIn;
|
Value * v = &vIn;
|
||||||
|
Pos pos = noPos;
|
||||||
|
|
||||||
for (auto & attr : tokens) {
|
for (auto & attr : tokens) {
|
||||||
|
|
||||||
@@ -70,8 +77,9 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath,
|
|||||||
|
|
||||||
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
|
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
|
||||||
if (a == v->attrs->end())
|
if (a == v->attrs->end())
|
||||||
throw Error(format("attribute '%1%' in selection path '%2%' not found") % attr % attrPath);
|
throw AttrPathNotFound("attribute '%1%' in selection path '%2%' not found", attr, attrPath);
|
||||||
v = &*a->value;
|
v = &*a->value;
|
||||||
|
pos = *a->pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (apType == apIndex) {
|
else if (apType == apIndex) {
|
||||||
@@ -82,14 +90,47 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath,
|
|||||||
% attrPath % showType(*v));
|
% attrPath % showType(*v));
|
||||||
|
|
||||||
if (attrIndex >= v->listSize())
|
if (attrIndex >= v->listSize())
|
||||||
throw Error(format("list index %1% in selection path '%2%' is out of range") % attrIndex % attrPath);
|
throw AttrPathNotFound("list index %1% in selection path '%2%' is out of range", attrIndex, attrPath);
|
||||||
|
|
||||||
v = v->listElems()[attrIndex];
|
v = v->listElems()[attrIndex];
|
||||||
|
pos = noPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return {v, pos};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Pos findDerivationFilename(EvalState & state, Value & v, std::string what)
|
||||||
|
{
|
||||||
|
Value * v2;
|
||||||
|
try {
|
||||||
|
auto dummyArgs = state.allocBindings(0);
|
||||||
|
v2 = findAlongAttrPath(state, "meta.position", *dummyArgs, v).first;
|
||||||
|
} catch (Error &) {
|
||||||
|
throw NoPositionInfo("package '%s' has no source location information", what);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: is it possible to extract the Pos object instead of doing this
|
||||||
|
// toString + parsing?
|
||||||
|
auto pos = state.forceString(*v2);
|
||||||
|
|
||||||
|
auto colon = pos.rfind(':');
|
||||||
|
if (colon == std::string::npos)
|
||||||
|
throw Error("cannot parse meta.position attribute '%s'", pos);
|
||||||
|
|
||||||
|
std::string filename(pos, 0, colon);
|
||||||
|
unsigned int lineno;
|
||||||
|
try {
|
||||||
|
lineno = std::stoi(std::string(pos, colon + 1));
|
||||||
|
} catch (std::invalid_argument & e) {
|
||||||
|
throw Error("cannot parse line number '%s'", pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
Symbol file = state.symbols.create(filename);
|
||||||
|
|
||||||
|
return { file, lineno, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,15 @@
|
|||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
Value * findAlongAttrPath(EvalState & state, const string & attrPath,
|
MakeError(AttrPathNotFound, Error);
|
||||||
|
MakeError(NoPositionInfo, Error);
|
||||||
|
|
||||||
|
std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||||
Bindings & autoArgs, Value & vIn);
|
Bindings & autoArgs, Value & vIn);
|
||||||
|
|
||||||
|
/* Heuristic to find the filename and lineno or a nix value. */
|
||||||
|
Pos findDerivationFilename(EvalState & state, Value & v, std::string what);
|
||||||
|
|
||||||
|
std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,12 @@ Value * EvalState::allocAttr(Value & vAttrs, const Symbol & name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Value * EvalState::allocAttr(Value & vAttrs, const std::string & name)
|
||||||
|
{
|
||||||
|
return allocAttr(vAttrs, symbols.create(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Bindings::sort()
|
void Bindings::sort()
|
||||||
{
|
{
|
||||||
std::sort(begin(), end());
|
std::sort(begin(), end());
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "symbol-table.hh"
|
#include "symbol-table.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
@@ -63,6 +64,22 @@ public:
|
|||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Attr * get(const Symbol & name)
|
||||||
|
{
|
||||||
|
Attr key(name, 0);
|
||||||
|
iterator i = std::lower_bound(begin(), end(), key);
|
||||||
|
if (i != end() && i->name == name) return &*i;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Attr & need(const Symbol & name, const Pos & pos = noPos)
|
||||||
|
{
|
||||||
|
auto a = get(name);
|
||||||
|
if (!a)
|
||||||
|
throw Error("attribute '%s' missing, at %s", name, pos);
|
||||||
|
return *a;
|
||||||
|
}
|
||||||
|
|
||||||
iterator begin() { return &attrs[0]; }
|
iterator begin() { return &attrs[0]; }
|
||||||
iterator end() { return &attrs[size_]; }
|
iterator end() { return &attrs[size_]; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,59 @@
|
|||||||
#include "common-eval-args.hh"
|
#include "common-eval-args.hh"
|
||||||
#include "shared.hh"
|
#include "shared.hh"
|
||||||
#include "download.hh"
|
#include "filetransfer.hh"
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
|
#include "fetchers.hh"
|
||||||
|
#include "registry.hh"
|
||||||
|
#include "flake/flakeref.hh"
|
||||||
|
#include "store-api.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
MixEvalArgs::MixEvalArgs()
|
MixEvalArgs::MixEvalArgs()
|
||||||
{
|
{
|
||||||
mkFlag()
|
addFlag({
|
||||||
.longName("arg")
|
.longName = "arg",
|
||||||
.description("argument to be passed to Nix functions")
|
.description = "argument to be passed to Nix functions",
|
||||||
.labels({"name", "expr"})
|
.labels = {"name", "expr"},
|
||||||
.handler([&](std::vector<std::string> ss) { autoArgs[ss[0]] = 'E' + ss[1]; });
|
.handler = {[&](std::string name, std::string expr) { autoArgs[name] = 'E' + expr; }}
|
||||||
|
});
|
||||||
|
|
||||||
mkFlag()
|
addFlag({
|
||||||
.longName("argstr")
|
.longName = "argstr",
|
||||||
.description("string-valued argument to be passed to Nix functions")
|
.description = "string-valued argument to be passed to Nix functions",
|
||||||
.labels({"name", "string"})
|
.labels = {"name", "string"},
|
||||||
.handler([&](std::vector<std::string> ss) { autoArgs[ss[0]] = 'S' + ss[1]; });
|
.handler = {[&](std::string name, std::string s) { autoArgs[name] = 'S' + s; }},
|
||||||
|
});
|
||||||
|
|
||||||
mkFlag()
|
addFlag({
|
||||||
.shortName('I')
|
.longName = "include",
|
||||||
.longName("include")
|
.shortName = 'I',
|
||||||
.description("add a path to the list of locations used to look up <...> file names")
|
.description = "add a path to the list of locations used to look up <...> file names",
|
||||||
.label("path")
|
.labels = {"path"},
|
||||||
.handler([&](std::string s) { searchPath.push_back(s); });
|
.handler = {[&](std::string s) { searchPath.push_back(s); }}
|
||||||
|
});
|
||||||
|
|
||||||
|
addFlag({
|
||||||
|
.longName = "impure",
|
||||||
|
.description = "allow access to mutable paths and repositories",
|
||||||
|
.handler = {[&]() {
|
||||||
|
evalSettings.pureEval = false;
|
||||||
|
}},
|
||||||
|
});
|
||||||
|
|
||||||
|
addFlag({
|
||||||
|
.longName = "override-flake",
|
||||||
|
.description = "override a flake registry value",
|
||||||
|
.labels = {"original-ref", "resolved-ref"},
|
||||||
|
.handler = {[&](std::string _from, std::string _to) {
|
||||||
|
auto from = parseFlakeRef(_from, absPath("."));
|
||||||
|
auto to = parseFlakeRef(_to, absPath("."));
|
||||||
|
fetchers::Attrs extraAttrs;
|
||||||
|
if (to.subdir != "") extraAttrs["dir"] = to.subdir;
|
||||||
|
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
||||||
|
}}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
||||||
@@ -46,9 +74,9 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||||||
Path lookupFileArg(EvalState & state, string s)
|
Path lookupFileArg(EvalState & state, string s)
|
||||||
{
|
{
|
||||||
if (isUri(s)) {
|
if (isUri(s)) {
|
||||||
CachedDownloadRequest request(s);
|
return state.store->toRealPath(
|
||||||
request.unpack = true;
|
fetchers::downloadTarball(
|
||||||
return getDownloader()->downloadCached(state.store, request).path;
|
state.store, resolveUri(s), "source", false).storePath);
|
||||||
} else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
|
} else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
|
||||||
Path p = s.substr(1, s.size() - 2);
|
Path p = s.substr(1, s.size() - 2);
|
||||||
return state.findFile(p);
|
return state.findFile(p);
|
||||||
|
|||||||
@@ -0,0 +1,503 @@
|
|||||||
|
#include "eval-cache.hh"
|
||||||
|
#include "sqlite.hh"
|
||||||
|
#include "eval.hh"
|
||||||
|
#include "eval-inline.hh"
|
||||||
|
|
||||||
|
namespace nix::eval_cache {
|
||||||
|
|
||||||
|
static const char * schema = R"sql(
|
||||||
|
create table if not exists Attributes (
|
||||||
|
parent integer not null,
|
||||||
|
name text,
|
||||||
|
type integer not null,
|
||||||
|
value text,
|
||||||
|
primary key (parent, name)
|
||||||
|
);
|
||||||
|
)sql";
|
||||||
|
|
||||||
|
struct AttrDb
|
||||||
|
{
|
||||||
|
struct State
|
||||||
|
{
|
||||||
|
SQLite db;
|
||||||
|
SQLiteStmt insertAttribute;
|
||||||
|
SQLiteStmt queryAttribute;
|
||||||
|
SQLiteStmt queryAttributes;
|
||||||
|
std::unique_ptr<SQLiteTxn> txn;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<Sync<State>> _state;
|
||||||
|
|
||||||
|
AttrDb(const Hash & fingerprint)
|
||||||
|
: _state(std::make_unique<Sync<State>>())
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
Path cacheDir = getCacheDir() + "/nix/eval-cache-v1";
|
||||||
|
createDirs(cacheDir);
|
||||||
|
|
||||||
|
Path dbPath = cacheDir + "/" + fingerprint.to_string(Base16, false) + ".sqlite";
|
||||||
|
|
||||||
|
state->db = SQLite(dbPath);
|
||||||
|
state->db.isCache();
|
||||||
|
state->db.exec(schema);
|
||||||
|
|
||||||
|
state->insertAttribute.create(state->db,
|
||||||
|
"insert or replace into Attributes(parent, name, type, value) values (?, ?, ?, ?)");
|
||||||
|
|
||||||
|
state->queryAttribute.create(state->db,
|
||||||
|
"select rowid, type, value from Attributes where parent = ? and name = ?");
|
||||||
|
|
||||||
|
state->queryAttributes.create(state->db,
|
||||||
|
"select name from Attributes where parent = ?");
|
||||||
|
|
||||||
|
state->txn = std::make_unique<SQLiteTxn>(state->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AttrDb()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
auto state(_state->lock());
|
||||||
|
state->txn->commit();
|
||||||
|
state->txn.reset();
|
||||||
|
} catch (...) {
|
||||||
|
ignoreException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setAttrs(
|
||||||
|
AttrKey key,
|
||||||
|
const std::vector<Symbol> & attrs)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::FullAttrs)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
AttrId rowId = state->db.getLastInsertedRowId();
|
||||||
|
assert(rowId);
|
||||||
|
|
||||||
|
for (auto & attr : attrs)
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(rowId)
|
||||||
|
(attr)
|
||||||
|
(AttrType::Placeholder)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setString(
|
||||||
|
AttrKey key,
|
||||||
|
std::string_view s)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::String)
|
||||||
|
(s).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setBool(
|
||||||
|
AttrKey key,
|
||||||
|
bool b)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::Bool)
|
||||||
|
(b ? 1 : 0).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setPlaceholder(AttrKey key)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::Placeholder)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setMissing(AttrKey key)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::Missing)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setMisc(AttrKey key)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::Misc)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrId setFailed(AttrKey key)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
state->insertAttribute.use()
|
||||||
|
(key.first)
|
||||||
|
(key.second)
|
||||||
|
(AttrType::Failed)
|
||||||
|
(0, false).exec();
|
||||||
|
|
||||||
|
return state->db.getLastInsertedRowId();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::pair<AttrId, AttrValue>> getAttr(
|
||||||
|
AttrKey key,
|
||||||
|
SymbolTable & symbols)
|
||||||
|
{
|
||||||
|
auto state(_state->lock());
|
||||||
|
|
||||||
|
auto queryAttribute(state->queryAttribute.use()(key.first)(key.second));
|
||||||
|
if (!queryAttribute.next()) return {};
|
||||||
|
|
||||||
|
auto rowId = (AttrType) queryAttribute.getInt(0);
|
||||||
|
auto type = (AttrType) queryAttribute.getInt(1);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case AttrType::Placeholder:
|
||||||
|
return {{rowId, placeholder_t()}};
|
||||||
|
case AttrType::FullAttrs: {
|
||||||
|
// FIXME: expensive, should separate this out.
|
||||||
|
std::vector<Symbol> attrs;
|
||||||
|
auto queryAttributes(state->queryAttributes.use()(rowId));
|
||||||
|
while (queryAttributes.next())
|
||||||
|
attrs.push_back(symbols.create(queryAttributes.getStr(0)));
|
||||||
|
return {{rowId, attrs}};
|
||||||
|
}
|
||||||
|
case AttrType::String:
|
||||||
|
return {{rowId, queryAttribute.getStr(2)}};
|
||||||
|
case AttrType::Bool:
|
||||||
|
return {{rowId, queryAttribute.getInt(2) != 0}};
|
||||||
|
case AttrType::Missing:
|
||||||
|
return {{rowId, missing_t()}};
|
||||||
|
case AttrType::Misc:
|
||||||
|
return {{rowId, misc_t()}};
|
||||||
|
case AttrType::Failed:
|
||||||
|
return {{rowId, failed_t()}};
|
||||||
|
default:
|
||||||
|
throw Error("unexpected type in evaluation cache");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EvalCache::EvalCache(
|
||||||
|
bool useCache,
|
||||||
|
const Hash & fingerprint,
|
||||||
|
EvalState & state,
|
||||||
|
RootLoader rootLoader)
|
||||||
|
: db(useCache ? std::make_shared<AttrDb>(fingerprint) : nullptr)
|
||||||
|
, state(state)
|
||||||
|
, rootLoader(rootLoader)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Value * EvalCache::getRootValue()
|
||||||
|
{
|
||||||
|
if (!value) {
|
||||||
|
debug("getting root value");
|
||||||
|
value = allocRootValue(rootLoader());
|
||||||
|
}
|
||||||
|
return *value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> EvalCache::getRoot()
|
||||||
|
{
|
||||||
|
return std::make_shared<AttrCursor>(ref(shared_from_this()), std::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrCursor::AttrCursor(
|
||||||
|
ref<EvalCache> root,
|
||||||
|
Parent parent,
|
||||||
|
Value * value,
|
||||||
|
std::optional<std::pair<AttrId, AttrValue>> && cachedValue)
|
||||||
|
: root(root), parent(parent), cachedValue(std::move(cachedValue))
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
_value = allocRootValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
AttrKey AttrCursor::getKey()
|
||||||
|
{
|
||||||
|
if (!parent)
|
||||||
|
return {0, root->state.sEpsilon};
|
||||||
|
if (!parent->first->cachedValue) {
|
||||||
|
parent->first->cachedValue = root->db->getAttr(
|
||||||
|
parent->first->getKey(), root->state.symbols);
|
||||||
|
assert(parent->first->cachedValue);
|
||||||
|
}
|
||||||
|
return {parent->first->cachedValue->first, parent->second};
|
||||||
|
}
|
||||||
|
|
||||||
|
Value & AttrCursor::getValue()
|
||||||
|
{
|
||||||
|
if (!_value) {
|
||||||
|
if (parent) {
|
||||||
|
auto & vParent = parent->first->getValue();
|
||||||
|
root->state.forceAttrs(vParent);
|
||||||
|
auto attr = vParent.attrs->get(parent->second);
|
||||||
|
if (!attr)
|
||||||
|
throw Error("attribute '%s' is unexpectedly missing", getAttrPathStr());
|
||||||
|
_value = allocRootValue(attr->value);
|
||||||
|
} else
|
||||||
|
_value = allocRootValue(root->getRootValue());
|
||||||
|
}
|
||||||
|
return **_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Symbol> AttrCursor::getAttrPath() const
|
||||||
|
{
|
||||||
|
if (parent) {
|
||||||
|
auto attrPath = parent->first->getAttrPath();
|
||||||
|
attrPath.push_back(parent->second);
|
||||||
|
return attrPath;
|
||||||
|
} else
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Symbol> AttrCursor::getAttrPath(Symbol name) const
|
||||||
|
{
|
||||||
|
auto attrPath = getAttrPath();
|
||||||
|
attrPath.push_back(name);
|
||||||
|
return attrPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AttrCursor::getAttrPathStr() const
|
||||||
|
{
|
||||||
|
return concatStringsSep(".", getAttrPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AttrCursor::getAttrPathStr(Symbol name) const
|
||||||
|
{
|
||||||
|
return concatStringsSep(".", getAttrPath(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
Value & AttrCursor::forceValue()
|
||||||
|
{
|
||||||
|
debug("evaluating uncached attribute %s", getAttrPathStr());
|
||||||
|
|
||||||
|
auto & v = getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
root->state.forceValue(v);
|
||||||
|
} catch (EvalError &) {
|
||||||
|
debug("setting '%s' to failed", getAttrPathStr());
|
||||||
|
if (root->db)
|
||||||
|
cachedValue = {root->db->setFailed(getKey()), failed_t()};
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root->db && (!cachedValue || std::get_if<placeholder_t>(&cachedValue->second))) {
|
||||||
|
if (v.type == tString)
|
||||||
|
cachedValue = {root->db->setString(getKey(), v.string.s), v.string.s};
|
||||||
|
else if (v.type == tBool)
|
||||||
|
cachedValue = {root->db->setBool(getKey(), v.boolean), v.boolean};
|
||||||
|
else if (v.type == tAttrs)
|
||||||
|
; // FIXME: do something?
|
||||||
|
else
|
||||||
|
cachedValue = {root->db->setMisc(getKey()), misc_t()};
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(Symbol name)
|
||||||
|
{
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
||||||
|
|
||||||
|
if (cachedValue) {
|
||||||
|
if (auto attrs = std::get_if<std::vector<Symbol>>(&cachedValue->second)) {
|
||||||
|
for (auto & attr : *attrs)
|
||||||
|
if (attr == name)
|
||||||
|
return std::make_shared<AttrCursor>(root, std::make_pair(shared_from_this(), name));
|
||||||
|
return nullptr;
|
||||||
|
} else if (std::get_if<placeholder_t>(&cachedValue->second)) {
|
||||||
|
auto attr = root->db->getAttr({cachedValue->first, name}, root->state.symbols);
|
||||||
|
if (attr) {
|
||||||
|
if (std::get_if<missing_t>(&attr->second))
|
||||||
|
return nullptr;
|
||||||
|
else if (std::get_if<failed_t>(&attr->second))
|
||||||
|
throw EvalError("cached failure of attribute '%s'", getAttrPathStr(name));
|
||||||
|
else
|
||||||
|
return std::make_shared<AttrCursor>(root,
|
||||||
|
std::make_pair(shared_from_this(), name), nullptr, std::move(attr));
|
||||||
|
}
|
||||||
|
// Incomplete attrset, so need to fall thru and
|
||||||
|
// evaluate to see whether 'name' exists
|
||||||
|
} else
|
||||||
|
return nullptr;
|
||||||
|
//throw TypeError("'%s' is not an attribute set", getAttrPathStr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto & v = forceValue();
|
||||||
|
|
||||||
|
if (v.type != tAttrs)
|
||||||
|
return nullptr;
|
||||||
|
//throw TypeError("'%s' is not an attribute set", getAttrPathStr());
|
||||||
|
|
||||||
|
auto attr = v.attrs->get(name);
|
||||||
|
|
||||||
|
if (!attr) {
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = {root->db->setPlaceholder(getKey()), placeholder_t()};
|
||||||
|
root->db->setMissing({cachedValue->first, name});
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::pair<AttrId, AttrValue>> cachedValue2;
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = {root->db->setPlaceholder(getKey()), placeholder_t()};
|
||||||
|
cachedValue2 = {root->db->setPlaceholder({cachedValue->first, name}), placeholder_t()};
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_shared<AttrCursor>(
|
||||||
|
root, std::make_pair(shared_from_this(), name), attr->value, std::move(cachedValue2));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(std::string_view name)
|
||||||
|
{
|
||||||
|
return maybeGetAttr(root->state.symbols.create(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> AttrCursor::getAttr(Symbol name)
|
||||||
|
{
|
||||||
|
auto p = maybeGetAttr(name);
|
||||||
|
if (!p)
|
||||||
|
throw Error("attribute '%s' does not exist", getAttrPathStr(name));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> AttrCursor::getAttr(std::string_view name)
|
||||||
|
{
|
||||||
|
return getAttr(root->state.symbols.create(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> AttrCursor::findAlongAttrPath(const std::vector<Symbol> & attrPath)
|
||||||
|
{
|
||||||
|
auto res = shared_from_this();
|
||||||
|
for (auto & attr : attrPath) {
|
||||||
|
res = res->maybeGetAttr(attr);
|
||||||
|
if (!res) return {};
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AttrCursor::getString()
|
||||||
|
{
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
||||||
|
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
|
||||||
|
if (auto s = std::get_if<std::string>(&cachedValue->second)) {
|
||||||
|
debug("using cached string attribute '%s'", getAttrPathStr());
|
||||||
|
return *s;
|
||||||
|
} else
|
||||||
|
throw TypeError("'%s' is not a string", getAttrPathStr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto & v = forceValue();
|
||||||
|
|
||||||
|
if (v.type != tString)
|
||||||
|
throw TypeError("'%s' is not a string", getAttrPathStr());
|
||||||
|
|
||||||
|
return v.string.s;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AttrCursor::getBool()
|
||||||
|
{
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
||||||
|
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
|
||||||
|
if (auto b = std::get_if<bool>(&cachedValue->second)) {
|
||||||
|
debug("using cached Boolean attribute '%s'", getAttrPathStr());
|
||||||
|
return *b;
|
||||||
|
} else
|
||||||
|
throw TypeError("'%s' is not a Boolean", getAttrPathStr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto & v = forceValue();
|
||||||
|
|
||||||
|
if (v.type != tBool)
|
||||||
|
throw TypeError("'%s' is not a Boolean", getAttrPathStr());
|
||||||
|
|
||||||
|
return v.boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Symbol> AttrCursor::getAttrs()
|
||||||
|
{
|
||||||
|
if (root->db) {
|
||||||
|
if (!cachedValue)
|
||||||
|
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
||||||
|
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
|
||||||
|
if (auto attrs = std::get_if<std::vector<Symbol>>(&cachedValue->second)) {
|
||||||
|
debug("using cached attrset attribute '%s'", getAttrPathStr());
|
||||||
|
return *attrs;
|
||||||
|
} else
|
||||||
|
throw TypeError("'%s' is not an attribute set", getAttrPathStr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto & v = forceValue();
|
||||||
|
|
||||||
|
if (v.type != tAttrs)
|
||||||
|
throw TypeError("'%s' is not an attribute set", getAttrPathStr());
|
||||||
|
|
||||||
|
std::vector<Symbol> attrs;
|
||||||
|
for (auto & attr : *getValue().attrs)
|
||||||
|
attrs.push_back(attr.name);
|
||||||
|
std::sort(attrs.begin(), attrs.end(), [](const Symbol & a, const Symbol & b) {
|
||||||
|
return (const string &) a < (const string &) b;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (root->db)
|
||||||
|
cachedValue = {root->db->setAttrs(getKey(), attrs), attrs};
|
||||||
|
|
||||||
|
return attrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AttrCursor::isDerivation()
|
||||||
|
{
|
||||||
|
auto aType = maybeGetAttr("type");
|
||||||
|
return aType && aType->getString() == "derivation";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "sync.hh"
|
||||||
|
#include "hash.hh"
|
||||||
|
#include "eval.hh"
|
||||||
|
|
||||||
|
#include <variant>
|
||||||
|
|
||||||
|
namespace nix::eval_cache {
|
||||||
|
|
||||||
|
class AttrDb;
|
||||||
|
class AttrCursor;
|
||||||
|
|
||||||
|
class EvalCache : public std::enable_shared_from_this<EvalCache>
|
||||||
|
{
|
||||||
|
friend class AttrCursor;
|
||||||
|
|
||||||
|
std::shared_ptr<AttrDb> db;
|
||||||
|
EvalState & state;
|
||||||
|
typedef std::function<Value *()> RootLoader;
|
||||||
|
RootLoader rootLoader;
|
||||||
|
RootValue value;
|
||||||
|
|
||||||
|
Value * getRootValue();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
EvalCache(
|
||||||
|
bool useCache,
|
||||||
|
const Hash & fingerprint,
|
||||||
|
EvalState & state,
|
||||||
|
RootLoader rootLoader);
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> getRoot();
|
||||||
|
};
|
||||||
|
|
||||||
|
enum AttrType {
|
||||||
|
Placeholder = 0,
|
||||||
|
FullAttrs = 1,
|
||||||
|
String = 2,
|
||||||
|
Missing = 3,
|
||||||
|
Misc = 4,
|
||||||
|
Failed = 5,
|
||||||
|
Bool = 6,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct placeholder_t {};
|
||||||
|
struct missing_t {};
|
||||||
|
struct misc_t {};
|
||||||
|
struct failed_t {};
|
||||||
|
typedef uint64_t AttrId;
|
||||||
|
typedef std::pair<AttrId, Symbol> AttrKey;
|
||||||
|
typedef std::variant<std::vector<Symbol>, std::string, placeholder_t, missing_t, misc_t, failed_t, bool> AttrValue;
|
||||||
|
|
||||||
|
class AttrCursor : public std::enable_shared_from_this<AttrCursor>
|
||||||
|
{
|
||||||
|
friend class EvalCache;
|
||||||
|
|
||||||
|
ref<EvalCache> root;
|
||||||
|
typedef std::optional<std::pair<std::shared_ptr<AttrCursor>, Symbol>> Parent;
|
||||||
|
Parent parent;
|
||||||
|
RootValue _value;
|
||||||
|
std::optional<std::pair<AttrId, AttrValue>> cachedValue;
|
||||||
|
|
||||||
|
AttrKey getKey();
|
||||||
|
|
||||||
|
Value & getValue();
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
AttrCursor(
|
||||||
|
ref<EvalCache> root,
|
||||||
|
Parent parent,
|
||||||
|
Value * value = nullptr,
|
||||||
|
std::optional<std::pair<AttrId, AttrValue>> && cachedValue = {});
|
||||||
|
|
||||||
|
std::vector<Symbol> getAttrPath() const;
|
||||||
|
|
||||||
|
std::vector<Symbol> getAttrPath(Symbol name) const;
|
||||||
|
|
||||||
|
std::string getAttrPathStr() const;
|
||||||
|
|
||||||
|
std::string getAttrPathStr(Symbol name) const;
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> maybeGetAttr(Symbol name);
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> maybeGetAttr(std::string_view name);
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> getAttr(Symbol name);
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> getAttr(std::string_view name);
|
||||||
|
|
||||||
|
std::shared_ptr<AttrCursor> findAlongAttrPath(const std::vector<Symbol> & attrPath);
|
||||||
|
|
||||||
|
std::string getString();
|
||||||
|
|
||||||
|
bool getBool();
|
||||||
|
|
||||||
|
std::vector<Symbol> getAttrs();
|
||||||
|
|
||||||
|
bool isDerivation();
|
||||||
|
|
||||||
|
Value & forceValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -57,7 +57,7 @@ inline void EvalState::forceAttrs(Value & v)
|
|||||||
|
|
||||||
inline void EvalState::forceAttrs(Value & v, const Pos & pos)
|
inline void EvalState::forceAttrs(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v);
|
forceValue(v, pos);
|
||||||
if (v.type != tAttrs)
|
if (v.type != tAttrs)
|
||||||
throwTypeError("value is %1% while a set was expected, at %2%", v, pos);
|
throwTypeError("value is %1% while a set was expected, at %2%", v, pos);
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ inline void EvalState::forceList(Value & v)
|
|||||||
|
|
||||||
inline void EvalState::forceList(Value & v, const Pos & pos)
|
inline void EvalState::forceList(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v);
|
forceValue(v, pos);
|
||||||
if (!v.isList())
|
if (!v.isList())
|
||||||
throwTypeError("value is %1% while a list was expected, at %2%", v, pos);
|
throwTypeError("value is %1% while a list was expected, at %2%", v, pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
#include "eval-inline.hh"
|
#include "eval-inline.hh"
|
||||||
#include "download.hh"
|
#include "filetransfer.hh"
|
||||||
#include "json.hh"
|
#include "json.hh"
|
||||||
#include "function-trace.hh"
|
#include "function-trace.hh"
|
||||||
|
#include "flake/flake.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -22,6 +23,8 @@
|
|||||||
|
|
||||||
#if HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
|
|
||||||
|
#define GC_INCLUDE_NEW
|
||||||
|
|
||||||
#include <gc/gc.h>
|
#include <gc/gc.h>
|
||||||
#include <gc/gc_cpp.h>
|
#include <gc/gc_cpp.h>
|
||||||
|
|
||||||
@@ -43,15 +46,33 @@ static char * dupString(const char * s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char * dupStringWithLen(const char * s, size_t size)
|
||||||
|
{
|
||||||
|
char * t;
|
||||||
|
#if HAVE_BOEHMGC
|
||||||
|
t = GC_STRNDUP(s, size);
|
||||||
|
#else
|
||||||
|
t = strndup(s, size);
|
||||||
|
#endif
|
||||||
|
if (!t) throw std::bad_alloc();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RootValue allocRootValue(Value * v)
|
||||||
|
{
|
||||||
|
return std::allocate_shared<Value *>(traceable_allocator<Value *>(), v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void printValue(std::ostream & str, std::set<const Value *> & active, const Value & v)
|
static void printValue(std::ostream & str, std::set<const Value *> & active, const Value & v)
|
||||||
{
|
{
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
if (active.find(&v) != active.end()) {
|
if (!active.insert(&v).second) {
|
||||||
str << "<CYCLE>";
|
str << "<CYCLE>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
active.insert(&v);
|
|
||||||
|
|
||||||
switch (v.type) {
|
switch (v.type) {
|
||||||
case tInt:
|
case tInt:
|
||||||
@@ -141,12 +162,12 @@ const Value *getPrimOp(const Value &v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string showType(const Value & v)
|
string showType(ValueType type)
|
||||||
{
|
{
|
||||||
switch (v.type) {
|
switch (type) {
|
||||||
case tInt: return "an integer";
|
case tInt: return "an integer";
|
||||||
case tBool: return "a boolean";
|
case tBool: return "a Boolean";
|
||||||
case tString: return v.string.context ? "a string with context" : "a string";
|
case tString: return "a string";
|
||||||
case tPath: return "a path";
|
case tPath: return "a path";
|
||||||
case tNull: return "null";
|
case tNull: return "null";
|
||||||
case tAttrs: return "a set";
|
case tAttrs: return "a set";
|
||||||
@@ -155,14 +176,39 @@ string showType(const Value & v)
|
|||||||
case tApp: return "a function application";
|
case tApp: return "a function application";
|
||||||
case tLambda: return "a function";
|
case tLambda: return "a function";
|
||||||
case tBlackhole: return "a black hole";
|
case tBlackhole: return "a black hole";
|
||||||
|
case tPrimOp: return "a built-in function";
|
||||||
|
case tPrimOpApp: return "a partially applied built-in function";
|
||||||
|
case tExternal: return "an external value";
|
||||||
|
case tFloat: return "a float";
|
||||||
|
}
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string showType(const Value & v)
|
||||||
|
{
|
||||||
|
switch (v.type) {
|
||||||
|
case tString: return v.string.context ? "a string with context" : "a string";
|
||||||
case tPrimOp:
|
case tPrimOp:
|
||||||
return fmt("the built-in function '%s'", string(v.primOp->name));
|
return fmt("the built-in function '%s'", string(v.primOp->name));
|
||||||
case tPrimOpApp:
|
case tPrimOpApp:
|
||||||
return fmt("the partially applied built-in function '%s'", string(getPrimOp(v)->primOp->name));
|
return fmt("the partially applied built-in function '%s'", string(getPrimOp(v)->primOp->name));
|
||||||
case tExternal: return v.external->showType();
|
case tExternal: return v.external->showType();
|
||||||
case tFloat: return "a float";
|
default:
|
||||||
|
return showType(v.type);
|
||||||
}
|
}
|
||||||
abort();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Value::isTrivial() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
type != tApp
|
||||||
|
&& type != tPrimOpApp
|
||||||
|
&& (type != tThunk
|
||||||
|
|| (dynamic_cast<ExprAttrs *>(thunk.expr)
|
||||||
|
&& ((ExprAttrs *) thunk.expr)->dynamicAttrs.empty())
|
||||||
|
|| dynamic_cast<ExprLambda *>(thunk.expr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -219,7 +265,7 @@ void initGC()
|
|||||||
that GC_expand_hp() causes a lot of virtual, but not physical
|
that GC_expand_hp() causes a lot of virtual, but not physical
|
||||||
(resident) memory to be allocated. This might be a problem on
|
(resident) memory to be allocated. This might be a problem on
|
||||||
systems that don't overcommit. */
|
systems that don't overcommit. */
|
||||||
if (!getenv("GC_INITIAL_HEAP_SIZE")) {
|
if (!getEnv("GC_INITIAL_HEAP_SIZE")) {
|
||||||
size_t size = 32 * 1024 * 1024;
|
size_t size = 32 * 1024 * 1024;
|
||||||
#if HAVE_SYSCONF && defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
|
#if HAVE_SYSCONF && defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
|
||||||
size_t maxSize = 384 * 1024 * 1024;
|
size_t maxSize = 384 * 1024 * 1024;
|
||||||
@@ -303,12 +349,16 @@ EvalState::EvalState(const Strings & _searchPath, ref<Store> store)
|
|||||||
, sOutputHash(symbols.create("outputHash"))
|
, sOutputHash(symbols.create("outputHash"))
|
||||||
, sOutputHashAlgo(symbols.create("outputHashAlgo"))
|
, sOutputHashAlgo(symbols.create("outputHashAlgo"))
|
||||||
, sOutputHashMode(symbols.create("outputHashMode"))
|
, sOutputHashMode(symbols.create("outputHashMode"))
|
||||||
|
, sDescription(symbols.create("description"))
|
||||||
|
, sSelf(symbols.create("self"))
|
||||||
|
, sEpsilon(symbols.create(""))
|
||||||
|
, sRecurseForDerivations(symbols.create("recurseForDerivations"))
|
||||||
, repair(NoRepair)
|
, repair(NoRepair)
|
||||||
, store(store)
|
, store(store)
|
||||||
, baseEnv(allocEnv(128))
|
, baseEnv(allocEnv(128))
|
||||||
, staticBaseEnv(false, 0)
|
, staticBaseEnv(false, 0)
|
||||||
{
|
{
|
||||||
countCalls = getEnv("NIX_COUNT_CALLS", "0") != "0";
|
countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0";
|
||||||
|
|
||||||
assert(gcInitialised);
|
assert(gcInitialised);
|
||||||
|
|
||||||
@@ -316,9 +366,8 @@ EvalState::EvalState(const Strings & _searchPath, ref<Store> store)
|
|||||||
|
|
||||||
/* Initialise the Nix expression search path. */
|
/* Initialise the Nix expression search path. */
|
||||||
if (!evalSettings.pureEval) {
|
if (!evalSettings.pureEval) {
|
||||||
Strings paths = parseNixPath(getEnv("NIX_PATH", ""));
|
|
||||||
for (auto & i : _searchPath) addToSearchPath(i);
|
for (auto & i : _searchPath) addToSearchPath(i);
|
||||||
for (auto & i : paths) addToSearchPath(i);
|
for (auto & i : evalSettings.nixPath.get()) addToSearchPath(i);
|
||||||
}
|
}
|
||||||
addToSearchPath("nix=" + canonPath(settings.nixDataDir + "/nix/corepkgs", true));
|
addToSearchPath("nix=" + canonPath(settings.nixDataDir + "/nix/corepkgs", true));
|
||||||
|
|
||||||
@@ -332,10 +381,10 @@ EvalState::EvalState(const Strings & _searchPath, ref<Store> store)
|
|||||||
auto path = r.second;
|
auto path = r.second;
|
||||||
|
|
||||||
if (store->isInStore(r.second)) {
|
if (store->isInStore(r.second)) {
|
||||||
PathSet closure;
|
StorePathSet closure;
|
||||||
store->computeFSClosure(store->toStorePath(r.second), closure);
|
store->computeFSClosure(store->parseStorePath(store->toStorePath(r.second)), closure);
|
||||||
for (auto & path : closure)
|
for (auto & path : closure)
|
||||||
allowedPaths->insert(path);
|
allowedPaths->insert(store->printStorePath(path));
|
||||||
} else
|
} else
|
||||||
allowedPaths->insert(r.second);
|
allowedPaths->insert(r.second);
|
||||||
}
|
}
|
||||||
@@ -434,7 +483,7 @@ Path EvalState::toRealPath(const Path & path, const PathSet & context)
|
|||||||
!context.empty() && store->isInStore(path)
|
!context.empty() && store->isInStore(path)
|
||||||
? store->toRealPath(path)
|
? store->toRealPath(path)
|
||||||
: path;
|
: path;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
Value * EvalState::addConstant(const string & name, Value & v)
|
Value * EvalState::addConstant(const string & name, Value & v)
|
||||||
@@ -452,14 +501,21 @@ Value * EvalState::addConstant(const string & name, Value & v)
|
|||||||
Value * EvalState::addPrimOp(const string & name,
|
Value * EvalState::addPrimOp(const string & name,
|
||||||
size_t arity, PrimOpFun primOp)
|
size_t arity, PrimOpFun primOp)
|
||||||
{
|
{
|
||||||
|
auto name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
|
||||||
|
Symbol sym = symbols.create(name2);
|
||||||
|
|
||||||
|
/* Hack to make constants lazy: turn them into a application of
|
||||||
|
the primop to a dummy value. */
|
||||||
if (arity == 0) {
|
if (arity == 0) {
|
||||||
|
auto vPrimOp = allocValue();
|
||||||
|
vPrimOp->type = tPrimOp;
|
||||||
|
vPrimOp->primOp = new PrimOp(primOp, 1, sym);
|
||||||
Value v;
|
Value v;
|
||||||
primOp(*this, noPos, nullptr, v);
|
mkApp(v, *vPrimOp, *vPrimOp);
|
||||||
return addConstant(name, v);
|
return addConstant(name, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value * v = allocValue();
|
Value * v = allocValue();
|
||||||
string name2 = string(name, 0, 2) == "__" ? string(name, 2) : name;
|
|
||||||
Symbol sym = symbols.create(name2);
|
|
||||||
v->type = tPrimOp;
|
v->type = tPrimOp;
|
||||||
v->primOp = new PrimOp(primOp, arity, sym);
|
v->primOp = new PrimOp(primOp, arity, sym);
|
||||||
staticBaseEnv.vars[symbols.create(name)] = baseEnvDispl;
|
staticBaseEnv.vars[symbols.create(name)] = baseEnvDispl;
|
||||||
@@ -552,9 +608,11 @@ void mkString(Value & v, const char * s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Value & mkString(Value & v, const string & s, const PathSet & context)
|
Value & mkString(Value & v, std::string_view s, const PathSet & context)
|
||||||
{
|
{
|
||||||
mkString(v, s.c_str());
|
v.type = tString;
|
||||||
|
v.string.s = dupStringWithLen(s.data(), s.size());
|
||||||
|
v.string.context = 0;
|
||||||
if (!context.empty()) {
|
if (!context.empty()) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
v.string.context = (const char * *)
|
v.string.context = (const char * *)
|
||||||
@@ -617,13 +675,9 @@ Value * EvalState::allocValue()
|
|||||||
|
|
||||||
Env & EvalState::allocEnv(size_t size)
|
Env & EvalState::allocEnv(size_t size)
|
||||||
{
|
{
|
||||||
if (size > std::numeric_limits<decltype(Env::size)>::max())
|
|
||||||
throw Error("environment size %d is too big", size);
|
|
||||||
|
|
||||||
nrEnvs++;
|
nrEnvs++;
|
||||||
nrValuesInEnvs += size;
|
nrValuesInEnvs += size;
|
||||||
Env * env = (Env *) allocBytes(sizeof(Env) + size * sizeof(Value *));
|
Env * env = (Env *) allocBytes(sizeof(Env) + size * sizeof(Value *));
|
||||||
env->size = (decltype(Env::size)) size;
|
|
||||||
env->type = Env::Plain;
|
env->type = Env::Plain;
|
||||||
|
|
||||||
/* We assume that env->values has been cleared by the allocator; maybeThunk() and lookupVar fromWith expect this. */
|
/* We assume that env->values has been cleared by the allocator; maybeThunk() and lookupVar fromWith expect this. */
|
||||||
@@ -727,7 +781,7 @@ Value * ExprPath::maybeThunk(EvalState & state, Env & env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EvalState::evalFile(const Path & path_, Value & v)
|
void EvalState::evalFile(const Path & path_, Value & v, bool mustBeTrivial)
|
||||||
{
|
{
|
||||||
auto path = checkSourcePath(path_);
|
auto path = checkSourcePath(path_);
|
||||||
|
|
||||||
@@ -756,6 +810,11 @@ void EvalState::evalFile(const Path & path_, Value & v)
|
|||||||
fileParseCache[path2] = e;
|
fileParseCache[path2] = e;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Enforce that 'flake.nix' is a direct attrset, not a
|
||||||
|
// computation.
|
||||||
|
if (mustBeTrivial &&
|
||||||
|
!(dynamic_cast<ExprAttrs *>(e)))
|
||||||
|
throw Error("file '%s' must be an attribute set", path);
|
||||||
eval(e, v);
|
eval(e, v);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
addErrorPrefix(e, "while evaluating the file '%1%':\n", path2);
|
addErrorPrefix(e, "while evaluating the file '%1%':\n", path2);
|
||||||
@@ -1247,7 +1306,7 @@ void ExprWith::eval(EvalState & state, Env & env, Value & v)
|
|||||||
|
|
||||||
void ExprIf::eval(EvalState & state, Env & env, Value & v)
|
void ExprIf::eval(EvalState & state, Env & env, Value & v)
|
||||||
{
|
{
|
||||||
(state.evalBool(env, cond) ? then : else_)->eval(state, env, v);
|
(state.evalBool(env, cond, pos) ? then : else_)->eval(state, env, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1256,7 +1315,7 @@ void ExprAssert::eval(EvalState & state, Env & env, Value & v)
|
|||||||
if (!state.evalBool(env, cond, pos)) {
|
if (!state.evalBool(env, cond, pos)) {
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
cond->show(out);
|
cond->show(out);
|
||||||
throwAssertionError("assertion %1% failed at %2%", out.str(), pos);
|
throwAssertionError("assertion '%1%' failed at %2%", out.str(), pos);
|
||||||
}
|
}
|
||||||
body->eval(state, env, v);
|
body->eval(state, env, v);
|
||||||
}
|
}
|
||||||
@@ -1447,8 +1506,7 @@ void EvalState::forceValueDeep(Value & v)
|
|||||||
std::function<void(Value & v)> recurse;
|
std::function<void(Value & v)> recurse;
|
||||||
|
|
||||||
recurse = [&](Value & v) {
|
recurse = [&](Value & v) {
|
||||||
if (seen.find(&v) != seen.end()) return;
|
if (!seen.insert(&v).second) return;
|
||||||
seen.insert(&v);
|
|
||||||
|
|
||||||
forceValue(v);
|
forceValue(v);
|
||||||
|
|
||||||
@@ -1494,7 +1552,7 @@ NixFloat EvalState::forceFloat(Value & v, const Pos & pos)
|
|||||||
|
|
||||||
bool EvalState::forceBool(Value & v, const Pos & pos)
|
bool EvalState::forceBool(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v);
|
forceValue(v, pos);
|
||||||
if (v.type != tBool)
|
if (v.type != tBool)
|
||||||
throwTypeError("value is %1% while a Boolean was expected, at %2%", v, pos);
|
throwTypeError("value is %1% while a Boolean was expected, at %2%", v, pos);
|
||||||
return v.boolean;
|
return v.boolean;
|
||||||
@@ -1509,7 +1567,7 @@ bool EvalState::isFunctor(Value & fun)
|
|||||||
|
|
||||||
void EvalState::forceFunction(Value & v, const Pos & pos)
|
void EvalState::forceFunction(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v);
|
forceValue(v, pos);
|
||||||
if (v.type != tLambda && v.type != tPrimOp && v.type != tPrimOpApp && !isFunctor(v))
|
if (v.type != tLambda && v.type != tPrimOp && v.type != tPrimOpApp && !isFunctor(v))
|
||||||
throwTypeError("value is %1% while a function was expected, at %2%", v, pos);
|
throwTypeError("value is %1% while a function was expected, at %2%", v, pos);
|
||||||
}
|
}
|
||||||
@@ -1586,7 +1644,7 @@ std::optional<string> EvalState::tryAttrsToString(const Pos & pos, Value & v,
|
|||||||
string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context,
|
string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context,
|
||||||
bool coerceMore, bool copyToStore)
|
bool coerceMore, bool copyToStore)
|
||||||
{
|
{
|
||||||
forceValue(v);
|
forceValue(v, pos);
|
||||||
|
|
||||||
string s;
|
string s;
|
||||||
|
|
||||||
@@ -1647,15 +1705,16 @@ string EvalState::copyPathToStore(PathSet & context, const Path & path)
|
|||||||
throwEvalError("file names are not allowed to end in '%1%'", drvExtension);
|
throwEvalError("file names are not allowed to end in '%1%'", drvExtension);
|
||||||
|
|
||||||
Path dstPath;
|
Path dstPath;
|
||||||
if (srcToStore[path] != "")
|
auto i = srcToStore.find(path);
|
||||||
dstPath = srcToStore[path];
|
if (i != srcToStore.end())
|
||||||
|
dstPath = store->printStorePath(i->second);
|
||||||
else {
|
else {
|
||||||
dstPath = settings.readOnlyMode
|
auto p = settings.readOnlyMode
|
||||||
? store->computeStorePathForPath(baseNameOf(path), checkSourcePath(path)).first
|
? store->computeStorePathForPath(std::string(baseNameOf(path)), checkSourcePath(path)).first
|
||||||
: store->addToStore(baseNameOf(path), checkSourcePath(path), true, htSHA256, defaultPathFilter, repair);
|
: store->addToStore(std::string(baseNameOf(path)), checkSourcePath(path), true, htSHA256, defaultPathFilter, repair);
|
||||||
srcToStore[path] = dstPath;
|
dstPath = store->printStorePath(p);
|
||||||
printMsg(lvlChatty, format("copied source '%1%' -> '%2%'")
|
srcToStore.insert_or_assign(path, std::move(p));
|
||||||
% path % dstPath);
|
printMsg(lvlChatty, "copied source '%1%' -> '%2%'", path, dstPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.insert(dstPath);
|
context.insert(dstPath);
|
||||||
@@ -1756,7 +1815,7 @@ bool EvalState::eqValues(Value & v1, Value & v2)
|
|||||||
|
|
||||||
void EvalState::printStats()
|
void EvalState::printStats()
|
||||||
{
|
{
|
||||||
bool showStats = getEnv("NIX_SHOW_STATS", "0") != "0";
|
bool showStats = getEnv("NIX_SHOW_STATS").value_or("0") != "0";
|
||||||
|
|
||||||
struct rusage buf;
|
struct rusage buf;
|
||||||
getrusage(RUSAGE_SELF, &buf);
|
getrusage(RUSAGE_SELF, &buf);
|
||||||
@@ -1772,7 +1831,7 @@ void EvalState::printStats()
|
|||||||
GC_get_heap_usage_safe(&heapSize, 0, 0, 0, &totalBytes);
|
GC_get_heap_usage_safe(&heapSize, 0, 0, 0, &totalBytes);
|
||||||
#endif
|
#endif
|
||||||
if (showStats) {
|
if (showStats) {
|
||||||
auto outPath = getEnv("NIX_SHOW_STATS_PATH","-");
|
auto outPath = getEnv("NIX_SHOW_STATS_PATH").value_or("-");
|
||||||
std::fstream fs;
|
std::fstream fs;
|
||||||
if (outPath != "-")
|
if (outPath != "-")
|
||||||
fs.open(outPath, std::fstream::out);
|
fs.open(outPath, std::fstream::out);
|
||||||
@@ -1864,7 +1923,7 @@ void EvalState::printStats()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEnv("NIX_SHOW_SYMBOLS", "0") != "0") {
|
if (getEnv("NIX_SHOW_SYMBOLS").value_or("0") != "0") {
|
||||||
auto list = topObj.list("symbols");
|
auto list = topObj.list("symbols");
|
||||||
symbols.dump([&](const std::string & s) { list.elem(s); });
|
symbols.dump([&](const std::string & s) { list.elem(s); });
|
||||||
}
|
}
|
||||||
@@ -1872,99 +1931,6 @@ void EvalState::printStats()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t valueSize(Value & v)
|
|
||||||
{
|
|
||||||
std::set<const void *> seen;
|
|
||||||
|
|
||||||
auto doString = [&](const char * s) -> size_t {
|
|
||||||
if (seen.find(s) != seen.end()) return 0;
|
|
||||||
seen.insert(s);
|
|
||||||
return strlen(s) + 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::function<size_t(Value & v)> doValue;
|
|
||||||
std::function<size_t(Env & v)> doEnv;
|
|
||||||
|
|
||||||
doValue = [&](Value & v) -> size_t {
|
|
||||||
if (seen.find(&v) != seen.end()) return 0;
|
|
||||||
seen.insert(&v);
|
|
||||||
|
|
||||||
size_t sz = sizeof(Value);
|
|
||||||
|
|
||||||
switch (v.type) {
|
|
||||||
case tString:
|
|
||||||
sz += doString(v.string.s);
|
|
||||||
if (v.string.context)
|
|
||||||
for (const char * * p = v.string.context; *p; ++p)
|
|
||||||
sz += doString(*p);
|
|
||||||
break;
|
|
||||||
case tPath:
|
|
||||||
sz += doString(v.path);
|
|
||||||
break;
|
|
||||||
case tAttrs:
|
|
||||||
if (seen.find(v.attrs) == seen.end()) {
|
|
||||||
seen.insert(v.attrs);
|
|
||||||
sz += sizeof(Bindings) + sizeof(Attr) * v.attrs->capacity();
|
|
||||||
for (auto & i : *v.attrs)
|
|
||||||
sz += doValue(*i.value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case tList1:
|
|
||||||
case tList2:
|
|
||||||
case tListN:
|
|
||||||
if (seen.find(v.listElems()) == seen.end()) {
|
|
||||||
seen.insert(v.listElems());
|
|
||||||
sz += v.listSize() * sizeof(Value *);
|
|
||||||
for (size_t n = 0; n < v.listSize(); ++n)
|
|
||||||
sz += doValue(*v.listElems()[n]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case tThunk:
|
|
||||||
sz += doEnv(*v.thunk.env);
|
|
||||||
break;
|
|
||||||
case tApp:
|
|
||||||
sz += doValue(*v.app.left);
|
|
||||||
sz += doValue(*v.app.right);
|
|
||||||
break;
|
|
||||||
case tLambda:
|
|
||||||
sz += doEnv(*v.lambda.env);
|
|
||||||
break;
|
|
||||||
case tPrimOpApp:
|
|
||||||
sz += doValue(*v.primOpApp.left);
|
|
||||||
sz += doValue(*v.primOpApp.right);
|
|
||||||
break;
|
|
||||||
case tExternal:
|
|
||||||
if (seen.find(v.external) != seen.end()) break;
|
|
||||||
seen.insert(v.external);
|
|
||||||
sz += v.external->valueSize(seen);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sz;
|
|
||||||
};
|
|
||||||
|
|
||||||
doEnv = [&](Env & env) -> size_t {
|
|
||||||
if (seen.find(&env) != seen.end()) return 0;
|
|
||||||
seen.insert(&env);
|
|
||||||
|
|
||||||
size_t sz = sizeof(Env) + sizeof(Value *) * env.size;
|
|
||||||
|
|
||||||
if (env.type != Env::HasWithExpr)
|
|
||||||
for (size_t i = 0; i < env.size; ++i)
|
|
||||||
if (env.values[i])
|
|
||||||
sz += doValue(*env.values[i]);
|
|
||||||
|
|
||||||
if (env.up) sz += doEnv(*env.up);
|
|
||||||
|
|
||||||
return sz;
|
|
||||||
};
|
|
||||||
|
|
||||||
return doValue(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string ExternalValueBase::coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const
|
string ExternalValueBase::coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const
|
||||||
{
|
{
|
||||||
throw TypeError(format("cannot coerce %1% to a string, at %2%") %
|
throw TypeError(format("cannot coerce %1% to a string, at %2%") %
|
||||||
@@ -1983,6 +1949,22 @@ std::ostream & operator << (std::ostream & str, const ExternalValueBase & v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EvalSettings::EvalSettings()
|
||||||
|
{
|
||||||
|
auto var = getEnv("NIX_PATH");
|
||||||
|
if (var) nixPath = parseNixPath(*var);
|
||||||
|
}
|
||||||
|
|
||||||
|
Strings EvalSettings::getDefaultNixPath()
|
||||||
|
{
|
||||||
|
Strings res;
|
||||||
|
auto add = [&](const Path & p) { if (pathExists(p)) { res.push_back(p); } };
|
||||||
|
add(getHome() + "/.nix-defexpr/channels");
|
||||||
|
add("nixpkgs=" + settings.nixStateDir + "/nix/profiles/per-user/root/channels/nixpkgs");
|
||||||
|
add(settings.nixStateDir + "/nix/profiles/per-user/root/channels");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
EvalSettings evalSettings;
|
EvalSettings evalSettings;
|
||||||
|
|
||||||
static GlobalConfig::Register r1(&evalSettings);
|
static GlobalConfig::Register r1(&evalSettings);
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
#include "value.hh"
|
#include "value.hh"
|
||||||
#include "nixexpr.hh"
|
#include "nixexpr.hh"
|
||||||
#include "symbol-table.hh"
|
#include "symbol-table.hh"
|
||||||
#include "hash.hh"
|
|
||||||
#include "config.hh"
|
#include "config.hh"
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
@@ -17,6 +18,7 @@ namespace nix {
|
|||||||
|
|
||||||
class Store;
|
class Store;
|
||||||
class EvalState;
|
class EvalState;
|
||||||
|
struct StorePath;
|
||||||
enum RepairFlag : bool;
|
enum RepairFlag : bool;
|
||||||
|
|
||||||
|
|
||||||
@@ -36,21 +38,20 @@ struct PrimOp
|
|||||||
struct Env
|
struct Env
|
||||||
{
|
{
|
||||||
Env * up;
|
Env * up;
|
||||||
unsigned short size; // used by ‘valueSize’
|
|
||||||
unsigned short prevWith:14; // nr of levels up to next `with' environment
|
unsigned short prevWith:14; // nr of levels up to next `with' environment
|
||||||
enum { Plain = 0, HasWithExpr, HasWithAttrs } type:2;
|
enum { Plain = 0, HasWithExpr, HasWithAttrs } type:2;
|
||||||
Value * values[0];
|
Value * values[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Value & mkString(Value & v, const string & s, const PathSet & context = PathSet());
|
Value & mkString(Value & v, std::string_view s, const PathSet & context = PathSet());
|
||||||
|
|
||||||
void copyContext(const Value & v, PathSet & context);
|
void copyContext(const Value & v, PathSet & context);
|
||||||
|
|
||||||
|
|
||||||
/* Cache for calls to addToStore(); maps source paths to the store
|
/* Cache for calls to addToStore(); maps source paths to the store
|
||||||
paths. */
|
paths. */
|
||||||
typedef std::map<Path, Path> SrcToStore;
|
typedef std::map<Path, StorePath> SrcToStore;
|
||||||
|
|
||||||
|
|
||||||
std::ostream & operator << (std::ostream & str, const Value & v);
|
std::ostream & operator << (std::ostream & str, const Value & v);
|
||||||
@@ -73,7 +74,8 @@ public:
|
|||||||
sSystem, sOverrides, sOutputs, sOutputName, sIgnoreNulls,
|
sSystem, sOverrides, sOutputs, sOutputName, sIgnoreNulls,
|
||||||
sFile, sLine, sColumn, sFunctor, sToString,
|
sFile, sLine, sColumn, sFunctor, sToString,
|
||||||
sRight, sWrong, sStructuredAttrs, sBuilder, sArgs,
|
sRight, sWrong, sStructuredAttrs, sBuilder, sArgs,
|
||||||
sOutputHash, sOutputHashAlgo, sOutputHashMode;
|
sOutputHash, sOutputHashAlgo, sOutputHashMode,
|
||||||
|
sDescription, sSelf, sEpsilon, sRecurseForDerivations;
|
||||||
Symbol sDerivationNix;
|
Symbol sDerivationNix;
|
||||||
|
|
||||||
/* If set, force copying files to the Nix store even if they
|
/* If set, force copying files to the Nix store even if they
|
||||||
@@ -88,6 +90,7 @@ public:
|
|||||||
|
|
||||||
const ref<Store> store;
|
const ref<Store> store;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SrcToStore srcToStore;
|
SrcToStore srcToStore;
|
||||||
|
|
||||||
@@ -114,6 +117,9 @@ private:
|
|||||||
/* Cache used by checkSourcePath(). */
|
/* Cache used by checkSourcePath(). */
|
||||||
std::unordered_map<Path, Path> resolvedPaths;
|
std::unordered_map<Path, Path> resolvedPaths;
|
||||||
|
|
||||||
|
/* Cache used by prim_match(). */
|
||||||
|
std::unordered_map<std::string, std::regex> regexCache;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EvalState(const Strings & _searchPath, ref<Store> store);
|
EvalState(const Strings & _searchPath, ref<Store> store);
|
||||||
@@ -141,14 +147,15 @@ public:
|
|||||||
Expr * parseExprFromFile(const Path & path, StaticEnv & staticEnv);
|
Expr * parseExprFromFile(const Path & path, StaticEnv & staticEnv);
|
||||||
|
|
||||||
/* Parse a Nix expression from the specified string. */
|
/* Parse a Nix expression from the specified string. */
|
||||||
Expr * parseExprFromString(const string & s, const Path & basePath, StaticEnv & staticEnv);
|
Expr * parseExprFromString(std::string_view s, const Path & basePath, StaticEnv & staticEnv);
|
||||||
Expr * parseExprFromString(const string & s, const Path & basePath);
|
Expr * parseExprFromString(std::string_view s, const Path & basePath);
|
||||||
|
|
||||||
Expr * parseStdin();
|
Expr * parseStdin();
|
||||||
|
|
||||||
/* Evaluate an expression read from the given file to normal
|
/* Evaluate an expression read from the given file to normal
|
||||||
form. */
|
form. Optionally enforce that the top-level expression is
|
||||||
void evalFile(const Path & path, Value & v);
|
trivial (i.e. doesn't require arbitrary computation). */
|
||||||
|
void evalFile(const Path & path, Value & v, bool mustBeTrivial = false);
|
||||||
|
|
||||||
void resetFileCache();
|
void resetFileCache();
|
||||||
|
|
||||||
@@ -268,6 +275,7 @@ public:
|
|||||||
Env & allocEnv(size_t size);
|
Env & allocEnv(size_t size);
|
||||||
|
|
||||||
Value * allocAttr(Value & vAttrs, const Symbol & name);
|
Value * allocAttr(Value & vAttrs, const Symbol & name);
|
||||||
|
Value * allocAttr(Value & vAttrs, const std::string & name);
|
||||||
|
|
||||||
Bindings * allocBindings(size_t capacity);
|
Bindings * allocBindings(size_t capacity);
|
||||||
|
|
||||||
@@ -314,10 +322,12 @@ private:
|
|||||||
friend struct ExprOpConcatLists;
|
friend struct ExprOpConcatLists;
|
||||||
friend struct ExprSelect;
|
friend struct ExprSelect;
|
||||||
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
|
friend void prim_match(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Return a string representing the type of the value `v'. */
|
/* Return a string representing the type of the value `v'. */
|
||||||
|
string showType(ValueType type);
|
||||||
string showType(const Value & v);
|
string showType(const Value & v);
|
||||||
|
|
||||||
/* Decode a context string ‘!<name>!<path>’ into a pair <path,
|
/* Decode a context string ‘!<name>!<path>’ into a pair <path,
|
||||||
@@ -338,9 +348,16 @@ struct InvalidPathError : EvalError
|
|||||||
|
|
||||||
struct EvalSettings : Config
|
struct EvalSettings : Config
|
||||||
{
|
{
|
||||||
|
EvalSettings();
|
||||||
|
|
||||||
|
static Strings getDefaultNixPath();
|
||||||
|
|
||||||
Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation",
|
Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation",
|
||||||
"Whether builtin functions that allow executing native code should be enabled."};
|
"Whether builtin functions that allow executing native code should be enabled."};
|
||||||
|
|
||||||
|
Setting<Strings> nixPath{this, getDefaultNixPath(), "nix-path",
|
||||||
|
"List of directories to be searched for <...> file references."};
|
||||||
|
|
||||||
Setting<bool> restrictEval{this, false, "restrict-eval",
|
Setting<bool> restrictEval{this, false, "restrict-eval",
|
||||||
"Whether to restrict file system access to paths in $NIX_PATH, "
|
"Whether to restrict file system access to paths in $NIX_PATH, "
|
||||||
"and network access to the URI prefixes listed in 'allowed-uris'."};
|
"and network access to the URI prefixes listed in 'allowed-uris'."};
|
||||||
@@ -355,7 +372,7 @@ struct EvalSettings : Config
|
|||||||
"Prefixes of URIs that builtin functions such as fetchurl and fetchGit are allowed to fetch."};
|
"Prefixes of URIs that builtin functions such as fetchurl and fetchGit are allowed to fetch."};
|
||||||
|
|
||||||
Setting<bool> traceFunctionCalls{this, false, "trace-function-calls",
|
Setting<bool> traceFunctionCalls{this, false, "trace-function-calls",
|
||||||
"Emit log messages for each function entry and exit at the 'vomit' log level (-vvvv)"};
|
"Emit log messages for each function entry and exit at the 'vomit' log level (-vvvv)."};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EvalSettings evalSettings;
|
extern EvalSettings evalSettings;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
lockFileStr: rootSrc: rootSubdir:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
lockFile = builtins.fromJSON lockFileStr;
|
||||||
|
|
||||||
|
allNodes =
|
||||||
|
builtins.mapAttrs
|
||||||
|
(key: node:
|
||||||
|
let
|
||||||
|
sourceInfo =
|
||||||
|
if key == lockFile.root
|
||||||
|
then rootSrc
|
||||||
|
else fetchTree ({ inherit (node.info) narHash; } // removeAttrs node.locked ["dir"]);
|
||||||
|
subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
|
||||||
|
flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix");
|
||||||
|
inputs = builtins.mapAttrs (inputName: key: allNodes.${key}) (node.inputs or {});
|
||||||
|
outputs = flake.outputs (inputs // { self = result; });
|
||||||
|
result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; };
|
||||||
|
in
|
||||||
|
if node.flake or true then
|
||||||
|
assert builtins.isFunction flake.outputs;
|
||||||
|
result
|
||||||
|
else
|
||||||
|
sourceInfo
|
||||||
|
)
|
||||||
|
lockFile.nodes;
|
||||||
|
|
||||||
|
in allNodes.${lockFile.root}
|
||||||
@@ -0,0 +1,660 @@
|
|||||||
|
#include "flake.hh"
|
||||||
|
#include "lockfile.hh"
|
||||||
|
#include "primops.hh"
|
||||||
|
#include "eval-inline.hh"
|
||||||
|
#include "store-api.hh"
|
||||||
|
#include "fetchers.hh"
|
||||||
|
#include "finally.hh"
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
using namespace flake;
|
||||||
|
|
||||||
|
namespace flake {
|
||||||
|
|
||||||
|
/* If 'allowLookup' is true, then resolve 'flakeRef' using the
|
||||||
|
registries. */
|
||||||
|
static FlakeRef maybeLookupFlake(
|
||||||
|
ref<Store> store,
|
||||||
|
const FlakeRef & flakeRef,
|
||||||
|
bool allowLookup)
|
||||||
|
{
|
||||||
|
if (!flakeRef.input->isDirect()) {
|
||||||
|
if (allowLookup)
|
||||||
|
return flakeRef.resolve(store);
|
||||||
|
else
|
||||||
|
throw Error("'%s' is an indirect flake reference, but registry lookups are not allowed", flakeRef);
|
||||||
|
} else
|
||||||
|
return flakeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef std::vector<std::pair<FlakeRef, FlakeRef>> FlakeCache;
|
||||||
|
|
||||||
|
static FlakeRef lookupInFlakeCache(
|
||||||
|
const FlakeCache & flakeCache,
|
||||||
|
const FlakeRef & flakeRef)
|
||||||
|
{
|
||||||
|
// FIXME: inefficient.
|
||||||
|
for (auto & i : flakeCache) {
|
||||||
|
if (flakeRef == i.first) {
|
||||||
|
debug("mapping '%s' to previously seen input '%s' -> '%s",
|
||||||
|
flakeRef, i.first, i.second);
|
||||||
|
return i.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return flakeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::tuple<fetchers::Tree, FlakeRef, FlakeRef> fetchOrSubstituteTree(
|
||||||
|
EvalState & state,
|
||||||
|
const FlakeRef & originalRef,
|
||||||
|
std::optional<TreeInfo> treeInfo,
|
||||||
|
bool allowLookup,
|
||||||
|
FlakeCache & flakeCache)
|
||||||
|
{
|
||||||
|
/* The tree may already be in the Nix store, or it could be
|
||||||
|
substituted (which is often faster than fetching from the
|
||||||
|
original source). So check that. */
|
||||||
|
if (treeInfo && originalRef.input->isDirect() && originalRef.input->isImmutable()) {
|
||||||
|
try {
|
||||||
|
auto storePath = treeInfo->computeStorePath(*state.store);
|
||||||
|
|
||||||
|
state.store->ensurePath(storePath);
|
||||||
|
|
||||||
|
debug("using substituted/cached input '%s' in '%s'",
|
||||||
|
originalRef, state.store->printStorePath(storePath));
|
||||||
|
|
||||||
|
auto actualPath = state.store->toRealPath(storePath);
|
||||||
|
|
||||||
|
if (state.allowedPaths)
|
||||||
|
state.allowedPaths->insert(actualPath);
|
||||||
|
|
||||||
|
return {
|
||||||
|
Tree {
|
||||||
|
.actualPath = actualPath,
|
||||||
|
.storePath = std::move(storePath),
|
||||||
|
.info = *treeInfo,
|
||||||
|
},
|
||||||
|
originalRef,
|
||||||
|
originalRef
|
||||||
|
};
|
||||||
|
} catch (Error & e) {
|
||||||
|
debug("substitution of input '%s' failed: %s", originalRef, e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto resolvedRef = lookupInFlakeCache(flakeCache,
|
||||||
|
maybeLookupFlake(state.store,
|
||||||
|
lookupInFlakeCache(flakeCache, originalRef), allowLookup));
|
||||||
|
|
||||||
|
auto [tree, lockedRef] = resolvedRef.fetchTree(state.store);
|
||||||
|
|
||||||
|
debug("got tree '%s' from '%s'",
|
||||||
|
state.store->printStorePath(tree.storePath), lockedRef);
|
||||||
|
|
||||||
|
flakeCache.push_back({originalRef, lockedRef});
|
||||||
|
flakeCache.push_back({resolvedRef, lockedRef});
|
||||||
|
|
||||||
|
if (state.allowedPaths)
|
||||||
|
state.allowedPaths->insert(tree.actualPath);
|
||||||
|
|
||||||
|
if (treeInfo)
|
||||||
|
assert(tree.storePath == treeInfo->computeStorePath(*state.store));
|
||||||
|
|
||||||
|
return {std::move(tree), resolvedRef, lockedRef};
|
||||||
|
}
|
||||||
|
|
||||||
|
static void expectType(EvalState & state, ValueType type,
|
||||||
|
Value & value, const Pos & pos)
|
||||||
|
{
|
||||||
|
if (value.type == tThunk && value.isTrivial())
|
||||||
|
state.forceValue(value, pos);
|
||||||
|
if (value.type != type)
|
||||||
|
throw Error("expected %s but got %s at %s",
|
||||||
|
showType(type), showType(value.type), pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::map<FlakeId, FlakeInput> parseFlakeInputs(
|
||||||
|
EvalState & state, Value * value, const Pos & pos);
|
||||||
|
|
||||||
|
static FlakeInput parseFlakeInput(EvalState & state,
|
||||||
|
const std::string & inputName, Value * value, const Pos & pos)
|
||||||
|
{
|
||||||
|
expectType(state, tAttrs, *value, pos);
|
||||||
|
|
||||||
|
FlakeInput input {
|
||||||
|
.ref = FlakeRef::fromAttrs({{"type", "indirect"}, {"id", inputName}})
|
||||||
|
};
|
||||||
|
|
||||||
|
auto sInputs = state.symbols.create("inputs");
|
||||||
|
auto sUrl = state.symbols.create("url");
|
||||||
|
auto sFlake = state.symbols.create("flake");
|
||||||
|
auto sFollows = state.symbols.create("follows");
|
||||||
|
|
||||||
|
fetchers::Attrs attrs;
|
||||||
|
std::optional<std::string> url;
|
||||||
|
|
||||||
|
for (nix::Attr attr : *(value->attrs)) {
|
||||||
|
try {
|
||||||
|
if (attr.name == sUrl) {
|
||||||
|
expectType(state, tString, *attr.value, *attr.pos);
|
||||||
|
url = attr.value->string.s;
|
||||||
|
attrs.emplace("url", *url);
|
||||||
|
} else if (attr.name == sFlake) {
|
||||||
|
expectType(state, tBool, *attr.value, *attr.pos);
|
||||||
|
input.isFlake = attr.value->boolean;
|
||||||
|
} else if (attr.name == sInputs) {
|
||||||
|
input.overrides = parseFlakeInputs(state, attr.value, *attr.pos);
|
||||||
|
} else if (attr.name == sFollows) {
|
||||||
|
expectType(state, tString, *attr.value, *attr.pos);
|
||||||
|
input.follows = parseInputPath(attr.value->string.s);
|
||||||
|
} else {
|
||||||
|
state.forceValue(*attr.value);
|
||||||
|
if (attr.value->type == tString)
|
||||||
|
attrs.emplace(attr.name, attr.value->string.s);
|
||||||
|
else
|
||||||
|
throw TypeError("flake input attribute '%s' is %s while a string is expected",
|
||||||
|
attr.name, showType(*attr.value));
|
||||||
|
}
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addPrefix(fmt("in flake attribute '%s' at '%s':\n", attr.name, *attr.pos));
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrs.count("type"))
|
||||||
|
try {
|
||||||
|
input.ref = FlakeRef::fromAttrs(attrs);
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addPrefix(fmt("in flake input at '%s':\n", pos));
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attrs.erase("url");
|
||||||
|
if (!attrs.empty())
|
||||||
|
throw Error("unexpected flake input attribute '%s', at %s", attrs.begin()->first, pos);
|
||||||
|
if (url)
|
||||||
|
input.ref = parseFlakeRef(*url, {}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::map<FlakeId, FlakeInput> parseFlakeInputs(
|
||||||
|
EvalState & state, Value * value, const Pos & pos)
|
||||||
|
{
|
||||||
|
std::map<FlakeId, FlakeInput> inputs;
|
||||||
|
|
||||||
|
expectType(state, tAttrs, *value, pos);
|
||||||
|
|
||||||
|
for (nix::Attr & inputAttr : *(*value).attrs) {
|
||||||
|
inputs.emplace(inputAttr.name,
|
||||||
|
parseFlakeInput(state,
|
||||||
|
inputAttr.name,
|
||||||
|
inputAttr.value,
|
||||||
|
*inputAttr.pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Flake getFlake(
|
||||||
|
EvalState & state,
|
||||||
|
const FlakeRef & originalRef,
|
||||||
|
std::optional<TreeInfo> treeInfo,
|
||||||
|
bool allowLookup,
|
||||||
|
FlakeCache & flakeCache)
|
||||||
|
{
|
||||||
|
auto [sourceInfo, resolvedRef, lockedRef] = fetchOrSubstituteTree(
|
||||||
|
state, originalRef, treeInfo, allowLookup, flakeCache);
|
||||||
|
|
||||||
|
// Guard against symlink attacks.
|
||||||
|
auto flakeFile = canonPath(sourceInfo.actualPath + "/" + lockedRef.subdir + "/flake.nix");
|
||||||
|
if (!isInDir(flakeFile, sourceInfo.actualPath))
|
||||||
|
throw Error("'flake.nix' file of flake '%s' escapes from '%s'",
|
||||||
|
lockedRef, state.store->printStorePath(sourceInfo.storePath));
|
||||||
|
|
||||||
|
Flake flake {
|
||||||
|
.originalRef = originalRef,
|
||||||
|
.resolvedRef = resolvedRef,
|
||||||
|
.lockedRef = lockedRef,
|
||||||
|
.sourceInfo = std::make_shared<fetchers::Tree>(std::move(sourceInfo))
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!pathExists(flakeFile))
|
||||||
|
throw Error("source tree referenced by '%s' does not contain a '%s/flake.nix' file", lockedRef, lockedRef.subdir);
|
||||||
|
|
||||||
|
Value vInfo;
|
||||||
|
state.evalFile(flakeFile, vInfo, true); // FIXME: symlink attack
|
||||||
|
|
||||||
|
expectType(state, tAttrs, vInfo, Pos(state.symbols.create(flakeFile), 0, 0));
|
||||||
|
|
||||||
|
auto sEdition = state.symbols.create("edition"); // FIXME: remove soon
|
||||||
|
|
||||||
|
if (vInfo.attrs->get(sEdition))
|
||||||
|
warn("flake '%s' has deprecated attribute 'edition'", lockedRef);
|
||||||
|
|
||||||
|
if (auto description = vInfo.attrs->get(state.sDescription)) {
|
||||||
|
expectType(state, tString, *description->value, *description->pos);
|
||||||
|
flake.description = description->value->string.s;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto sInputs = state.symbols.create("inputs");
|
||||||
|
|
||||||
|
if (auto inputs = vInfo.attrs->get(sInputs))
|
||||||
|
flake.inputs = parseFlakeInputs(state, inputs->value, *inputs->pos);
|
||||||
|
|
||||||
|
auto sOutputs = state.symbols.create("outputs");
|
||||||
|
|
||||||
|
if (auto outputs = vInfo.attrs->get(sOutputs)) {
|
||||||
|
expectType(state, tLambda, *outputs->value, *outputs->pos);
|
||||||
|
flake.vOutputs = allocRootValue(outputs->value);
|
||||||
|
|
||||||
|
if ((*flake.vOutputs)->lambda.fun->matchAttrs) {
|
||||||
|
for (auto & formal : (*flake.vOutputs)->lambda.fun->formals->formals) {
|
||||||
|
if (formal.name != state.sSelf)
|
||||||
|
flake.inputs.emplace(formal.name, FlakeInput {
|
||||||
|
.ref = parseFlakeRef(formal.name)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
throw Error("flake '%s' lacks attribute 'outputs'", lockedRef);
|
||||||
|
|
||||||
|
for (auto & attr : *vInfo.attrs) {
|
||||||
|
if (attr.name != sEdition &&
|
||||||
|
attr.name != state.sDescription &&
|
||||||
|
attr.name != sInputs &&
|
||||||
|
attr.name != sOutputs)
|
||||||
|
throw Error("flake '%s' has an unsupported attribute '%s', at %s",
|
||||||
|
lockedRef, attr.name, *attr.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return flake;
|
||||||
|
}
|
||||||
|
|
||||||
|
Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup)
|
||||||
|
{
|
||||||
|
FlakeCache flakeCache;
|
||||||
|
return getFlake(state, originalRef, {}, allowLookup, flakeCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute an in-memory lock file for the specified top-level flake,
|
||||||
|
and optionally write it to file, it the flake is writable. */
|
||||||
|
LockedFlake lockFlake(
|
||||||
|
EvalState & state,
|
||||||
|
const FlakeRef & topRef,
|
||||||
|
const LockFlags & lockFlags)
|
||||||
|
{
|
||||||
|
settings.requireExperimentalFeature("flakes");
|
||||||
|
|
||||||
|
FlakeCache flakeCache;
|
||||||
|
|
||||||
|
auto flake = getFlake(state, topRef, {}, lockFlags.useRegistries, flakeCache);
|
||||||
|
|
||||||
|
// FIXME: symlink attack
|
||||||
|
auto oldLockFile = LockFile::read(
|
||||||
|
flake.sourceInfo->actualPath + "/" + flake.lockedRef.subdir + "/flake.lock");
|
||||||
|
|
||||||
|
debug("old lock file: %s", oldLockFile);
|
||||||
|
|
||||||
|
// FIXME: check whether all overrides are used.
|
||||||
|
std::map<InputPath, FlakeInput> overrides;
|
||||||
|
std::set<InputPath> overridesUsed, updatesUsed;
|
||||||
|
|
||||||
|
for (auto & i : lockFlags.inputOverrides)
|
||||||
|
overrides.insert_or_assign(i.first, FlakeInput { .ref = i.second });
|
||||||
|
|
||||||
|
LockFile newLockFile;
|
||||||
|
|
||||||
|
std::vector<FlakeRef> parents;
|
||||||
|
std::map<InputPath, InputPath> follows;
|
||||||
|
|
||||||
|
std::function<void(
|
||||||
|
const FlakeInputs & flakeInputs,
|
||||||
|
std::shared_ptr<Node> node,
|
||||||
|
const InputPath & inputPathPrefix,
|
||||||
|
std::shared_ptr<const Node> oldNode)>
|
||||||
|
computeLocks;
|
||||||
|
|
||||||
|
computeLocks = [&](
|
||||||
|
const FlakeInputs & flakeInputs,
|
||||||
|
std::shared_ptr<Node> node,
|
||||||
|
const InputPath & inputPathPrefix,
|
||||||
|
std::shared_ptr<const Node> oldNode)
|
||||||
|
{
|
||||||
|
debug("computing lock file node '%s'", concatStringsSep("/", inputPathPrefix));
|
||||||
|
|
||||||
|
/* Get the overrides (i.e. attributes of the form
|
||||||
|
'inputs.nixops.inputs.nixpkgs.url = ...'). */
|
||||||
|
// FIXME: check this
|
||||||
|
for (auto & [id, input] : flake.inputs) {
|
||||||
|
for (auto & [idOverride, inputOverride] : input.overrides) {
|
||||||
|
auto inputPath(inputPathPrefix);
|
||||||
|
inputPath.push_back(id);
|
||||||
|
inputPath.push_back(idOverride);
|
||||||
|
overrides.insert_or_assign(inputPath, inputOverride);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go over the flake inputs, resolve/fetch them if
|
||||||
|
necessary (i.e. if they're new or the flakeref changed
|
||||||
|
from what's in the lock file). */
|
||||||
|
for (auto & [id, input2] : flakeInputs) {
|
||||||
|
auto inputPath(inputPathPrefix);
|
||||||
|
inputPath.push_back(id);
|
||||||
|
auto inputPathS = concatStringsSep("/", inputPath);
|
||||||
|
debug("computing input '%s'", concatStringsSep("/", inputPath));
|
||||||
|
|
||||||
|
/* Do we have an override for this input from one of the
|
||||||
|
ancestors? */
|
||||||
|
auto i = overrides.find(inputPath);
|
||||||
|
bool hasOverride = i != overrides.end();
|
||||||
|
if (hasOverride) overridesUsed.insert(inputPath);
|
||||||
|
auto & input = hasOverride ? i->second : input2;
|
||||||
|
|
||||||
|
/* Resolve 'follows' later (since it may refer to an input
|
||||||
|
path we haven't processed yet. */
|
||||||
|
if (input.follows) {
|
||||||
|
if (hasOverride)
|
||||||
|
/* 'follows' from an override is relative to the
|
||||||
|
root of the graph. */
|
||||||
|
follows.insert_or_assign(inputPath, *input.follows);
|
||||||
|
else {
|
||||||
|
/* Otherwise, it's relative to the current flake. */
|
||||||
|
InputPath path(inputPathPrefix);
|
||||||
|
for (auto & i : *input.follows) path.push_back(i);
|
||||||
|
follows.insert_or_assign(inputPath, path);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have an entry in the existing lock file? And we
|
||||||
|
don't have a --update-input flag for this input? */
|
||||||
|
std::shared_ptr<const LockedNode> oldLock;
|
||||||
|
|
||||||
|
updatesUsed.insert(inputPath);
|
||||||
|
|
||||||
|
if (oldNode && !lockFlags.inputUpdates.count(inputPath)) {
|
||||||
|
auto oldLockIt = oldNode->inputs.find(id);
|
||||||
|
if (oldLockIt != oldNode->inputs.end())
|
||||||
|
oldLock = std::dynamic_pointer_cast<const LockedNode>(oldLockIt->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldLock
|
||||||
|
&& oldLock->originalRef == input.ref
|
||||||
|
&& !hasOverride)
|
||||||
|
{
|
||||||
|
debug("keeping existing input '%s'", inputPathS);
|
||||||
|
|
||||||
|
/* Copy the input from the old lock since its flakeref
|
||||||
|
didn't change and there is no override from a
|
||||||
|
higher level flake. */
|
||||||
|
auto childNode = std::make_shared<LockedNode>(
|
||||||
|
oldLock->lockedRef, oldLock->originalRef, oldLock->info, oldLock->isFlake);
|
||||||
|
|
||||||
|
node->inputs.insert_or_assign(id, childNode);
|
||||||
|
|
||||||
|
/* If we have an --update-input flag for an input
|
||||||
|
of this input, then we must fetch the flake to
|
||||||
|
to update it. */
|
||||||
|
auto lb = lockFlags.inputUpdates.lower_bound(inputPath);
|
||||||
|
|
||||||
|
auto hasChildUpdate =
|
||||||
|
lb != lockFlags.inputUpdates.end()
|
||||||
|
&& lb->size() > inputPath.size()
|
||||||
|
&& std::equal(inputPath.begin(), inputPath.end(), lb->begin());
|
||||||
|
|
||||||
|
if (hasChildUpdate) {
|
||||||
|
auto inputFlake = getFlake(
|
||||||
|
state, oldLock->lockedRef, oldLock->info, false, flakeCache);
|
||||||
|
computeLocks(inputFlake.inputs, childNode, inputPath, oldLock);
|
||||||
|
} else {
|
||||||
|
/* No need to fetch this flake, we can be
|
||||||
|
lazy. However there may be new overrides on the
|
||||||
|
inputs of this flake, so we need to check
|
||||||
|
those. */
|
||||||
|
FlakeInputs fakeInputs;
|
||||||
|
|
||||||
|
for (auto & i : oldLock->inputs) {
|
||||||
|
auto lockedNode = std::dynamic_pointer_cast<LockedNode>(i.second);
|
||||||
|
// Note: this node is not locked in case
|
||||||
|
// of a circular reference back to the root.
|
||||||
|
if (lockedNode)
|
||||||
|
fakeInputs.emplace(i.first, FlakeInput {
|
||||||
|
.ref = lockedNode->originalRef
|
||||||
|
});
|
||||||
|
else {
|
||||||
|
InputPath path(inputPath);
|
||||||
|
path.push_back(i.first);
|
||||||
|
follows.insert_or_assign(path, InputPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
computeLocks(fakeInputs, childNode, inputPath, oldLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* We need to create a new lock file entry. So fetch
|
||||||
|
this input. */
|
||||||
|
|
||||||
|
if (!lockFlags.allowMutable && !input.ref.input->isImmutable())
|
||||||
|
throw Error("cannot update flake input '%s' in pure mode", inputPathS);
|
||||||
|
|
||||||
|
if (input.isFlake) {
|
||||||
|
auto inputFlake = getFlake(state, input.ref, {}, lockFlags.useRegistries, flakeCache);
|
||||||
|
|
||||||
|
/* Note: in case of an --override-input, we use
|
||||||
|
the *original* ref (input2.ref) for the
|
||||||
|
"original" field, rather than the
|
||||||
|
override. This ensures that the override isn't
|
||||||
|
nuked the next time we update the lock
|
||||||
|
file. That is, overrides are sticky unless you
|
||||||
|
use --no-write-lock-file. */
|
||||||
|
auto childNode = std::make_shared<LockedNode>(
|
||||||
|
inputFlake.lockedRef, input2.ref, inputFlake.sourceInfo->info);
|
||||||
|
|
||||||
|
node->inputs.insert_or_assign(id, childNode);
|
||||||
|
|
||||||
|
/* Guard against circular flake imports. */
|
||||||
|
for (auto & parent : parents)
|
||||||
|
if (parent == input.ref)
|
||||||
|
throw Error("found circular import of flake '%s'", parent);
|
||||||
|
parents.push_back(input.ref);
|
||||||
|
Finally cleanup([&]() { parents.pop_back(); });
|
||||||
|
|
||||||
|
/* Recursively process the inputs of this
|
||||||
|
flake. Also, unless we already have this flake
|
||||||
|
in the top-level lock file, use this flake's
|
||||||
|
own lock file. */
|
||||||
|
computeLocks(
|
||||||
|
inputFlake.inputs, childNode, inputPath,
|
||||||
|
oldLock
|
||||||
|
? std::dynamic_pointer_cast<const Node>(oldLock)
|
||||||
|
: LockFile::read(
|
||||||
|
inputFlake.sourceInfo->actualPath + "/" + inputFlake.lockedRef.subdir + "/flake.lock").root);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
auto [sourceInfo, resolvedRef, lockedRef] = fetchOrSubstituteTree(
|
||||||
|
state, input.ref, {}, lockFlags.useRegistries, flakeCache);
|
||||||
|
node->inputs.insert_or_assign(id,
|
||||||
|
std::make_shared<LockedNode>(lockedRef, input.ref, sourceInfo.info, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
computeLocks(
|
||||||
|
flake.inputs, newLockFile.root, {},
|
||||||
|
lockFlags.recreateLockFile ? nullptr : oldLockFile.root);
|
||||||
|
|
||||||
|
/* Insert edges for 'follows' overrides. */
|
||||||
|
for (auto & [from, to] : follows) {
|
||||||
|
debug("adding 'follows' node from '%s' to '%s'",
|
||||||
|
concatStringsSep("/", from),
|
||||||
|
concatStringsSep("/", to));
|
||||||
|
|
||||||
|
assert(!from.empty());
|
||||||
|
|
||||||
|
InputPath fromParent(from);
|
||||||
|
fromParent.pop_back();
|
||||||
|
|
||||||
|
auto fromParentNode = newLockFile.root->findInput(fromParent);
|
||||||
|
assert(fromParentNode);
|
||||||
|
|
||||||
|
auto toNode = newLockFile.root->findInput(to);
|
||||||
|
if (!toNode)
|
||||||
|
throw Error("flake input '%s' follows non-existent flake input '%s'",
|
||||||
|
concatStringsSep("/", from),
|
||||||
|
concatStringsSep("/", to));
|
||||||
|
|
||||||
|
fromParentNode->inputs.insert_or_assign(from.back(), toNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto & i : lockFlags.inputOverrides)
|
||||||
|
if (!overridesUsed.count(i.first))
|
||||||
|
warn("the flag '--override-input %s %s' does not match any input",
|
||||||
|
concatStringsSep("/", i.first), i.second);
|
||||||
|
|
||||||
|
for (auto & i : lockFlags.inputUpdates)
|
||||||
|
if (!updatesUsed.count(i))
|
||||||
|
warn("the flag '--update-input %s' does not match any input", concatStringsSep("/", i));
|
||||||
|
|
||||||
|
debug("new lock file: %s", newLockFile);
|
||||||
|
|
||||||
|
/* Check whether we need to / can write the new lock file. */
|
||||||
|
if (!(newLockFile == oldLockFile)) {
|
||||||
|
|
||||||
|
auto diff = diffLockFiles(oldLockFile, newLockFile);
|
||||||
|
|
||||||
|
if (!(oldLockFile == LockFile()))
|
||||||
|
printInfo("inputs of flake '%s' changed:\n%s", topRef, chomp(diff));
|
||||||
|
|
||||||
|
if (lockFlags.writeLockFile) {
|
||||||
|
if (auto sourcePath = topRef.input->getSourcePath()) {
|
||||||
|
if (!newLockFile.isImmutable()) {
|
||||||
|
if (settings.warnDirty)
|
||||||
|
warn("will not write lock file of flake '%s' because it has a mutable input", topRef);
|
||||||
|
} else {
|
||||||
|
if (!lockFlags.updateLockFile)
|
||||||
|
throw Error("flake '%s' requires lock file changes but they're not allowed due to '--no-update-lock-file'", topRef);
|
||||||
|
|
||||||
|
auto relPath = (topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock";
|
||||||
|
|
||||||
|
auto path = *sourcePath + "/" + relPath;
|
||||||
|
|
||||||
|
bool lockFileExists = pathExists(path);
|
||||||
|
|
||||||
|
if (lockFileExists)
|
||||||
|
warn("updating lock file '%s'", path);
|
||||||
|
else
|
||||||
|
warn("creating lock file '%s'", path);
|
||||||
|
|
||||||
|
newLockFile.write(path);
|
||||||
|
|
||||||
|
topRef.input->markChangedFile(
|
||||||
|
(topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock",
|
||||||
|
lockFlags.commitLockFile
|
||||||
|
? std::optional<std::string>(fmt("%s: %s\n\nFlake input changes:\n\n%s",
|
||||||
|
relPath, lockFileExists ? "Update" : "Add", diff))
|
||||||
|
: std::nullopt);
|
||||||
|
|
||||||
|
/* Rewriting the lockfile changed the top-level
|
||||||
|
repo, so we should re-read it. FIXME: we could
|
||||||
|
also just clear the 'rev' field... */
|
||||||
|
auto prevLockedRef = flake.lockedRef;
|
||||||
|
FlakeCache dummyCache;
|
||||||
|
flake = getFlake(state, topRef, {}, lockFlags.useRegistries, dummyCache);
|
||||||
|
|
||||||
|
if (lockFlags.commitLockFile &&
|
||||||
|
flake.lockedRef.input->getRev() &&
|
||||||
|
prevLockedRef.input->getRev() != flake.lockedRef.input->getRev())
|
||||||
|
warn("committed new revision '%s'", flake.lockedRef.input->getRev()->gitRev());
|
||||||
|
|
||||||
|
/* Make sure that we picked up the change,
|
||||||
|
i.e. the tree should usually be dirty
|
||||||
|
now. Corner case: we could have reverted from a
|
||||||
|
dirty to a clean tree! */
|
||||||
|
if (flake.lockedRef.input == prevLockedRef.input
|
||||||
|
&& !flake.lockedRef.input->isImmutable())
|
||||||
|
throw Error("'%s' did not change after I updated its 'flake.lock' file; is 'flake.lock' under version control?", flake.originalRef);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
throw Error("cannot write modified lock file of flake '%s' (use '--no-write-lock-file' to ignore)", topRef);
|
||||||
|
} else
|
||||||
|
warn("not writing modified lock file of flake '%s'", topRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
return LockedFlake { .flake = std::move(flake), .lockFile = std::move(newLockFile) };
|
||||||
|
}
|
||||||
|
|
||||||
|
void callFlake(EvalState & state,
|
||||||
|
const LockedFlake & lockedFlake,
|
||||||
|
Value & vRes)
|
||||||
|
{
|
||||||
|
auto vLocks = state.allocValue();
|
||||||
|
auto vRootSrc = state.allocValue();
|
||||||
|
auto vRootSubdir = state.allocValue();
|
||||||
|
auto vTmp1 = state.allocValue();
|
||||||
|
auto vTmp2 = state.allocValue();
|
||||||
|
|
||||||
|
mkString(*vLocks, lockedFlake.lockFile.to_string());
|
||||||
|
|
||||||
|
emitTreeAttrs(state, *lockedFlake.flake.sourceInfo, lockedFlake.flake.lockedRef.input, *vRootSrc);
|
||||||
|
|
||||||
|
mkString(*vRootSubdir, lockedFlake.flake.lockedRef.subdir);
|
||||||
|
|
||||||
|
static RootValue vCallFlake = nullptr;
|
||||||
|
|
||||||
|
if (!vCallFlake) {
|
||||||
|
vCallFlake = allocRootValue(state.allocValue());
|
||||||
|
state.eval(state.parseExprFromString(
|
||||||
|
#include "call-flake.nix.gen.hh"
|
||||||
|
, "/"), **vCallFlake);
|
||||||
|
}
|
||||||
|
|
||||||
|
state.callFunction(**vCallFlake, *vLocks, *vTmp1, noPos);
|
||||||
|
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
|
||||||
|
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void prim_getFlake(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
|
{
|
||||||
|
auto flakeRefS = state.forceStringNoCtx(*args[0], pos);
|
||||||
|
auto flakeRef = parseFlakeRef(flakeRefS, {}, true);
|
||||||
|
if (evalSettings.pureEval && !flakeRef.input->isImmutable())
|
||||||
|
throw Error("cannot call 'getFlake' on mutable flake reference '%s', at %s (use --impure to override)", flakeRefS, pos);
|
||||||
|
|
||||||
|
callFlake(state,
|
||||||
|
lockFlake(state, flakeRef,
|
||||||
|
LockFlags {
|
||||||
|
.updateLockFile = false,
|
||||||
|
.useRegistries = !evalSettings.pureEval,
|
||||||
|
.allowMutable = !evalSettings.pureEval,
|
||||||
|
}),
|
||||||
|
v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static RegisterPrimOp r2("getFlake", 1, prim_getFlake);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Fingerprint LockedFlake::getFingerprint() const
|
||||||
|
{
|
||||||
|
// FIXME: as an optimization, if the flake contains a lock file
|
||||||
|
// and we haven't changed it, then it's sufficient to use
|
||||||
|
// flake.sourceInfo.storePath for the fingerprint.
|
||||||
|
return hashString(htSHA256,
|
||||||
|
fmt("%s;%d;%d;%s",
|
||||||
|
flake.sourceInfo->storePath.to_string(),
|
||||||
|
flake.sourceInfo->info.revCount.value_or(0),
|
||||||
|
flake.sourceInfo->info.lastModified.value_or(0),
|
||||||
|
lockFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
Flake::~Flake() { }
|
||||||
|
|
||||||
|
}
|
||||||