Update nix.yml

This commit is contained in:
2026-02-11 23:06:21 -07:00
parent 1ec3cbe44d
commit 67328182cb

13
nix.yml
View File

@@ -1,9 +1,10 @@
# Required Gitea Actions secrets: # Required Gitea Actions secrets:
# SSH_PRIVATE_KEY - Private key for SSH authentication # SSH_PRIVATE_KEY - Private key for SSH
# DEPLOY_HOST - Target server IP address (e.g. 144.217.160.198) # DEPLOY_HOST - Target server IP address
# DEPLOY_USER - SSH user on the target server (e.g. root) # DEPLOY_USER - SSH user on the target server
# FLAKE_TARGET - NixOS flake target name
name: Deploy Haschel name: Deploy NixOS
on: on:
push: push:
@@ -20,7 +21,7 @@ jobs:
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
cat >> ~/.ssh/config << EOF cat >> ~/.ssh/config << EOF
Host haschel Host deploy-target
HostName ${{ secrets.DEPLOY_HOST }} HostName ${{ secrets.DEPLOY_HOST }}
User ${{ secrets.DEPLOY_USER }} User ${{ secrets.DEPLOY_USER }}
StrictHostKeyChecking no StrictHostKeyChecking no
@@ -32,4 +33,4 @@ jobs:
- name: Deploy - name: Deploy
run: | run: |
REPO_URL="${{ github.server_url }}/${{ github.repository }}.git" REPO_URL="${{ github.server_url }}/${{ github.repository }}.git"
ssh haschel "rm -rf /tmp/nixos-config && git clone $REPO_URL /tmp/nixos-config && nixos-rebuild switch --flake /tmp/nixos-config#haschel && rm -rf /tmp/nixos-config" ssh deploy-target "rm -rf /tmp/nixos-config && git clone $REPO_URL /tmp/nixos-config && nixos-rebuild switch --flake /tmp/nixos-config#${{ secrets.FLAKE_TARGET }} && rm -rf /tmp/nixos-config"