···3737 </para>
3838 <para>
3939 In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
4040- 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>:
4141- <programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...</programlisting>
4040+ 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>:
4141+ <programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>, or just off <varname>stdenv</varname>:
4242+ <programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>.
4243 </para>
4344 <variablelist>
4445 <varlistentry>
+8
lib/lists.nix
···477477 */
478478 subtractLists = e: filter (x: !(elem x e));
479479480480+ /* Test if two lists have no common element.
481481+ It should be slightly more efficient than (intersectLists a b == [])
482482+ */
483483+ mutuallyExclusive = a: b:
484484+ (builtins.length a) == 0 ||
485485+ (!(builtins.elem (builtins.head a) b) &&
486486+ mutuallyExclusive (builtins.tail a) b);
487487+480488}
···250250# If --repair is given, don't try to use the Nix daemon, because the
251251# flag can only be used directly.
252252if [ -z "$repair" ] && systemctl show nix-daemon.socket nix-daemon.service | grep -q ActiveState=active; then
253253- export NIX_REMOTE=${NIX_REMOTE:-daemon}
253253+ export NIX_REMOTE=${NIX_REMOTE-daemon}
254254fi
255255256256
+4
nixos/modules/programs/zsh/oh-my-zsh.nix
···4242 };
43434444 config = mkIf cfg.enable {
4545+4646+ # Prevent zsh from overwriting oh-my-zsh's prompt
4747+ programs.zsh.promptInit = mkDefault "";
4848+4549 environment.systemPackages = with pkgs; [ oh-my-zsh ];
46504751 programs.zsh.interactiveShellInit = with pkgs; with builtins; ''
+32-39
nixos/modules/programs/zsh/zsh.nix
···97979898 config = mkIf cfg.enable {
9999100100- programs.zsh = {
101101-102102- shellInit = ''
103103- . ${config.system.build.setEnvironment}
104104-105105- ${cfge.shellInit}
106106- '';
107107-108108- loginShellInit = cfge.loginShellInit;
109109-110110- interactiveShellInit = ''
111111- # history defaults
112112- SAVEHIST=2000
113113- HISTSIZE=2000
114114- HISTFILE=$HOME/.zsh_history
115115-116116- setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
117117-118118- # Tell zsh how to find installed completions
119119- for p in ''${(z)NIX_PROFILES}; do
120120- fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
121121- done
122122-123123- ${if cfg.enableCompletion then "autoload -U compinit && compinit" else ""}
124124-125125- ${optionalString (cfg.enableAutosuggestions)
126126- "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
127127- }
128128-129129- ${zshAliases}
130130- ${cfg.promptInit}
131131-132132- ${cfge.interactiveShellInit}
133133-134134- HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
135135- '';
136136-137137- };
138138-139100 environment.etc."zshenv".text =
140101 ''
141102 # /etc/zshenv: DO NOT EDIT -- this file has been generated automatically.
···145106 # But don't clobber the environment of interactive non-login children!
146107 if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
147108 export __ETC_ZSHENV_SOURCED=1
109109+110110+ . ${config.system.build.setEnvironment}
111111+112112+ ${cfge.shellInit}
148113149114 ${cfg.shellInit}
150115···162127 # Only execute this file once per shell.
163128 if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi
164129 __ETC_ZPROFILE_SOURCED=1
130130+131131+ ${cfge.loginShellInit}
165132166133 ${cfg.loginShellInit}
167134···182149183150 . /etc/zinputrc
184151152152+ # history defaults
153153+ SAVEHIST=2000
154154+ HISTSIZE=2000
155155+ HISTFILE=$HOME/.zsh_history
156156+157157+ setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
158158+159159+ HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
160160+161161+ ${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
162162+163163+ ${optionalString (cfg.enableAutosuggestions)
164164+ "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
165165+ }
166166+167167+ ${zshAliases}
168168+169169+ ${cfge.interactiveShellInit}
170170+185171 ${cfg.interactiveShellInit}
172172+173173+ ${cfg.promptInit}
174174+175175+ # Tell zsh how to find installed completions
176176+ for p in ''${(z)NIX_PROFILES}; do
177177+ fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
178178+ done
186179187180 # Read system-wide modifications.
188181 if test -f /etc/zshrc.local; then
···99 # /var/lib/misc is for dnsmasq.leases.
1010 stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
11111212+ dns =
1313+ if cfg.useDnsmasq then "dnsmasq"
1414+ else if config.services.resolved.enable then "systemd-resolved"
1515+ else "default";
1616+1217 configFile = writeText "NetworkManager.conf" ''
1318 [main]
1419 plugins=keyfile
1520 dhcp=${cfg.dhcp}
1616- dns=${if cfg.useDnsmasq then "dnsmasq" else "default"}
2121+ dns=${dns}
17221823 [keyfile]
1924 ${optionalString (cfg.unmanaged != [])
+42
nixos/modules/services/web-servers/minio.nix
···2929 description = "The config directory, for the access keys and other settings.";
3030 };
31313232+ accessKey = mkOption {
3333+ default = "";
3434+ type = types.str;
3535+ description = ''
3636+ Access key of 5 to 20 characters in length that clients use to access the server.
3737+ This overrides the access key that is generated by minio on first startup and stored inside the
3838+ <literal>configDir</literal> directory.
3939+ '';
4040+ };
4141+4242+ secretKey = mkOption {
4343+ default = "";
4444+ type = types.str;
4545+ description = ''
4646+ Specify the Secret key of 8 to 40 characters in length that clients use to access the server.
4747+ This overrides the secret key that is generated by minio on first startup and stored inside the
4848+ <literal>configDir</literal> directory.
4949+ '';
5050+ };
5151+5252+ region = mkOption {
5353+ default = "us-east-1";
5454+ type = types.str;
5555+ description = ''
5656+ 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.
5757+ '';
5858+ };
5959+6060+ browser = mkOption {
6161+ default = true;
6262+ type = types.bool;
6363+ description = "Enable or disable access to web UI.";
6464+ };
6565+3266 package = mkOption {
3367 default = pkgs.minio;
3468 defaultText = "pkgs.minio";
···5690 User = "minio";
5791 Group = "minio";
5892 LimitNOFILE = 65536;
9393+ };
9494+ environment = {
9595+ MINIO_REGION = "${cfg.region}";
9696+ MINIO_BROWSER = "${if cfg.browser then "on" else "off"}";
9797+ } // optionalAttrs (cfg.accessKey != "") {
9898+ MINIO_ACCESS_KEY = "${cfg.accessKey}";
9999+ } // optionalAttrs (cfg.secretKey != "") {
100100+ MINIO_SECRET_KEY = "${cfg.secretKey}";
59101 };
60102 };
61103
···113113 patches = [
114114 ./remove-tools-1.5.patch
115115 ./creds-test.patch
116116+ ./fix-systime-1.6.patch
116117117118 # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
118119 # actually works on old versions too.
···11-{ stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl, bash,
22- debugInfo ? false }:
33-44-stdenv.mkDerivation rec {
55- name = "elixir-${version}";
66- version = "1.4.4";
77-88- src = fetchFromGitHub {
99- owner = "elixir-lang";
1010- repo = "elixir";
1111- rev = "v${version}";
1212- sha256 = "0m51cirkv1dahw4z2jlmz58cwmpy0dya88myx4wykq0v5bh1xbq8";
1313- };
1414-1515- buildInputs = [ erlang rebar makeWrapper ];
1616-1717- # Elixir expects that UTF-8 locale to be set (see https://github.com/elixir-lang/elixir/issues/3548).
1818- # In other cases there is warnings during compilation.
1919- LANG = "en_US.UTF-8";
2020- LC_TYPE = "en_US.UTF-8";
2121-2222- setupHook = ./setup-hook.sh;
2323-2424- inherit debugInfo;
2525-2626- buildFlags = if debugInfo
2727- then "ERL_COMPILER_OPTIONS=debug_info"
2828- else "";
2929-3030- preBuild = ''
3131- # The build process uses ./rebar. Link it to the nixpkgs rebar
3232- rm -v rebar
3333- ln -s ${rebar}/bin/rebar rebar
3434-3535- substituteInPlace Makefile \
3636- --replace "/usr/local" $out
3737- '';
3838-3939- postFixup = ''
4040- # Elixir binaries are shell scripts which run erl. Add some stuff
4141- # to PATH so the scripts can run without problems.
4242-4343- for f in $out/bin/*; do
4444- b=$(basename $f)
4545- if [ $b == "mix" ]; then continue; fi
4646- wrapProgram $f \
4747- --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \
4848- --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
4949- done
5050-5151- substituteInPlace $out/bin/mix \
5252- --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
5353- '';
5454-5555- meta = with stdenv.lib; {
5656- homepage = "http://elixir-lang.org/";
5757- description = "A functional, meta-programming aware language built on top of the Erlang VM";
5858-5959- longDescription = ''
6060- Elixir is a functional, meta-programming aware language built on
6161- top of the Erlang VM. It is a dynamic language with flexible
6262- syntax and macro support that leverages Erlang's abilities to
6363- build concurrent, distributed and fault-tolerant applications
6464- with hot code upgrades.
6565- '';
6666-6767- license = licenses.epl10;
6868- platforms = platforms.unix;
6969- maintainers = with maintainers; [ the-kenny havvy couchemar ];
7070- };
7171-}
···11{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, ounit }:
2233+if !stdenv.lib.versionAtLeast ocaml.version "4"
44+then throw "qtest is not available for OCaml ${ocaml.version}"
55+else
66+37let version = "2.2"; in
4859stdenv.mkDerivation {
+1-1
pkgs/development/ocaml-modules/sedlex/default.nix
···33assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4455stdenv.mkDerivation rec {
66- name = "ocaml${ocaml.version}-${version}";
66+ name = "ocaml${ocaml.version}-sedlex-${version}";
77 version = "1.99.3";
8899 src = fetchzip {
···3939 SCHEDSTATS n
4040 DETECT_HUNG_TASK y
41414242- ${optionalString (versionOlder version "4.10") ''
4242+ ${optionalString (versionOlder version "4.4") ''
4343 CPU_NOTIFIER_ERROR_INJECT? n
4444 ''}
4545···9292 # module, so that the initrd gets a good I/O scheduler.
9393 IOSCHED_CFQ y
9494 BLK_CGROUP y # required by CFQ
9595+ IOSCHED_DEADLINE y
9696+ ${optionalString (versionAtLeast version "4.11") ''
9797+ MQ_IOSCHED_DEADLINE y
9898+ ''}
9999+ ${optionalString (versionAtLeast version "4.12") ''
100100+ MQ_IOSCHED_KYBER y
101101+ IOSCHED_BFQ m
102102+ ''}
9510396104 # Enable NUMA.
97105 NUMA? y
···593601 FW_LOADER_USER_HELPER_FALLBACK? n
594602595603 # Disable various self-test modules that have no use in a production system
596596- ${optionalString (versionOlder version "4.9") ''
604604+ ${optionalString (versionOlder version "4.4") ''
597605 ARM_KPROBES_TEST? n
598606 ''}
599607···602610 BACKTRACE_SELF_TEST? n
603611 CRC32_SELFTEST? n
604612 CRYPTO_TEST? n
605605- DRM_DEBUG_MM_SELFTEST? n
606606- EFI_TEST? n
607613 GLOB_SELFTEST? n
608614 INTERVAL_TREE_TEST? n
609615 LNET_SELFTEST? n
···612618 NOTIFIER_ERROR_INJECTION? n
613619 PERCPU_TEST? n
614620 RBTREE_TEST? n
615615- RCU_PERF_TEST? n
616621 RCU_TORTURE_TEST? n
617617- TEST_ASYNC_DRIVER_PROBE? n
618618- TEST_BITMAP? n
619622 TEST_BPF? n
620623 TEST_FIRMWARE? n
621621- TEST_HASH? n
622624 TEST_HEXDUMP? n
623625 TEST_KSTRTOX? n
624626 TEST_LIST_SORT? n
625627 TEST_LKM? n
626626- TEST_PARMAN? n
627628 TEST_PRINTF? n
628629 TEST_RHASHTABLE? n
629629- TEST_SORT? n
630630 TEST_STATIC_KEYS? n
631631 TEST_STRING_HELPERS? n
632632 TEST_UDELAY? n
633633 TEST_USER_COPY? n
634634- TEST_UUID? n
635635- WW_MUTEX_SELFTEST? n
636634 XZ_DEC_TEST? n
635635+636636+ ${optionalString (versionOlder version "4.4") ''
637637+ EFI_TEST? n
638638+ RCU_PERF_TEST? n
639639+ TEST_ASYNC_DRIVER_PROBE? n
640640+ TEST_BITMAP? n
641641+ TEST_HASH? n
642642+ TEST_UUID? n
643643+ ''}
644644+645645+ ${optionalString (versionAtLeast version "4.11") ''
646646+ DRM_DEBUG_MM_SELFTEST? n
647647+ TEST_PARMAN? n
648648+ TEST_SORT? n
649649+ WW_MUTEX_SELFTEST? n
650650+ ''}
637651638652 # ChromiumOS support
639653 ${optionalString (features.chromiumos or false) ''
···6161 , buildPlatform, hostPlatform, targetPlatform
6262 } @ overrideArgs: let
6363 stdenv = overrideArgs.stdenv.override {
6464- # TODO(@Ericson2314): Cannot do this for now because then Nix thinks the
6565- # resulting derivation should be built on the host platform.
6666- #hostPlatform = buildPlatform;
6767- #targetPlatform = hostPlatform;
6868- inherit cc;
6464+ inherit
6565+ buildPlatform hostPlatform targetPlatform
6666+ cc;
69677068 allowedRequisites = null;
7169
···11+# Extend a derivation with checks for brokenness, license, etc. Throw a
22+# descriptive error when the check fails; return `derivationArg` otherwise.
33+# Note: no dependencies are checked in this step.
44+55+{ lib, config, system, meta, derivationArg, mkDerivationArg }:
66+77+let
88+ attrs = mkDerivationArg; # TODO: probably get rid of passing this one
99+1010+ # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
1111+ # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
1212+ shouldCheckMeta = config.checkMeta or false;
1313+1414+ allowUnfree = config.allowUnfree or false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
1515+1616+ whitelist = config.whitelistedLicenses or [];
1717+ blacklist = config.blacklistedLicenses or [];
1818+1919+ onlyLicenses = list:
2020+ lib.lists.all (license:
2121+ let l = lib.licenses.${license.shortName or "BROKEN"} or false; in
2222+ if license == l then true else
2323+ throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
2424+ ) list;
2525+2626+ areLicenseListsValid =
2727+ if lib.mutuallyExclusive whitelist blacklist then
2828+ assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
2929+ else
3030+ throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";
3131+3232+ hasLicense = attrs:
3333+ attrs ? meta.license;
3434+3535+ hasWhitelistedLicense = assert areLicenseListsValid; attrs:
3636+ hasLicense attrs && builtins.elem attrs.meta.license whitelist;
3737+3838+ hasBlacklistedLicense = assert areLicenseListsValid; attrs:
3939+ hasLicense attrs && builtins.elem attrs.meta.license blacklist;
4040+4141+ allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
4242+4343+ isUnfree = licenses: lib.lists.any (l:
4444+ !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses;
4545+4646+ # Alow granular checks to allow only some unfree packages
4747+ # Example:
4848+ # {pkgs, ...}:
4949+ # {
5050+ # allowUnfree = false;
5151+ # allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayer-" x.name);
5252+ # }
5353+ allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
5454+5555+ # Check whether unfree packages are allowed and if not, whether the
5656+ # package has an unfree license and is not explicitely allowed by the
5757+ # `allowUNfreePredicate` function.
5858+ hasDeniedUnfreeLicense = attrs:
5959+ !allowUnfree &&
6060+ hasLicense attrs &&
6161+ isUnfree (lib.lists.toList attrs.meta.license) &&
6262+ !allowUnfreePredicate attrs;
6363+6464+ allowInsecureDefaultPredicate = x: builtins.elem x.name (config.permittedInsecurePackages or []);
6565+ allowInsecurePredicate = x: (config.allowUnfreePredicate or allowInsecureDefaultPredicate) x;
6666+6767+ hasAllowedInsecure = attrs:
6868+ (attrs.meta.knownVulnerabilities or []) == [] ||
6969+ allowInsecurePredicate attrs ||
7070+ builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
7171+7272+ showLicense = license: license.shortName or "unknown";
7373+7474+ pos_str = meta.position or "«unknown-file»";
7575+7676+ remediation = {
7777+ unfree = remediate_whitelist "Unfree";
7878+ broken = remediate_whitelist "Broken";
7979+ blacklisted = x: "";
8080+ insecure = remediate_insecure;
8181+ unknown-meta = x: "";
8282+ };
8383+ remediate_whitelist = allow_attr: attrs:
8484+ ''
8585+ a) For `nixos-rebuild` you can set
8686+ { nixpkgs.config.allow${allow_attr} = true; }
8787+ in configuration.nix to override this.
8888+8989+ b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
9090+ { allow${allow_attr} = true; }
9191+ to ~/.config/nixpkgs/config.nix.
9292+ '';
9393+9494+ remediate_insecure = attrs:
9595+ ''
9696+9797+ Known issues:
9898+9999+ '' + (lib.fold (issue: default: "${default} - ${issue}\n") "" attrs.meta.knownVulnerabilities) + ''
100100+101101+ You can install it anyway by whitelisting this package, using the
102102+ following methods:
103103+104104+ a) for `nixos-rebuild` you can add ‘${attrs.name or "«name-missing»"}’ to
105105+ `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
106106+ like so:
107107+108108+ {
109109+ nixpkgs.config.permittedInsecurePackages = [
110110+ "${attrs.name or "«name-missing»"}"
111111+ ];
112112+ }
113113+114114+ b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
115115+ ‘${attrs.name or "«name-missing»"}’ to `permittedInsecurePackages` in
116116+ ~/.config/nixpkgs/config.nix, like so:
117117+118118+ {
119119+ permittedInsecurePackages = [
120120+ "${attrs.name or "«name-missing»"}"
121121+ ];
122122+ }
123123+124124+ '';
125125+126126+ throwEvalHelp = { reason , errormsg ? "" }:
127127+ throw (''
128128+ Package ‘${attrs.name or "«name-missing»"}’ in ${pos_str} ${errormsg}, refusing to evaluate.
129129+130130+ '' + ((builtins.getAttr reason remediation) attrs));
131131+132132+ metaTypes = with lib.types; rec {
133133+ # These keys are documented
134134+ description = str;
135135+ longDescription = str;
136136+ branch = str;
137137+ homepage = str;
138138+ downloadPage = str;
139139+ license = either (listOf lib.types.attrs) (either lib.types.attrs str);
140140+ maintainers = listOf str;
141141+ priority = int;
142142+ platforms = listOf str;
143143+ hydraPlatforms = listOf str;
144144+ broken = bool;
145145+146146+ # Weirder stuff that doesn't appear in the documentation?
147147+ version = str;
148148+ tag = str;
149149+ updateWalker = bool;
150150+ executables = listOf str;
151151+ outputsToInstall = listOf str;
152152+ position = str;
153153+ repositories = attrsOf str;
154154+ isBuildPythonPackage = platforms;
155155+ schedulingPriority = str;
156156+ downloadURLRegexp = str;
157157+ isFcitxEngine = bool;
158158+ isIbusEngine = bool;
159159+ };
160160+161161+ checkMetaAttr = k: v:
162162+ if metaTypes?${k} then
163163+ 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}"
164164+ else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
165165+ checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
166166+167167+ # Check if a derivation is valid, that is whether it passes checks for
168168+ # e.g brokenness or license.
169169+ #
170170+ # Return { valid: Bool } and additionally
171171+ # { reason: String; errormsg: String } if it is not valid, where
172172+ # reason is one of "unfree", "blacklisted" or "broken".
173173+ checkValidity = attrs:
174174+ if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then
175175+ { valid = false; reason = "unfree"; errormsg = "has an unfree license (‘${showLicense attrs.meta.license}’)"; }
176176+ else if hasBlacklistedLicense attrs then
177177+ { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
178178+ else if !allowBroken && attrs.meta.broken or false then
179179+ { valid = false; reason = "broken"; errormsg = "is marked as broken"; }
180180+ else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem system attrs.meta.platforms then
181181+ { valid = false; reason = "broken"; errormsg = "is not supported on ‘${system}’"; }
182182+ else if !(hasAllowedInsecure attrs) then
183183+ { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
184184+ else let res = checkMeta (attrs.meta or {}); in if res != [] then
185185+ { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; }
186186+ else { valid = true; };
187187+188188+ # Throw an error if trying to evaluate an non-valid derivation
189189+ validityCondition =
190190+ let v = checkValidity attrs;
191191+ in if !v.valid
192192+ then throwEvalHelp (removeAttrs v ["valid"])
193193+ else true;
194194+195195+in
196196+ assert validityCondition;
197197+ derivationArg
+38-345
pkgs/stdenv/generic/default.nix
···1515, stdenvSandboxProfile ? ""
1616, extraSandboxProfile ? ""
17171818-, # The platforms here do *not* correspond to the stage the stdenv is
1919- # used in, but rather the previous one, in which it was built. We
2020- # use the latter two platforms, like a cross compiler, because the
2121- # stand environment is a build tool if you squint at it, and because
2222- # neither of these are used when building stdenv so we know the
2323- # build platform is irrelevant.
2424- hostPlatform, targetPlatform
2525-}:
2626-2727-let
2828- inherit (targetPlatform) system;
2929-3030- # See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
3131- # for why this defaults to false, but I (@copumpkin) want to default it to true soon.
3232- shouldCheckMeta = config.checkMeta or false;
3333-3434- allowUnfree = config.allowUnfree or false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
3535-3636- whitelist = config.whitelistedLicenses or [];
3737- blacklist = config.blacklistedLicenses or [];
3838-3939- ifDarwin = attrs: if system == "x86_64-darwin" then attrs else {};
4040-4141- onlyLicenses = list:
4242- lib.lists.all (license:
4343- let l = lib.licenses.${license.shortName or "BROKEN"} or false; in
4444- if license == l then true else
4545- throw ''‘${showLicense license}’ is not an attribute of lib.licenses''
4646- ) list;
4747-4848- mutuallyExclusive = a: b:
4949- (builtins.length a) == 0 ||
5050- (!(builtins.elem (builtins.head a) b) &&
5151- mutuallyExclusive (builtins.tail a) b);
5252-5353- areLicenseListsValid =
5454- if mutuallyExclusive whitelist blacklist then
5555- assert onlyLicenses whitelist; assert onlyLicenses blacklist; true
5656- else
5757- throw "whitelistedLicenses and blacklistedLicenses are not mutually exclusive.";
5858-5959- hasLicense = attrs:
6060- attrs ? meta.license;
6161-6262- hasWhitelistedLicense = assert areLicenseListsValid; attrs:
6363- hasLicense attrs && builtins.elem attrs.meta.license whitelist;
6464-6565- hasBlacklistedLicense = assert areLicenseListsValid; attrs:
6666- hasLicense attrs && builtins.elem attrs.meta.license blacklist;
6767-6868- allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
6969-7070- isUnfree = licenses: lib.lists.any (l:
7171- !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses;
7272-7373- # Alow granular checks to allow only some unfree packages
7474- # Example:
7575- # {pkgs, ...}:
7676- # {
7777- # allowUnfree = false;
7878- # allowUnfreePredicate = (x: pkgs.lib.hasPrefix "flashplayer-" x.name);
7979- # }
8080- allowUnfreePredicate = config.allowUnfreePredicate or (x: false);
8181-8282- # Check whether unfree packages are allowed and if not, whether the
8383- # package has an unfree license and is not explicitely allowed by the
8484- # `allowUNfreePredicate` function.
8585- hasDeniedUnfreeLicense = attrs:
8686- !allowUnfree &&
8787- hasLicense attrs &&
8888- isUnfree (lib.lists.toList attrs.meta.license) &&
8989- !allowUnfreePredicate attrs;
1818+ ## Platform parameters
1919+ ##
2020+ ## The "build" "host" "target" terminology below comes from GNU Autotools. See
2121+ ## its documentation for more information on what those words mean. Note that
2222+ ## each should always be defined, even when not cross compiling.
2323+ ##
2424+ ## For purposes of bootstrapping, think of each stage as a "sliding window"
2525+ ## over a list of platforms. Specifically, the host platform of the previous
2626+ ## stage becomes the build platform of the current one, and likewise the
2727+ ## target platform of the previous stage becomes the host platform of the
2828+ ## current one.
2929+ ##
90309191- allowInsecureDefaultPredicate = x: builtins.elem x.name (config.permittedInsecurePackages or []);
9292- allowInsecurePredicate = x: (config.allowUnfreePredicate or allowInsecureDefaultPredicate) x;
3131+, # The platform on which packages are built. Consists of `system`, a
3232+ # string (e.g.,`i686-linux') identifying the most import attributes of the
3333+ # build platform, and `platform` a set of other details.
3434+ buildPlatform
93359494- hasAllowedInsecure = attrs:
9595- (attrs.meta.knownVulnerabilities or []) == [] ||
9696- allowInsecurePredicate attrs ||
9797- builtins.getEnv "NIXPKGS_ALLOW_INSECURE" == "1";
3636+, # The platform on which packages run.
3737+ hostPlatform
98389999- showLicense = license: license.shortName or "unknown";
3939+, # The platform which build tools (especially compilers) build for in this stage,
4040+ targetPlatform
4141+}:
100424343+let
10144 defaultNativeBuildInputs = extraBuildInputs ++
10245 [ ../../build-support/setup-hooks/move-docs.sh
10346 ../../build-support/setup-hooks/compress-man-pages.sh
···10649 ]
10750 # FIXME this on Darwin; see
10851 # https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
109109- ++ lib.optional result.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
5252+ ++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
11053 ++ [
11154 ../../build-support/setup-hooks/multiple-outputs.sh
11255 ../../build-support/setup-hooks/move-sbin.sh
···11558 cc
11659 ];
11760118118- # `mkDerivation` wraps the builtin `derivation` function to
119119- # produce derivations that use this stdenv and its shell.
120120- #
121121- # See also:
122122- #
123123- # * https://nixos.org/nixpkgs/manual/#sec-using-stdenv
124124- # Details on how to use this mkDerivation function
125125- #
126126- # * https://nixos.org/nix/manual/#ssec-derivation
127127- # Explanation about derivations in general
128128- mkDerivation =
129129- { nativeBuildInputs ? []
130130- , buildInputs ? []
131131-132132- , propagatedNativeBuildInputs ? []
133133- , propagatedBuildInputs ? []
134134-135135- , crossConfig ? null
136136- , meta ? {}
137137- , passthru ? {}
138138- , pos ? null # position used in error messages and for meta.position
139139- , separateDebugInfo ? false
140140- , outputs ? [ "out" ]
141141- , __impureHostDeps ? []
142142- , __propagatedImpureHostDeps ? []
143143- , sandboxProfile ? ""
144144- , propagatedSandboxProfile ? ""
145145- , ... } @ attrs:
146146- let
147147- dependencies = [
148148- (map (drv: drv.nativeDrv or drv) nativeBuildInputs)
149149- (map (drv: drv.crossDrv or drv) buildInputs)
150150- ];
151151- propagatedDependencies = [
152152- (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
153153- (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
154154- ];
155155- in let
156156- pos' =
157157- if pos != null then
158158- pos
159159- else if attrs.meta.description or null != null then
160160- builtins.unsafeGetAttrPos "description" attrs.meta
161161- else
162162- builtins.unsafeGetAttrPos "name" attrs;
163163- pos'' = if pos' != null then "‘" + pos'.file + ":" + toString pos'.line + "’" else "«unknown-file»";
164164-165165-166166- remediation = {
167167- unfree = remediate_whitelist "Unfree";
168168- broken = remediate_whitelist "Broken";
169169- blacklisted = x: "";
170170- insecure = remediate_insecure;
171171- unknown-meta = x: "";
172172- };
173173- remediate_whitelist = allow_attr: attrs:
174174- ''
175175- a) For `nixos-rebuild` you can set
176176- { nixpkgs.config.allow${allow_attr} = true; }
177177- in configuration.nix to override this.
178178-179179- b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
180180- { allow${allow_attr} = true; }
181181- to ~/.config/nixpkgs/config.nix.
182182- '';
183183-184184- remediate_insecure = attrs:
185185- ''
186186-187187- Known issues:
188188-189189- '' + (lib.fold (issue: default: "${default} - ${issue}\n") "" attrs.meta.knownVulnerabilities) + ''
190190-191191- You can install it anyway by whitelisting this package, using the
192192- following methods:
193193-194194- a) for `nixos-rebuild` you can add ‘${attrs.name or "«name-missing»"}’ to
195195- `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
196196- like so:
197197-198198- {
199199- nixpkgs.config.permittedInsecurePackages = [
200200- "${attrs.name or "«name-missing»"}"
201201- ];
202202- }
203203-204204- b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
205205- ‘${attrs.name or "«name-missing»"}’ to `permittedInsecurePackages` in
206206- ~/.config/nixpkgs/config.nix, like so:
207207-208208- {
209209- permittedInsecurePackages = [
210210- "${attrs.name or "«name-missing»"}"
211211- ];
212212- }
213213-214214- '';
215215-216216-217217- throwEvalHelp = { reason , errormsg ? "" }:
218218- throw (''
219219- Package ‘${attrs.name or "«name-missing»"}’ in ${pos''} ${errormsg}, refusing to evaluate.
220220-221221- '' + ((builtins.getAttr reason remediation) attrs));
222222-223223- metaTypes = with lib.types; rec {
224224- # These keys are documented
225225- description = str;
226226- longDescription = str;
227227- branch = str;
228228- homepage = str;
229229- downloadPage = str;
230230- license = either (listOf lib.types.attrs) (either lib.types.attrs str);
231231- maintainers = listOf str;
232232- priority = int;
233233- platforms = listOf str;
234234- hydraPlatforms = listOf str;
235235- broken = bool;
236236-237237- # Weirder stuff that doesn't appear in the documentation?
238238- version = str;
239239- tag = str;
240240- updateWalker = bool;
241241- executables = listOf str;
242242- outputsToInstall = listOf str;
243243- position = str;
244244- repositories = attrsOf str;
245245- isBuildPythonPackage = platforms;
246246- schedulingPriority = str;
247247- downloadURLRegexp = str;
248248- isFcitxEngine = bool;
249249- isIbusEngine = bool;
250250- };
251251-252252- checkMetaAttr = k: v:
253253- if metaTypes?${k} then
254254- 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}"
255255- else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
256256- checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
257257-258258- # Check if a derivation is valid, that is whether it passes checks for
259259- # e.g brokenness or license.
260260- #
261261- # Return { valid: Bool } and additionally
262262- # { reason: String; errormsg: String } if it is not valid, where
263263- # reason is one of "unfree", "blacklisted" or "broken".
264264- checkValidity = attrs:
265265- if hasDeniedUnfreeLicense attrs && !(hasWhitelistedLicense attrs) then
266266- { valid = false; reason = "unfree"; errormsg = "has an unfree license (‘${showLicense attrs.meta.license}’)"; }
267267- else if hasBlacklistedLicense attrs then
268268- { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
269269- else if !allowBroken && attrs.meta.broken or false then
270270- { valid = false; reason = "broken"; errormsg = "is marked as broken"; }
271271- else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem result.system attrs.meta.platforms then
272272- { valid = false; reason = "broken"; errormsg = "is not supported on ‘${result.system}’"; }
273273- else if !(hasAllowedInsecure attrs) then
274274- { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
275275- else let res = checkMeta (attrs.meta or {}); in if res != [] then
276276- { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; }
277277- else { valid = true; };
278278-279279- outputs' =
280280- outputs ++
281281- (if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []);
282282-283283- dependencies' = let
284284- justMap = map lib.chooseDevOutputs dependencies;
285285- nativeBuildInputs = lib.elemAt justMap 0
286286- ++ lib.optional targetPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
287287- buildInputs = lib.elemAt justMap 1
288288- # TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
289289- ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
290290- in [ nativeBuildInputs buildInputs ];
291291-292292- propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
293293- in
294294-295295- # Throw an error if trying to evaluate an non-valid derivation
296296- assert let v = checkValidity attrs;
297297- in if !v.valid
298298- then throwEvalHelp (removeAttrs v ["valid"])
299299- else true;
300300-301301- lib.addPassthru (derivation (
302302- (removeAttrs attrs
303303- ["meta" "passthru" "crossAttrs" "pos"
304304- "__impureHostDeps" "__propagatedImpureHostDeps"
305305- "sandboxProfile" "propagatedSandboxProfile"])
306306- // (let
307307- # TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
308308- computedSandboxProfile =
309309- lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
310310- computedPropagatedSandboxProfile =
311311- lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
312312- computedImpureHostDeps =
313313- lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
314314- computedPropagatedImpureHostDeps =
315315- lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
316316- in
317317- {
318318- builder = attrs.realBuilder or shell;
319319- args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
320320- stdenv = result;
321321- system = result.system;
322322- userHook = config.stdenv.userHook or null;
323323- __ignoreNulls = true;
324324-325325- nativeBuildInputs = lib.elemAt dependencies' 0;
326326- buildInputs = lib.elemAt dependencies' 1;
327327-328328- propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
329329- propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
330330- } // ifDarwin {
331331- # TODO: remove lib.unique once nix has a list canonicalization primitive
332332- __sandboxProfile =
333333- let profiles = [ extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
334334- final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
335335- in final;
336336- __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
337337- __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [
338338- "/dev/zero"
339339- "/dev/random"
340340- "/dev/urandom"
341341- "/bin/sh"
342342- ];
343343- __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
344344- } // (if outputs' != [ "out" ] then {
345345- outputs = outputs';
346346- } else { })))) (
347347- {
348348- overrideAttrs = f: mkDerivation (attrs // (f attrs));
349349- # The meta attribute is passed in the resulting attribute set,
350350- # but it's not part of the actual derivation, i.e., it's not
351351- # passed to the builder and is not a dependency. But since we
352352- # include it in the result, it *is* available to nix-env for queries.
353353- meta = { }
354354- # If the packager hasn't specified `outputsToInstall`, choose a default,
355355- # which is the name of `p.bin or p.out or p`;
356356- # if he has specified it, it will be overridden below in `// meta`.
357357- # Note: This default probably shouldn't be globally configurable.
358358- # Services and users should specify outputs explicitly,
359359- # unless they are comfortable with this default.
360360- // { outputsToInstall =
361361- let
362362- outs = outputs'; # the value passed to derivation primitive
363363- hasOutput = out: builtins.elem out outs;
364364- in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
365365- }
366366- // meta
367367- # Fill `meta.position` to identify the source location of the package.
368368- // lib.optionalAttrs (pos' != null)
369369- { position = pos'.file + ":" + toString pos'.line; }
370370- ;
371371- inherit passthru;
372372- } //
373373- # Pass through extra attributes that are not inputs, but
374374- # should be made available to Nix expressions using the
375375- # derivation (e.g., in assertions).
376376- passthru);
377377-37861 # The stdenv that we are producing.
379379- result =
6262+ stdenv =
38063 derivation (
38164 (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
38265 {
383383- inherit system name;
6666+ inherit name;
6767+6868+ # Nix itself uses the `system` field of a derivation to decide where to
6969+ # build it. This is a bit confusing for cross compilation.
7070+ inherit (buildPlatform) system;
3847138572 builder = shell;
38673···3907739178 inherit preHook initialPath shell defaultNativeBuildInputs;
39279 }
393393- // ifDarwin {
8080+ // lib.optionalAttrs buildPlatform.isDarwin {
39481 __sandboxProfile = stdenvSandboxProfile;
39582 __impureHostDeps = __stdenvImpureHostDeps;
39683 })
···40289 platforms = lib.platforms.all;
40390 };
404919292+ inherit buildPlatform hostPlatform targetPlatform;
9393+9494+ inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
9595+40596 # Utility flags to test the type of platform.
40697 inherit (hostPlatform)
40798 isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
···412103 # Whether we should run paxctl to pax-mark binaries.
413104 needsPax = isLinux;
414105415415- inherit mkDerivation;
106106+ inherit (import ./make-derivation.nix {
107107+ inherit lib config stdenv;
108108+ }) mkDerivation;
416109417110 # For convenience, bring in the library functions in lib/ so
418111 # packages don't have to do that themselves.
···431124 # like curl = if stdenv ? curl then stdenv.curl else ...).
432125 // extraAttrs;
433126434434-in result)
127127+in stdenv)
+150
pkgs/stdenv/generic/make-derivation.nix
···11+{ lib, config, stdenv }:
22+33+rec {
44+ # `mkDerivation` wraps the builtin `derivation` function to
55+ # produce derivations that use this stdenv and its shell.
66+ #
77+ # See also:
88+ #
99+ # * https://nixos.org/nixpkgs/manual/#sec-using-stdenv
1010+ # Details on how to use this mkDerivation function
1111+ #
1212+ # * https://nixos.org/nix/manual/#ssec-derivation
1313+ # Explanation about derivations in general
1414+ mkDerivation =
1515+ { nativeBuildInputs ? []
1616+ , buildInputs ? []
1717+1818+ , propagatedNativeBuildInputs ? []
1919+ , propagatedBuildInputs ? []
2020+2121+ , crossConfig ? null
2222+ , meta ? {}
2323+ , passthru ? {}
2424+ , pos ? # position used in error messages and for meta.position
2525+ (if attrs.meta.description or null != null
2626+ then builtins.unsafeGetAttrPos "description" attrs.meta
2727+ else builtins.unsafeGetAttrPos "name" attrs)
2828+ , separateDebugInfo ? false
2929+ , outputs ? [ "out" ]
3030+ , __impureHostDeps ? []
3131+ , __propagatedImpureHostDeps ? []
3232+ , sandboxProfile ? ""
3333+ , propagatedSandboxProfile ? ""
3434+ , ... } @ attrs:
3535+ let
3636+ dependencies = [
3737+ (map (drv: drv.nativeDrv or drv) nativeBuildInputs)
3838+ (map (drv: drv.crossDrv or drv) buildInputs)
3939+ ];
4040+ propagatedDependencies = [
4141+ (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
4242+ (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
4343+ ];
4444+ in let
4545+4646+ outputs' =
4747+ outputs ++
4848+ (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
4949+5050+ dependencies' = let
5151+ justMap = map lib.chooseDevOutputs dependencies;
5252+ nativeBuildInputs = lib.elemAt justMap 0
5353+ ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
5454+ buildInputs = lib.elemAt justMap 1
5555+ # TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
5656+ ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
5757+ in [ nativeBuildInputs buildInputs ];
5858+5959+ propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
6060+6161+ derivationArg =
6262+ (removeAttrs attrs
6363+ ["meta" "passthru" "crossAttrs" "pos"
6464+ "__impureHostDeps" "__propagatedImpureHostDeps"
6565+ "sandboxProfile" "propagatedSandboxProfile"])
6666+ // (let
6767+ # TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
6868+ computedSandboxProfile =
6969+ lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
7070+ computedPropagatedSandboxProfile =
7171+ lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
7272+ computedImpureHostDeps =
7373+ lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
7474+ computedPropagatedImpureHostDeps =
7575+ lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
7676+ in
7777+ {
7878+ builder = attrs.realBuilder or stdenv.shell;
7979+ args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
8080+ inherit stdenv;
8181+ inherit (stdenv) system;
8282+ userHook = config.stdenv.userHook or null;
8383+ __ignoreNulls = true;
8484+8585+ nativeBuildInputs = lib.elemAt dependencies' 0;
8686+ buildInputs = lib.elemAt dependencies' 1;
8787+8888+ propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
8989+ propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
9090+ } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
9191+ # TODO: remove lib.unique once nix has a list canonicalization primitive
9292+ __sandboxProfile =
9393+ let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
9494+ final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
9595+ in final;
9696+ __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
9797+ __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
9898+ "/dev/zero"
9999+ "/dev/random"
100100+ "/dev/urandom"
101101+ "/bin/sh"
102102+ ];
103103+ __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
104104+ } // (if outputs' != [ "out" ] then {
105105+ outputs = outputs';
106106+ } else { }));
107107+108108+ # The meta attribute is passed in the resulting attribute set,
109109+ # but it's not part of the actual derivation, i.e., it's not
110110+ # passed to the builder and is not a dependency. But since we
111111+ # include it in the result, it *is* available to nix-env for queries.
112112+ meta = { }
113113+ # If the packager hasn't specified `outputsToInstall`, choose a default,
114114+ # which is the name of `p.bin or p.out or p`;
115115+ # if he has specified it, it will be overridden below in `// meta`.
116116+ # Note: This default probably shouldn't be globally configurable.
117117+ # Services and users should specify outputs explicitly,
118118+ # unless they are comfortable with this default.
119119+ // { outputsToInstall =
120120+ let
121121+ outs = outputs'; # the value passed to derivation primitive
122122+ hasOutput = out: builtins.elem out outs;
123123+ in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
124124+ }
125125+ // attrs.meta or {}
126126+ # Fill `meta.position` to identify the source location of the package.
127127+ // lib.optionalAttrs (pos != null)
128128+ { position = pos.file + ":" + toString pos.line; }
129129+ ;
130130+131131+ in
132132+133133+ lib.addPassthru
134134+ (derivation (import ./check-meta.nix
135135+ {
136136+ inherit lib config meta derivationArg;
137137+ mkDerivationArg = attrs;
138138+ # Nix itself uses the `system` field of a derivation to decide where
139139+ # to build it. This is a bit confusing for cross compilation.
140140+ inherit (stdenv) system;
141141+ }))
142142+ ( {
143143+ overrideAttrs = f: mkDerivation (attrs // (f attrs));
144144+ inherit meta passthru;
145145+ } //
146146+ # Pass through extra attributes that are not inputs, but
147147+ # should be made available to Nix expressions using the
148148+ # derivation (e.g., in assertions).
149149+ passthru);
150150+}
···11+{ stdenv, fetchurl, libiconv, libshout, taglib, libxml2, pkgconfig }:
22+33+stdenv.mkDerivation rec {
44+ name = "ezstream-${version}";
55+ version = "0.6.0";
66+77+ src = fetchurl {
88+ url = "https://ftp.osuosl.org/pub/xiph/releases/ezstream/${name}.tar.gz";
99+ sha256 = "f86eb8163b470c3acbc182b42406f08313f85187bd9017afb8b79b02f03635c9";
1010+ };
1111+1212+ buildInputs = [ libiconv libshout taglib libxml2 ];
1313+ nativeBuildInputs = [ pkgconfig ];
1414+1515+ doCheck = true;
1616+1717+ meta = with stdenv.lib; {
1818+ description = "A command line source client for Icecast media streaming servers";
1919+ longDescription = ''
2020+ Ezstream is a command line source client for Icecast media
2121+ streaming servers. It began as the successor of the old "shout"
2222+ utility, and has since gained a lot of useful features.
2323+2424+ In its basic mode of operation, it streams media files or data
2525+ from standard input without reencoding and thus requires only
2626+ very little CPU resources.
2727+ '';
2828+ homepage = http://icecast.org/ezstream/;
2929+ license = licenses.gpl2;
3030+ maintainers = [ maintainers.barrucadu ];
3131+ platforms = platforms.all;
3232+ };
3333+}
+4
pkgs/tools/filesystems/btrfs-progs/default.nix
···2121 # This should be fine on all platforms so apply universally
2222 patchPhase = "sed -i s/-O1/-O2/ configure";
23232424+ postInstall = ''
2525+ install -v -m 444 -D btrfs-completion $out/etc/bash_completion.d/btrfs
2626+ '';
2727+2428 meta = with stdenv.lib; {
2529 description = "Utilities for the btrfs filesystem";
2630 homepage = https://btrfs.wiki.kernel.org/;
+2-2
pkgs/tools/filesystems/mergerfs/default.nix
···2233stdenv.mkDerivation rec {
44 name = "mergerfs-${version}";
55- version = "2.22.1";
55+ version = "2.23.0";
6677 # not using fetchFromGitHub because of changelog being built with git log
88 src = fetchgit {
99 url = "https://github.com/trapexit/mergerfs";
1010 rev = "refs/tags/${version}";
1111- sha256 = "12dm64l74wyagbwxsz57p8j3dwl9hgi0j3b6i0pn9m5ar7qrnv00";
1111+ sha256 = "0k4nn0f4c355q7hnni7iia8qi9m0khvyd04hx1hmlrnf0zsi9mfw";
1212 deepClone = true;
1313 leaveDotGit = true;
1414 };
···5656 # Other Beam languages. These are built with `beam.interpreters.erlang`. To
5757 # access for example elixir built with different version of Erlang, use
5858 # `beam.packages.erlangR19.elixir`.
5959- elixir = packages.erlang.elixir;
5959+ inherit (packages.erlang) elixir elixir_1_5_rc elixir_1_4 elixir_1_3;
6060+6061 lfe = packages.erlang.lfe;
6162 };
6263
···1818, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
1919 nixpkgsFun
20202121- ## Platform parameters
2222- ##
2323- ## The "build" "host" "target" terminology below comes from GNU Autotools. See
2424- ## its documentation for more information on what those words mean. Note that
2525- ## each should always be defined, even when not cross compiling.
2626- ##
2727- ## For purposes of bootstrapping, think of each stage as a "sliding window"
2828- ## over a list of platforms. Specifically, the host platform of the previous
2929- ## stage becomes the build platform of the current one, and likewise the
3030- ## target platform of the previous stage becomes the host platform of the
3131- ## current one.
3232- ##
3333-3434-, # The platform on which packages are built. Consists of `system`, a
3535- # string (e.g.,`i686-linux') identifying the most import attributes of the
3636- # build platform, and `platform` a set of other details.
3737- buildPlatform
3838-3939-, # The platform on which packages run.
4040- hostPlatform
4141-4242-, # The platform which build tools (especially compilers) build for in this stage,
4343- targetPlatform
4444-4521 ## Other parameters
4622 ##
4723···6945, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
7046 # outside of the store. Thus, GCC, GFortran, & co. must always look for files
7147 # in standard system directories (/usr/include, etc.)
7272- noSysDirs ? buildPlatform.system != "x86_64-freebsd"
7373- && buildPlatform.system != "i686-freebsd"
7474- && buildPlatform.system != "x86_64-solaris"
7575- && buildPlatform.system != "x86_64-kfreebsd-gnu"
4848+ noSysDirs ? stdenv.buildPlatform.system != "x86_64-freebsd"
4949+ && stdenv.buildPlatform.system != "i686-freebsd"
5050+ && stdenv.buildPlatform.system != "x86_64-solaris"
5151+ && stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu"
76527753, # The configuration attribute set
7854 config
···9874 // { recurseForDerivations = false; };
9975 __targetPackages = (if __targetPackages == null then self else __targetPackages)
10076 // { recurseForDerivations = false; };
101101- inherit stdenv
102102- buildPlatform hostPlatform targetPlatform;
7777+ inherit stdenv;
10378 };
1047910580 # The old identifiers for cross-compiling. These should eventually be removed,
10681 # and the packages that rely on them refactored accordingly.
10782 platformCompat = self: super: let
108108- # TODO(@Ericson2314) this causes infinite recursion
109109- #inherit (self) buildPlatform hostPlatform targetPlatform;
8383+ inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
11084 in {
11185 stdenv = super.stdenv // {
112112- inherit (buildPlatform) platform;
8686+ inherit (super.stdenv.buildPlatform) platform;
11387 };
8888+ inherit buildPlatform hostPlatform targetPlatform;
11489 inherit (buildPlatform) system platform;
11590 };
11691