I have followed guide on Serving a Nix store via S3
Here is my /etc/nix/nix.conf
experimental-features = nix-command flakes
substituters = s3://example-nix-store-cache
trusted-public-keys = example-nix-store-cache:eVxbn0w8iWxlD9fMZeOMddHhIm85Jab+s/Ko+fKZZ3U=
build-users-group = nixbld
Then I copy some package libbpf
to S3
nix copy nixpkgs#libbpf --to 's3://example-nix-store-cache?secret-key=/home/user/nix-cache-key.sec&profile=default®ion=us-east-1'
List S3 bucket
$ aws s3 ls example-nix-store-cache
PRE nar/
2022-09-16 16:35:30 721 4v2bk6almk03mfnz4122dfz8vcxynvs3.narinfo
2022-09-16 16:35:32 900 54iswic0mckispx2ycxgbri26qfmz6s1.narinfo
2022-09-16 16:35:33 811 f8andlqv1jnnv86irh231amb92y83ji4.narinfo
2022-09-16 16:35:27 668 jyiybh44fcvypizjnl3yrffqr8mndhid.narinfo
2022-09-16 16:42:15 21 nix-cache-info
2022-09-16 16:35:27 712 scphgcsdllg55axw45vrr07jhl17i8i7.narinfo
2022-09-16 16:35:27 705 skb4mxgggvm22qxvdrqh7ga6y30mf06n.narinfo
2022-09-16 16:35:31 760 y1iq99faxkdrf28h2jz9gji0245jms6f.narinfo
On the machine that I uploaded it works,
$ nix-env -iA nixpkgs.libbpf -v
downloaded 's3://example-nix-store-cache/nar/17mamxhqbxjapg4aiqj88lqmxkzk1f4akgwpjw6ffsbgy21ss431.nar.xz' (340404 bytes) in 513 ms
evaluating file '/nix/store/hgpv1b2ilb2n4pm3kmgxvhv0cz2cxk1v-nixpkgs/nixpkgs/maintainers/maintainer-list.nix'
building '/nix/store/h2gphcjpxzxw1cs8jd53fb4qdbb9whfp-user-environment.drv'...
$ nix-env -qaPsA nixpkgs.libbpf
IPS nixpkgs.libbpf libbpf-0.8.1
But on the other machine, it doesn’t try S3 cache at all even after removing it from /nix/store
dev1$ nix-env -e libbpf
uninstalling 'libbpf-0.8.1'
dev1$ nix-store --delete $(nix eval --raw nixpkgs#libbpf.outPath)
finding garbage collector roots...
deleting '/nix/store/f8andlqv1jnnv86irh231amb92y83ji4-libbpf-0.8.1'
deleting unused links...
note: currently hard linking saves -0.00 MiB
1 store paths deleted, 0.00 MiB freed
dev1$ nix-env -iA nixpkgs.libbpf
installing 'libbpf-0.8.1'
Is there a reason S
flag is missing on second machine?
dev1$ nix-env -qaPsA nixpkgs.libbpf
IP- nixpkgs.libbpf libbpf-0.8.1
In addition, realizing package fails
dev1$ nix-store -r /nix/store/f8andlqv1jnnv86irh231amb92y83ji4-libbpf-0.8.1
these 7 paths will be fetched (2.98 MiB download, 14.66 MiB unpacked):
/nix/store/4v2bk6almk03mfnz4122dfz8vcxynvs3-gcc-11.3.0-lib
/nix/store/54iswic0mckispx2ycxgbri26qfmz6s1-elfutils-0.187
/nix/store/f8andlqv1jnnv86irh231amb92y83ji4-libbpf-0.8.1
/nix/store/jyiybh44fcvypizjnl3yrffqr8mndhid-zlib-1.2.12
/nix/store/scphgcsdllg55axw45vrr07jhl17i8i7-bzip2-1.0.8
/nix/store/skb4mxgggvm22qxvdrqh7ga6y30mf06n-xz-5.2.6
/nix/store/y1iq99faxkdrf28h2jz9gji0245jms6f-zstd-1.5.2
don't know how to build these paths:
/nix/store/bzd91shky9j9d43girrrj6vmqlw7x9m8-glibc-2.35-163
error: build of '/nix/store/f8andlqv1jnnv86irh231amb92y83ji4-libbpf-0.8.1' failed