···37 </para>
38 <para>
39 In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
40- All three are always defined at the top level, so one can get at them just like a dependency in a function that is imported with <literal>callPackage</literal>:
41- <programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...</programlisting>
042 </para>
43 <variablelist>
44 <varlistentry>
···37 </para>
38 <para>
39 In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
40+ All three are always defined as attributes in the standard environment, and at the top level. That means one can get at them just like a dependency in a function that is imported with <literal>callPackage</literal>:
41+ <programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>, or just off <varname>stdenv</varname>:
42+ <programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>.
43 </para>
44 <variablelist>
45 <varlistentry>
···477 */
478 subtractLists = e: filter (x: !(elem x e));
479480+ /* Test if two lists have no common element.
481+ It should be slightly more efficient than (intersectLists a b == [])
482+ */
483+ mutuallyExclusive = a: b:
484+ (builtins.length a) == 0 ||
485+ (!(builtins.elem (builtins.head a) b) &&
486+ mutuallyExclusive (builtins.tail a) b);
487+488}
···250# If --repair is given, don't try to use the Nix daemon, because the
251# flag can only be used directly.
252if [ -z "$repair" ] && systemctl show nix-daemon.socket nix-daemon.service | grep -q ActiveState=active; then
253- export NIX_REMOTE=${NIX_REMOTE:-daemon}
254fi
255256
···250# If --repair is given, don't try to use the Nix daemon, because the
251# flag can only be used directly.
252if [ -z "$repair" ] && systemctl show nix-daemon.socket nix-daemon.service | grep -q ActiveState=active; then
253+ export NIX_REMOTE=${NIX_REMOTE-daemon}
254fi
255256
+4
nixos/modules/programs/zsh/oh-my-zsh.nix
···42 };
4344 config = mkIf cfg.enable {
000045 environment.systemPackages = with pkgs; [ oh-my-zsh ];
4647 programs.zsh.interactiveShellInit = with pkgs; with builtins; ''
···42 };
4344 config = mkIf cfg.enable {
45+46+ # Prevent zsh from overwriting oh-my-zsh's prompt
47+ programs.zsh.promptInit = mkDefault "";
48+49 environment.systemPackages = with pkgs; [ oh-my-zsh ];
5051 programs.zsh.interactiveShellInit = with pkgs; with builtins; ''
+32-39
nixos/modules/programs/zsh/zsh.nix
···9798 config = mkIf cfg.enable {
99100- programs.zsh = {
101-102- shellInit = ''
103- . ${config.system.build.setEnvironment}
104-105- ${cfge.shellInit}
106- '';
107-108- loginShellInit = cfge.loginShellInit;
109-110- interactiveShellInit = ''
111- # history defaults
112- SAVEHIST=2000
113- HISTSIZE=2000
114- HISTFILE=$HOME/.zsh_history
115-116- setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
117-118- # Tell zsh how to find installed completions
119- for p in ''${(z)NIX_PROFILES}; do
120- fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
121- done
122-123- ${if cfg.enableCompletion then "autoload -U compinit && compinit" else ""}
124-125- ${optionalString (cfg.enableAutosuggestions)
126- "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
127- }
128-129- ${zshAliases}
130- ${cfg.promptInit}
131-132- ${cfge.interactiveShellInit}
133-134- HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
135- '';
136-137- };
138-139 environment.etc."zshenv".text =
140 ''
141 # /etc/zshenv: DO NOT EDIT -- this file has been generated automatically.
···145 # But don't clobber the environment of interactive non-login children!
146 if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
147 export __ETC_ZSHENV_SOURCED=1
0000148149 ${cfg.shellInit}
150···162 # Only execute this file once per shell.
163 if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi
164 __ETC_ZPROFILE_SOURCED=1
00165166 ${cfg.loginShellInit}
167···182183 . /etc/zinputrc
1840000000000000000000185 ${cfg.interactiveShellInit}
0000000186187 # Read system-wide modifications.
188 if test -f /etc/zshrc.local; then
···9798 config = mkIf cfg.enable {
99000000000000000000000000000000000000000100 environment.etc."zshenv".text =
101 ''
102 # /etc/zshenv: DO NOT EDIT -- this file has been generated automatically.
···106 # But don't clobber the environment of interactive non-login children!
107 if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
108 export __ETC_ZSHENV_SOURCED=1
109+110+ . ${config.system.build.setEnvironment}
111+112+ ${cfge.shellInit}
113114 ${cfg.shellInit}
115···127 # Only execute this file once per shell.
128 if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi
129 __ETC_ZPROFILE_SOURCED=1
130+131+ ${cfge.loginShellInit}
132133 ${cfg.loginShellInit}
134···149150 . /etc/zinputrc
151152+ # history defaults
153+ SAVEHIST=2000
154+ HISTSIZE=2000
155+ HISTFILE=$HOME/.zsh_history
156+157+ setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
158+159+ HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
160+161+ ${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
162+163+ ${optionalString (cfg.enableAutosuggestions)
164+ "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
165+ }
166+167+ ${zshAliases}
168+169+ ${cfge.interactiveShellInit}
170+171 ${cfg.interactiveShellInit}
172+173+ ${cfg.promptInit}
174+175+ # Tell zsh how to find installed completions
176+ for p in ''${(z)NIX_PROFILES}; do
177+ fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
178+ done
179180 # Read system-wide modifications.
181 if test -f /etc/zshrc.local; then
···9 # /var/lib/misc is for dnsmasq.leases.
10 stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
1112+ dns =
13+ if cfg.useDnsmasq then "dnsmasq"
14+ else if config.services.resolved.enable then "systemd-resolved"
15+ else "default";
16+17 configFile = writeText "NetworkManager.conf" ''
18 [main]
19 plugins=keyfile
20 dhcp=${cfg.dhcp}
21+ dns=${dns}
2223 [keyfile]
24 ${optionalString (cfg.unmanaged != [])
+42
nixos/modules/services/web-servers/minio.nix
···29 description = "The config directory, for the access keys and other settings.";
30 };
31000000000000000000000000000000000032 package = mkOption {
33 default = pkgs.minio;
34 defaultText = "pkgs.minio";
···56 User = "minio";
57 Group = "minio";
58 LimitNOFILE = 65536;
0000000059 };
60 };
61
···29 description = "The config directory, for the access keys and other settings.";
30 };
3132+ accessKey = mkOption {
33+ default = "";
34+ type = types.str;
35+ description = ''
36+ Access key of 5 to 20 characters in length that clients use to access the server.
37+ This overrides the access key that is generated by minio on first startup and stored inside the
38+ <literal>configDir</literal> directory.
39+ '';
40+ };
41+42+ secretKey = mkOption {
43+ default = "";
44+ type = types.str;
45+ description = ''
46+ Specify the Secret key of 8 to 40 characters in length that clients use to access the server.
47+ This overrides the secret key that is generated by minio on first startup and stored inside the
48+ <literal>configDir</literal> directory.
49+ '';
50+ };
51+52+ region = mkOption {
53+ default = "us-east-1";
54+ type = types.str;
55+ description = ''
56+ The physical location of the server. By default it is set to us-east-1, which is same as AWS S3's and Minio's default region.
57+ '';
58+ };
59+60+ browser = mkOption {
61+ default = true;
62+ type = types.bool;
63+ description = "Enable or disable access to web UI.";
64+ };
65+66 package = mkOption {
67 default = pkgs.minio;
68 defaultText = "pkgs.minio";
···90 User = "minio";
91 Group = "minio";
92 LimitNOFILE = 65536;
93+ };
94+ environment = {
95+ MINIO_REGION = "${cfg.region}";
96+ MINIO_BROWSER = "${if cfg.browser then "on" else "off"}";
97+ } // optionalAttrs (cfg.accessKey != "") {
98+ MINIO_ACCESS_KEY = "${cfg.accessKey}";
99+ } // optionalAttrs (cfg.secretKey != "") {
100+ MINIO_SECRET_KEY = "${cfg.secretKey}";
101 };
102 };
103
···1{ fetchurl, stdenv, which, pkgconfig, makeWrapper, libxcb, xcbutilkeysyms
2, xcbutil, xcbutilwm, xcbutilxrm, libstartup_notification, libX11, pcre, libev
3, yajl, xcb-util-cursor, coreutils, perl, pango, perlPackages, libxkbcommon
4-, xorgserver, xvfb_run, symlinkJoin, configFile ? null }:
56-let
07 version = "4.13";
89- i3 = stdenv.mkDerivation rec {
10- name = "i3-${version}";
001112- src = fetchurl {
13- url = "http://i3wm.org/downloads/${name}.tar.bz2";
14- sha256 = "12ngz32swh9n85xy0cz1lq16aqi9ys5hq19v589q9a97wn1k3hcl";
15- };
1617- nativeBuildInputs = [ which pkgconfig makeWrapper ];
0000001819- buildInputs = [
20- libxcb xcbutilkeysyms xcbutil xcbutilwm xcbutilxrm libxkbcommon
21- libstartup_notification libX11 pcre libev yajl xcb-util-cursor perl pango
22- perlPackages.AnyEventI3 perlPackages.X11XCB perlPackages.IPCRun
23- perlPackages.ExtUtilsPkgConfig perlPackages.TestMore perlPackages.InlineC
24- xorgserver xvfb_run
25- ];
2627- configureFlags = [ "--disable-builddir" ];
2829- enableParallelBuilding = true;
003031- postPatch = ''
32- patchShebangs .
33- '';
00003435- # Tests have been failing (at least for some people in some cases)
36- # and have been disabled until someone wants to fix them. Some
37- # initial digging uncovers that the tests call out to `git`, which
38- # they shouldn't, and then even once that's fixed have some
39- # perl-related errors later on. For more, see
40- # https://github.com/NixOS/nixpkgs/issues/7957
41- doCheck = false; # stdenv.system == "x86_64-linux";
4243- checkPhase = stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
44- ''
45- (cd testcases && xvfb-run ./complete-run.pl -p 1 --keep-xserver-output)
46- ! grep -q '^not ok' testcases/latest/complete-run.log
47- '';
04849- postInstall = ''
50- wrapProgram "$out/bin/i3-save-tree" --prefix PERL5LIB ":" "$PERL5LIB"
51- for program in $out/bin/i3-sensible-*; do
52- sed -i 's/which/command -v/' $program
53- done
54- '';
5556- separateDebugInfo = true;
57-58- meta = with stdenv.lib; {
59- description = "A tiling window manager";
60- homepage = "http://i3wm.org";
61- maintainers = with maintainers; [ garbas modulistic fpletz ];
62- license = licenses.bsd3;
63- platforms = platforms.all;
64-65- longDescription = ''
66- A tiling window manager primarily targeted at advanced users and
67- developers. Based on a tree as data structure, supports tiling,
68- stacking, and tabbing layouts, handled dynamically, as well as
69- floating windows. Configured via plain text file. Multi-monitor.
70- UTF-8 clean.
71- '';
72- };
73000000074 };
75-in if configFile == null then i3 else symlinkJoin {
76- name = "i3-with-config-${version}";
77- paths = [ i3 ];
7879- buildInputs = [ makeWrapper ];
80-81- postBuild = ''
82- wrapProgram $out/bin/i3 \
83- --add-flags "-c ${configFile}"
84- '';
85}
···1{ fetchurl, stdenv, which, pkgconfig, makeWrapper, libxcb, xcbutilkeysyms
2, xcbutil, xcbutilwm, xcbutilxrm, libstartup_notification, libX11, pcre, libev
3, yajl, xcb-util-cursor, coreutils, perl, pango, perlPackages, libxkbcommon
4+, xorgserver, xvfb_run }:
56+stdenv.mkDerivation rec {
7+ name = "i3-${version}";
8 version = "4.13";
910+ src = fetchurl {
11+ url = "http://i3wm.org/downloads/${name}.tar.bz2";
12+ sha256 = "12ngz32swh9n85xy0cz1lq16aqi9ys5hq19v589q9a97wn1k3hcl";
13+ };
1415+ nativeBuildInputs = [ which pkgconfig makeWrapper ];
0001617+ buildInputs = [
18+ libxcb xcbutilkeysyms xcbutil xcbutilwm xcbutilxrm libxkbcommon
19+ libstartup_notification libX11 pcre libev yajl xcb-util-cursor perl pango
20+ perlPackages.AnyEventI3 perlPackages.X11XCB perlPackages.IPCRun
21+ perlPackages.ExtUtilsPkgConfig perlPackages.TestMore perlPackages.InlineC
22+ xorgserver xvfb_run
23+ ];
2425+ configureFlags = [ "--disable-builddir" ];
0000002627+ enableParallelBuilding = true;
2829+ postPatch = ''
30+ patchShebangs .
31+ '';
3233+ # Tests have been failing (at least for some people in some cases)
34+ # and have been disabled until someone wants to fix them. Some
35+ # initial digging uncovers that the tests call out to `git`, which
36+ # they shouldn't, and then even once that's fixed have some
37+ # perl-related errors later on. For more, see
38+ # https://github.com/NixOS/nixpkgs/issues/7957
39+ doCheck = false; # stdenv.system == "x86_64-linux";
4041+ checkPhase = stdenv.lib.optionalString (stdenv.system == "x86_64-linux")
42+ ''
43+ (cd testcases && xvfb-run ./complete-run.pl -p 1 --keep-xserver-output)
44+ ! grep -q '^not ok' testcases/latest/complete-run.log
45+ '';
004647+ postInstall = ''
48+ wrapProgram "$out/bin/i3-save-tree" --prefix PERL5LIB ":" "$PERL5LIB"
49+ for program in $out/bin/i3-sensible-*; do
50+ sed -i 's/which/command -v/' $program
51+ done
52+ '';
5354+ separateDebugInfo = true;
000005556+ meta = with stdenv.lib; {
57+ description = "A tiling window manager";
58+ homepage = "http://i3wm.org";
59+ maintainers = with maintainers; [ garbas modulistic fpletz ];
60+ license = licenses.bsd3;
61+ platforms = platforms.all;
000000000006263+ longDescription = ''
64+ A tiling window manager primarily targeted at advanced users and
65+ developers. Based on a tree as data structure, supports tiling,
66+ stacking, and tabbing layouts, handled dynamically, as well as
67+ floating windows. Configured via plain text file. Multi-monitor.
68+ UTF-8 clean.
69+ '';
70 };
0007100000072}
+3-1
pkgs/build-support/cc-wrapper/default.nix
···22assert !(nativeLibc && noLibc);
23assert (noLibc || nativeLibc) == (libc == null);
2425-assert targetPlatform != hostPlatform -> runCommand != null;
2627# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
28assert cc.langVhdl or false -> zlib != null;
2930let
0031 # Prefix for binaries. Customarily ends with a dash separator.
32 #
33 # TODO(@Ericson2314) Make unconditional, or optional but always true by
···22assert !(nativeLibc && noLibc);
23assert (noLibc || nativeLibc) == (libc == null);
2425+assert stdenv.targetPlatform != stdenv.hostPlatform -> runCommand != null;
2627# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
28assert cc.langVhdl or false -> zlib != null;
2930let
31+ inherit (stdenv) hostPlatform targetPlatform;
32+33 # Prefix for binaries. Customarily ends with a dash separator.
34 #
35 # TODO(@Ericson2314) Make unconditional, or optional but always true by
···113 patches = [
114 ./remove-tools-1.5.patch
115 ./creds-test.patch
0116117 # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
118 # actually works on old versions too.
···113 patches = [
114 ./remove-tools-1.5.patch
115 ./creds-test.patch
116+ ./fix-systime-1.6.patch
117118 # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
119 # actually works on old versions too.
···1import ./generic.nix {
2 major_version = "4";
3 minor_version = "04";
4- patch_version = "1";
5- sha256 = "11f2kcldpad9h5ihi1crad5lvv2501iccb2g4c8m197fnjac8b12";
67 # If the executable is stipped it does not work
8 dontStrip = true;
···1import ./generic.nix {
2 major_version = "4";
3 minor_version = "04";
4+ patch_version = "2";
5+ sha256 = "0bhgjzi78l10824qga85nlh18jg9lb6aiamf9dah1cs6jhzfsn6i";
67 # If the executable is stipped it does not work
8 dontStrip = true;
···1-{ stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl, bash,
2- debugInfo ? false }:
3-4-stdenv.mkDerivation rec {
5- name = "elixir-${version}";
6- version = "1.4.4";
7-8- src = fetchFromGitHub {
9- owner = "elixir-lang";
10- repo = "elixir";
11- rev = "v${version}";
12- sha256 = "0m51cirkv1dahw4z2jlmz58cwmpy0dya88myx4wykq0v5bh1xbq8";
13- };
14-15- buildInputs = [ erlang rebar makeWrapper ];
16-17- # Elixir expects that UTF-8 locale to be set (see https://github.com/elixir-lang/elixir/issues/3548).
18- # In other cases there is warnings during compilation.
19- LANG = "en_US.UTF-8";
20- LC_TYPE = "en_US.UTF-8";
21-22- setupHook = ./setup-hook.sh;
23-24- inherit debugInfo;
25-26- buildFlags = if debugInfo
27- then "ERL_COMPILER_OPTIONS=debug_info"
28- else "";
29-30- preBuild = ''
31- # The build process uses ./rebar. Link it to the nixpkgs rebar
32- rm -v rebar
33- ln -s ${rebar}/bin/rebar rebar
34-35- substituteInPlace Makefile \
36- --replace "/usr/local" $out
37- '';
38-39- postFixup = ''
40- # Elixir binaries are shell scripts which run erl. Add some stuff
41- # to PATH so the scripts can run without problems.
42-43- for f in $out/bin/*; do
44- b=$(basename $f)
45- if [ $b == "mix" ]; then continue; fi
46- wrapProgram $f \
47- --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \
48- --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
49- done
50-51- substituteInPlace $out/bin/mix \
52- --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
53- '';
54-55- meta = with stdenv.lib; {
56- homepage = "http://elixir-lang.org/";
57- description = "A functional, meta-programming aware language built on top of the Erlang VM";
58-59- longDescription = ''
60- Elixir is a functional, meta-programming aware language built on
61- top of the Erlang VM. It is a dynamic language with flexible
62- syntax and macro support that leverages Erlang's abilities to
63- build concurrent, distributed and fault-tolerant applications
64- with hot code upgrades.
65- '';
66-67- license = licenses.epl10;
68- platforms = platforms.unix;
69- maintainers = with maintainers; [ the-kenny havvy couchemar ];
70- };
71-}
···1{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, ounit }:
200003let version = "2.2"; in
45stdenv.mkDerivation {
···1{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, ounit }:
23+if !stdenv.lib.versionAtLeast ocaml.version "4"
4+then throw "qtest is not available for OCaml ${ocaml.version}"
5+else
6+7let version = "2.2"; in
89stdenv.mkDerivation {
+1-1
pkgs/development/ocaml-modules/sedlex/default.nix
···3assert stdenv.lib.versionAtLeast ocaml.version "4.02";
45stdenv.mkDerivation rec {
6- name = "ocaml${ocaml.version}-${version}";
7 version = "1.99.3";
89 src = fetchzip {
···3assert stdenv.lib.versionAtLeast ocaml.version "4.02";
45stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-sedlex-${version}";
7 version = "1.99.3";
89 src = fetchzip {
···39 SCHEDSTATS n
40 DETECT_HUNG_TASK y
4142- ${optionalString (versionOlder version "4.10") ''
43 CPU_NOTIFIER_ERROR_INJECT? n
44 ''}
45···92 # module, so that the initrd gets a good I/O scheduler.
93 IOSCHED_CFQ y
94 BLK_CGROUP y # required by CFQ
000000009596 # Enable NUMA.
97 NUMA? y
···593 FW_LOADER_USER_HELPER_FALLBACK? n
594595 # Disable various self-test modules that have no use in a production system
596- ${optionalString (versionOlder version "4.9") ''
597 ARM_KPROBES_TEST? n
598 ''}
599···602 BACKTRACE_SELF_TEST? n
603 CRC32_SELFTEST? n
604 CRYPTO_TEST? n
605- DRM_DEBUG_MM_SELFTEST? n
606- EFI_TEST? n
607 GLOB_SELFTEST? n
608 INTERVAL_TREE_TEST? n
609 LNET_SELFTEST? n
···612 NOTIFIER_ERROR_INJECTION? n
613 PERCPU_TEST? n
614 RBTREE_TEST? n
615- RCU_PERF_TEST? n
616 RCU_TORTURE_TEST? n
617- TEST_ASYNC_DRIVER_PROBE? n
618- TEST_BITMAP? n
619 TEST_BPF? n
620 TEST_FIRMWARE? n
621- TEST_HASH? n
622 TEST_HEXDUMP? n
623 TEST_KSTRTOX? n
624 TEST_LIST_SORT? n
625 TEST_LKM? n
626- TEST_PARMAN? n
627 TEST_PRINTF? n
628 TEST_RHASHTABLE? n
629- TEST_SORT? n
630 TEST_STATIC_KEYS? n
631 TEST_STRING_HELPERS? n
632 TEST_UDELAY? n
633 TEST_USER_COPY? n
634- TEST_UUID? n
635- WW_MUTEX_SELFTEST? n
636 XZ_DEC_TEST? n
0000000000000000637638 # ChromiumOS support
639 ${optionalString (features.chromiumos or false) ''
···39 SCHEDSTATS n
40 DETECT_HUNG_TASK y
4142+ ${optionalString (versionOlder version "4.4") ''
43 CPU_NOTIFIER_ERROR_INJECT? n
44 ''}
45···92 # module, so that the initrd gets a good I/O scheduler.
93 IOSCHED_CFQ y
94 BLK_CGROUP y # required by CFQ
95+ IOSCHED_DEADLINE y
96+ ${optionalString (versionAtLeast version "4.11") ''
97+ MQ_IOSCHED_DEADLINE y
98+ ''}
99+ ${optionalString (versionAtLeast version "4.12") ''
100+ MQ_IOSCHED_KYBER y
101+ IOSCHED_BFQ m
102+ ''}
103104 # Enable NUMA.
105 NUMA? y
···601 FW_LOADER_USER_HELPER_FALLBACK? n
602603 # Disable various self-test modules that have no use in a production system
604+ ${optionalString (versionOlder version "4.4") ''
605 ARM_KPROBES_TEST? n
606 ''}
607···610 BACKTRACE_SELF_TEST? n
611 CRC32_SELFTEST? n
612 CRYPTO_TEST? n
00613 GLOB_SELFTEST? n
614 INTERVAL_TREE_TEST? n
615 LNET_SELFTEST? n
···618 NOTIFIER_ERROR_INJECTION? n
619 PERCPU_TEST? n
620 RBTREE_TEST? n
0621 RCU_TORTURE_TEST? n
00622 TEST_BPF? n
623 TEST_FIRMWARE? n
0624 TEST_HEXDUMP? n
625 TEST_KSTRTOX? n
626 TEST_LIST_SORT? n
627 TEST_LKM? n
0628 TEST_PRINTF? n
629 TEST_RHASHTABLE? n
0630 TEST_STATIC_KEYS? n
631 TEST_STRING_HELPERS? n
632 TEST_UDELAY? n
633 TEST_USER_COPY? n
00634 XZ_DEC_TEST? n
635+636+ ${optionalString (versionOlder version "4.4") ''
637+ EFI_TEST? n
638+ RCU_PERF_TEST? n
639+ TEST_ASYNC_DRIVER_PROBE? n
640+ TEST_BITMAP? n
641+ TEST_HASH? n
642+ TEST_UUID? n
643+ ''}
644+645+ ${optionalString (versionAtLeast version "4.11") ''
646+ DRM_DEBUG_MM_SELFTEST? n
647+ TEST_PARMAN? n
648+ TEST_SORT? n
649+ WW_MUTEX_SELFTEST? n
650+ ''}
651652 # ChromiumOS support
653 ${optionalString (features.chromiumos or false) ''
···61 , buildPlatform, hostPlatform, targetPlatform
62 } @ overrideArgs: let
63 stdenv = overrideArgs.stdenv.override {
64- # TODO(@Ericson2314): Cannot do this for now because then Nix thinks the
65- # resulting derivation should be built on the host platform.
66- #hostPlatform = buildPlatform;
67- #targetPlatform = hostPlatform;
68- inherit cc;
6970 allowedRequisites = null;
71
···1+# Extend a derivation with checks for brokenness, license, etc. Throw a
2+# descriptive error when the check fails; return `derivationArg` otherwise.
3+# Note: no dependencies are checked in this step.
4+5+{ lib, config, system, meta, derivationArg, mkDerivationArg }:
6+7+let
8+ attrs = mkDerivationArg; # TODO: probably get rid of passing this one
9+10+ # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
11+ # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
12+ shouldCheckMeta = config.checkMeta or false;
13+14+ allowUnfree = config.allowUnfree or false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
15+16+ whitelist = config.whitelistedLicenses or [];
17+ blacklist = config.blacklistedLicenses or [];
18+19+ onlyLicenses = list:
20+ lib.lists.all (license:
21+ let l = lib.licenses.${license.shortName or "BROKEN"} or false; in
22+ if license == l then true else
23+ throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
24+ ) list;
25+26+ areLicenseListsValid =
27+ if lib.mutuallyExclusive whitelist blacklist then
28+ assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
29+ else
30+ throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";
31+32+ hasLicense = attrs:
33+ attrs ? meta.license;
34+35+ hasWhitelistedLicense = assert areLicenseListsValid; attrs:
36+ hasLicense attrs && builtins.elem attrs.meta.license whitelist;
37+38+ hasBlacklistedLicense = assert areLicenseListsValid; attrs:
39+ hasLicense attrs && builtins.elem attrs.meta.license blacklist;
40+41+ allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
42+43+ isUnfree = licenses: lib.lists.any (l:
44+ !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses;
45+46+ # Alow granular checks to allow only some unfree packages
47+ # Example:
48+ # {pkgs, ...}:
49+ # {
50+ # allowUnfree = false;
51+ # allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayer-" x.name);
52+ # }
53+ allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
54+55+ # Check whether unfree packages are allowed and if not, whether the
56+ # package has an unfree license and is not explicitely allowed by the
57+ # `allowUNfreePredicate` function.
58+ hasDeniedUnfreeLicense = attrs:
59+ !allowUnfree &&
60+ hasLicense attrs &&
61+ isUnfree (lib.lists.toList attrs.meta.license) &&
62+ !allowUnfreePredicate attrs;
63+64+ allowInsecureDefaultPredicate = x: builtins.elem x.name (config.permittedInsecurePackages or []);
65+ allowInsecurePredicate = x: (config.allowUnfreePredicate or allowInsecureDefaultPredicate) x;
66+67+ hasAllowedInsecure = attrs:
68+ (attrs.meta.knownVulnerabilities or []) == [] ||
69+ allowInsecurePredicate attrs ||
70+ builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
71+72+ showLicense = license: license.shortName or "unknown";
73+74+ pos_str = meta.position or "«unknown-file»";
75+76+ remediation = {
77+ unfree = remediate_whitelist "Unfree";
78+ broken = remediate_whitelist "Broken";
79+ blacklisted = x: "";
80+ insecure = remediate_insecure;
81+ unknown-meta = x: "";
82+ };
83+ remediate_whitelist = allow_attr: attrs:
84+ ''
85+ a) For `nixos-rebuild` you can set
86+ { nixpkgs.config.allow${allow_attr} = true; }
87+ in configuration.nix to override this.
88+89+ b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
90+ { allow${allow_attr} = true; }
91+ to ~/.config/nixpkgs/config.nix.
92+ '';
93+94+ remediate_insecure = attrs:
95+ ''
96+97+ Known issues:
98+99+ '' + (lib.fold (issue: default: "${default} - ${issue}\n") "" attrs.meta.knownVulnerabilities) + ''
100+101+ You can install it anyway by whitelisting this package, using the
102+ following methods:
103+104+ a) for `nixos-rebuild` you can add ‘${attrs.name or "«name-missing»"}’ to
105+ `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
106+ like so:
107+108+ {
109+ nixpkgs.config.permittedInsecurePackages = [
110+ "${attrs.name or "«name-missing»"}"
111+ ];
112+ }
113+114+ b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
115+ ‘${attrs.name or "«name-missing»"}’ to `permittedInsecurePackages` in
116+ ~/.config/nixpkgs/config.nix, like so:
117+118+ {
119+ permittedInsecurePackages = [
120+ "${attrs.name or "«name-missing»"}"
121+ ];
122+ }
123+124+ '';
125+126+ throwEvalHelp = { reason , errormsg ? "" }:
127+ throw (''
128+ Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
129+130+ '' + ((builtins.getAttr reason remediation) attrs));
131+132+ metaTypes = with lib.types; rec {
133+ # These keys are documented
134+ description = str;
135+ longDescription = str;
136+ branch = str;
137+ homepage = str;
138+ downloadPage = str;
139+ license = either (listOf lib.types.attrs) (either lib.types.attrs str);
140+ maintainers = listOf str;
141+ priority = int;
142+ platforms = listOf str;
143+ hydraPlatforms = listOf str;
144+ broken = bool;
145+146+ # Weirder stuff that doesn't appear in the documentation?
147+ version = str;
148+ tag = str;
149+ updateWalker = bool;
150+ executables = listOf str;
151+ outputsToInstall = listOf str;
152+ position = str;
153+ repositories = attrsOf str;
154+ isBuildPythonPackage = platforms;
155+ schedulingPriority = str;
156+ downloadURLRegexp = str;
157+ isFcitxEngine = bool;
158+ isIbusEngine = bool;
159+ };
160+161+ checkMetaAttr = k: v:
162+ if metaTypes?${k} then
163+ if metaTypes.${k}.check v then null else "key '${k}' has a value ${v} of an invalid type ${builtins.typeOf v}; expected ${metaTypes.${k}.description}"
164+ else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
165+ checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
166+167+ # Check if a derivation is valid, that is whether it passes checks for
168+ # e.g brokenness or license.
169+ #
170+ # Return { valid: Bool } and additionally
171+ # { reason: String; errormsg: String } if it is not valid, where
172+ # reason is one of "unfree", "blacklisted" or "broken".
173+ checkValidity = attrs:
174+ if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then
175+ { valid = false; reason = "unfree"; errormsg = "has an unfree license (‘${showLicense attrs.meta.license}’)"; }
176+ else if hasBlacklistedLicense attrs then
177+ { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
178+ else if !allowBroken && attrs.meta.broken or false then
179+ { valid = false; reason = "broken"; errormsg = "is marked as broken"; }
180+ else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem system attrs.meta.platforms then
181+ { valid = false; reason = "broken"; errormsg = "is not supported on ‘${system}’"; }
182+ else if !(hasAllowedInsecure attrs) then
183+ { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
184+ else let res = checkMeta (attrs.meta or {}); in if res != [] then
185+ { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; }
186+ else { valid = true; };
187+188+ # Throw an error if trying to evaluate an non-valid derivation
189+ validityCondition =
190+ let v = checkValidity attrs;
191+ in if !v.valid
192+ then throwEvalHelp (removeAttrs v ["valid"])
193+ else true;
194+195+in
196+ assert validityCondition;
197+ derivationArg
+38-345
pkgs/stdenv/generic/default.nix
···15, stdenvSandboxProfile ? ""
16, extraSandboxProfile ? ""
1718-, # The platforms here do *not* correspond to the stage the stdenv is
19- # used in, but rather the previous one, in which it was built. We
20- # use the latter two platforms, like a cross compiler, because the
21- # stand environment is a build tool if you squint at it, and because
22- # neither of these are used when building stdenv so we know the
23- # build platform is irrelevant.
24- hostPlatform, targetPlatform
25-}:
26-27-let
28- inherit (targetPlatform) system;
29-30- # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
31- # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
32- shouldCheckMeta = config.checkMeta or false;
33-34- allowUnfree = config.allowUnfree or false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
35-36- whitelist = config.whitelistedLicenses or [];
37- blacklist = config.blacklistedLicenses or [];
38-39- ifDarwin = attrs: if system == "x86_64-darwin" then attrs else {};
40-41- onlyLicenses = list:
42- lib.lists.all (license:
43- let l = lib.licenses.${license.shortName or "BROKEN"} or false; in
44- if license == l then true else
45- throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
46- ) list;
47-48- mutuallyExclusive = a: b:
49- (builtins.length a) == 0 ||
50- (!(builtins.elem (builtins.head a) b) &&
51- mutuallyExclusive (builtins.tail a) b);
52-53- areLicenseListsValid =
54- if mutuallyExclusive whitelist blacklist then
55- assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
56- else
57- throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";
58-59- hasLicense = attrs:
60- attrs ? meta.license;
61-62- hasWhitelistedLicense = assert areLicenseListsValid; attrs:
63- hasLicense attrs && builtins.elem attrs.meta.license whitelist;
64-65- hasBlacklistedLicense = assert areLicenseListsValid; attrs:
66- hasLicense attrs && builtins.elem attrs.meta.license blacklist;
67-68- allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
69-70- isUnfree = licenses: lib.lists.any (l:
71- !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses;
72-73- # Alow granular checks to allow only some unfree packages
74- # Example:
75- # {pkgs, ...}:
76- # {
77- # allowUnfree = false;
78- # allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayer-" x.name);
79- # }
80- allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
81-82- # Check whether unfree packages are allowed and if not, whether the
83- # package has an unfree license and is not explicitely allowed by the
84- # `allowUNfreePredicate` function.
85- hasDeniedUnfreeLicense = attrs:
86- !allowUnfree &&
87- hasLicense attrs &&
88- isUnfree (lib.lists.toList attrs.meta.license) &&
89- !allowUnfreePredicate attrs;
9091- allowInsecureDefaultPredicate = x: builtins.elem x.name (config.permittedInsecurePackages or []);
92- allowInsecurePredicate = x: (config.allowUnfreePredicate or allowInsecureDefaultPredicate) x;
009394- hasAllowedInsecure = attrs:
95- (attrs.meta.knownVulnerabilities or []) == [] ||
96- allowInsecurePredicate attrs ||
97- builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
9899- showLicense = license: license.shortName or "unknown";
001000101 defaultNativeBuildInputs = extraBuildInputs ++
102 [ ../../build-support/setup-hooks/move-docs.sh
103 ../../build-support/setup-hooks/compress-man-pages.sh
···106 ]
107 # FIXME this on Darwin; see
108 # https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
109- ++ lib.optional result.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
110 ++ [
111 ../../build-support/setup-hooks/multiple-outputs.sh
112 ../../build-support/setup-hooks/move-sbin.sh
···115 cc
116 ];
117118- # `mkDerivation` wraps the builtin `derivation` function to
119- # produce derivations that use this stdenv and its shell.
120- #
121- # See also:
122- #
123- # * https://nixos.org/nixpkgs/manual/#sec-using-stdenv
124- # Details on how to use this mkDerivation function
125- #
126- # * https://nixos.org/nix/manual/#ssec-derivation
127- # Explanation about derivations in general
128- mkDerivation =
129- { nativeBuildInputs ? []
130- , buildInputs ? []
131-132- , propagatedNativeBuildInputs ? []
133- , propagatedBuildInputs ? []
134-135- , crossConfig ? null
136- , meta ? {}
137- , passthru ? {}
138- , pos ? null # position used in error messages and for meta.position
139- , separateDebugInfo ? false
140- , outputs ? [ "out" ]
141- , __impureHostDeps ? []
142- , __propagatedImpureHostDeps ? []
143- , sandboxProfile ? ""
144- , propagatedSandboxProfile ? ""
145- , ... } @ attrs:
146- let
147- dependencies = [
148- (map (drv: drv.nativeDrv or drv) nativeBuildInputs)
149- (map (drv: drv.crossDrv or drv) buildInputs)
150- ];
151- propagatedDependencies = [
152- (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
153- (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
154- ];
155- in let
156- pos' =
157- if pos != null then
158- pos
159- else if attrs.meta.description or null != null then
160- builtins.unsafeGetAttrPos "description" attrs.meta
161- else
162- builtins.unsafeGetAttrPos "name" attrs;
163- pos'' = if pos' != null then "‘" + pos'.file + ":" + toString pos'.line + "’" else "«unknown-file»";
164-165-166- remediation = {
167- unfree = remediate_whitelist "Unfree";
168- broken = remediate_whitelist "Broken";
169- blacklisted = x: "";
170- insecure = remediate_insecure;
171- unknown-meta = x: "";
172- };
173- remediate_whitelist = allow_attr: attrs:
174- ''
175- a) For `nixos-rebuild` you can set
176- { nixpkgs.config.allow${allow_attr} = true; }
177- in configuration.nix to override this.
178-179- b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
180- { allow${allow_attr} = true; }
181- to ~/.config/nixpkgs/config.nix.
182- '';
183-184- remediate_insecure = attrs:
185- ''
186-187- Known issues:
188-189- '' + (lib.fold (issue: default: "${default} - ${issue}\n") "" attrs.meta.knownVulnerabilities) + ''
190-191- You can install it anyway by whitelisting this package, using the
192- following methods:
193-194- a) for `nixos-rebuild` you can add ‘${attrs.name or "«name-missing»"}’ to
195- `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
196- like so:
197-198- {
199- nixpkgs.config.permittedInsecurePackages = [
200- "${attrs.name or "«name-missing»"}"
201- ];
202- }
203-204- b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
205- ‘${attrs.name or "«name-missing»"}’ to `permittedInsecurePackages` in
206- ~/.config/nixpkgs/config.nix, like so:
207-208- {
209- permittedInsecurePackages = [
210- "${attrs.name or "«name-missing»"}"
211- ];
212- }
213-214- '';
215-216-217- throwEvalHelp = { reason , errormsg ? "" }:
218- throw (''
219- Package ‘${attrs.name or "«name-missing»"}’ in ${pos''} ${errormsg}, refusing to evaluate.
220-221- '' + ((builtins.getAttr reason remediation) attrs));
222-223- metaTypes = with lib.types; rec {
224- # These keys are documented
225- description = str;
226- longDescription = str;
227- branch = str;
228- homepage = str;
229- downloadPage = str;
230- license = either (listOf lib.types.attrs) (either lib.types.attrs str);
231- maintainers = listOf str;
232- priority = int;
233- platforms = listOf str;
234- hydraPlatforms = listOf str;
235- broken = bool;
236-237- # Weirder stuff that doesn't appear in the documentation?
238- version = str;
239- tag = str;
240- updateWalker = bool;
241- executables = listOf str;
242- outputsToInstall = listOf str;
243- position = str;
244- repositories = attrsOf str;
245- isBuildPythonPackage = platforms;
246- schedulingPriority = str;
247- downloadURLRegexp = str;
248- isFcitxEngine = bool;
249- isIbusEngine = bool;
250- };
251-252- checkMetaAttr = k: v:
253- if metaTypes?${k} then
254- if metaTypes.${k}.check v then null else "key '${k}' has a value ${v} of an invalid type ${builtins.typeOf v}; expected ${metaTypes.${k}.description}"
255- else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
256- checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
257-258- # Check if a derivation is valid, that is whether it passes checks for
259- # e.g brokenness or license.
260- #
261- # Return { valid: Bool } and additionally
262- # { reason: String; errormsg: String } if it is not valid, where
263- # reason is one of "unfree", "blacklisted" or "broken".
264- checkValidity = attrs:
265- if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then
266- { valid = false; reason = "unfree"; errormsg = "has an unfree license (‘${showLicense attrs.meta.license}’)"; }
267- else if hasBlacklistedLicense attrs then
268- { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
269- else if !allowBroken && attrs.meta.broken or false then
270- { valid = false; reason = "broken"; errormsg = "is marked as broken"; }
271- else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then
272- { valid = false; reason = "broken"; errormsg = "is not supported on ‘${result.system}’"; }
273- else if !(hasAllowedInsecure attrs) then
274- { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
275- else let res = checkMeta (attrs.meta or {}); in if res != [] then
276- { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; }
277- else { valid = true; };
278-279- outputs' =
280- outputs ++
281- (if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []);
282-283- dependencies' = let
284- justMap = map lib.chooseDevOutputs dependencies;
285- nativeBuildInputs = lib.elemAt justMap 0
286- ++ lib.optional targetPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
287- buildInputs = lib.elemAt justMap 1
288- # TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
289- ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
290- in [ nativeBuildInputs buildInputs ];
291-292- propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
293- in
294-295- # Throw an error if trying to evaluate an non-valid derivation
296- assert let v = checkValidity attrs;
297- in if !v.valid
298- then throwEvalHelp (removeAttrs v ["valid"])
299- else true;
300-301- lib.addPassthru (derivation (
302- (removeAttrs attrs
303- ["meta" "passthru" "crossAttrs" "pos"
304- "__impureHostDeps" "__propagatedImpureHostDeps"
305- "sandboxProfile" "propagatedSandboxProfile"])
306- // (let
307- # TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
308- computedSandboxProfile =
309- lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
310- computedPropagatedSandboxProfile =
311- lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
312- computedImpureHostDeps =
313- lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
314- computedPropagatedImpureHostDeps =
315- lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
316- in
317- {
318- builder = attrs.realBuilder or shell;
319- args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
320- stdenv = result;
321- system = result.system;
322- userHook = config.stdenv.userHook or null;
323- __ignoreNulls = true;
324-325- nativeBuildInputs = lib.elemAt dependencies' 0;
326- buildInputs = lib.elemAt dependencies' 1;
327-328- propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
329- propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
330- } // ifDarwin {
331- # TODO: remove lib.unique once nix has a list canonicalization primitive
332- __sandboxProfile =
333- let profiles = [ extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
334- final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
335- in final;
336- __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
337- __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [
338- "/dev/zero"
339- "/dev/random"
340- "/dev/urandom"
341- "/bin/sh"
342- ];
343- __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
344- } // (if outputs' != [ "out" ] then {
345- outputs = outputs';
346- } else { })))) (
347- {
348- overrideAttrs = f: mkDerivation (attrs // (f attrs));
349- # The meta attribute is passed in the resulting attribute set,
350- # but it's not part of the actual derivation, i.e., it's not
351- # passed to the builder and is not a dependency. But since we
352- # include it in the result, it *is* available to nix-env for queries.
353- meta = { }
354- # If the packager hasn't specified `outputsToInstall`, choose a default,
355- # which is the name of `p.bin or p.out or p`;
356- # if he has specified it, it will be overridden below in `// meta`.
357- # Note: This default probably shouldn't be globally configurable.
358- # Services and users should specify outputs explicitly,
359- # unless they are comfortable with this default.
360- // { outputsToInstall =
361- let
362- outs = outputs'; # the value passed to derivation primitive
363- hasOutput = out: builtins.elem out outs;
364- in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
365- }
366- // meta
367- # Fill `meta.position` to identify the source location of the package.
368- // lib.optionalAttrs (pos' != null)
369- { position = pos'.file + ":" + toString pos'.line; }
370- ;
371- inherit passthru;
372- } //
373- # Pass through extra attributes that are not inputs, but
374- # should be made available to Nix expressions using the
375- # derivation (e.g., in assertions).
376- passthru);
377-378 # The stdenv that we are producing.
379- result =
380 derivation (
381 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
382 {
383- inherit system name;
0000384385 builder = shell;
386···390391 inherit preHook initialPath shell defaultNativeBuildInputs;
392 }
393- // ifDarwin {
394 __sandboxProfile = stdenvSandboxProfile;
395 __impureHostDeps = __stdenvImpureHostDeps;
396 })
···402 platforms = lib.platforms.all;
403 };
4040000405 # Utility flags to test the type of platform.
406 inherit (hostPlatform)
407 isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
···412 # Whether we should run paxctl to pax-mark binaries.
413 needsPax = isLinux;
414415- inherit mkDerivation;
00416417 # For convenience, bring in the library functions in lib/ so
418 # packages don't have to do that themselves.
···431 # like curl = if stdenv ? curl then stdenv.curl else ...).
432 // extraAttrs;
433434-in result)
···15, stdenvSandboxProfile ? ""
16, extraSandboxProfile ? ""
1718+ ## Platform parameters
19+ ##
20+ ## The "build" "host" "target" terminology below comes from GNU Autotools. See
21+ ## its documentation for more information on what those words mean. Note that
22+ ## each should always be defined, even when not cross compiling.
23+ ##
24+ ## For purposes of bootstrapping, think of each stage as a "sliding window"
25+ ## over a list of platforms. Specifically, the host platform of the previous
26+ ## stage becomes the build platform of the current one, and likewise the
27+ ## target platform of the previous stage becomes the host platform of the
28+ ## current one.
29+ ##
0000000000000000000000000000000000000000000000000000000000003031+, # The platform on which packages are built. Consists of `system`, a
32+ # string (e.g.,`i686-linux') identifying the most import attributes of the
33+ # build platform, and `platform` a set of other details.
34+ buildPlatform
3536+, # The platform on which packages run.
37+ hostPlatform
003839+, # The platform which build tools (especially compilers) build for in this stage,
40+ targetPlatform
41+}:
4243+let
44 defaultNativeBuildInputs = extraBuildInputs ++
45 [ ../../build-support/setup-hooks/move-docs.sh
46 ../../build-support/setup-hooks/compress-man-pages.sh
···49 ]
50 # FIXME this on Darwin; see
51 # https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
52+ ++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
53 ++ [
54 ../../build-support/setup-hooks/multiple-outputs.sh
55 ../../build-support/setup-hooks/move-sbin.sh
···58 cc
59 ];
600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061 # The stdenv that we are producing.
62+ stdenv =
63 derivation (
64 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
65 {
66+ inherit name;
67+68+ # Nix itself uses the `system` field of a derivation to decide where to
69+ # build it. This is a bit confusing for cross compilation.
70+ inherit (buildPlatform) system;
7172 builder = shell;
73···7778 inherit preHook initialPath shell defaultNativeBuildInputs;
79 }
80+ // lib.optionalAttrs buildPlatform.isDarwin {
81 __sandboxProfile = stdenvSandboxProfile;
82 __impureHostDeps = __stdenvImpureHostDeps;
83 })
···89 platforms = lib.platforms.all;
90 };
9192+ inherit buildPlatform hostPlatform targetPlatform;
93+94+ inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
95+96 # Utility flags to test the type of platform.
97 inherit (hostPlatform)
98 isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
···103 # Whether we should run paxctl to pax-mark binaries.
104 needsPax = isLinux;
105106+ inherit (import ./make-derivation.nix {
107+ inherit lib config stdenv;
108+ }) mkDerivation;
109110 # For convenience, bring in the library functions in lib/ so
111 # packages don't have to do that themselves.
···124 # like curl = if stdenv ? curl then stdenv.curl else ...).
125 // extraAttrs;
126127+in stdenv)
···1+{ stdenv, fetchurl, libiconv, libshout, taglib, libxml2, pkgconfig }:
2+3+stdenv.mkDerivation rec {
4+ name = "ezstream-${version}";
5+ version = "0.6.0";
6+7+ src = fetchurl {
8+ url = "https://ftp.osuosl.org/pub/xiph/releases/ezstream/${name}.tar.gz";
9+ sha256 = "f86eb8163b470c3acbc182b42406f08313f85187bd9017afb8b79b02f03635c9";
10+ };
11+12+ buildInputs = [ libiconv libshout taglib libxml2 ];
13+ nativeBuildInputs = [ pkgconfig ];
14+15+ doCheck = true;
16+17+ meta = with stdenv.lib; {
18+ description = "A command line source client for Icecast media streaming servers";
19+ longDescription = ''
20+ Ezstream is a command line source client for Icecast media
21+ streaming servers. It began as the successor of the old "shout"
22+ utility, and has since gained a lot of useful features.
23+24+ In its basic mode of operation, it streams media files or data
25+ from standard input without reencoding and thus requires only
26+ very little CPU resources.
27+ '';
28+ homepage = http://icecast.org/ezstream/;
29+ license = licenses.gpl2;
30+ maintainers = [ maintainers.barrucadu ];
31+ platforms = platforms.all;
32+ };
33+}
+4
pkgs/tools/filesystems/btrfs-progs/default.nix
···21 # This should be fine on all platforms so apply universally
22 patchPhase = "sed -i s/-O1/-O2/ configure";
23000024 meta = with stdenv.lib; {
25 description = "Utilities for the btrfs filesystem";
26 homepage = https://btrfs.wiki.kernel.org/;
···21 # This should be fine on all platforms so apply universally
22 patchPhase = "sed -i s/-O1/-O2/ configure";
2324+ postInstall = ''
25+ install -v -m 444 -D btrfs-completion $out/etc/bash_completion.d/btrfs
26+ '';
27+28 meta = with stdenv.lib; {
29 description = "Utilities for the btrfs filesystem";
30 homepage = https://btrfs.wiki.kernel.org/;
+2-2
pkgs/tools/filesystems/mergerfs/default.nix
···23stdenv.mkDerivation rec {
4 name = "mergerfs-${version}";
5- version = "2.22.1";
67 # not using fetchFromGitHub because of changelog being built with git log
8 src = fetchgit {
9 url = "https://github.com/trapexit/mergerfs";
10 rev = "refs/tags/${version}";
11- sha256 = "12dm64l74wyagbwxsz57p8j3dwl9hgi0j3b6i0pn9m5ar7qrnv00";
12 deepClone = true;
13 leaveDotGit = true;
14 };
···23stdenv.mkDerivation rec {
4 name = "mergerfs-${version}";
5+ version = "2.23.0";
67 # not using fetchFromGitHub because of changelog being built with git log
8 src = fetchgit {
9 url = "https://github.com/trapexit/mergerfs";
10 rev = "refs/tags/${version}";
11+ sha256 = "0k4nn0f4c355q7hnni7iia8qi9m0khvyd04hx1hmlrnf0zsi9mfw";
12 deepClone = true;
13 leaveDotGit = true;
14 };
···56 # Other Beam languages. These are built with `beam.interpreters.erlang`. To
57 # access for example elixir built with different version of Erlang, use
58 # `beam.packages.erlangR19.elixir`.
59- elixir = packages.erlang.elixir;
060 lfe = packages.erlang.lfe;
61 };
62
···56 # Other Beam languages. These are built with `beam.interpreters.erlang`. To
57 # access for example elixir built with different version of Erlang, use
58 # `beam.packages.erlangR19.elixir`.
59+ inherit (packages.erlang) elixir elixir_1_5_rc elixir_1_4 elixir_1_3;
60+61 lfe = packages.erlang.lfe;
62 };
63
···18, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
19 nixpkgsFun
2021- ## Platform parameters
22- ##
23- ## The "build" "host" "target" terminology below comes from GNU Autotools. See
24- ## its documentation for more information on what those words mean. Note that
25- ## each should always be defined, even when not cross compiling.
26- ##
27- ## For purposes of bootstrapping, think of each stage as a "sliding window"
28- ## over a list of platforms. Specifically, the host platform of the previous
29- ## stage becomes the build platform of the current one, and likewise the
30- ## target platform of the previous stage becomes the host platform of the
31- ## current one.
32- ##
33-34-, # The platform on which packages are built. Consists of `system`, a
35- # string (e.g.,`i686-linux') identifying the most import attributes of the
36- # build platform, and `platform` a set of other details.
37- buildPlatform
38-39-, # The platform on which packages run.
40- hostPlatform
41-42-, # The platform which build tools (especially compilers) build for in this stage,
43- targetPlatform
44-45 ## Other parameters
46 ##
47···69, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
70 # outside of the store. Thus, GCC, GFortran, & co. must always look for files
71 # in standard system directories (/usr/include, etc.)
72- noSysDirs ? buildPlatform.system != "x86_64-freebsd"
73- && buildPlatform.system != "i686-freebsd"
74- && buildPlatform.system != "x86_64-solaris"
75- && buildPlatform.system != "x86_64-kfreebsd-gnu"
7677, # The configuration attribute set
78 config
···98 // { recurseForDerivations = false; };
99 __targetPackages = (if __targetPackages == null then self else __targetPackages)
100 // { recurseForDerivations = false; };
101- inherit stdenv
102- buildPlatform hostPlatform targetPlatform;
103 };
104105 # The old identifiers for cross-compiling. These should eventually be removed,
106 # and the packages that rely on them refactored accordingly.
107 platformCompat = self: super: let
108- # TODO(@Ericson2314) this causes infinite recursion
109- #inherit (self) buildPlatform hostPlatform targetPlatform;
110 in {
111 stdenv = super.stdenv // {
112- inherit (buildPlatform) platform;
113 };
0114 inherit (buildPlatform) system platform;
115 };
116
···18, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
19 nixpkgsFun
2000000000000000000000000021 ## Other parameters
22 ##
23···45, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
46 # outside of the store. Thus, GCC, GFortran, & co. must always look for files
47 # in standard system directories (/usr/include, etc.)
48+ noSysDirs ? stdenv.buildPlatform.system != "x86_64-freebsd"
49+ && stdenv.buildPlatform.system != "i686-freebsd"
50+ && stdenv.buildPlatform.system != "x86_64-solaris"
51+ && stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu"
5253, # The configuration attribute set
54 config
···74 // { recurseForDerivations = false; };
75 __targetPackages = (if __targetPackages == null then self else __targetPackages)
76 // { recurseForDerivations = false; };
77+ inherit stdenv;
078 };
7980 # The old identifiers for cross-compiling. These should eventually be removed,
81 # and the packages that rely on them refactored accordingly.
82 platformCompat = self: super: let
83+ inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
084 in {
85 stdenv = super.stdenv // {
86+ inherit (super.stdenv.buildPlatform) platform;
87 };
88+ inherit buildPlatform hostPlatform targetPlatform;
89 inherit (buildPlatform) system platform;
90 };
91