2020-10-18 17:47:48 +11:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-19 19:11:26 +11:00
|
|
|
, variant
|
2020-10-15 19:05:13 +11:00
|
|
|
, jetbrainsPlatforms
|
|
|
|
}:
|
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
with lib;
|
|
|
|
|
|
|
|
{ pname
|
2020-10-15 19:05:13 +11:00
|
|
|
, version
|
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
, plugname
|
|
|
|
, plugid
|
|
|
|
|
|
|
|
, buildInputs ? []
|
|
|
|
, packageRequires ? []
|
|
|
|
, meta ? {}
|
2020-10-15 19:05:13 +11:00
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
, ...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
defaultMeta = {
|
|
|
|
broken = false;
|
|
|
|
platforms = variant.meta.platforms;
|
|
|
|
} // optionalAttrs ((args.src.meta.homepage or "") != "") {
|
|
|
|
homepage = args.src.meta.homepage;
|
|
|
|
} // optionalAttrs ((args.src.meta.description or "") != "") {
|
|
|
|
description = args.src.meta.description;
|
2020-10-25 12:47:11 +11:00
|
|
|
} // optionalAttrs ((args.src.meta.license or {}) != {}) {
|
|
|
|
license = args.src.meta.license;
|
2020-10-15 19:05:13 +11:00
|
|
|
};
|
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
inherit pname version;
|
2020-10-18 17:47:48 +11:00
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
unpackCmd = ''
|
|
|
|
case "$curSrc" in
|
|
|
|
*.jar)
|
|
|
|
# don't unpack; keep original source filename without the hash
|
|
|
|
local filename=$(basename "$curSrc")
|
|
|
|
filename="''${filename:33}"
|
|
|
|
cp $curSrc $filename
|
|
|
|
chmod +w $filename
|
|
|
|
sourceRoot="."
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_defaultUnpack "$curSrc"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
'';
|
|
|
|
|
|
|
|
# FIXME: Entirely possible this isn't correct for niche plugins;
|
|
|
|
# at the very least there are some plugins that come with JS
|
2020-10-15 19:05:13 +11:00
|
|
|
installPhase = ''
|
2020-10-19 19:11:26 +11:00
|
|
|
mkdir -p "$out/lib"
|
|
|
|
find -iname '*.jar' -exec cp {} "$out/lib/" \;
|
2020-10-15 19:05:13 +11:00
|
|
|
'';
|
|
|
|
|
2020-10-19 19:11:26 +11:00
|
|
|
buildInputs = [ ] ++ packageRequires ++ buildInputs;
|
|
|
|
propagatedBuildInputs = packageRequires;
|
|
|
|
|
|
|
|
passthru = { inherit jetbrainsPlatforms plugid plugname; };
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = defaultMeta // meta;
|
2020-10-15 19:05:13 +11:00
|
|
|
}
|
2020-10-19 19:11:26 +11:00
|
|
|
|
|
|
|
// removeAttrs args [ "buildInputs" "packageRequires" "meta" ])
|