nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

Revert "nextcloudPackages: Revamp package generation script"

This reverts commit 4349a61a715bb29e0c326076f3666a8c419130ec.

+5 -53
+1 -1
pkgs/servers/nextcloud/packages/default.nix
··· 19 19 appName = pname; 20 20 appVersion = data.version; 21 21 license = appBaseDefs.${pname}; 22 - inherit (data) url hash description homepage; 22 + inherit (data) url sha256 description homepage; 23 23 }) {}; 24 24 25 25 } // lib.mapAttrs (type: pkgs:
+4 -52
pkgs/servers/nextcloud/packages/generate.sh
··· 1 1 #!/usr/bin/env nix-shell 2 - #! nix-shell -I nixpkgs=../../../.. -i bash -p jq gnused curl 2 + #! nix-shell -I nixpkgs=../../../.. -i bash -p nc4nix jq 3 3 4 4 set -e 5 5 set -u ··· 8 8 9 9 export NEXTCLOUD_VERSIONS=$(nix-instantiate --eval -E 'import ./nc-versions.nix {}' -A e) 10 10 11 - APPS=$(jq -r 'keys|.[]' nextcloud-apps.json | sed -z 's/\n/,/g;s/,$/\n/') 11 + APPS=`cat nextcloud-apps.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'` 12 12 13 - for v in ${NEXTCLOUD_VERSIONS//,/ }; do 14 - # Get major version and back up previous major version apps file 15 - v=$(sed -e 's/^"//' -e 's/"$//' <<<"$v") 16 - MAJOR=${v%.*.*} 17 - MAJOR_FILE="$MAJOR".json 18 - mv "$MAJOR_FILE" "$MAJOR_FILE".bak 19 - 20 - # Download current apps file from Nextcloud's official servers 21 - APPS_PER_VERSION=${v}.json 22 - curl "https://apps.nextcloud.com/api/v1/platform/${v}/apps.json" -o "$APPS_PER_VERSION" 23 - 24 - # Add a starting bracket to the apps file for this version 25 - echo '{' >"$MAJOR_FILE".tmp 26 - for a in ${APPS//,/ }; do 27 - echo "Fetching $a" 28 - # Ensure the app exists in the file 29 - if [ "$(jq -r ".[] | select(.id == \"${a}\")" "$APPS_PER_VERSION")" != "" ]; then 30 - # Get all of our variables 31 - VERSION=$(jq -r ".[] | select(.id == \"${a}\") | .releases[0].version" "$APPS_PER_VERSION") 32 - URL=$(jq -r ".[] | select(.id == \"${a}\") | .releases[0].download" "$APPS_PER_VERSION") 33 - HASH=$(nix store prefetch-file --json --hash-type sha256 --unpack "$URL" | jq -r .hash) 34 - HOMEPAGE=$(jq -r ".[] | select(.id == \"${a}\") | .website" "$APPS_PER_VERSION") 35 - DESCRIPTION=$(jq ".[] | select(.id == \"${a}\") | .translations.en.description" "$APPS_PER_VERSION") 36 - # Add all variables to the file 37 - cat >>"$MAJOR_FILE".tmp <<EOF 38 - "${a}": { 39 - "hash": "$HASH", 40 - "url": "$URL", 41 - "version": "$VERSION", 42 - "description": $DESCRIPTION, 43 - "homepage": "$HOMEPAGE" 44 - }, 45 - EOF 46 - 47 - # If we can't find the app, then don't try to process it. 48 - else 49 - true 50 - fi 51 - done 52 - # clean up by removing last trailing comma 53 - sed -i '$s/,$//' "$MAJOR_FILE".tmp 54 - # Add final closing bracket 55 - echo '}' >>"$MAJOR_FILE".tmp 56 - # Beautify file 57 - jq '.' "$MAJOR_FILE".tmp >"$MAJOR_FILE" 58 - # Remove the temporary files 59 - rm "$APPS_PER_VERSION" 60 - rm "$MAJOR_FILE".tmp 61 - rm "$MAJOR_FILE".bak 62 - done 13 + nc4nix -apps $APPS 14 + rm *.log