Move NixOS switches to SSH runners
NixOS switch cloud-pc / switch (push) Failing after 10m52s
Deploy cloud-pc / deploy (push) Failing after 11m46s
Deploy mini-pc / deploy (push) Failing after 10m14s
NixOS switch mini-pc / switch (push) Has been cancelled

This commit is contained in:
Dmitry
2026-05-30 13:11:29 +03:00
parent ef1503aa3a
commit 60a5778194
8 changed files with 56 additions and 54 deletions
+11 -2
View File
@@ -12,7 +12,7 @@ on:
jobs: jobs:
switch: switch:
runs-on: cloud-pc-nixos runs-on: cloud-pc
steps: steps:
- name: Sync repo - name: Sync repo
run: | run: |
@@ -20,4 +20,13 @@ jobs:
git -C /opt/services pull --ff-only git -C /opt/services pull --ff-only
- name: Switch NixOS generation - name: Switch NixOS generation
run: sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /opt/services/nixos#cloud-pc env:
NIXOS_DEPLOY_KEY: ${{ secrets.NIXOS_DEPLOY_KEY }}
run: |
KEY=$(mktemp)
echo "$NIXOS_DEPLOY_KEY" > "$KEY"
chmod 600 "$KEY"
trap "rm -f $KEY" EXIT
ssh -i "$KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ada@192.168.1.5 \
"sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /opt/services/nixos#cloud-pc"
+11 -2
View File
@@ -12,7 +12,7 @@ on:
jobs: jobs:
switch: switch:
runs-on: mini-pc-nixos runs-on: mini-pc
steps: steps:
- name: Sync repo - name: Sync repo
run: | run: |
@@ -20,4 +20,13 @@ jobs:
git -C /opt/services pull --ff-only git -C /opt/services pull --ff-only
- name: Switch NixOS generation - name: Switch NixOS generation
run: sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /opt/services/nixos#mini-pc env:
NIXOS_DEPLOY_KEY: ${{ secrets.NIXOS_DEPLOY_KEY }}
run: |
KEY=$(mktemp)
echo "$NIXOS_DEPLOY_KEY" > "$KEY"
chmod 600 "$KEY"
trap "rm -f $KEY" EXIT
ssh -i "$KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ada@192.168.1.10 \
"sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /opt/services/nixos#mini-pc"
+4
View File
@@ -0,0 +1,4 @@
FROM gitea/act_runner:latest
USER root
RUN apk add --no-cache docker-cli docker-cli-compose
+13
View File
@@ -0,0 +1,13 @@
services:
gitea-runner:
build: .
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/services:/opt/services
- /opt/data/gitea-runner:/data
environment:
GITEA_INSTANCE_URL: https://git.ada-dev.ru
GITEA_RUNNER_REGISTRATION_TOKEN: ${TOKEN}
GITEA_RUNNER_NAME: cloud-pc-runner
GITEA_RUNNER_LABELS: cloud-pc
+4
View File
@@ -0,0 +1,4 @@
FROM gitea/act_runner:latest
USER root
RUN apk add --no-cache docker-cli docker-cli-compose
+13
View File
@@ -0,0 +1,13 @@
services:
gitea-runner:
build: .
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/services:/opt/services
- /opt/data/gitea-runner:/data
environment:
GITEA_INSTANCE_URL: https://git.ada-dev.ru
GITEA_RUNNER_REGISTRATION_TOKEN: ${TOKEN}
GITEA_RUNNER_NAME: mini-pc-runner
GITEA_RUNNER_LABELS: mini-pc
-25
View File
@@ -80,30 +80,5 @@
"d /mnt/yandex 0755 ada users - -" "d /mnt/yandex 0755 ada users - -"
]; ];
services.gitea-actions-runner.instances."cloud-pc" = {
enable = true;
name = "cloud-pc";
url = "https://git.ada-dev.ru";
tokenFile = "/etc/gitea-runner/cloud-pc.token";
labels = [ "cloud-pc" "cloud-pc-nixos" ];
};
systemd.services."gitea-runner-cloud-pc".serviceConfig = {
SupplementaryGroups = [ "docker" ];
Environment = [ "PATH=/run/current-system/sw/bin:/bin" ];
};
security.sudo.extraRules = [
{
users = [ "gitea-runner" ];
commands = [
{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "NOPASSWD" ];
}
];
}
];
system.stateVersion = "25.11"; system.stateVersion = "25.11";
} }
-25
View File
@@ -75,30 +75,5 @@
} }
''; '';
services.gitea-actions-runner.instances."mini-pc" = {
enable = true;
name = "mini-pc";
url = "https://git.ada-dev.ru";
tokenFile = "/etc/gitea-runner/mini-pc.token";
labels = [ "mini-pc" "mini-pc-nixos" ];
};
systemd.services."gitea-runner-mini-pc".serviceConfig = {
SupplementaryGroups = [ "docker" ];
Environment = [ "PATH=/run/current-system/sw/bin:/bin" ];
};
security.sudo.extraRules = [
{
users = [ "gitea-runner" ];
commands = [
{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "NOPASSWD" ];
}
];
}
];
system.stateVersion = "25.11"; system.stateVersion = "25.11";
} }