pkgs/default.nix: simplify (no need for the scope)

This commit is contained in:
Colin 2023-05-17 23:17:24 +00:00
parent 2db988b67c
commit 85c8292f9a
2 changed files with 16 additions and 9 deletions

View File

@ -3,6 +3,5 @@
# - `additional` packages
# - `patched` versions of nixpkgs (which necessarily shadow their nixpkgs version)
# - `pythonPackagesExtensions`
import ../pkgs
{ pkgs = next; lib = prev.lib; unpatched = prev; }
import ../pkgs { pkgs = prev; final = next; }
)

View File

@ -1,14 +1,22 @@
{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib, unpatched ? pkgs }:
# this supports being used as an overlay or in a standalone context
# - if overlay, invoke as `(final: prev: import ./. { inherit final; pkgs = prev; })`
# - if standalone: `import ./. { inherit pkgs; }`
#
# using the correct invocation is critical if any packages mentioned here are
# additionally patched elsewhere
#
{ pkgs ? import <nixpkgs> {}, final ? null }:
let
lib = pkgs.lib;
unpatched = pkgs;
pythonPackagesOverlay = py-final: py-prev: import ./python-packages {
inherit (py-final) callPackage;
};
# this scope ensures that my packages can all take each other as inputs,
# even when evaluated bare (i.e. outside of an overlay)
sane = lib.makeScope pkgs.newScope (self: with self; {
final' = if final != null then final else (pkgs // sane);
sane = with final'; {
sane-data = import ../modules/data { inherit lib; };
sane-lib = import ../modules/lib pkgs;
sane-lib = import ../modules/lib final';
### ADDITIONAL PACKAGES
bootpart-uefi-x86_64 = callPackage ./additional/bootpart-uefi-x86_64 { };
@ -80,5 +88,5 @@ let
python3 = unpatched.python3.override {
packageOverrides = pythonPackagesOverlay;
};
});
in sane.packages sane
};
in sane