diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..9177dea --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: Deploy Hashel + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Configure SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -H haschel >> ~/.ssh/known_hosts 2>/dev/null || true + + - name: Deploy with deploy-rs + run: | + nix run github:serokell/deploy-rs -- .#haschel --skip-checks diff --git a/flake.nix b/flake.nix index c17b5c8..5c335c0 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + deploy-rs.url = "github:serokell/deploy-rs"; }; - outputs = { self, nixpkgs, ... }@inputs: + outputs = { self, nixpkgs, deploy-rs, ... }@inputs: let settings = import ./settings.nix; system = "x86_64-linux"; @@ -17,5 +18,16 @@ ./configuration.nix ]; }; + + deploy.nodes."${settings.hostname}" = { + hostname = "haschel"; + sshUser = "root"; + profiles.system = { + user = "root"; + path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations."${settings.hostname}"; + }; + }; + + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; }; }