Development environment with nix-shell: Difference between revisions
TYPO |
Anna Aurora (talk | contribs) m Fixed indentation in code block. |
||
Line 4: | Line 4: | ||
But, if you don't (or you don't want to) have a package definition you can still use a nix-shell to provide a reproducible development environment. To do so, you have to create a <code>shell.nix</code> file at the root of your repository. For example, if you want to have Ruby 3.2 and not one provided by your system you can write: | But, if you don't (or you don't want to) have a package definition you can still use a nix-shell to provide a reproducible development environment. To do so, you have to create a <code>shell.nix</code> file at the root of your repository. For example, if you want to have Ruby 3.2 and not one provided by your system you can write: | ||
< | <syntaxhighlight lang="nix"> | ||
{ pkgs ? import <nixpkgs> {} }: | { pkgs ? import <nixpkgs> {} }: | ||
pkgs.mkShell { | |||
# nativeBuildInputs is usually what you want -- tools you need to run | |||
nativeBuildInputs = with pkgs.buildPackages; [ ruby_3_2 ]; | |||
} | } | ||
</ | </syntaxhighlight> | ||
Then just run: | Then just run: |