name: Build & Deploy (Nix) on: push: branches: - main jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Install Nix run: | curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \ | sh -s -- install --no-confirm 2>&1 echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH" - name: Build with Nix run: | . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh || true nix build .#teleuploader --impure --option sandbox false 2>&1 - name: Deploy via Docker socket (host access) run: | set -eu STORE_PATH=$(readlink result) # Use Docker socket to run commands on the VPS host docker run --rm --pid=host --privileged \ -v /:/host \ alpine:latest \ chroot /host sh -c " nix-env --profile /nix/var/nix/profiles/teleuploader --set '$STORE_PATH' && \ systemctl restart teleuploader " echo "=== Service status ===" docker run --rm --pid=host --privileged \ -v /:/host \ alpine:latest \ chroot /host sh -c "systemctl status teleuploader --no-pager | head -15"