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:
@@ -1,5 +1,4 @@
|
||||
{ lib
|
||||
}: self:
|
||||
{ lib, makeWrapper, runCommand }: self:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -20,12 +19,31 @@ in
|
||||
|
||||
assert assertMsg (length badPlugins == 0) errorMsg;
|
||||
|
||||
appendToName "with-plugins" (package.overrideAttrs (oldAttrs: {
|
||||
passthru = { inherit plugins; };
|
||||
# TODO: Purely aesthetics, but link the plugin to its name instead of hash-name-version
|
||||
installPhase = oldAttrs.installPhase + ''
|
||||
for plugin in $plugins; do
|
||||
ln -s "$plugin" "$out/$name/plugins/$(basename $plugin)"
|
||||
done
|
||||
'';
|
||||
}))
|
||||
runCommand
|
||||
(appendToName "with-plugins" package).name
|
||||
{
|
||||
nativeBuildInputs = [ package makeWrapper ];
|
||||
inherit package plugins;
|
||||
packageName = package.name;
|
||||
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
|
||||
} ''
|
||||
mkdir -p $out/$packageName/plugins
|
||||
for dir in $package/*; do
|
||||
cp -r $dir $out/
|
||||
done
|
||||
|
||||
# Install plugins
|
||||
for plugin in $plugins; do
|
||||
local pluginName=$(basename $plugin)
|
||||
pluginName=''${pluginName#*-}
|
||||
pluginName=''${pluginName%-([0-9].)*}
|
||||
ln -s $plugin $out/$packageName/plugins/$pluginName
|
||||
done
|
||||
|
||||
# Fix up wrapper
|
||||
substituteInPlace $out/bin/* \
|
||||
--replace "$package" "$out"
|
||||
''
|
||||
|
@@ -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;
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@@ -55,7 +55,7 @@ rec {
|
||||
# A functional Jetbrains IDE-with-plugins package set.
|
||||
jetbrains = pkgs.dontRecurseIntoAttrs rec {
|
||||
jetbrainsPluginsFor = variant: import ../top-level/jetbrains-plugins.nix {
|
||||
inherit (pkgs) lib newScope stdenv fetchzip;
|
||||
inherit (pkgs) lib newScope stdenv fetchzip makeWrapper runCommand;
|
||||
inherit variant;
|
||||
};
|
||||
|
||||
|
@@ -2,6 +2,8 @@
|
||||
, newScope
|
||||
, stdenv
|
||||
, fetchzip
|
||||
, makeWrapper
|
||||
, runCommand
|
||||
|
||||
, variant
|
||||
}:
|
||||
@@ -17,7 +19,7 @@ let
|
||||
};
|
||||
|
||||
jetbrainsWithPlugins = import ../applications/editors/jetbrains/wrapper.nix {
|
||||
inherit lib;
|
||||
inherit lib makeWrapper runCommand;
|
||||
};
|
||||
|
||||
in lib.makeScope newScope (self: lib.makeOverridable ({
|
||||
|
Reference in New Issue
Block a user