53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
![]() |
# Woodpecker plugin: nix-attic
|
||
|
|
||
|
This woodpecker plugin can be configured to use a private binary cache, and it also has
|
||
|
[attic-client](ihttps://github.com/zhaofengli/attic) pre-installed.
|
||
|
|
||
|
## Example configuration
|
||
|
|
||
|
```yaml
|
||
|
steps:
|
||
|
check:
|
||
|
image: git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic:0.1.0
|
||
|
settings:
|
||
|
binary_cache: https://some-binary-cache.example.com
|
||
|
binary_cache_public_key: some-binary-cache.example.com:some-public-key
|
||
|
binary_cache_token:
|
||
|
from_secret: binary_cache_access_token
|
||
|
script: |
|
||
|
nix flake check
|
||
|
nix build
|
||
|
attic login default $PLUGIN_BINARY_CACHE_TOKEN
|
||
|
attic push some-cache $(nix path-info .#default)
|
||
|
```
|
||
|
|
||
|
## 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
|
||
|
```
|