diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-elpa b/pkgs/applications/editors/emacs/elisp-packages/update-elpa deleted file mode 100755 index 6cf3bafd24e16..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-elpa +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="elpa-generated.nix" -elpa-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel b/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel deleted file mode 100755 index 356d93167af88..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="elpa-devel-generated.nix" -elpa-devel-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu b/pkgs/applications/editors/emacs/elisp-packages/update-nongnu deleted file mode 100755 index 9a4b20716c152..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="nongnu-generated.nix" -nongnu-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel b/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel deleted file mode 100755 index a1f5f950d4387..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="nongnu-devel-generated.nix" -nongnu-devel-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-package-sets b/pkgs/applications/editors/emacs/elisp-packages/update-package-sets new file mode 100755 index 0000000000000..299ac414919ae --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/update-package-sets @@ -0,0 +1,54 @@ +#! /usr/bin/env nix-shell +#! nix-shell --show-trace ./emacs2nix.nix -i bash + +usage(){ + cat<<-EOF +Usage: update-package-sets 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") + # Do not include duplicates + if [[ ! ${SETS[@]} =~ $1 ]]; then + SETS+=( "$1" ) + fi + shift + ;; + "melpa" | "melpa-stable") + # Let's warn the user of the correct script and go on + echo "This script does not generate the MELPA package set." + echo "Use update-melpa script instead." + shift + ;; + *) + echo "Unknown package set: $1" + usage + exit 1 + ;; + esac + done + + for SET in "${SETS[@]}"; do + echo "${SET}: updating..." + update_set "${SET}" + echo "${SET}: updated" + done +} + +main "$@"