fetchNextcloudApp: rewrite with fetchzip & applyPatches
There are the following issues with the current implementation: * `fetchurl` with a tarball from GitHub appears to break occasionally because the tarballs are not necessarily reproducible. Because of that, `fetchFromGitHub` unpacks the tarball already because the contents are actually reproducible in contrast to the tarball. To have the same behavior here, we use `fetchzip` now (and `applyPatches` on top to apply additional patches if needed). * Fixes the way how patches are applied. Previously, when having patches for a git checkout of the app, these wouldn't apply because the `appname-version` prefix is missing. * Because all old hashes are broken with this, I added an evaluation check that breaks evaluation when using the old API (i.e. with `name`/`version` which are not needed anymore).
This commit is contained in:
parent
dae204faa0
commit
3ca9b9a8ad
@ -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
|
||||||
unpackPhase = ''
|
if [ ! -f ./appinfo/info.xml ]; then
|
||||||
tar -xzpf $src
|
echo "appinfo/info.xml doesn't exist in $out, aborting!"
|
||||||
'';
|
exit 1
|
||||||
|
|
||||||
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
|
fi
|
||||||
|
popd &>/dev/null
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user