jetbrains: move to auto-generated plugins

Some edge cases but appears to work on my machine (TM).

Still TODO is setting up the job to generate and commit updates.
This commit is contained in:
2021-01-25 12:01:06 +11:00
parent 28235c3b29
commit ea98e965cb
5 changed files with 187 additions and 50 deletions

View File

@@ -4,30 +4,38 @@
, jetbrainsPlatforms
}:
{ pluginId
{ plugid
, pname
, version
, versionId
, sha256
, filename ? "${pname}-${version}.zip"
}:
, ...
}@args:
stdenv.mkDerivation {
inherit pname version;
let
src = fetchzip {
inherit sha256;
url = "https://plugins.jetbrains.com/files/${toString pluginId}/${toString versionId}/${filename}";
defaultMeta = {
broken = false;
} // lib.optionalAttrs ((args.src.meta.homepage or "") != "") {
homepage = args.src.meta.homepage;
} // lib.optionalAttrs ((args.src.meta.description or "") != "") {
description = args.src.meta.description;
} // lib.optionalAttrs ((args.src.meta.license or {}) != {}) {
license = args.src.meta.license;
};
in
stdenv.mkDerivation (args // {
passthru = { inherit jetbrainsPlatforms; };
dontUnpack = lib.any (lib.hasSuffix ".jar") args.src.urls;
installPhase = ''
mkdir $out
cp -r * $out/
'';
meta = {
homepage = "https://plugins.jetbrains.com/plugin/${pluginId}-${lib.toLower pname}";
inherit (args.meta) license description;
homepage = if (args.meta.homepage == "") then null else args.meta.homepage;
};
}
})