···1+{ pkgs, ... }:
2+3+# This test builds IDEA Community with some plugins and checks that they can be discovered by the IDE.
4+let
5+ idea = (
6+ pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-community-src [
7+ # This is a "normal plugin", it's output must be linked into /idea-community/plugins.
8+ "ideavim"
9+ # This is a plugin where the output contains a single JAR file. This JAR file needs to be linked directly in /idea-community/plugins.
10+ "wakatime"
11+ ]
12+ );
13+in
14+{
15+ name = "jetbrains_build-ide-with-plugins";
16+ meta.maintainers = pkgs.lib.teams.jetbrains.members;
17+18+ nodes = {
19+ server =
20+ { config, pkgs, ... }:
21+ {
22+ environment.systemPackages = [
23+ idea
24+ ];
25+ };
26+ };
27+28+ testScript =
29+ { ... }:
30+ ''
31+ with subtest("ensure normal plugin is available"):
32+ machine.succeed("find -L ${idea.out}/idea-community/plugins -type f -iname 'IdeaVIM-*.jar' | grep .")
33+34+ with subtest("ensure single JAR file plugin is available"):
35+ machine.succeed("""
36+ PATH_TO_LINK=$(find ${idea.out}/idea-community/plugins -maxdepth 1 -type l -iname '*wakatime.jar' | grep .)
37+ test -f $(readlink $PATH_TO_LINK)
38+ """)
39+ '';
40+41+}
···1-{ jetbrains, writeText }:
0000000000000200000000000000000000003{
4 # Check to see if the process for adding plugins is breaking anything, instead of the plugins themselves
5- default =
6 let
7 modify-ide = ide: jetbrains.plugins.addPlugins ide [ ];
8- ides =
9- with jetbrains;
10- map modify-ide [
11- clion
12- datagrip
13- dataspell
14- goland
15- idea-community
16- idea-ultimate
17- mps
18- phpstorm
19- pycharm-community
20- pycharm-professional
21- rider
22- ruby-mine
23- rust-rover
24- webstorm
25- ];
26- paths = builtins.concatStringsSep " " ides;
27 in
28- writeText "jb-ides" paths;
0002930- idea-ce-with-plugins = jetbrains.plugins.addPlugins jetbrains.idea-community [
31- "ideavim"
32- "nixidea"
33- # test JAR plugins
34- "wakatime"
35- ];
0000000000000000000000036}
···1+{
2+ jetbrains,
3+ symlinkJoin,
4+ lib,
5+ # If not set, all IDEs are tested.
6+ ideName ? null,
7+}:
8+9+let
10+11+ # Known broken plugins, PLEASE remove entries here whenever possible.
12+ brokenPlugins = [
13+ "github-copilot" # GitHub Copilot: https://github.com/NixOS/nixpkgs/issues/400317
14+ ];
1516+ ideNames =
17+ if ideName == null then
18+ with jetbrains;
19+ [
20+ clion
21+ datagrip
22+ dataspell
23+ goland
24+ idea-community
25+ idea-ultimate
26+ mps
27+ phpstorm
28+ pycharm-community
29+ pycharm-professional
30+ rider
31+ ruby-mine
32+ rust-rover
33+ webstorm
34+ ]
35+ else
36+ [ (jetbrains.${ideName}) ];
37+in
38{
39 # Check to see if the process for adding plugins is breaking anything, instead of the plugins themselves
40+ empty =
41 let
42 modify-ide = ide: jetbrains.plugins.addPlugins ide [ ];
000000000000000000043 in
44+ symlinkJoin {
45+ name = "jetbrains-test-plugins-empty";
46+ paths = (map modify-ide ideNames);
47+ };
4849+ # Test all plugins. This will only build plugins compatible with the IDE and version. It will fail if the plugin is marked
50+ # as compatible, but the build version is somehow not in the "builds" map (as that would indicate that something with update_plugins.py went wrong).
51+ all =
52+ let
53+ pluginsJson = builtins.fromJSON (builtins.readFile ./plugins.json);
54+ pluginsFor =
55+ with lib.asserts;
56+ ide:
57+ builtins.map (plugin: plugin.name) (
58+ builtins.filter (
59+ plugin:
60+ (
61+ # Plugin has to not be broken
62+ (!builtins.elem plugin.name brokenPlugins)
63+ # IDE has to be compatible
64+ && (builtins.elem ide.pname plugin.compatible)
65+ # Assert: The build number needs to be included (if marked compatible)
66+ && (assertMsg (builtins.elem ide.buildNumber (builtins.attrNames plugin.builds)) "For plugin ${plugin.name} no entry for IDE build ${ide.buildNumber} is defined, even though ${ide.pname} is on that build.")
67+ # The plugin has to exist for the build
68+ && (plugin.builds.${ide.buildNumber} != null)
69+ )
70+ ) (builtins.attrValues pluginsJson.plugins)
71+ );
72+ modify-ide = ide: jetbrains.plugins.addPlugins ide (pluginsFor ide);
73+ in
74+ symlinkJoin {
75+ name = "jetbrains-test-plugins-all";
76+ paths = (map modify-ide ideNames);
77+ };
78}
+9-2
pkgs/applications/editors/jetbrains/readme.md
···1This directory contains the build expressions needed to build any of the jetbrains IDEs.
2The jdk is in `pkgs/development/compilers/jetbrains-jdk`.
3-To test the build process of every IDE (as well as the process for adding plugins), build `jetbrains.plugins.tests.default`.
000000045## How to use plugins:
6 - Get the ide you want and call `jetbrains.plugins.addPlugins` with a list of plugins you want to add.
7 - The list of plugins can be a list of ids or names (as in `plugins/plugins.json`)
8 - Example: `jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "nixidea" ]`
9- - The list can also contain a drv giving a `.jar` or `.zip` (this is how you use a plugin not added to nixpkgs)
1011### How to add a new plugin to nixpkgs
12 - Find the page for the plugin on https://plugins.jetbrains.com
···1This directory contains the build expressions needed to build any of the jetbrains IDEs.
2The jdk is in `pkgs/development/compilers/jetbrains-jdk`.
3+4+## Tests:
5+- To test the build process of every IDE (as well as the process for adding plugins), build `jetbrains.plugins.tests.empty`.
6+- To test the build process with all plugins* supported by all IDEs, build `jetbrains.plugins.tests.all`.
7+- To test only plugins for a specific IDE*, build `jetbrains.ide-name.tests.plugins.all`.
8+- To test that plugins are correctly stored in the plugins directory run the NixOS test `nixosTests.jetbrains.plugins-available`.
9+10+*: Plugins marked as broken in nixpkgs are skipped: When updating/fixing plugins, please check the `brokenPlugins` in `plugins/tests.nix` and update it if needed.
1112## How to use plugins:
13 - Get the ide you want and call `jetbrains.plugins.addPlugins` with a list of plugins you want to add.
14 - The list of plugins can be a list of ids or names (as in `plugins/plugins.json`)
15 - Example: `jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "nixidea" ]`
16+ - The list can also contain drvs giving the directory contents of the plugin (this is how you use a plugin not added to nixpkgs) or a single `.jar` (executable). For an example, look at the implementation of `fetchPluginSrc` in `plugins/default.nix`.
1718### How to add a new plugin to nixpkgs
19 - Find the page for the plugin on https://plugins.jetbrains.com