package.nix: migrate the main nix itself!

Change-Id: Ib36e4f3857fa6473f04b1f2cc7537edad15ae8db
This commit is contained in:
Qyriad 2024-03-05 13:33:34 -07:00
parent b73cce7cc0
commit ff3a105e3c
2 changed files with 38 additions and 35 deletions

View file

@ -144,6 +144,8 @@
busybox-sandbox-shell = sh;
};
inherit boehmgc-nix;
# Use "busybox-sandbox-shell" if present,
# if not (legacy) fallback and hope it's sufficient.
sh = pkgs.busybox-sandbox-shell or (busybox.override {
@ -369,41 +371,38 @@
# Forward from the previous stage as we dont want it to pick the lowdown override
nixUnstable = prev.nixUnstable;
nix = let
canRunInstalled = currentStdenv.buildPlatform.canExecute currentStdenv.hostPlatform;
in currentStdenv.mkDerivation (finalAttrs: {
name = "nix-${version}";
inherit version;
inherit (comDeps) boehmgc-nix;
inherit (comDeps.calledPackage.finalAttrs)
src
VERSION_SUFFIX
outputs
nativeBuildInputs
buildInputs
propagatedBuildInputs
disallowedReferences
preConfigure
configureFlags
enableParallelBuilding
makeFlags
doCheck
installFlags
postInstall
doInstallCheck
installCheckFlags
installCheckTarget
separateDebugInfo
strictDeps
hardeningDisable
meta
;
default-busybox-sandbox-shell = final.busybox.override {
useMusl = true;
enableStatic = true;
enableMinimal = true;
extraConfig = ''
CONFIG_FEATURE_FANCY_ECHO y
CONFIG_FEATURE_SH_MATH y
CONFIG_FEATURE_SH_MATH_64 y
passthru.perl-bindings = final.callPackage ./perl {
inherit fileset;
stdenv = currentStdenv;
CONFIG_ASH y
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
CONFIG_ASH_ALIAS y
CONFIG_ASH_BASH_COMPAT y
CONFIG_ASH_CMDCMD y
CONFIG_ASH_ECHO y
CONFIG_ASH_GETOPTS y
CONFIG_ASH_INTERNAL_GLOB y
CONFIG_ASH_JOB_CONTROL y
CONFIG_ASH_PRINTF y
CONFIG_ASH_TEST y
'';
};
nix = final.callPackage ./package.nix {
inherit (final) stdenv;
inherit versionSuffix fileset;
boehmgc = final.boehmgc-nix;
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
};
});
};
in {

View file

@ -1,4 +1,5 @@
{
pkgs,
lib,
stdenv,
buildPackages,
@ -139,10 +140,10 @@ in stdenv.mkDerivation (finalAttrs: {
# TODO(Qyriad): Should this also have && (stdenv.isLinux || stdenv.isDarwin), as upstream does?
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) aws-sdk-cpp-nix
# FIXME(Qyriad): This is how the flake.nix version does it, but this is cursed.
++ lib.optionals (finalAttrs.doCheck) finalAttrs._checkInputs
++ lib.optionals (finalAttrs.doCheck) finalAttrs.passthru._checkInputs
;
_checkInputs = [
passthru._checkInputs = [
gtest
rapidcheck
];
@ -230,4 +231,7 @@ in stdenv.mkDerivation (finalAttrs: {
# FIXME: Used to make checkInputs accessible from outside the derivation args
# during the refactor.
passthru.finalAttrs = finalAttrs;
passthru.perl-bindings = pkgs.callPackage ./perl {
inherit fileset stdenv;
};
})