Skip to content

Commit

Permalink
emacsPackages: squash elpa and nongnu update scripts
Browse files Browse the repository at this point in the history
Now they can be called via `./update-package-sets <package sets>`.
  • Loading branch information
AndersonTorres committed Oct 26, 2024
1 parent 5293db1 commit 9cace28
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 24 deletions.
6 changes: 0 additions & 6 deletions pkgs/applications/editors/emacs/elisp-packages/update-elpa

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions pkgs/applications/editors/emacs/elisp-packages/update-nongnu

This file was deleted.

This file was deleted.

49 changes: 49 additions & 0 deletions pkgs/applications/editors/emacs/elisp-packages/update-package-sets
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /usr/bin/env nix-shell
#! nix-shell --show-trace ./emacs2nix.nix -i bash

usage(){
local PROGNAME="$1"

cat<<-EOF
Usage: ${PROGNAME} args
args can be at least one from: elpa-devel, elpa, nongnu-devel, nongnu.
EOF
}

update_set(){
local PKGSET="$1"

local output="${PKGSET}-generated.nix"
local script="${PKGSET}-packages.sh"

eval "${script} --names ${EMACS2NIX}/names.nix -o ${output}"
nixfmt "${output}"
}

main(){
local SETS=( )

while (( $# )); do
case $1 in
"elpa-devel" | "elpa" | "nongnu-devel" | "nongnu")
if [[ ! ${SETS[@]} =~ $1 ]]; then
SETS+=( "$1" )
fi
shift
;;
*)
echo "Unknown package set: $1"
usage "update-package-sets"
exit 1
;;
esac
done

for SET in "${SETS[@]}"; do
echo "${SET}: updating..."
update_set "${SET}"
echo "${SET}: updated"
done
}

main "$@"

0 comments on commit 9cace28

Please sign in to comment.