doc/dev-environments: add starter guide for dev environments

This commit is contained in:
Johannes Kirschbauer
2026-07-18 17:48:42 +02:00
parent 98089f0292
commit 47404376cf
5 changed files with 62 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
# Dev environments {#dev-environments}
Create a `shell.nix` with the following:
```nix
# shell.nix
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
pkgs = import nixpkgs { };
in
pkgs.mkShell {
packages = [ pkgs.python3 ];
shellHook = ''
echo "Welcome in my nix shell"
'';
}
```
run
```sh
nix-shell
```
This activates your `shell.nix` and you should see:
```sh
unpacking 'https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz' into the Git cache...
Welcome in your nix shell
```
python3 is available
```sh
$ python3 --version
```
To leave the shell
```bash
ctrl+D
```
:::{.note}
You should use [pinned nixpkgs](https://nix.dev/guides/recipes/dependency-management.html).
The example used `unstable` here for demonstration purposes only
:::
For further information check out [nix-shell](https://nix.dev/manual/nix/stable/command-ref/nix-shell)

View File

@@ -0,0 +1,6 @@
# Getting started {#getting-started}
```{=include=} chapters
first-package.chapter.md
dev-environments.md
```

View File

@@ -3,10 +3,10 @@
```{=include=} chapters
preface.chapter.md
first-package.chapter.md
```
```{=include=} parts
getting-started/getting-started.part.md
using-nixpkgs.md
lib.md
stdenv.md

View File

@@ -105,6 +105,9 @@
"cuda-writing-tests": [
"index.html#cuda-writing-tests"
],
"dev-environments": [
"index.html#dev-environments"
],
"ex-build-helpers-extendMkDerivation": [
"index.html#ex-build-helpers-extendMkDerivation"
],
@@ -149,6 +152,9 @@
"friction-graphics-wayland": [
"index.html#friction-graphics-wayland"
],
"getting-started": [
"index.html#getting-started"
],
"ghc-deprecation-policy": [
"index.html#ghc-deprecation-policy"
],