Development environment with nix-shell: Difference between revisions

imported>Tobias.bora
No edit summary
imported>Bionicles
m fix extremely minor typo
Line 1: Line 1:
Nix can be used to provides some kind of '''virtual environment''' through the <code>nix-shell</code> command.
Nix can be used to provide some kind of '''virtual environment''' through the <code>nix-shell</code> command.


If you already have a nix package definition of your project it's easy: Just use <code>nix-shell</code> instead of <code>nix-build</code> and you will end up in a bash shell that reproduce the build-environment of your package. You can also override[https://nixos.org/nixpkgs/manual/#sec-pkg-override] your package in a <code>shell.nix</code> file to add test and coverage dependencies, that are not necessary for the actual build of the package, but that you want for your development environment.
If you already have a nix package definition of your project it's easy: Just use <code>nix-shell</code> instead of <code>nix-build</code> and you will end up in a bash shell that reproduce the build-environment of your package. You can also override[https://nixos.org/nixpkgs/manual/#sec-pkg-override] your package in a <code>shell.nix</code> file to add test and coverage dependencies, that are not necessary for the actual build of the package, but that you want for your development environment.