nixpkgs-immich/pkgs/by-name/xo/xonsh/wrapper.nix
2024-09-17 10:23:40 -06:00

26 lines
475 B
Nix

{
lib,
runCommand,
xonsh,
# configurable options
extraPackages ? (ps: [ ]),
}:
let
inherit (xonsh.passthru) python;
pythonEnv = python.withPackages
(ps: [ (ps.toPythonModule xonsh) ] ++ extraPackages ps);
in
runCommand
"xonsh-wrapped-${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
''