Merge pull request #193075 from Ma27/nextcloud-pkg-fix

fetchNextcloudApp: rewrite with fetchzip & applyPatches
This commit is contained in:
Maximilian Bosch 2022-10-16 20:07:57 +02:00 committed by GitHub
commit a914b9460d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 26 deletions

View File

@ -734,6 +734,16 @@
<literal>[ &quot;lua54&quot; &quot;luau&quot; ]</literal>. <literal>[ &quot;lua54&quot; &quot;luau&quot; ]</literal>.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<literal>pkgs.fetchNextcloudApp</literal> has been rewritten
to circumvent impurities in e.g. tarballs from GitHub and to
make it easier to apply patches. This means that your hashes
are out-of-date and the (previously required) attributes
<literal>name</literal> and <literal>version</literal> are no
longer accepted.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
<section xml:id="sec-release-22.11-notable-changes"> <section xml:id="sec-release-22.11-notable-changes">

View File

@ -236,6 +236,10 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
- `stylua` no longer accepts `lua52Support` and `luauSupport` overrides, use `features` instead, which defaults to `[ "lua54" "luau" ]`. - `stylua` no longer accepts `lua52Support` and `luauSupport` overrides, use `features` instead, which defaults to `[ "lua54" "luau" ]`.
- `pkgs.fetchNextcloudApp` has been rewritten to circumvent impurities in e.g. tarballs from GitHub and to make it easier to
apply patches. This means that your hashes are out-of-date and the (previously required) attributes `name` and `version`
are no longer accepted.
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
## Other Notable Changes {#sec-release-22.11-notable-changes} ## Other Notable Changes {#sec-release-22.11-notable-changes}

View File

@ -1,32 +1,27 @@
{ stdenv, fetchurl, ... }: { stdenv, fetchzip, applyPatches, ... }:
{ name { url
, url
, version
, sha256 , sha256
, patches ? [ ] , patches ? [ ]
, name ? null
, version ? null
}: }:
stdenv.mkDerivation { if name != null || version != null then throw ''
pname = "nc-app-${name}"; `pkgs.fetchNextcloudApp` has been changed to use `fetchzip`.
inherit version patches; To update, please
* remove `name`/`version`
src = fetchurl { * update the hash
''
else applyPatches {
inherit patches;
src = fetchzip {
inherit url sha256; inherit url 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
'';
}; };
unpackPhase = ''
tar -xzpf $src
'';
installPhase = ''
approot="$(dirname $(dirname $(find -path '*/appinfo/info.xml' | head -n 1)))"
if [ -d "$approot" ];
then
mv "$approot/" $out
chmod -R a-w $out
else
echo "Could not find appinfo/info.xml"
exit 1;
fi
'';
} }