Packaging/Quirks and Caveats: Difference between revisions
imported>Fadenb m Syntax highlighting |
imported>Lheckemann |
||
| Line 28: | Line 28: | ||
installPhase = "install -m755 -D ${./myscript.py} $out/bin/myscript"; | installPhase = "install -m755 -D ${./myscript.py} $out/bin/myscript"; | ||
};</syntaxhighlight> | };</syntaxhighlight> | ||
<code> | <code>stdenv</code>'s <code>patchShebangs</code> will automatically replace shebangs in the fixup phase, for ex. <code>#!/usr/bin/env python3</code> with dependencies given in <code>buildInputs</code>. As the derivation got <code>pkgs.python36.withPackages (...)</code> in <code>buildInputs</code>, it will create a [https://virtualenv.pypa.io/en/stable/ virtualenv]-like python wrapper. The python wrapper will have all specified dependencies and will be used to call the script. | ||
In NixOS, the package can be put into <code>environment.systemPackages</code>, and <code>myscript</code> will be available as a global command. | In NixOS, the package can be put into <code>environment.systemPackages</code>, and <code>myscript</code> will be available as a global command. | ||