My nix-darwin and NixOS config
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: critically fix the typo

+15 -29
+15 -29
settings/gnome-export.sh
··· 9 9 # Flag defaults 10 10 DRY_RUN=false 11 11 12 - # Helper for notifications 13 12 status_msg() { 14 13 local title="$1" 15 14 local msg="$2" 16 - echo -e "\n📦 **$title**: $msg" 15 + echo -e "\n**$title**: $msg" 17 16 if command -v notify-send >/dev/null 2>&1; then 18 17 notify-send "$title" "$msg" 19 - else 20 - # Fallback: Log to system journal so you can audit via journalctl -t gnome-sync 21 - echo "[$title] $msg" | systemd-cat -t gnome-sync 22 18 fi 23 19 } 24 20 25 - # Parse flags 26 21 while [[ "$#" -gt 0 ]]; do 27 22 case $1 in 28 23 -d|--dry-run) DRY_RUN=true; shift ;; 29 24 *) echo "Unknown parameter: $1"; exit 1 ;; 30 25 esac 31 26 done 32 - 33 - if [ "$DRY_RUN" = true ]; then 34 - echo "🔍 DRY RUN MODE: No changes will be written to disk or Git." 35 - fi 36 27 37 28 # 1. Temporary Build Space 38 29 TEMP_EXPORT=$(mktemp -d) ··· 58 49 59 50 mkdir -p "$full_path_dir" 60 51 52 + # FIXED TYPO HERE: /tmp/dconf_temp 61 53 if echo "$raw_output" | dconf2nix > /tmp/dconf_temp 2>/dev/null; then 62 - mv /tmp/dcgitonf_temp "$full_file_path" 54 + mv /tmp/dconf_temp "$full_file_path" 63 55 else 64 - # Fallback for complex types (like GVariant layouts) 65 56 { 66 57 echo "{ ... }:" 67 58 echo "{" 68 59 echo " dconf.settings.\"${dconf_path%/}\" = {" 69 - # Enhanced sed to wrap values in double quotes if they look like GVariant/complex data 60 + # Enhanced quoting to handle the GVariant error you saw earlier 70 61 echo "$raw_output" | sed '/^\[.*\]$/d' | sed "s/^\([^=]*\)=\(.*\)$/ \"\1\" = \"\2\";/g" 71 62 echo " };" 72 63 echo "}" ··· 74 65 fi 75 66 done 76 67 68 + # 3. SAFETY CHECK: Abort if nothing was generated 69 + FILE_COUNT=$(find "$TEMP_EXPORT" -name "*.nix" | wc -l) 70 + if [ "$FILE_COUNT" -lt 2 ]; then 71 + echo "❌ ERROR: Export failed (only $FILE_COUNT files generated). Aborting to save existing config." 72 + rm -rf "$TEMP_EXPORT" 73 + exit 1 74 + fi 75 + 77 76 # Master default.nix 78 77 { 79 78 echo "{ ... }:" ··· 84 83 echo "}" 85 84 } > "$TEMP_EXPORT/default.nix" 86 85 87 - # 3. Synchronize Logic 86 + # 4. Sync Logic 88 87 if [ "$DRY_RUN" = true ]; then 89 - echo -e "\n--- DIFF OF PROPOSED CHANGES ---" 90 88 diff -rN "$TARGET_DIR" "$TEMP_EXPORT" || true 91 - echo "--------------------------------" 92 89 rm -rf "$TEMP_EXPORT" 93 90 exit 0 94 91 fi 95 92 96 - # Apply Changes Locally 97 93 sudo mkdir -p "$TARGET_DIR" 98 94 sudo rsync -av --delete "$TEMP_EXPORT/" "$TARGET_DIR/" 99 95 sudo chown -R "$CURRENT_USER" "$TARGET_DIR" 100 96 rm -rf "$TEMP_EXPORT" 101 97 102 - # 4. Git Logic 98 + # 5. Git Logic 103 99 cd "$REPO_ROOT" || exit 104 100 if [ -d ".git" ]; then 105 101 git add "$TARGET_DIR" 106 - 107 102 if ! git diff --cached --quiet; then 108 103 git commit -m "dconf-export: $TIMESTAMP" 109 - echo "☁️ Pushing to remote..." 110 - if git push; then 111 - status_msg "GNOME Sync" "Settings synced and pushed successfully." 112 - else 113 - status_msg "Git Error" "Commit created, but push failed." 114 - fi 115 - else 116 - echo "✅ No changes to sync." 104 + git push && status_msg "GNOME Sync" "Success" || status_msg "Git Error" "Push Failed" 117 105 fi 118 - else 119 - status_msg "Nix Config" "Not a git repo. Settings updated locally only." 120 106 fi