From 44532cc3a36bf5ca92e22585eebcebe3a0fc304e Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Mon, 5 Oct 2026 12:04:28 +0200 Subject: [PATCH] Normalise snake cases as dashes. --- nix-system-configs/modules/scripts/pull.zsh | 15 +++++++++------ nix-system-configs/modules/scripts/push.zsh | 14 ++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/nix-system-configs/modules/scripts/pull.zsh b/nix-system-configs/modules/scripts/pull.zsh index 72f5051..37e7ff6 100755 --- a/nix-system-configs/modules/scripts/pull.zsh +++ b/nix-system-configs/modules/scripts/pull.zsh @@ -210,12 +210,15 @@ fi # Step 4: Rebuild system using local flake # Compute repository root (three levels up from this script: .../nix-system-configs/modules/scripts -> repo root) FLAKE_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" -# Normalize selected system name to flake nixosConfigurations naming convention (prefix with 'nixos-' if missing) -if [[ "${selected_system}" == nixos-* ]]; then - flake_name="${selected_system}" -else - flake_name="nixos-${selected_system}" -fi +# Map repository configuration filenames to flake nixosConfigurations names. +# Normalise the snake-cases as dashes. +case "${selected_system}" in + blank_system_USE_THIS_AS_COPY) flake_name="nixos-blank" ;; + gramethus) flake_name="nixos-logs" ;; + wireguard_server) flake_name="nixos-local-wireguard-server" ;; + nixos-*) flake_name="${selected_system}" ;; + *) flake_name="nixos-${selected_system//_/-}" ;; +esac # If the selected system is the database module, use the standard non-flake rebuild if [[ "${selected_system}" == "database" ]]; then diff --git a/nix-system-configs/modules/scripts/push.zsh b/nix-system-configs/modules/scripts/push.zsh index 522c724..becbf48 100755 --- a/nix-system-configs/modules/scripts/push.zsh +++ b/nix-system-configs/modules/scripts/push.zsh @@ -102,12 +102,14 @@ echo "" # Step 1: Rebuild system print_info "Rebuilding NixOS system..." -# Normalize selected system name to flake nixosConfigurations naming convention (prefix with 'nixos-' if missing) -if [[ "${selected_system}" == nixos-* ]]; then - flake_name="${selected_system}" -else - flake_name="nixos-${selected_system}" -fi +# Map repository configuration filenames to flake nixosConfigurations names. +case "${selected_system}" in + blank_system_USE_THIS_AS_COPY) flake_name="nixos-blank" ;; + gramethus) flake_name="nixos-logs" ;; + wireguard_server) flake_name="nixos-local-wireguard-server" ;; + nixos-*) flake_name="${selected_system}" ;; + *) flake_name="nixos-${selected_system//_/-}" ;; +esac echo "" if sudo NIX_CONFIG='experimental-features = nix-command flakes' nixos-rebuild switch --upgrade-all --flake "${PWD}#${flake_name}"; then