summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2025-01-23 08:27:29 +0100
committerRobert Hensing <robert@roberthensing.nl>2025-01-23 08:27:29 +0100
commit0f9034d8b5c5c26f42a6b036d171044d4b11fb5d (patch)
tree094ad43f12d19e9a85d1e1c3c715e05de20be8ef /flake.nix
parentpython312Packages.pytapo: 3.3.37 -> 3.3.38 (#373943) (diff)
downloadnixpkgs-0f9034d8b5c5c26f42a6b036d171044d4b11fb5d.tar.gz
lib: Discourage use of extend
It creates interoperability issues that can not be reconciled by `lib` or maintainers of projects that use the Nixpkgs library. Occasionally, end users may be able to solve the problems they run into, but most are not prepared to deal with this set of problems, nor should they be. Typical conflict: - User wants to propagate their own lib, because it has some function they like to use throughout their projects - Project maintainer requires the project's lib to be used No sane language uses a single namespace for combining all the things. (Arguably not even C with its extensive use of prefixing) Meanwhile, in Nix, all symbols are first class variables. We don't even have the concept of a global top-level namespace to pour everything into. With `lib` you can try to approximate that, I get the appeal of its apparent simplicity, but since `lib` can't be global, we just don't even get that apparent simplicity. I apologize for not offering concrete solutions to this in the text. The manuals are limited to reference documentation. Alternatives - of which we have multiple - are best provided in task-oriented documentation, e.g. nix.dev.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 8510ce7e69bd..83ae9decf803 100644
--- a/flake.nix
+++ b/flake.nix
@@ -24,6 +24,8 @@
- `lib.nixos` for other NixOS-provided functionality, such as [`runTest`](https://nixos.org/manual/nixos/unstable/#sec-call-nixos-test-outside-nixos)
*/
+ # DON'T USE lib.extend TO ADD NEW FUNCTIONALITY.
+ # THIS WAS A MISTAKE. See the warning in lib/default.nix.
lib = lib.extend (final: prev: {
/**