minimal-bootstrap: dont use top-level newScope to prevent accidentally using top-level attrs

Co-authored-by: Emily Trau <me@angus.ws>
This commit is contained in:
Artturin 2023-05-02 20:52:13 +03:00 committed by Emily Trau
parent 365597483f
commit 06e21ebba5
3 changed files with 26 additions and 20 deletions

View file

@ -1,20 +1,26 @@
{ lib
, newScope
, stdenv
, config
, buildPlatform
, hostPlatform
}:
lib.makeScope newScope (self: with self; {
fetchurl = import ../../../build-support/fetchurl/boot.nix {
inherit (stdenv.buildPlatform) system;
};
lib.makeScope
# Prevent using top-level attrs to protect against introducing dependency on
# non-bootstrap packages by mistake. Any top-level inputs must be explicitly
# declared here.
(extra: lib.callPackageWith ({ inherit lib config buildPlatform hostPlatform; } // extra))
(self: with self; {
fetchurl = import ../../../build-support/fetchurl/boot.nix {
inherit (buildPlatform) system;
};
inherit (callPackage ./stage0-posix { }) kaem m2libc mescc-tools mescc-tools-extra writeTextFile writeText runCommand;
inherit (callPackage ./stage0-posix { }) kaem m2libc mescc-tools mescc-tools-extra writeTextFile writeText runCommand;
mes = callPackage ./mes { };
inherit (mes) mes-libc;
mes = callPackage ./mes { };
inherit (mes) mes-libc;
ln-boot = callPackage ./ln-boot { };
ln-boot = callPackage ./ln-boot { };
tinycc-bootstrappable = callPackage ./tinycc/bootstrappable.nix { };
tinycc-mes = callPackage ./tinycc/mes.nix { };
})
tinycc-bootstrappable = callPackage ./tinycc/bootstrappable.nix { };
tinycc-mes = callPackage ./tinycc/mes.nix { };
})

View file

@ -1,7 +1,6 @@
{ lib
, stdenv
, buildPlatform
, callPackage
, fetchurl
, kaem
, kaem-unwrapped
, mescc-tools
@ -9,9 +8,7 @@
}:
let
checkMeta = callPackage ../../../../stdenv/generic/check-meta.nix {
inherit (stdenv) hostPlatform;
};
checkMeta = callPackage ../../../../stdenv/generic/check-meta.nix { };
in
rec {
derivationWithMeta = attrs:
@ -24,7 +21,7 @@ rec {
validity.handled
({ inherit meta passthru; } // passthru)
(derivation ({
inherit (stdenv.buildPlatform) system;
inherit (buildPlatform) system;
inherit (meta) name;
} // (builtins.removeAttrs attrs [ "meta" "passthru" ])));

View file

@ -26943,7 +26943,10 @@ with pkgs;
metastore = callPackage ../os-specific/linux/metastore { };
minimal-bootstrap = recurseIntoAttrs (callPackage ../os-specific/linux/minimal-bootstrap { });
minimal-bootstrap = recurseIntoAttrs (import ../os-specific/linux/minimal-bootstrap {
inherit (stdenv) buildPlatform hostPlatform;
inherit lib config;
});
mingetty = callPackage ../os-specific/linux/mingetty { };