depot/pkgs/build-support/fetchnextcloudapp/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

35 lines
915 B
Nix

{ fetchurl, fetchzip, applyPatches, lib, ... }:
{ url
, hash ? ""
, sha256 ? ""
, appName ? null
, appVersion ? null
, license
, patches ? [ ]
, description ? null
, homepage ? null
, unpack ? false # whether to use fetchzip rather than fetchurl
}:
applyPatches ({
inherit patches;
src = (if unpack then fetchzip else fetchurl) {
inherit url hash sha256;
meta = {
license = lib.licenses.${license};
longDescription = description;
inherit homepage;
} // lib.optionalAttrs (description != null) {
longDescription = description;
} // lib.optionalAttrs (homepage != null) {
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}";
})