2020-10-15 19:05:13 +11:00
|
|
|
{ lib
|
|
|
|
}: self:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
package:
|
|
|
|
pluginsFun:
|
|
|
|
|
|
|
|
let
|
|
|
|
plugins =
|
|
|
|
if isFunction pluginsFun
|
|
|
|
then pluginsFun self
|
|
|
|
else pluginsFun;
|
|
|
|
|
2020-10-18 17:47:48 +11:00
|
|
|
# FIXME: Is this still needed?
|
2020-10-15 19:05:13 +11:00
|
|
|
info = builtins.parseDrvName package.name;
|
|
|
|
badPlugins = filter (p: ! elem info.name p.jetbrainsPlatforms) plugins;
|
|
|
|
errorMsg = "plugins [ ${toString (map (p: p.name) badPlugins)} ] are not available for platform ${info.name}";
|
|
|
|
in
|
|
|
|
|
|
|
|
assert assertMsg (length badPlugins == 0) errorMsg;
|
|
|
|
|
2020-10-18 17:47:48 +11:00
|
|
|
appendToName "with-plugins" (package.overrideAttrs (oldAttrs: {
|
2020-12-09 10:35:02 +11:00
|
|
|
passthru = { inherit plugins; };
|
|
|
|
# TODO: Purely aesthetics, but link the plugin to its name instead of hash-name-version
|
2020-10-15 19:05:13 +11:00
|
|
|
installPhase = oldAttrs.installPhase + ''
|
|
|
|
for plugin in $plugins; do
|
2020-12-09 10:35:02 +11:00
|
|
|
ln -s "$plugin" "$out/$name/plugins/$(basename $plugin)"
|
2020-10-15 19:05:13 +11:00
|
|
|
done
|
|
|
|
'';
|
2020-10-18 17:47:48 +11:00
|
|
|
}))
|