diff --git a/doc/getting-started/dev-environments.md b/doc/getting-started/dev-environments.md new file mode 100644 index 000000000000..4b85ed40733a --- /dev/null +++ b/doc/getting-started/dev-environments.md @@ -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) diff --git a/doc/first-package.chapter.md b/doc/getting-started/first-package.chapter.md similarity index 100% rename from doc/first-package.chapter.md rename to doc/getting-started/first-package.chapter.md diff --git a/doc/getting-started/getting-started.part.md b/doc/getting-started/getting-started.part.md new file mode 100644 index 000000000000..4fffd1033fd0 --- /dev/null +++ b/doc/getting-started/getting-started.part.md @@ -0,0 +1,6 @@ +# Getting started {#getting-started} + +```{=include=} chapters +first-package.chapter.md +dev-environments.md +``` diff --git a/doc/manual.md.in b/doc/manual.md.in index c198b68c886d..e22d5b6773f9 100644 --- a/doc/manual.md.in +++ b/doc/manual.md.in @@ -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 diff --git a/doc/redirects.json b/doc/redirects.json index 19ac1ce89977..2be4573016b5 100644 --- a/doc/redirects.json +++ b/doc/redirects.json @@ -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" ],