···1# pkgs.mkShell {#sec-pkgs-mkShell}
23-`pkgs.mkShell` is a special kind of derivation that is only useful when using
4-it combined with `nix-shell`. It will in fact fail to instantiate when invoked
5-with `nix-build`.
67## Usage {#sec-pkgs-mkShell-usage}
8009```nix
10{ pkgs ? import <nixpkgs> {} }:
11pkgs.mkShell {
12- # specify which packages to add to the shell environment
13 packages = [ pkgs.gnumake ];
14- # add all the dependencies, of the given packages, to the shell environment
15- inputsFrom = with pkgs; [ hello gnutar ];
000016}
17```
0000000000000000
···1# pkgs.mkShell {#sec-pkgs-mkShell}
23+`pkgs.mkShell` is a specialized `stdenv.mkDerivation` that removes some
4+repetition when using it with `nix-shell` (or `nix develop`).
056## Usage {#sec-pkgs-mkShell-usage}
78+Here is a common usage example:
9+10```nix
11{ pkgs ? import <nixpkgs> {} }:
12pkgs.mkShell {
013 packages = [ pkgs.gnumake ];
14+15+ inputsFrom = [ pkgs.hello pkgs.gnutar ];
16+17+ shellHook = ''
18+ export DEBUG=1
19+ '';
20}
21```
22+23+## Attributes
24+25+* `name` (default: `nix-shell`). Set the name of the derivation.
26+* `packages` (default: `[]`). Add executable packages to the `nix-shell` environment.
27+* `inputsFrom` (default: `[]`). Add build dependencies of the listed derivations to the `nix-shell` environment.
28+* `shellHook` (default: `""`). Bash statements that are executed by `nix-shell`.
29+30+... all the attributes of `stdenv.mkDerivation`.
31+32+## Building the shell
33+34+This derivation output will contain a text file that contains a reference to
35+all the build inputs. This is useful in CI where we want to make sure that
36+every derivation, and its dependencies, build properly. Or when creating a GC
37+root so that the build dependencies don't get garbage-collected.
···6for i in @path@; do PATH=$PATH:$i/bin; done
78usage() {
9- echo "usage: $0 -t <timeout> -c <path-to-default-configuration> [-d <boot-dir>] [-g <num-generations>] [-n <dtbName>]" >&2
10 exit 1
11}
12···15target=/boot # Target directory
16numGenerations=0 # Number of other generations to include in the menu
1718-while getopts "t:c:d:g:n:" opt; do
19 case "$opt" in
20 t) # U-Boot interprets '0' as infinite and negative as instant boot
21 if [ "$OPTARG" -lt 0 ]; then
···30 d) target="$OPTARG" ;;
31 g) numGenerations="$OPTARG" ;;
32 n) dtbName="$OPTARG" ;;
033 \?) usage ;;
34 esac
35done
···96 fi
97 echo " LINUX ../nixos/$(basename $kernel)"
98 echo " INITRD ../nixos/$(basename $initrd)"
00000099 if [ -d "$dtbDir" ]; then
100 # if a dtbName was specified explicitly, use that, else use FDTDIR
101 if [ -n "$dtbName" ]; then
···109 exit 1
110 fi
111 fi
112- echo " APPEND init=$path/init $extraParams"
113}
114115tmpFile="$target/extlinux/extlinux.conf.tmp.$$"
···6for i in @path@; do PATH=$PATH:$i/bin; done
78usage() {
9+ echo "usage: $0 -t <timeout> -c <path-to-default-configuration> [-d <boot-dir>] [-g <num-generations>] [-n <dtbName>] [-r]" >&2
10 exit 1
11}
12···15target=/boot # Target directory
16numGenerations=0 # Number of other generations to include in the menu
1718+while getopts "t:c:d:g:n:r" opt; do
19 case "$opt" in
20 t) # U-Boot interprets '0' as infinite and negative as instant boot
21 if [ "$OPTARG" -lt 0 ]; then
···30 d) target="$OPTARG" ;;
31 g) numGenerations="$OPTARG" ;;
32 n) dtbName="$OPTARG" ;;
33+ r) noDeviceTree=1 ;;
34 \?) usage ;;
35 esac
36done
···97 fi
98 echo " LINUX ../nixos/$(basename $kernel)"
99 echo " INITRD ../nixos/$(basename $initrd)"
100+ echo " APPEND init=$path/init $extraParams"
101+102+ if [ -n "$noDeviceTree" ]; then
103+ return
104+ fi
105+106 if [ -d "$dtbDir" ]; then
107 # if a dtbName was specified explicitly, use that, else use FDTDIR
108 if [ -n "$dtbName" ]; then
···116 exit 1
117 fi
118 fi
0119}
120121tmpFile="$target/extlinux/extlinux.conf.tmp.$$"
···23stdenv.mkDerivation rec {
4 pname = "lean";
5- version = "3.36.0";
67 src = fetchFromGitHub {
8 owner = "leanprover-community";
···11 # from. this is then used to check whether an olean file should be
12 # rebuilt. don't use a tag as rev because this will get replaced into
13 # src/githash.h.in in preConfigure.
14- rev = "e948149d3d1bbdb8eac9cd103d58626a59fae3b9";
15- sha256 = "1lcjif29lfj3myc6j63ifk8fdvylyv8g82g2dv0d85nz7mpbq47b";
16 };
1718 nativeBuildInputs = [ cmake ];
···23stdenv.mkDerivation rec {
4 pname = "lean";
5+ version = "3.37.0";
67 src = fetchFromGitHub {
8 owner = "leanprover-community";
···11 # from. this is then used to check whether an olean file should be
12 # rebuilt. don't use a tag as rev because this will get replaced into
13 # src/githash.h.in in preConfigure.
14+ rev = "e69ab934262eb6f141344fdaec98ede68a9102b6";
15+ sha256 = "19sigzbrdl90jqk7lvl3q8j6n4nnidzwp9zzmzgq3zxxgywa2ghp";
16 };
1718 nativeBuildInputs = [ cmake ];
···1-{ lib, stdenv, fetchurl, pkg-config
2-0003, abiVersion ? "6"
4-, mouseSupport ? false
5-, unicode ? true
6, enableStatic ? stdenv.hostPlatform.isStatic
7-, enableShared ? !enableStatic
8, withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt
9-10-, gpm
11-12-, buildPackages
13}:
1415stdenv.mkDerivation rec {
···31 setOutputFlags = false; # some aren't supported
3233 configureFlags = [
34- (lib.withFeature enableShared "shared")
35 "--without-debug"
36 "--enable-pc-files"
37 "--enable-symlinks"
38 "--with-manpage-format=normal"
39 "--disable-stripping"
40- ] ++ lib.optional unicode "--enable-widec"
41 ++ lib.optional (!withCxx) "--without-cxx"
42 ++ lib.optional (abiVersion == "5") "--with-abi-version=5"
43 ++ lib.optional stdenv.hostPlatform.isNetBSD "--enable-rpath"
···49 # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
50 CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
5152- depsBuildBuild = [ buildPackages.stdenv.cc ];
00053 nativeBuildInputs = [
54 pkg-config
55 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
56 buildPackages.ncurses
57 ];
058 buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
5960 preConfigure = ''
···147 rm "$out"/lib/*.a
148 '';
149150- meta = {
0151 description = "Free software emulation of curses in SVR4 and more";
152-153 longDescription = ''
154- The Ncurses (new curses) library is a free software emulation of
155- curses in System V Release 4.0, and more. It uses Terminfo
156- format, supports pads and color and multiple highlights and
157- forms characters and function-key mapping, and has all the other
158- SYSV-curses enhancements over BSD Curses.
159160- The ncurses code was developed under GNU/Linux. It has been in
161- use for some time with OpenBSD as the system curses library, and
162- on FreeBSD and NetBSD as an external package. It should port
163- easily to any ANSI/POSIX-conforming UNIX. It has even been
164- ported to OS/2 Warp!
165 '';
166-167- homepage = "https://www.gnu.org/software/ncurses/";
168-169- license = lib.licenses.mit;
170- platforms = lib.platforms.all;
171 };
172173 passthru = {
174 ldflags = "-lncurses";
175- inherit unicode abiVersion;
176 };
177}
···1+{ lib
2+, stdenv
3+, fetchurl
4+, buildPackages
5+, pkg-config
6, abiVersion ? "6"
007, enableStatic ? stdenv.hostPlatform.isStatic
08, withCxx ? !stdenv.hostPlatform.useAndroidPrebuilt
9+, mouseSupport ? false, gpm
10+, unicodeSupport ? true
0011}:
1213stdenv.mkDerivation rec {
···29 setOutputFlags = false; # some aren't supported
3031 configureFlags = [
32+ (lib.withFeature (!enableStatic) "shared")
33 "--without-debug"
34 "--enable-pc-files"
35 "--enable-symlinks"
36 "--with-manpage-format=normal"
37 "--disable-stripping"
38+ ] ++ lib.optional unicodeSupport "--enable-widec"
39 ++ lib.optional (!withCxx) "--without-cxx"
40 ++ lib.optional (abiVersion == "5") "--with-abi-version=5"
41 ++ lib.optional stdenv.hostPlatform.isNetBSD "--enable-rpath"
···47 # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
48 CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
4950+ depsBuildBuild = [
51+ buildPackages.stdenv.cc
52+ ];
53+54 nativeBuildInputs = [
55 pkg-config
56 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
57 buildPackages.ncurses
58 ];
59+60 buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
6162 preConfigure = ''
···149 rm "$out"/lib/*.a
150 '';
151152+ meta = with lib; {
153+ homepage = "https://www.gnu.org/software/ncurses/";
154 description = "Free software emulation of curses in SVR4 and more";
0155 longDescription = ''
156+ The Ncurses (new curses) library is a free software emulation of curses in
157+ System V Release 4.0, and more. It uses Terminfo format, supports pads and
158+ color and multiple highlights and forms characters and function-key
159+ mapping, and has all the other SYSV-curses enhancements over BSD Curses.
0160161+ The ncurses code was developed under GNU/Linux. It has been in use for
162+ some time with OpenBSD as the system curses library, and on FreeBSD and
163+ NetBSD as an external package. It should port easily to any
164+ ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!
0165 '';
166+ license = licenses.mit;
167+ platforms = platforms.all;
000168 };
169170 passthru = {
171 ldflags = "-lncurses";
172+ inherit unicodeSupport abiVersion;
173 };
174}