Add instructions on how to use the cache in the web
This commit is contained in:
parent
982fc647cf
commit
5cd8372c4c
68
web/content/cache/_index.md
vendored
Normal file
68
web/content/cache/_index.md
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
title: "Cache"
|
||||
description: "nix binary cache"
|
||||
date: 2025-02-26T17:37:19+0100
|
||||
---
|
||||
|
||||
We provide a binary cache in `hut`, with the aim of avoiding unnecessary
|
||||
recompilation of packages.
|
||||
|
||||
The cache should contain common packages from bsckpkgs, but we don't provide
|
||||
any guarantee that of what will be available in the cache, or for how long.
|
||||
We recommend following the latest version of the `jungle` flake to avoid cache
|
||||
misses.
|
||||
|
||||
## Usage
|
||||
|
||||
### From NixOS
|
||||
|
||||
In NixOS, we can add the cache through the `nix.settings` option, which will
|
||||
enable it for all builds in the system.
|
||||
|
||||
```nix
|
||||
{ ... }: {
|
||||
nix.settings = {
|
||||
substituters = [ "https://jungle.bsc.es" ];
|
||||
trusted-public-keys = [ "jungle.bsc.es:pEc7MlAT0HEwLQYPtpkPLwRsGf80ZI26aj29zMw/HH0=" ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Interactively
|
||||
|
||||
The cache can also be specified in a per-command basis through the flags
|
||||
`--substituters` and `--trusted-public-keys`:
|
||||
|
||||
```sh
|
||||
nix build --substituters "https://jungle.bsc.es/cache" --trusted-public-keys "jungle.bsc.es:pEc7MlAT0HEwLQYPtpkPLwRsGf80ZI26aj29zMw/HH0=" <...>
|
||||
```
|
||||
|
||||
### Nix configuration file (non-nixos)
|
||||
|
||||
If using nix outside of NixOS, you'll have to update `nix.conf`
|
||||
|
||||
```bash
|
||||
echo "substituters = https://jungle.bsc.es" >> /etc/nix/nix.conf
|
||||
echo "trusted-public-keys = jungle.bsc.es:pEc7MlAT0HEwLQYPtpkPLwRsGf80ZI26aj29zMw/HH0=" >> /etc/nix/nix.conf
|
||||
```
|
||||
|
||||
### Hint in flakes
|
||||
|
||||
By adding the configuration below to a `flake.nix`, when someone uses the flake,
|
||||
`nix` will interactively ask to trust and use the provided binary cache:
|
||||
|
||||
```nix
|
||||
{
|
||||
nixConfig = {
|
||||
extra-substituters = [
|
||||
"https://jungle.bsc.es/cache"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"jungle.bsc.es:pEc7MlAT0HEwLQYPtpkPLwRsGf80ZI26aj29zMw/HH0="
|
||||
];
|
||||
};
|
||||
outputs = { ... }: {
|
||||
...
|
||||
};
|
||||
}
|
||||
```
|
@ -13,6 +13,7 @@ which is available at `hut` or `xeon07`. It runs the following services:
|
||||
- Grafana: to plot the data in the web browser.
|
||||
- Slurmctld: to manage the SLURM nodes.
|
||||
- Gitlab runner: to run CI jobs from Gitlab.
|
||||
- Nix binary cache: to serve cached nix builds (See [cache](/cache))
|
||||
|
||||
This node is prone to interruptions from all the services it runs, so it is not
|
||||
a good candidate for low noise executions.
|
||||
|
Loading…
Reference in New Issue
Block a user