forked from rarias/jungle
Add documentation section with commands to query the cache
This commit is contained in:
parent
31d03ee3ac
commit
3590879c17
@ -82,3 +82,44 @@ By adding the configuration below to a `flake.nix`, when someone uses the flake,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Querying the cache
|
||||||
|
|
||||||
|
Check if the cache is available:
|
||||||
|
```sh
|
||||||
|
$ curl https://jungle.bsc.es/cache/nix-cache-info
|
||||||
|
StoreDir: /nix/store
|
||||||
|
WantMassQuery: 1
|
||||||
|
Priority: 30
|
||||||
|
```
|
||||||
|
|
||||||
|
Prevent nix from building locally:
|
||||||
|
```bash
|
||||||
|
nix build --max-jobs 0 <...>
|
||||||
|
```
|
||||||
|
|
||||||
|
Check if a package is in cache:
|
||||||
|
```bash
|
||||||
|
# Do a raw eval on the <package>.outPath (this should not build the package)
|
||||||
|
$ nix eval --raw jungle#openmp.outPath
|
||||||
|
/nix/store/dwnn4dgm1m4184l4xbi0qfrprji9wjmi-openmp-2024.11
|
||||||
|
# Take the hash (everything from / to - in the basename) and curl <hash>.narinfo
|
||||||
|
# if it exists in the cache, it will return HTTP 200 and some information
|
||||||
|
# if not, it will return 404
|
||||||
|
$ curl https://jungle.bsc.es/cache/dwnn4dgm1m4184l4xbi0qfrprji9wjmi.narinfo
|
||||||
|
StorePath: /nix/store/dwnn4dgm1m4184l4xbi0qfrprji9wjmi-openmp-2024.11
|
||||||
|
URL: nar/dwnn4dgm1m4184l4xbi0qfrprji9wjmi-17imkdfqzmnb013d14dx234bx17bnvws8baf3ii1xra5qi2y1wiz.nar
|
||||||
|
Compression: none
|
||||||
|
NarHash: sha256:17imkdfqzmnb013d14dx234bx17bnvws8baf3ii1xra5qi2y1wiz
|
||||||
|
NarSize: 1519328
|
||||||
|
References: 4gk773fqcsv4fh2rfkhs9bgfih86fdq8-gcc-13.3.0-lib nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36
|
||||||
|
Deriver: vcn0x8hikc4mvxdkvrdxp61bwa5r7lr6-openmp-2024.11.drv
|
||||||
|
Sig: jungle.bsc.es:GDTOUEs1jl91wpLbb+gcKsAZjpKdARO9j5IQqb3micBeqzX2M/NDtKvgCS1YyiudOUdcjwa3j+hyzV2njokcCA==
|
||||||
|
# In oneline:
|
||||||
|
$ curl "https://jungle.bsc.es/cache/$(nix eval --raw jungle#<package>.outPath | cut -d '/' -f4 | cut -d '-' -f1).narinfo"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### References
|
||||||
|
|
||||||
|
- https://nix.dev/guides/recipes/add-binary-cache.html
|
||||||
|
- https://nixos.wiki/wiki/Binary_Cache
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user