Cheatsheet: Difference between revisions

imported>Mic92
building static packages go easier!
imported>Mic92
explain nix-store --realise
Line 497: Line 497:
=== Rebuild a package with debug symbols ===
=== Rebuild a package with debug symbols ===


<source lang="bash">
<syntaxHighlight lang="console">
$ nix-build -E 'with import <nixpkgs> {}; enableDebugging st'
$ nix-build -E 'with import <nixpkgs> {}; enableDebugging st'
$ file result/bin/st
$ file result/bin/st
result/bin/st: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/f111ij1fc83965m48bf2zqgiaq88fqv5-glibc-2.25/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped, with debug_info
result/bin/st: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/f111ij1fc83965m48bf2zqgiaq88fqv5-glibc-2.25/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped, with debug_info
</source>
</syntaxHighlight>
 
=== Download a nix store path from the cache ===
 
If you want to the exact same nix store path on a different system, you can use the `--realise`  or short `-r` parameter in the `nix-store` command:
 
<syntaxHighlight lang="console">
$ nix-store -r /nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10
$ find  /nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10
/nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10
/nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10/bin
/nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10/bin/hello
/nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10/share
/nix/store/0vg5bw04dn21czjcqcqczyjrhys5cv30-hello-2.10/share/locale
...
</syntaxHighlight>