From ff3a105e3ccc0175163028f48dfb99fc1d15fe79 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Tue, 5 Mar 2024 13:33:34 -0700 Subject: [PATCH] package.nix: migrate the main nix itself! Change-Id: Ib36e4f3857fa6473f04b1f2cc7537edad15ae8db --- flake.nix | 65 ++++++++++++++++++++++++++--------------------------- package.nix | 8 +++++-- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/flake.nix b/flake.nix index 62a735653..ed8ca4241 100644 --- a/flake.nix +++ b/flake.nix @@ -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 don’t 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 { diff --git a/package.nix b/package.nix index 10469e156..38b4f96ae 100644 --- a/package.nix +++ b/package.nix @@ -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; + }; })