2024-06-04 16:28:27 +03:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2024-07-01 21:36:46 +03:00
|
|
|
, mkMesonDerivation
|
2024-06-04 16:28:27 +03:00
|
|
|
, releaseTools
|
|
|
|
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
2024-06-28 21:26:04 +03:00
|
|
|
, unixtools
|
2024-06-04 16:28:27 +03:00
|
|
|
|
|
|
|
, nix-util
|
|
|
|
, boost
|
|
|
|
, curl
|
|
|
|
, aws-sdk-cpp
|
|
|
|
, libseccomp
|
|
|
|
, nlohmann_json
|
|
|
|
, sqlite
|
|
|
|
|
|
|
|
, busybox-sandbox-shell ? null
|
|
|
|
|
|
|
|
# Configuration Options
|
|
|
|
|
2024-07-06 18:36:31 +03:00
|
|
|
, version
|
2024-06-04 16:28:27 +03:00
|
|
|
|
2024-06-28 21:26:04 +03:00
|
|
|
, embeddedSandboxShell ? stdenv.hostPlatform.isStatic
|
2024-06-04 16:28:27 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-06-26 04:18:01 +03:00
|
|
|
inherit (lib) fileset;
|
2024-06-04 16:28:27 +03:00
|
|
|
in
|
|
|
|
|
2024-07-01 21:36:46 +03:00
|
|
|
mkMesonDerivation (finalAttrs: {
|
2024-06-04 16:28:27 +03:00
|
|
|
pname = "nix-store";
|
|
|
|
inherit version;
|
|
|
|
|
2024-07-01 21:36:46 +03:00
|
|
|
workDir = ./.;
|
|
|
|
fileset = fileset.unions [
|
|
|
|
../../build-utils-meson
|
|
|
|
./build-utils-meson
|
|
|
|
../../.version
|
|
|
|
./.version
|
|
|
|
./meson.build
|
|
|
|
./meson.options
|
|
|
|
./linux/meson.build
|
|
|
|
./unix/meson.build
|
|
|
|
./windows/meson.build
|
|
|
|
(fileset.fileFilter (file: file.hasExt "cc") ./.)
|
|
|
|
(fileset.fileFilter (file: file.hasExt "hh") ./.)
|
|
|
|
(fileset.fileFilter (file: file.hasExt "sb") ./.)
|
|
|
|
(fileset.fileFilter (file: file.hasExt "md") ./.)
|
|
|
|
(fileset.fileFilter (file: file.hasExt "sql") ./.)
|
|
|
|
];
|
2024-06-04 16:28:27 +03:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2024-06-28 21:26:04 +03:00
|
|
|
] ++ lib.optional embeddedSandboxShell unixtools.hexdump;
|
2024-06-04 16:28:27 +03:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
curl
|
|
|
|
sqlite
|
|
|
|
] ++ lib.optional stdenv.hostPlatform.isLinux libseccomp
|
|
|
|
# There have been issues building these dependencies
|
|
|
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin))
|
|
|
|
(aws-sdk-cpp.override {
|
|
|
|
apis = ["s3" "transfer"];
|
|
|
|
customMemoryManagement = false;
|
|
|
|
})
|
|
|
|
;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
nix-util
|
|
|
|
nlohmann_json
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure =
|
2024-06-28 02:19:32 +03:00
|
|
|
# "Inline" .version so it's not a symlink, and includes the suffix.
|
|
|
|
# Do the meson utils, without modification.
|
2024-06-04 16:28:27 +03:00
|
|
|
''
|
2024-07-01 21:36:46 +03:00
|
|
|
chmod u+w ./.version
|
|
|
|
echo ${version} > ../../.version
|
2024-06-04 16:28:27 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
(lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux)
|
2024-06-28 21:26:04 +03:00
|
|
|
(lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell)
|
2024-06-04 16:28:27 +03:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
(lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox")
|
|
|
|
];
|
|
|
|
|
|
|
|
env = {
|
|
|
|
# Needed for Meson to find Boost.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/86131.
|
|
|
|
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
|
|
|
|
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
|
|
|
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
|
|
|
|
LDFLAGS = "-fuse-ld=gold";
|
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
|
|
|
|
2024-07-01 21:36:46 +03:00
|
|
|
strictDeps = true;
|
2024-06-04 16:28:27 +03:00
|
|
|
|
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
platforms = lib.platforms.unix ++ lib.platforms.windows;
|
|
|
|
};
|
|
|
|
|
|
|
|
})
|