FAQ: Difference between revisions
imported>Ixxie /* Why is Nix written in C++ rather than a functional language like Haskell? |
imported>Makefu →I've downloaded a binary, but I can't run it, what can I do?: fix interpreter |
||
| Line 137: | Line 137: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# mybinaryprogram.nix | # mybinaryprogram.nix | ||
with import <nixpkgs> {} | with import <nixpkgs> {}; | ||
stdenv.mkDerivation rec { | stdenv.mkDerivation rec { | ||
name = "somename"; | name = "somename"; | ||
buildInputs = [ makeWrapper ]; | buildInputs = [ makeWrapper ]; | ||
buildPhase = "true"; | buildPhase = "true"; | ||
libPath = lib.makeLibraryPath [ libXrandr libXinerama libXcursor ]; | libPath = lib.makeLibraryPath with xlibs;[ libXrandr libXinerama libXcursor ]; | ||
unpackPhase = "true"; | unpackPhase = "true"; | ||
installPhase = '' | installPhase = '' | ||
mkdir -p $out/bin | mkdir -p $out/bin | ||
cp ${./mybinaryprogram} $out/bin/mybinaryprogram | cp ${./mybinaryprogram} $out/bin/mybinaryprogram | ||
''; | |||
postFixup = '' | |||
patchelf \ | patchelf \ | ||
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |||
--set-rpath "${libPath}" \ | |||
$out/bin/mybinaryprogram | |||
''; | ''; | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
| Line 185: | Line 187: | ||
<syntaxhighlight lang="bash">nix-shell fhsUser.nix</syntaxhighlight> | <syntaxhighlight lang="bash">nix-shell fhsUser.nix</syntaxhighlight> | ||
== What are channels and how they get updated? == | == What are channels and how they get updated? == | ||