2024-06-26 11:41:56 +03:00
|
|
|
# These overrides are applied to the dependencies of the Nix components.
|
|
|
|
|
|
|
|
{
|
|
|
|
# Flake inputs; used for sources
|
|
|
|
inputs,
|
|
|
|
|
|
|
|
# The raw Nixpkgs, not affected by this scope
|
|
|
|
pkgs,
|
|
|
|
|
|
|
|
stdenv,
|
|
|
|
}:
|
2024-06-28 02:30:58 +03:00
|
|
|
|
2024-07-11 16:01:38 +03:00
|
|
|
let
|
|
|
|
prevStdenv = stdenv;
|
|
|
|
in
|
|
|
|
|
2024-06-29 20:28:09 +03:00
|
|
|
let
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
2024-07-06 18:49:58 +03:00
|
|
|
root = ../.;
|
|
|
|
|
2024-07-11 16:01:38 +03:00
|
|
|
stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64
|
|
|
|
then darwinStdenv
|
|
|
|
else prevStdenv;
|
|
|
|
|
|
|
|
# Fix the following error with the default x86_64-darwin SDK:
|
|
|
|
#
|
|
|
|
# error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
|
|
|
|
#
|
|
|
|
# Despite the use of the 10.13 deployment target here, the aligned
|
|
|
|
# allocation function Clang uses with this setting actually works
|
|
|
|
# all the way back to 10.6.
|
|
|
|
darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; };
|
|
|
|
|
2024-07-06 18:49:58 +03:00
|
|
|
# Nixpkgs implements this by returning a subpath into the fetched Nix sources.
|
|
|
|
resolvePath = p: p;
|
|
|
|
|
|
|
|
# Indirection for Nixpkgs to override when package.nix files are vendored
|
|
|
|
filesetToSource = lib.fileset.toSource;
|
|
|
|
|
2024-06-29 20:28:09 +03:00
|
|
|
localSourceLayer = finalAttrs: prevAttrs:
|
|
|
|
let
|
|
|
|
workDirPath =
|
|
|
|
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
|
|
|
|
# the requirement that everything except passthru and meta must be
|
|
|
|
# serialized by mkDerivation, which doesn't work for this.
|
|
|
|
prevAttrs.workDir;
|
|
|
|
|
|
|
|
workDirSubpath = lib.path.removePrefix root workDirPath;
|
|
|
|
sources = assert prevAttrs.fileset._type == "fileset"; prevAttrs.fileset;
|
|
|
|
src = lib.fileset.toSource { fileset = sources; inherit root; };
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
sourceRoot = "${src.name}/" + workDirSubpath;
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
# Clear what `derivation` can't/shouldn't serialize; see prevAttrs.workDir.
|
|
|
|
fileset = null;
|
|
|
|
workDir = null;
|
|
|
|
};
|
|
|
|
|
2024-07-22 18:44:53 +03:00
|
|
|
# Work around weird `--as-needed` linker behavior with BSD, see
|
|
|
|
# https://github.com/mesonbuild/meson/issues/3593
|
2024-07-25 06:12:39 +03:00
|
|
|
bsdNoLinkAsNeeded = finalAttrs: prevAttrs:
|
|
|
|
lib.optionalAttrs stdenv.hostPlatform.isBSD {
|
|
|
|
mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or [];
|
|
|
|
};
|
|
|
|
|
|
|
|
miscGoodPractice = finalAttrs: prevAttrs:
|
|
|
|
{
|
|
|
|
strictDeps = prevAttrs.strictDeps or true;
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
};
|
2024-06-29 20:28:09 +03:00
|
|
|
in
|
2024-06-26 11:41:56 +03:00
|
|
|
scope: {
|
2024-08-13 23:15:56 +03:00
|
|
|
inherit stdenv;
|
2024-06-26 11:41:56 +03:00
|
|
|
|
2024-07-27 03:10:31 +03:00
|
|
|
aws-sdk-cpp = (pkgs.aws-sdk-cpp.override {
|
|
|
|
apis = [ "s3" "transfer" ];
|
|
|
|
customMemoryManagement = false;
|
|
|
|
}).overrideAttrs {
|
|
|
|
# only a stripped down version is built, which takes a lot less resources
|
|
|
|
# to build, so we don't need a "big-parallel" machine.
|
|
|
|
requiredSystemFeatures = [ ];
|
|
|
|
};
|
|
|
|
|
2024-06-26 11:41:56 +03:00
|
|
|
libseccomp = pkgs.libseccomp.overrideAttrs (_: rec {
|
|
|
|
version = "2.5.5";
|
|
|
|
src = pkgs.fetchurl {
|
|
|
|
url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
|
|
|
|
hash = "sha256-JIosik2bmFiqa69ScSw0r+/PnJ6Ut23OAsHJqiX7M3U=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
boehmgc = pkgs.boehmgc.override {
|
|
|
|
enableLargeConfig = true;
|
|
|
|
};
|
|
|
|
|
2024-06-28 02:30:58 +03:00
|
|
|
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
2024-06-28 00:28:31 +03:00
|
|
|
boost = (pkgs.boost.override {
|
|
|
|
extraB2Args = [
|
|
|
|
"--with-container"
|
|
|
|
"--with-context"
|
|
|
|
"--with-coroutine"
|
|
|
|
];
|
|
|
|
}).overrideAttrs (old: {
|
|
|
|
# Need to remove `--with-*` to use `--with-libraries=...`
|
2024-06-28 02:30:58 +03:00
|
|
|
buildPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase;
|
|
|
|
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
|
2024-06-28 00:28:31 +03:00
|
|
|
});
|
|
|
|
|
2024-06-26 11:41:56 +03:00
|
|
|
libgit2 = pkgs.libgit2.overrideAttrs (attrs: {
|
|
|
|
src = inputs.libgit2;
|
|
|
|
version = inputs.libgit2.lastModifiedDate;
|
|
|
|
cmakeFlags = attrs.cmakeFlags or []
|
|
|
|
++ [ "-DUSE_SSH=exec" ];
|
2024-08-28 02:48:25 +03:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
|
|
|
++ [
|
|
|
|
# Needed for `git apply`; see `prePatch`
|
|
|
|
pkgs.buildPackages.gitMinimal
|
|
|
|
];
|
|
|
|
# Only `git apply` can handle git binary patches
|
|
|
|
prePatch = ''
|
|
|
|
patch() {
|
|
|
|
git apply
|
|
|
|
}
|
|
|
|
'';
|
2024-08-19 14:21:44 +03:00
|
|
|
patches = attrs.patches or []
|
2024-08-28 02:48:25 +03:00
|
|
|
++ [
|
|
|
|
./patches/libgit2-mempack-thin-packfile.patch
|
|
|
|
|
|
|
|
# binary patch; see `prePatch`
|
|
|
|
./patches/libgit2-packbuilder-callback-interruptible.patch
|
|
|
|
];
|
2024-06-26 11:41:56 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
busybox-sandbox-shell = pkgs.busybox-sandbox-shell or (pkgs.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
|
|
|
|
'';
|
|
|
|
});
|
2024-06-29 20:28:09 +03:00
|
|
|
|
2024-06-28 02:30:58 +03:00
|
|
|
# TODO change in Nixpkgs, Windows works fine. First commit of
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/322977 backported will fix.
|
|
|
|
toml11 = pkgs.toml11.overrideAttrs (old: {
|
|
|
|
meta.platforms = lib.platforms.all;
|
|
|
|
});
|
|
|
|
|
2024-07-06 18:49:58 +03:00
|
|
|
inherit resolvePath filesetToSource;
|
|
|
|
|
2024-07-25 06:12:39 +03:00
|
|
|
mkMesonDerivation = f: let
|
|
|
|
exts = [
|
|
|
|
miscGoodPractice
|
|
|
|
bsdNoLinkAsNeeded
|
|
|
|
localSourceLayer
|
|
|
|
];
|
|
|
|
in stdenv.mkDerivation
|
|
|
|
(lib.extends
|
|
|
|
(lib.foldr lib.composeExtensions (_: _: {}) exts)
|
|
|
|
f);
|
2024-06-26 11:41:56 +03:00
|
|
|
}
|