package: cleanup of all intermediaries

Change-Id: I0da5182de6b01c192cfcba407959d659d70c6dc9
This commit is contained in:
Qyriad 2024-03-09 01:22:06 -07:00
parent 5afa84342c
commit a98500320e
2 changed files with 20 additions and 159 deletions

169
flake.nix
View file

@ -48,50 +48,6 @@
})
stdenvs);
baseFiles =
# .gitignore has already been processed, so any changes in it are irrelevant
# at this point. It is not represented verbatim for test purposes because
# that would interfere with repo semantics.
fileset.fileFilter (f: f.name != ".gitignore") ./.;
configureFiles = fileset.unions [
./.version
./configure.ac
./m4
# TODO: do we really need README.md? It doesn't seem used in the build.
./README.md
];
topLevelBuildFiles = fileset.unions [
./local.mk
./Makefile
./Makefile.config.in
./mk
];
functionalTestFiles = fileset.unions [
./tests/functional
./tests/unit
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
];
nixSrc = fileset.toSource {
root = ./.;
fileset = fileset.intersection baseFiles (fileset.unions [
configureFiles
topLevelBuildFiles
./boehmgc-coroutine-sp-fallback.diff
./doc
./misc
./precompiled-headers.h
./src
./unit-test-data
./COPYING
./scripts/local.mk
functionalTestFiles
]);
};
# Memoize nixpkgs for different platforms for efficiency.
nixpkgsFor = forAllSystems
(system: let
@ -118,97 +74,6 @@
cross = forAllCrossSystems (crossSystem: make-pkgs crossSystem "stdenv");
});
commonDeps = {
pkgs,
isStatic ? pkgs.stdenv.hostPlatform.isStatic
}: let
inherit (pkgs) stdenv buildPackages
busybox curl bzip2 xz brotli editline openssl sqlite libarchive boost
libseccomp libsodium libcpuid gtest rapidcheck aws-sdk-cpp boehmgc nlohmann_json
lowdown;
changelog-d = pkgs.buildPackages.callPackage ./misc/changelog-d.nix { };
boehmgc-nix = (boehmgc.override {
enableLargeConfig = true;
}).overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
./boehmgc-coroutine-sp-fallback.diff
# https://github.com/ivmai/bdwgc/pull/586
./boehmgc-traceable_allocator-public.diff
];
});
in rec {
calledPackage = pkgs.callPackage ./package.nix {
inherit stdenv versionSuffix fileset changelog-d officialRelease buildUnreleasedNotes lowdown;
boehmgc = boehmgc-nix;
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 {
useMusl = true;
enableStatic = true;
enableMinimal = true;
extraConfig = ''
CONFIG_FEATURE_FANCY_ECHO y
CONFIG_FEATURE_SH_MATH y
CONFIG_FEATURE_SH_MATH_64 y
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
'';
});
configureFlags =
lib.optionals stdenv.isLinux [
"--with-boost=${boost}/lib"
"--with-sandbox-shell=${sh}/bin/busybox"
]
++ lib.optionals (stdenv.isLinux && !(isStatic && stdenv.system == "aarch64-linux")) [
"LDFLAGS=-fuse-ld=gold"
];
testConfigureFlags = [
"RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include"
];
internalApiDocsConfigureFlags = [
"--enable-internal-api-docs"
];
inherit changelog-d;
nativeBuildDeps = calledPackage.nativeBuildInputs;
buildDeps = calledPackage.buildInputs;
checkDeps = calledPackage.finalAttrs.passthru._checkInputs;
internalApiDocsDeps = [
buildPackages.doxygen
];
awsDeps = lib.optional (stdenv.isLinux || stdenv.isDarwin)
(aws-sdk-cpp.override {
apis = ["s3" "transfer"];
customMemoryManagement = false;
});
propagatedDeps = calledPackage.propagatedBuildInputs;
};
installScriptFor = systems:
with nixpkgsFor.x86_64-linux.native;
runCommand "installer-script"
@ -353,20 +218,23 @@
'';
overlayFor = getStdenv: final: prev:
let
currentStdenv = getStdenv final;
comDeps = with final; commonDeps {
inherit pkgs;
inherit (currentStdenv.hostPlatform) isStatic;
};
inherit (final) stdenv boost;
in {
{
nixStable = prev.nix;
# Forward from the previous stage as we dont want it to pick the lowdown override
nixUnstable = prev.nixUnstable;
inherit (comDeps) boehmgc-nix;
changelog-d = final.buildPackages.callPackage ./misc/changelog-d.nix { };
boehmgc-nix = (final.boehmgc.override {
enableLargeConfig = true;
}).overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
./boehmgc-coroutine-sp-fallback.diff
# https://github.com/ivmai/bdwgc/pull/586
./boehmgc-traceable_allocator-public.diff
];
});
default-busybox-sandbox-shell = final.busybox.override {
useMusl = true;
@ -425,13 +293,12 @@
internal-api-docs = let
nixpkgs = nixpkgsFor.x86_64-linux.native;
inherit (nixpkgs) pkgs;
comDeps = commonDeps { inherit pkgs; };
nix = nixpkgs.pkgs.callPackage ./package.nix {
nix = pkgs.callPackage ./package.nix {
inherit versionSuffix fileset officialRelease buildUnreleasedNotes;
inherit (comDeps) changelog-d;
boehmgc = comDeps.boehmgc-nix;
busybox-sandbox-shell = comDeps.sh;
inherit (pkgs) changelog-d;
boehmgc = pkgs.boehmgc-nix;
busybox-sandbox-shell = pkgs.busybox-sandbox-shell;
};
in
nix.overrideAttrs (prev: {
@ -444,7 +311,7 @@
# Depropagate the build inputs for the docs build.
propagatedBuildInputs = [ ];
buildInputs = prev.buildInputs ++ comDeps.internalApiDocsDeps ++ [
buildInputs = prev.buildInputs ++ [ pkgs.buildPackages.doxygen ] ++ [
pkgs.gtest
pkgs.rapidcheck
] ++ prev.propagatedBuildInputs;
@ -518,7 +385,7 @@
rl-next =
let pkgs = nixpkgsFor.${system}.native;
in pkgs.buildPackages.runCommand "test-rl-next-release-notes" { } ''
LANG=C.UTF-8 ${(commonDeps { inherit pkgs; }).changelog-d}/bin/changelog-d ${./doc/manual/rl-next} >$out
LANG=C.UTF-8 ${pkgs.changelog-d}/bin/changelog-d ${./doc/manual/rl-next} >$out
'';
} // (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
dockerImage = self.hydraJobs.dockerImage.${system};

View file

@ -35,7 +35,7 @@
utillinuxMinimal ? null,
xz,
busybox-sandbox-shell ? null,
busybox-sandbox-shell,
pname ? "nix",
versionSuffix ? "",
@ -152,18 +152,13 @@ in stdenv.mkDerivation (finalAttrs: {
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
# There have been issues building these dependencies
++ 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.passthru._checkInputs
;
passthru._checkInputs = [
checkInputs = [
gtest
rapidcheck
];
# FIXME(Qyriad): remove at the end of refactoring.
checkInputs = finalAttrs.passthru._checkInputs;
propagatedBuildInputs = [
boehmgc
nlohmann_json
@ -244,7 +239,6 @@ in stdenv.mkDerivation (finalAttrs: {
meta.platforms = lib.platforms.unix;
passthru.finalAttrs = finalAttrs;
passthru.perl-bindings = pkgs.callPackage ./perl {
inherit fileset stdenv;
};