2023-09-30 20:03:43 +00:00
|
|
|
# Woodpecker plugin: nix-attic
|
|
|
|
|
2023-11-30 21:25:47 +00:00
|
|
|
This Woodpecker CI plugin is to build and cache nix derivations using the binary cache
|
|
|
|
[attic](https://github.com/zhaofengli/attic). The image is based on NixOS.
|
2023-09-30 20:03:43 +00:00
|
|
|
|
2023-11-30 21:25:47 +00:00
|
|
|
## Features
|
2023-09-30 20:03:43 +00:00
|
|
|
|
2023-11-30 21:25:47 +00:00
|
|
|
- nix experimental features enabled by default: commands and flakes
|
|
|
|
- preinstalled [attic-client](https://github.com/zhaofengli/attic)
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
See [docs.md](docs.md).
|
2023-09-30 20:03:43 +00:00
|
|
|
|
|
|
|
## How to build the image locally?
|
|
|
|
|
|
|
|
### On Linux
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ nix build
|
|
|
|
$ docker load -i result
|
|
|
|
```
|
|
|
|
|
|
|
|
### On macOS
|
|
|
|
|
|
|
|
The easiest way to build the image is using a previously built version of the image:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ echo << EOF >> cmd.txt
|
|
|
|
nix build
|
|
|
|
nix-env -iA nixpkgs.docker-client
|
|
|
|
docker load -i result
|
|
|
|
EOF
|
|
|
|
$ docker run -it \
|
|
|
|
-e PLUGIN_BINARY_CACHE=https://some-binary-cache.example.com \
|
|
|
|
-e PLUGIN_BINARY_CACHE_PUBLIC_KEY=some-binary-cache.example.com:some-public-keyi \
|
|
|
|
-e PLUGIN_BINARY_CACHE_TOKEN=$ACCESS_TOKEN \
|
|
|
|
-e PLUGIN_SCRIPT="$(cat cmd.txt)" \
|
|
|
|
-v $(pwd):/opt/plugin \
|
|
|
|
-w /opt/plugin \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic:0.1.0
|
|
|
|
```
|