aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-03-09 01:22:06 -0700
committerQyriad <qyriad@qyriad.me>2024-03-11 04:26:35 -0600
commit36a8d151e10d5d7e37eb9a7102c8ebf2455e4a57 (patch)
treea6d1bf5efde01b50398257832a6808bdb53d46a9
parent529a01ade2b5cd19f0013e1cf030d59dd88532fe (diff)
package: cleanup of all intermediaries
Change-Id: I0da5182de6b01c192cfcba407959d659d70c6dc9
-rw-r--r--flake.nix158
-rw-r--r--package.nix18
2 files changed, 25 insertions, 151 deletions
diff --git a/flake.nix b/flake.nix
index d3033ca05..8fde05179 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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"
@@ -365,7 +230,17 @@
# Forward from the previous stage as we don’t 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;
@@ -424,14 +299,13 @@
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;
+ inherit (pkgs) changelog-d;
internalApiDocs = true;
- boehmgc = comDeps.boehmgc-nix;
- busybox-sandbox-shell = comDeps.sh;
+ boehmgc = pkgs.boehmgc-nix;
+ busybox-sandbox-shell = pkgs.busybox-sandbox-shell;
};
in
nix.overrideAttrs (prev: {
@@ -490,7 +364,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};
diff --git a/package.nix b/package.nix
index 73e887d8d..06d644627 100644
--- a/package.nix
+++ b/package.nix
@@ -36,7 +36,7 @@
utillinuxMinimal ? null,
xz,
- busybox-sandbox-shell ? null,
+ busybox-sandbox-shell,
pname ? "nix",
versionSuffix ? "",
@@ -162,19 +162,14 @@ 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
++ lib.optionals (finalAttrs.dontBuild) maybePropagatedInputs
;
- passthru._checkInputs = [
+ checkInputs = [
gtest
rapidcheck
];
- # FIXME(Qyriad): remove at the end of refactoring.
- checkInputs = finalAttrs.passthru._checkInputs;
-
propagatedBuildInputs = lib.optionals (!finalAttrs.dontBuild) maybePropagatedInputs;
disallowedReferences = [
@@ -197,6 +192,13 @@ in stdenv.mkDerivation (finalAttrs: {
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
done
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
+ '' + ''
+ # Workaround https://github.com/NixOS/nixpkgs/issues/294890.
+ if [[ -n "''${doCheck:-}" ]]; then
+ appendToVar configureFlags "--enable-tests"
+ else
+ appendToVar configureFlags "--disable-tests"
+ fi
'';
configureFlags = lib.optionals stdenv.isLinux [
@@ -206,7 +208,6 @@ in stdenv.mkDerivation (finalAttrs: {
"LDFLAGS=-fuse-ld=gold"
] ++ [ "--sysconfdir=/etc" ]
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
- ++ [ (lib.enableFeature finalAttrs.doCheck "tests") ]
++ lib.optionals (finalAttrs.doCheck || internalApiDocs) testConfigureFlags
++ lib.optional (!canRunInstalled) "--disable-doc-gen"
++ [ (lib.enableFeature internalApiDocs "internal-api-docs") ]
@@ -254,7 +255,6 @@ in stdenv.mkDerivation (finalAttrs: {
meta.platforms = lib.platforms.unix;
- passthru.finalAttrs = finalAttrs;
passthru.perl-bindings = pkgs.callPackage ./perl {
inherit fileset stdenv;
};