dotfiles

shared miscellaneous configuration files between my systems
git clone git://git.shmage.xyz/dotfiles.git
Log | Files | Refs

commit 503514f81fa251dfcd1da76c57880f5d3baa0c9a
parent b35a39285a41953fd5ea794c6b462589d1208260
Author: Ian Ressa <ian@eonn.xyz>
Date:   Mon, 17 Oct 2022 02:00:44 -0400

Change guix update script to also update the user profile if chosen

Diffstat:
Dbin/guix-update-extra-profiles.sh | 48------------------------------------------------
Abin/guix-update-profiles.sh | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 48 deletions(-)

diff --git a/bin/guix-update-extra-profiles.sh b/bin/guix-update-extra-profiles.sh @@ -1,48 +0,0 @@ -#!/bin/sh - -GUIX_EXTRA_PROFILES="$HOME/.guix-extra-profiles" -GUIX_EXTRA_MANIFESTS="$HOME/guix-config/manifest" - -declare -a PROFILEDIRS -if [ "$#" -eq 0 ]; then - mapfile -d '' PROFILEDIRS < <(find "$GUIX_EXTRA_PROFILES"/ -maxdepth 1 -not -path "$GUIX_EXTRA_PROFILES"/ -print0) -else - for i in "$@"; do - profiledirs="$(find "$GUIX_EXTRA_PROFILES"/ -maxdepth 1 -not -path "$GUIX_EXTRA_PROFILES"/ -name "$i")" - if $(echo "$profiledirs" | grep -v .); then - echo "WARNING: Can't find profile \""$i"\" in GUIX_EXTRA_PROFILES, skipping" - else - PROFILEDIRS+=("$profiledirs") - fi - done -fi - -for i in "${PROFILEDIRS[@]}"; do - profile="$i"/$(basename "$i") - manifest="$GUIX_EXTRA_MANIFESTS"/"$(basename "$i")".scm - if [ -f "$manifest" ]; then - echo "Queueing "$i"..." - CMDS+=("guix package --manifest="$manifest" --profile="$profile"") - else - echo "WARNING: Can't find manifest \""$manifest"\" for \""$profile"\", skipping" - fi -done - -if (( ${#CMDS[@]} == 0 )); then - echo "Nothing to do, quitting..." -else - echo "The following will be run:" - for cmd in "${CMDS[@]}"; do - echo "$cmd" - done - read -p "Proceed? [Y/n] " re - case "$re" in [yY][eE][sS]|[yY]|'') - echo - for cmd in "${CMDS[@]}"; do - echo "$cmd" - $cmd - done - echo "Done with updates, exiting..." - ;; - esac -fi diff --git a/bin/guix-update-profiles.sh b/bin/guix-update-profiles.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +GUIX_EXTRA_PROFILES="$HOME/.guix-extra-profiles" +GUIX_EXTRA_MANIFESTS="$HOME/guix-config/manifest" +USER_PROFILE="$HOME/.guix-profile" +UPDATE_USER_PROFILE=false + +declare -a PROFILEDIRS +if [ "$#" -eq 0 ]; then + mapfile -d '' PROFILEDIRS < <(find "$GUIX_EXTRA_PROFILES"/ -maxdepth 1 -not -path "$GUIX_EXTRA_PROFILES"/ -print0) + UPDATE_USER_PROFILE=true +else + for i in "$@"; do + profiledirs="$(find "$GUIX_EXTRA_PROFILES"/ -maxdepth 1 -not -path "$GUIX_EXTRA_PROFILES"/ -name "$i")" + if $(echo "$profiledirs" | grep -v .); then + if [ "$i" == "user" ]; then + $UPDATE_USER_PROFILE || UPDATE_USER_PROFILE=true + else + echo "WARNING: Can't find profile \""$i"\" in GUIX_EXTRA_PROFILES, skipping" + fi + else + [[ "$PROFILEDIRS[*]" =~ "$profiledirs" ]] || PROFILEDIRS+=("$profiledirs") + fi + done +fi + +$UPDATE_USER_PROFILE && echo "Queueing user profile "$USER_PROFILE"..." +$UPDATE_USER_PROFILE && CMDS+=("guix package -u") +for i in "${PROFILEDIRS[@]}"; do + profile="$i"/$(basename "$i") + manifest="$GUIX_EXTRA_MANIFESTS"/"$(basename "$i")".scm + if [ -f "$manifest" ]; then + echo "Queueing "$i"..." + CMDS+=("guix package --manifest="$manifest" --profile="$profile"") + else + echo "WARNING: Can't find manifest \""$manifest"\" for \""$profile"\", skipping" + fi +done + +if (( ${#CMDS[@]} == 0 )); then + echo "Nothing to do, quitting..." +else + echo "The following will be run:" + for cmd in "${CMDS[@]}"; do + echo "$cmd" + done + read -p "Proceed? [Y/n] " re + case "$re" in [yY][eE][sS]|[yY]|'') + echo + for cmd in "${CMDS[@]}"; do + echo "$cmd" + $cmd + done + echo "Done with updates, exiting..." + ;; + esac +fi