Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nc4nix: 0-unstable-2024-03-01 -> 0-unstable-2024-08-01 #331507

Merged
merged 5 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions pkgs/build-support/fetchnextcloudapp/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchzip, applyPatches, lib, ... }:
{ fetchurl, fetchzip, applyPatches, lib, ... }:
{ url
, hash ? ""
, sha256 ? ""
Expand All @@ -8,19 +8,12 @@
, patches ? [ ]
, description ? null
, homepage ? null
, unpack ? true # whether to use fetchzip rather than fetchurl
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is a non-breaking change until we set

Suggested change
, unpack ? true # whether to use fetchzip rather than fetchurl
, unpack ? false # whether to use fetchzip rather than fetchurl

by default. I suggest we do so, accompanied by release notes, before NixOS 24.11.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍
Do you want to file a PR for that?

}:
applyPatches ({
inherit patches;
src = fetchzip {
src = (if unpack then fetchzip else fetchurl) {
inherit url hash sha256;
postFetch = ''
pushd $out &>/dev/null
if [ ! -f ./appinfo/info.xml ]; then
echo "appinfo/info.xml doesn't exist in $out, aborting!"
exit 1
fi
popd &>/dev/null
'';
meta = {
license = lib.licenses.${license};
longDescription = description;
Expand All @@ -31,6 +24,12 @@ applyPatches ({
inherit homepage;
};
};
prePatch = ''
if [ ! -f ./appinfo/info.xml ]; then
echo "appinfo/info.xml doesn't exist in $out, aborting!"
exit 1
fi
'';
} // lib.optionalAttrs (appName != null && appVersion != null) {
name = "nextcloud-app-${appName}-${appVersion}";
})
27 changes: 15 additions & 12 deletions pkgs/by-name/nc/nc4nix/package.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{ lib
, buildGoModule
, fetchFromGitHub
{
lib,
buildGoModule,
fetchFromGitHub,
unstableGitUpdater,
}:

buildGoModule {
pname = "nc4nix";
version = "0-unstable-2024-03-01";
version = "0-unstable-2024-08-01";

src = fetchFromGitHub {
owner = "helsinki-systems";
repo = "nc4nix";
rev = "ba37674c0dddf93e0a011dace92ec7f0ec834765";
hash = "sha256-k12eeP2gojLCsJH1GGuiTmxz3ViPc0+oFBuptyh42Bw=";
rev = "827bb7244a3529e71c9474fe1f74aed51a4b08d5";
hash = "sha256-ToT+VvdXiUMmy0dNJAeyMlzMx87QhZPIwzxPXm2fR7s=";
};

vendorHash = "sha256-ZXl4kMDY9ADkHUcLsl3uNpyErMzbgS+J65+uUeIXpSE=";
vendorHash = "sha256-qntRsv3KvAbV3lENjAHKkQOqh3uTo3gacfwase489tQ=";

meta = with lib; {
passthru.updateScript = unstableGitUpdater { };

meta = {
description = "Packaging helper for Nextcloud apps";
mainProgram = "nc4nix";
homepage = "https://github.com/helsinki-systems/nc4nix";
license = licenses.mit;
maintainers = with maintainers; [ onny ];
platforms = platforms.linux;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ onny ];
platforms = lib.platforms.linux;
};
}

8 changes: 4 additions & 4 deletions pkgs/servers/nextcloud/notify_push.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

rustPlatform.buildRustPackage rec {
pname = "notify_push";
version = "0.6.12";
version = "0.7.0";

src = fetchFromGitHub {
owner = "nextcloud";
repo = pname;
rev = "v${version}";
hash = "sha256-Wbrkr9DWOQpOKAp9X/PzU8alDDrDapX/1hE+ObbD/nc=";
hash = "sha256-QHVWiH6qkwQay0wffoyDUyVxgxzNp10ieYIsdqoEdCM=";
};

cargoHash = "sha256-4bgbhtqdb1IVsf0yIcZOXZCVdRHjdvhZe/VCab0kuMk=";
cargoHash = "sha256-HwE/ql8rJcGIINy+hNnpaTFEJqbmuUDrIvVI8kCpfQ8=";

passthru = rec {
test_client = rustPlatform.buildRustPackage {
Expand All @@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec {

buildAndTestSubdir = "test_client";

cargoHash = "sha256-Z7AX/PXfiUHEV/M+i/2qne70tcZnnPj/iNT+DNMECS8=";
cargoHash = "sha256-KybnPzCM9mLF55s5eZ3qr5GRcaaYFpEdNklWEo/72Ts=";

meta = meta // {
mainProgram = "test_client";
Expand Down
288 changes: 190 additions & 98 deletions pkgs/servers/nextcloud/packages/28.json

Large diffs are not rendered by default.

288 changes: 190 additions & 98 deletions pkgs/servers/nextcloud/packages/29.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkgs/servers/nextcloud/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let packages = self:
appName = pname;
appVersion = data.version;
license = appBaseDefs.${pname};
unpack = false;
inherit (data) url hash description homepage;
}) {};

Expand Down
58 changes: 4 additions & 54 deletions pkgs/servers/nextcloud/packages/generate.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,14 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p jq gnused curl
#! nix-shell -I nixpkgs=../../../.. -i bash -p nc4nix jq

set -e
set -u
set -o pipefail
set -x

cd $(dirname -- "${BASH_SOURCE[0]}")

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/')

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 --extra-experimental-features nix-command 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 <<EOF
"${a}": {
"hash": "$HASH",
"url": "$URL",
"version": "$VERSION",
"description": $DESCRIPTION,
"homepage": "$HOMEPAGE"
},
EOF
APPS=`cat nextcloud-apps.json | jq -r 'keys|.[]' | sed -z 's/\n/,/g;s/,$/\n/'`
Ma27 marked this conversation as resolved.
Show resolved Hide resolved

# If we can't find the app, then don't try to process it.
else
true
fi
done
# clean up by removing last trailing comma
sed -i '$s/,$//' "$MAJOR_FILE".tmp
# Add final closing bracket
echo '}' >>"$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
Ma27 marked this conversation as resolved.
Show resolved Hide resolved