From 19d48a925778a524a970ca06cabc45ade3f82474 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 8 Apr 2023 00:33:11 -0700 Subject: [PATCH 1/4] doc/stdenv/meta.chapter.md: explain difference between broken and badPlatforms There has been a longstanding ambiguity between `broken` and `badPlatforms`, which seem to serve overlapping purposes. This commit adds to the documentation two examples of constraints which cannot be expressed by `platforms` and `badPlatforms`. This commit also mentions `NIXPKGS_ALLOW_BROKEN=1` for overriding `broken`. --- doc/stdenv/meta.chapter.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index 0b4777efdb8..f4e9a5d4f9b 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -182,7 +182,9 @@ meta.hydraPlatforms = []; ### `broken` {#var-meta-broken} -If set to `true`, the package is marked as "broken", meaning that it won’t show up in `nix-env -qa`, and cannot be built or installed. Such packages should be removed from Nixpkgs eventually unless they are fixed. +If set to `true`, the package is marked as "broken", meaning that it won’t show up in `nix-env -qa`, and cannot be built or installed unless the environment variable `NIXPKGS_ALLOW_BROKEN` is set. Such unconditionally-broken packages should be removed from Nixpkgs eventually unless they are fixed. + +The value of this attribute can depend on a package's arguments, including `stdenv`. This means that `broken` can be used to express constraints such as "does not cross compile" (`meta.broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)`) or "broken if all of a certain set of its dependencies are broken". This makes `broken` strictly more powerful than `meta.badPlatforms`. However `meta.availableOn` currently examines only `meta.platforms` and `meta.badPlatforms`, so `meta.broken` does not influence the default values for optional dependencies. ## Licenses {#sec-meta-license} From 467ee31e58ccb79476d815f4131cb283cecd9560 Mon Sep 17 00:00:00 2001 From: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> Date: Mon, 24 Apr 2023 04:30:37 +0000 Subject: [PATCH 2/4] Update doc/stdenv/meta.chapter.md Co-authored-by: Valentin Gagarin --- doc/stdenv/meta.chapter.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index f4e9a5d4f9b..6f58648cdf5 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -182,7 +182,8 @@ meta.hydraPlatforms = []; ### `broken` {#var-meta-broken} -If set to `true`, the package is marked as "broken", meaning that it won’t show up in `nix-env -qa`, and cannot be built or installed unless the environment variable `NIXPKGS_ALLOW_BROKEN` is set. Such unconditionally-broken packages should be removed from Nixpkgs eventually unless they are fixed. +If set to `true`, the package is marked as "broken", meaning that it won’t show up in [search.nixos.org](https://search.nixos.org/packages), and cannot be built or installed unless the environment variable [`NIXPKGS_ALLOW_BROKEN`](#opt-allowBroken) is set. +Such unconditionally-broken packages should be removed from Nixpkgs eventually unless they are fixed. The value of this attribute can depend on a package's arguments, including `stdenv`. This means that `broken` can be used to express constraints such as "does not cross compile" (`meta.broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)`) or "broken if all of a certain set of its dependencies are broken". This makes `broken` strictly more powerful than `meta.badPlatforms`. However `meta.availableOn` currently examines only `meta.platforms` and `meta.badPlatforms`, so `meta.broken` does not influence the default values for optional dependencies. From 401430319c2a5ceb488cfad9a3e4a6207aa5cad7 Mon Sep 17 00:00:00 2001 From: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> Date: Mon, 24 Apr 2023 04:31:38 +0000 Subject: [PATCH 3/4] Update doc/stdenv/meta.chapter.md Co-authored-by: Valentin Gagarin --- doc/stdenv/meta.chapter.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index 6f58648cdf5..1ce44a9065f 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -185,7 +185,23 @@ meta.hydraPlatforms = []; If set to `true`, the package is marked as "broken", meaning that it won’t show up in [search.nixos.org](https://search.nixos.org/packages), and cannot be built or installed unless the environment variable [`NIXPKGS_ALLOW_BROKEN`](#opt-allowBroken) is set. Such unconditionally-broken packages should be removed from Nixpkgs eventually unless they are fixed. -The value of this attribute can depend on a package's arguments, including `stdenv`. This means that `broken` can be used to express constraints such as "does not cross compile" (`meta.broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)`) or "broken if all of a certain set of its dependencies are broken". This makes `broken` strictly more powerful than `meta.badPlatforms`. However `meta.availableOn` currently examines only `meta.platforms` and `meta.badPlatforms`, so `meta.broken` does not influence the default values for optional dependencies. +The value of this attribute can depend on a package's arguments, including `stdenv`. +This means that `broken` can be used to express constraints, for example: + +- Does not cross compile + + ```nix + meta.broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform) + ``` + +- Broken if all of a certain set of its dependencies are broken + + ```nix + meta.broken = lib.all (map (p: p.meta.broken) [ glibc musl ]) + ``` + +This makes `broken` strictly more powerful than `meta.badPlatforms`. +However `meta.availableOn` currently examines only `meta.platforms` and `meta.badPlatforms`, so `meta.broken` does not influence the default values for optional dependencies. ## Licenses {#sec-meta-license} From 75bbbbd39b15341bb54197db321ea37fc6e25b4b Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 23 Apr 2023 21:32:40 -0700 Subject: [PATCH 4/4] remove trailing whitespace --- doc/stdenv/meta.chapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index 1ce44a9065f..30bfb392c93 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -185,7 +185,7 @@ meta.hydraPlatforms = []; If set to `true`, the package is marked as "broken", meaning that it won’t show up in [search.nixos.org](https://search.nixos.org/packages), and cannot be built or installed unless the environment variable [`NIXPKGS_ALLOW_BROKEN`](#opt-allowBroken) is set. Such unconditionally-broken packages should be removed from Nixpkgs eventually unless they are fixed. -The value of this attribute can depend on a package's arguments, including `stdenv`. +The value of this attribute can depend on a package's arguments, including `stdenv`. This means that `broken` can be used to express constraints, for example: - Does not cross compile