nix-super/src/libfetchers/package.nix

87 lines
1.5 KiB
Nix
Raw Normal View History

2024-06-06 04:36:18 +03:00
{ lib
, stdenv
2024-07-01 21:36:46 +03:00
, mkMesonDerivation
2024-06-06 04:36:18 +03:00
, releaseTools
, meson
, ninja
, pkg-config
, nix-util
, nix-store
, nlohmann_json
, libgit2
, man
# Configuration Options
, versionSuffix ? ""
}:
let
inherit (lib) fileset;
2024-06-06 04:36:18 +03:00
version = lib.fileContents ./.version + versionSuffix;
in
2024-07-01 21:36:46 +03:00
mkMesonDerivation (finalAttrs: {
2024-06-29 00:17:20 +03:00
pname = "nix-fetchers";
2024-06-06 04:36:18 +03:00
inherit version;
2024-07-01 21:36:46 +03:00
workDir = ./.;
fileset = fileset.unions [
../../build-utils-meson
./build-utils-meson
../../.version
./.version
./meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
2024-06-06 04:36:18 +03:00
outputs = [ "out" "dev" ];
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = [
libgit2
];
propagatedBuildInputs = [
nix-store
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-06 04:36:18 +03:00
''
2024-07-01 21:36:46 +03:00
chmod u+w ./.version
echo ${version} > ../../.version
2024-06-06 04:36:18 +03:00
'';
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
LDFLAGS = "-fuse-ld=gold";
};
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic;
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
# to work with `strictDeps`.
2024-07-01 21:36:46 +03:00
strictDeps = true;
2024-06-06 04:36:18 +03:00
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})