From b8a80e15e5a952b85322ab742d9dc823e9c800b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 1 Aug 2024 03:49:12 -0700 Subject: [PATCH] Revert "nextcloudPackages: Revamp package generation script" This reverts commit 4349a61a715bb29e0c326076f3666a8c419130ec. --- pkgs/servers/nextcloud/packages/default.nix | 2 +- pkgs/servers/nextcloud/packages/generate.sh | 56 ++------------------- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/pkgs/servers/nextcloud/packages/default.nix b/pkgs/servers/nextcloud/packages/default.nix index 8af2e2f5833b..9c12619968af 100644 --- a/pkgs/servers/nextcloud/packages/default.nix +++ b/pkgs/servers/nextcloud/packages/default.nix @@ -19,7 +19,7 @@ let packages = self: appName = pname; appVersion = data.version; license = appBaseDefs.${pname}; - inherit (data) url hash description homepage; + inherit (data) url sha256 description homepage; }) {}; } // lib.mapAttrs (type: pkgs: diff --git a/pkgs/servers/nextcloud/packages/generate.sh b/pkgs/servers/nextcloud/packages/generate.sh index e2e6093652fe..b97673a54eee 100755 --- a/pkgs/servers/nextcloud/packages/generate.sh +++ b/pkgs/servers/nextcloud/packages/generate.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#! nix-shell -I nixpkgs=../../../.. -i bash -p jq gnused curl +#! nix-shell -I nixpkgs=../../../.. -i bash -p nc4nix jq set -e set -u @@ -8,55 +8,7 @@ set -x export NEXTCLOUD_VERSIONS=$(nix-instantiate --eval -E 'import ./nc-versions.nix {}' -A e) -APPS=$(jq -r 'keys|.[]' nextcloud-apps.json | sed -z 's/\n/,/g;s/,$/\n/') +APPS=`cat nextcloud-apps.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'` -for v in ${NEXTCLOUD_VERSIONS//,/ }; do - # Get major version and back up previous major version apps file - v=$(sed -e 's/^"//' -e 's/"$//' <<<"$v") - MAJOR=${v%.*.*} - MAJOR_FILE="$MAJOR".json - mv "$MAJOR_FILE" "$MAJOR_FILE".bak - - # Download current apps file from Nextcloud's official servers - APPS_PER_VERSION=${v}.json - curl "https://apps.nextcloud.com/api/v1/platform/${v}/apps.json" -o "$APPS_PER_VERSION" - - # Add a starting bracket to the apps file for this version - echo '{' >"$MAJOR_FILE".tmp - for a in ${APPS//,/ }; do - echo "Fetching $a" - # Ensure the app exists in the file - if [ "$(jq -r ".[] | select(.id == \"${a}\")" "$APPS_PER_VERSION")" != "" ]; then - # Get all of our variables - VERSION=$(jq -r ".[] | select(.id == \"${a}\") | .releases[0].version" "$APPS_PER_VERSION") - URL=$(jq -r ".[] | select(.id == \"${a}\") | .releases[0].download" "$APPS_PER_VERSION") - HASH=$(nix store prefetch-file --json --hash-type sha256 --unpack "$URL" | jq -r .hash) - HOMEPAGE=$(jq -r ".[] | select(.id == \"${a}\") | .website" "$APPS_PER_VERSION") - DESCRIPTION=$(jq ".[] | select(.id == \"${a}\") | .translations.en.description" "$APPS_PER_VERSION") - # Add all variables to the file - cat >>"$MAJOR_FILE".tmp <>"$MAJOR_FILE".tmp - # Beautify file - jq '.' "$MAJOR_FILE".tmp >"$MAJOR_FILE" - # Remove the temporary files - rm "$APPS_PER_VERSION" - rm "$MAJOR_FILE".tmp - rm "$MAJOR_FILE".bak -done +nc4nix -apps $APPS +rm *.log