diff --git a/pkgs/applications/editors/jetbrains/common-plugins.nix b/pkgs/applications/editors/jetbrains/common-plugins.nix index 5ad91cf..734055c 100644 --- a/pkgs/applications/editors/jetbrains/common-plugins.nix +++ b/pkgs/applications/editors/jetbrains/common-plugins.nix @@ -4,7 +4,7 @@ self: let - commonBuild = import ../../../build-support/jetbrains/plugin-old.nix { + commonBuild = import ../../../build-support/jetbrains/plugin.nix { inherit lib stdenv fetchzip; jetbrainsPlatforms = [ "clion" diff --git a/pkgs/applications/editors/jetbrains/idea-plugins.nix b/pkgs/applications/editors/jetbrains/idea-plugins.nix index b5fc0c3..33188ec 100644 --- a/pkgs/applications/editors/jetbrains/idea-plugins.nix +++ b/pkgs/applications/editors/jetbrains/idea-plugins.nix @@ -1,19 +1,19 @@ -{ lib, stdenv, variant }: +{ lib, stdenv, fetchzip }: self: let ideaBuild = import ../../../build-support/jetbrains/plugin.nix { - inherit lib stdenv variant; + inherit lib stdenv fetchzip; jetbrainsPlatforms = [ "idea-community" "idea-ultimate" ]; }; generateIdea = lib.makeOverridable ({ - generated ? ./idea-generated.nix + idea ? ./manual-idea-packages.nix }: let - imported = import generated { + imported = import idea { inherit (self) callPackage; }; @@ -26,3 +26,4 @@ let in ideaPlugins // { inherit ideaBuild; }); in generateIdea { } + diff --git a/pkgs/applications/editors/jetbrains/wrapper.nix b/pkgs/applications/editors/jetbrains/wrapper.nix index 4c50a4d..fa59585 100644 --- a/pkgs/applications/editors/jetbrains/wrapper.nix +++ b/pkgs/applications/editors/jetbrains/wrapper.nix @@ -21,13 +21,11 @@ in assert assertMsg (length badPlugins == 0) errorMsg; appendToName "with-plugins" (package.overrideAttrs (oldAttrs: { - inherit plugins; - # TODO: Remove version from directory name + 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 - local dirname=$(basename "$plugin") - dirname=''${dirname:33} - ln -s "$plugin" "$out/$name/plugins/$dirname" + ln -s "$plugin" "$out/$name/plugins/$(basename $plugin)" done ''; })) diff --git a/pkgs/build-support/jetbrains/plugin-old.nix b/pkgs/build-support/jetbrains/plugin-old.nix deleted file mode 100644 index 82f8ff5..0000000 --- a/pkgs/build-support/jetbrains/plugin-old.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib -, stdenv -, fetchzip -, jetbrainsPlatforms -}: - -{ pluginId -, pname -, version -, versionId -, sha256 -, filename ? "${pname}-${version}.zip" -}: - -stdenv.mkDerivation { - inherit pname version; - - src = fetchzip { - inherit sha256; - url = "https://plugins.jetbrains.com/files/${toString pluginId}/${toString versionId}/${filename}"; - }; - - passthru = { inherit jetbrainsPlatforms; }; - - installPhase = '' - mkdir $out - cp -r * $out/ - ''; - - meta = { - homepage = "https://plugins.jetbrains.com/plugin/${pluginId}-${lib.toLower pname}"; - }; -} diff --git a/pkgs/build-support/jetbrains/plugin.nix b/pkgs/build-support/jetbrains/plugin.nix index ccd1a29..82f8ff5 100644 --- a/pkgs/build-support/jetbrains/plugin.nix +++ b/pkgs/build-support/jetbrains/plugin.nix @@ -1,71 +1,33 @@ { lib , stdenv -, variant +, fetchzip , jetbrainsPlatforms }: -with lib; - -{ pname +{ pluginId +, pname , version +, versionId +, sha256 +, filename ? "${pname}-${version}.zip" +}: -, plugname -, plugid - -, buildInputs ? [] -, packageRequires ? [] -, meta ? {} - -, ... -}@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; - }; - -in - -stdenv.mkDerivation ({ +stdenv.mkDerivation { inherit pname version; - 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 - ''; + src = fetchzip { + inherit sha256; + url = "https://plugins.jetbrains.com/files/${toString pluginId}/${toString versionId}/${filename}"; + }; + + passthru = { inherit jetbrainsPlatforms; }; - # FIXME: Entirely possible this isn't correct for niche plugins; - # at the very least there are some plugins that come with JS installPhase = '' - mkdir -p "$out/lib" - find -iname '*.jar' -exec cp {} "$out/lib/" \; + mkdir $out + cp -r * $out/ ''; - buildInputs = [ ] ++ packageRequires ++ buildInputs; - propagatedBuildInputs = packageRequires; - - passthru = { inherit jetbrainsPlatforms plugid plugname; }; - - doCheck = false; - - meta = defaultMeta // meta; + meta = { + homepage = "https://plugins.jetbrains.com/plugin/${pluginId}-${lib.toLower pname}"; + }; } - -// removeAttrs args [ "buildInputs" "packageRequires" "meta" ]) diff --git a/pkgs/top-level/jetbrains-plugins.nix b/pkgs/top-level/jetbrains-plugins.nix index 85b6487..badfac5 100644 --- a/pkgs/top-level/jetbrains-plugins.nix +++ b/pkgs/top-level/jetbrains-plugins.nix @@ -13,7 +13,7 @@ let }; mkIdeaPlugins = import ../applications/editors/jetbrains/idea-plugins.nix { - inherit lib stdenv variant; + inherit lib stdenv fetchzip; }; jetbrainsWithPlugins = import ../applications/editors/jetbrains/wrapper.nix {