jetbrains: rework following the Emacs builder
This commit moves a lot of the heavy lifting out of callPackage and back into regular import, following conventions from upstream Nixpkgs. It allows for a clearer and less magic definition of new packages, particularly by downstream, as well, by exposing the *Build package callers in the attribute set.
This commit is contained in:
30
pkgs/applications/editors/jetbrains/wrapper.nix
Normal file
30
pkgs/applications/editors/jetbrains/wrapper.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ lib
|
||||
}: self:
|
||||
|
||||
with lib;
|
||||
|
||||
package:
|
||||
pluginsFun:
|
||||
|
||||
let
|
||||
plugins =
|
||||
if isFunction pluginsFun
|
||||
then pluginsFun self
|
||||
else pluginsFun;
|
||||
|
||||
# FIXME: Is this still needed?
|
||||
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;
|
||||
|
||||
appendToName "with-plugins" (package.overrideAttrs (oldAttrs: {
|
||||
inherit plugins;
|
||||
installPhase = oldAttrs.installPhase + ''
|
||||
for plugin in $plugins; do
|
||||
ln -s "$plugin" "$out/$name/plugins/$(basename $plugin)"
|
||||
done
|
||||
'';
|
||||
}))
|
Reference in New Issue
Block a user