Enhance push.sh to handle both NixOS deploys and service deploys.
Omni/Ide/push.sh - Add service deploy mode# Builds NixOS, copies to host, runs switch-to-configuration
target="$1"
what=$(realpath "${CODEROOT:?}/_/nix/$target")
where=<extracted from systemd service>
nix copy --to ssh://"$USER"@"$where" "$what"
ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what"
ssh "$USER"@"$where" sudo switch-to-configuration switch
#!/usr/bin/env bash
target="$1"
if [[ "$target" == *.nix ]]; then
# NixOS deploy (existing behavior)
bild "$target"
# ... existing nix copy + switch logic ...
else
# Service deploy (new behavior)
# 1. Build and cache
store_path=$(bild --cache "$target" | grep '^/nix/store')
# 2. Extract service name from target path
# Biz/PodcastItLater/Web.py -> podcastitlater-web
service_name=$(derive_service_name "$target")
# 3. Update manifest in S3
# Could shell out to python or use aws cli + jq
python3 -c "
import Omni.Deploy.Manifest as M
manifest = M.load_manifest_from_s3('omni-nix-cache')
manifest = M.update_service(manifest, '$service_name', '$store_path')
M.save_manifest_to_s3(manifest, 'omni-nix-cache')
"
echo "Deployed $service_name, deployer will pick up in <5 min"
fi
Use same credentials as bild:
Convert namespace path to service name:
# NixOS deploy (should work as before)
push.sh Biz.nix
# Service deploy (new)
push.sh Biz/PodcastItLater/Web.py
# Should update manifest.json in S3