diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-03-24 10:15:32 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-03-24 10:15:32 +0100 |
commit | 96f063dd321abc80ecaa156226cfb7cf9540315a (patch) | |
tree | 7a53ef61484fc7bfff6419b1fd635c67199f27d2 /nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix | |
parent | af58f08d3d524e7b008b73a8497ea710915ffaf1 (diff) | |
parent | d96bd3394b734487d1c3bfbac0e8f17465e03afe (diff) |
Merge commit 'd96bd3394b734487d1c3bfbac0e8f17465e03afe'
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix b/nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix new file mode 100644 index 00000000000..38978799b5a --- /dev/null +++ b/nixpkgs/pkgs/applications/misc/rxvt-unicode/wrapper.nix @@ -0,0 +1,58 @@ +{ callPackage +, symlinkJoin +, makeWrapper +, lib +, rxvt-unicode-unwrapped +, rxvt-unicode-plugins +, perlPackages +, configure ? { availablePlugins, ... }: + { plugins = builtins.attrValues availablePlugins; + extraDeps = [ ]; + perlDeps = [ ]; + } +}: + +let + availablePlugins = rxvt-unicode-plugins; + + # Transform the string "self" to the plugin itself. + # It's needed for plugins like bidi who depends on the perl + # package they provide themself. + mkPerlDeps = p: + let deps = p.perlPackages or [ ]; + in map (x: if x == "self" then p else x) deps; + + # The wrapper is called with a `configure` function + # that takes the urxvt plugins as input and produce + # the configuration of the wrapper: list of plugins, + # extra dependencies and perl dependencies. + # This provides simple way to customize urxvt using + # the `.override` mechanism. + wrapper = { configure, ... }: + let + config = configure { inherit availablePlugins; }; + plugins = config.plugins or (builtins.attrValues availablePlugins); + extraDeps = config.extraDeps or [ ]; + perlDeps = (config.perlDeps or [ ]) ++ lib.concatMap mkPerlDeps plugins; + in + symlinkJoin { + name = "rxvt-unicode-${rxvt-unicode-unwrapped.version}"; + + paths = [ rxvt-unicode-unwrapped ] ++ plugins ++ extraDeps; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram $out/bin/urxvt \ + --prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \ + --suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl" + wrapProgram $out/bin/urxvtd \ + --prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \ + --suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl" + ''; + + passthru.plugins = plugins; + }; + +in + lib.makeOverridable wrapper { inherit configure; } |