summary refs log tree commit diff
path: root/doc/stdenv
diff options
context:
space:
mode:
authormilahu <milahu@gmail.com>2023-02-16 19:21:12 +0100
committerGitHub <noreply@github.com>2023-02-16 19:21:12 +0100
commit121fbb3cf7d339db9c998dadfa5b485775f2c94b (patch)
treeb48fbe854439bea91ce1841d2c8f2d142c0b7168 /doc/stdenv
parentac1f5b72a9e95873d1de0233fddcb56f99884b37 (diff)
docs: Building a stdenv package in nix-shell (#216650)
* docs: Building a stdenv package in nix-shell
Diffstat (limited to 'doc/stdenv')
-rw-r--r--doc/stdenv/stdenv.chapter.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md
index dcf173f865f2b..1488a09982ad9 100644
--- a/doc/stdenv/stdenv.chapter.md
+++ b/doc/stdenv/stdenv.chapter.md
@@ -95,6 +95,27 @@ installPhase() {
 genericBuild
 ```
 
+### Building a `stdenv` package in `nix-shell` {#sec-building-stdenv-package-in-nix-shell}
+
+To build a `stdenv` package in a [`nix-shell`](https://nixos.org/manual/nix/unstable/command-ref/nix-shell.html), use
+
+```bash
+nix-shell '<nixpkgs>' -A some_package
+eval ${unpackPhase:-unpackPhase}
+cd $sourceRoot
+eval ${patchPhase:-patchPhase}
+eval ${configurePhase:-configurePhase}
+eval ${buildPhase:-buildPhase}
+```
+
+To modify a [phase](#sec-stdenv-phases), first print it with
+
+```bash
+type buildPhase
+```
+
+then change it in a text editor, and paste it back to the terminal.
+
 ## Tools provided by `stdenv` {#sec-tools-of-stdenv}
 
 The standard environment provides the following packages: