mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 01:23:03 +00:00
0fab94a844
It is currently not obvious how to install/use xonsh with dependencies and python packages. This PR implements a wrapper that allows you to construct a custom xonsh environment by using: ``` nix xonsh.override { extraPackages = ps: [ ps.requests ]; } ```
25 lines
465 B
Nix
25 lines
465 B
Nix
{ runCommand
|
|
, xonsh-unwrapped
|
|
, lib
|
|
, extraPackages ? (ps: [ ])
|
|
}:
|
|
|
|
let
|
|
xonsh = xonsh-unwrapped;
|
|
inherit (xonsh.passthru) python;
|
|
|
|
pythonEnv = python.withPackages (ps: [
|
|
(ps.toPythonModule xonsh)
|
|
] ++ extraPackages ps);
|
|
|
|
in
|
|
runCommand "${xonsh.pname}-${xonsh.version}"
|
|
{
|
|
inherit (xonsh) pname version meta passthru;
|
|
} ''
|
|
mkdir -p $out/bin
|
|
for bin in ${lib.getBin xonsh}/bin/*; do
|
|
ln -s ${pythonEnv}/bin/$(basename "$bin") $out/bin/
|
|
done
|
|
''
|