Development environment with nix-shell: Difference between revisions
Typo |
m Correct a typo |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 22: | Line 22: | ||
hello | hello | ||
]; | ]; | ||
# compilers & linkers & | # compilers & linkers & dependency finding programs | ||
nativeBuildInputs = [ | nativeBuildInputs = [ | ||
rustc | rustc | ||
Line 42: | Line 42: | ||
{{Commands|$ nix-shell shell.nix}} | {{Commands|$ nix-shell shell.nix}} | ||
Now you have | Now you have rustc available in your shell: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ rustc --version | $ rustc --version | ||
Line 82: | Line 82: | ||
we replace <code>nix-shell</code> with <code>nix develop</code> | we replace <code>nix-shell</code> with <code>nix develop</code> | ||
Example: Building Nix in a development shell, to get [[Incremental builds]] = faster recompiles | Example: Building Nix in a development shell, to get [[Incremental builds]] = faster recompiles. This is because Nix evaluations are cached. | ||
<pre> | <pre> | ||
Line 175: | Line 175: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
and <code>nativeBuildInputs</code> would be for the native platform, while <code>buildInputs</code> would be for the foreign platform. That's a much more practical distinction: any tool that's miscategorized one won't be able to run, and any library that's miscategorized one won't be able to link! | and <code>nativeBuildInputs</code> would be for the native platform, while <code>buildInputs</code> would be for the foreign platform. That's a much more practical distinction: any tool that's miscategorized one won't be able to run, and any library that's miscategorized one won't be able to link! | ||
== Troubleshooting == | == Troubleshooting == | ||
Line 249: | Line 209: | ||
Similar to the Gsettings issue, icons can be added with XDG_DATA_DIRS: | Similar to the Gsettings issue, icons can be added with XDG_DATA_DIRS: | ||
<pre> XDG_DATA_DIRS=...:${hicolor-icon-theme}/share:${gnome3.adwaita-icon-theme}/share</pre> | <pre> XDG_DATA_DIRS=...:${hicolor-icon-theme}/share:${gnome3.adwaita-icon-theme}/share</pre> | ||
== See Also == | |||
* [[Direnv]] | |||
* [[Command Shell#Using a different shell in nix-shell and nix develop]] | |||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:nix]] | [[Category:nix]] |