File tree 4 files changed +72
-0
lines changed
4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ pkgs.stdenv.mkDerivation {
49
49
outputFile = "introduction.xml" ;
50
50
useChapters = true ;
51
51
}
52
+ + toDocbook {
53
+ inputFile = ./shell.md ;
54
+ outputFile = "shell.xml" ;
55
+ }
52
56
+ toDocbook {
53
57
inputFile = ./languages-frameworks/python.md ;
54
58
outputFile = "./languages-frameworks/python.xml" ;
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : stdenv.mkShell
3
+ author : zimbatm
4
+ date : 2017-10-30
5
+ ---
6
+
7
+ stdenv.mkShell is a special kind of derivation that is only useful when using
8
+ it combined with nix-shell. It will in fact fail to instantiate when invoked
9
+ with nix-build.
10
+
11
+ ## Usage
12
+
13
+ ``` nix
14
+ { pkgs ? import <nixpkgs> {} }:
15
+ pkgs.mkShell {
16
+ # this will make all the build inputs from hello and gnutar available to the shell environment
17
+ inputsFrom = with pkgs; [ hello gnutar ];
18
+ buildInputs = [ pkgs.gnumake ];
19
+ }
20
+ ```
Original file line number Diff line number Diff line change
1
+ { lib , stdenv } :
2
+
3
+ # A special kind of derivation that is only meant to be consumed by the
4
+ # nix-shell.
5
+ {
6
+ inputsFrom ? [ ] , # a list of derivations whose inputs will be made available to the environment
7
+ buildInputs ? [ ] ,
8
+ nativeBuildInputs ? [ ] ,
9
+ propagatedBuildInputs ? [ ] ,
10
+ propagatedNativeBuildInputs ? [ ] ,
11
+ ...
12
+ } @attrs :
13
+ let
14
+ mergeInputs = name :
15
+ let
16
+ op = item : sum : sum ++ item . "${ name } " or [ ] ;
17
+ nul = [ ] ;
18
+ list = [ attrs ] ++ inputsFrom ;
19
+ in
20
+ lib . foldr op nul list ;
21
+
22
+ rest = builtins . removeAttrs attrs [
23
+ "inputsFrom"
24
+ "buildInputs"
25
+ "nativeBuildInputs"
26
+ "propagatedBuildInputs"
27
+ "propagatedNativeBuildInputs"
28
+ ] ;
29
+ in
30
+
31
+ stdenv . mkDerivation ( {
32
+ name = "nix-shell" ;
33
+ phases = [ "nobuildPhase" ] ;
34
+
35
+ buildInputs = mergeInputs "buildInputs" ;
36
+ nativeBuildInputs = mergeInputs "nativeBuildInputs" ;
37
+ propagatedBuildInputs = mergeInputs "propagatedBuildInputs" ;
38
+ propagatedNativeBuildInputs = mergeInputs "propagatedNativeBuildInputs" ;
39
+
40
+ nobuildPhase = ''
41
+ echo
42
+ echo "This derivation is not meant to be built, aborting";
43
+ echo
44
+ exit 1
45
+ '' ;
46
+ } // rest )
Original file line number Diff line number Diff line change @@ -311,6 +311,8 @@ with pkgs;
311
311
inherit kernel rootModules allowMissing;
312
312
};
313
313
314
+ mkShell = callPackage ../build-supports/mkshell { };
315
+
314
316
nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacsPackagesNg) inherit-local; };
315
317
316
318
pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
You can’t perform that action at this time.
0 commit comments