try store mounted read-only

- `--store` as per
https://blog.kotatsu.dev/posts/2023-04-21-woodpecker-nix-caching/
- `--eval-store` as per
https://kevincox.ca/2022/01/02/nix-in-docker-caching/

mount store

rm kvm
This commit is contained in:
Kiara Grouwstra 2025-08-04 17:49:42 +02:00
parent 1e99075184
commit 35cf1dad09
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
11 changed files with 36 additions and 14 deletions

View file

@ -8,12 +8,14 @@ when:
steps:
- name: build
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- |
mkdir -p ~/.ssh
echo "$CD_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- nix-shell --run 'eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519 && ssh-agent -s && SHELL=$(which bash) nixops4 apply -v default'
- nix-shell --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --run 'eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519 && ssh-agent -s && SHELL=$(which bash) nixops4 apply -v default'
environment:
CD_SSH_KEY:
from_secret: cd_ssh_key

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-data-model
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix-shell --run 'nix-unit ./deployment/data-model-test.nix'
- nix-shell --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --run 'nix-unit ./deployment/data-model-test.nix'

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-deployment-basic
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-basic -L
- nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-basic -L

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-deployment-cli
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-cli -L
- nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-cli -L

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-deployment-panel
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-panel -L
- nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.deployment-panel -L

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-mastodon
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.test-mastodon-service -L
- nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.test-mastodon-service -L

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-panel
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix-build -A tests.panel
- nix-build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt -A tests.panel

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-peertube
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.test-peertube-service -L
- nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.test-peertube-service -L

View file

@ -9,5 +9,7 @@ when:
steps:
- name: check-pre-commit
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix-build -A tests
- nix-build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt -A tests

View file

@ -14,20 +14,22 @@ when:
steps:
- name: check-resources
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- echo ==================== [ VM Options ] ====================
- |
set -euC
machines=$(nix eval --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).vmOptions)')
machines=$(nix eval --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).vmOptions)')
for machine in $machines; do
echo ~~~~~~~~~~~~~~~~~~~~~: $machine :~~~~~~~~~~~~~~~~~~~~~
nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.vmOptions-$machine
nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.vmOptions-$machine
done
- echo ==================== [ NixOS Configurations ] ====================
- |
set -euC
machines=$(nix eval --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).nixosConfigurations)')
machines=$(nix eval --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).nixosConfigurations)')
for machine in $machines; do
echo ~~~~~~~~~~~~~~~~~~~~~: $machine :~~~~~~~~~~~~~~~~~~~~~
nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.nixosConfigurations-$machine
nix build --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.nixosConfigurations-$machine
done

View file

@ -8,8 +8,10 @@ when:
steps:
- name: lockfile
image: nixos/nix
volumes:
- /nix:/mnt/nix:ro
commands:
- nix-shell --run "npins --verbose update"
- nix-shell --eval-store local --store unix:///mnt/nix/var/nix/daemon-socket/socket?root=/mnt --run "npins --verbose update"
# - name: Create PR
# uses: https://github.com/KiaraGrouwstra/gitea-create-pull-request@f9f80aa5134bc5c03c38f5aaa95053492885b397
# with: