Add build-local.nix for machine-specific web-app builds and update deployment instructions

Introduced a new example-build-local.nix file to facilitate machine-specific web-app builds, enhancing the deployment process. Updated the .gitignore to include build-local.nix, ensuring user-specific configurations remain untracked. Revised the DEPLOYMENT-GUIDE.md to reflect the addition of build-local.nix and provide clearer instructions for setting up configuration files, improving the onboarding experience for new users.
This commit is contained in:
padreug 2025-10-12 08:34:58 +02:00
parent 2229717860
commit ca5b78b561
3 changed files with 88 additions and 6 deletions

View file

@ -11,11 +11,12 @@ This setup builds the web-app **locally** with machine-specific configuration, t
When you first clone this repository, you need to set up your local configuration:
### 1. Create your krops.nix
### 1. Create your configuration files
```bash
# Copy the example template
# Copy the example templates
cp example-krops.nix krops.nix
cp example-build-local.nix build-local.nix
```
### 2. Create your first machine configuration
@ -29,20 +30,38 @@ cp -r config/machines/example-machine config/machines/my-machine
# - Add your hardware-configuration.nix (from nixos-generate-config)
```
### 3. Update krops.nix
### 3. Create machine-specific web-app assets (if deploying web-app)
Edit `krops.nix` and:
```bash
mkdir -p machine-specific/my-machine/env
mkdir -p machine-specific/my-machine/images
# Add your .env file and images
# See machine-specific/example-machine/ for reference
```
### 4. Update krops.nix and build-local.nix
**In `krops.nix`:**
- Replace `example-machine` with your machine name
- Update the SSH target (`root@your-host`)
- Add to the `inherit` list and `all` script
### 4. Deploy!
**In `build-local.nix`:**
- Replace `example-machine` with your machine name
- Add to the `all` build script
### 5. Build and deploy!
```bash
# Build web-app locally (if using web-app)
nix-build ./build-local.nix -A my-machine && ./result/bin/build-my-machine
# Deploy to target machine
nix-build ./krops.nix -A my-machine && ./result
```
**Note:** Your `krops.nix` and machine configs in `config/machines/*` are gitignored. You can safely pull updates without overwriting your local configuration.
**Note:** Your `krops.nix`, `build-local.nix`, and machine configs in `config/machines/*` are gitignored. You can safely pull updates without overwriting your local configuration.
## Structure