NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.28k stars 13.53k forks source link

Investigate returning __splicedPackages when importing nixpkgs #251005

Open Artturin opened 1 year ago

Artturin commented 1 year ago

The NixOS module for Nixpkgs does this since https://github.com/NixOS/nixpkgs/pull/190358. Should all callers of Nixpkgs do so? If so, make Nixpkgs always return __splicedPackages.

infinisil commented 1 year ago

I have a theory that we could do something like this to essentially fix all splicing problems:

diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 3886ae04e492..e95a303bdc1a 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -288,4 +288,4 @@ let

 in
   # Return the complete set of packages.
-  lib.fix toFix
+  lib.fix (x: toFix (splicePackages x))