2023-12-14 16:09:09 +00:00
|
|
|
{ lib, stdenv, rustPlatform
|
|
|
|
, pkg-config
|
|
|
|
, installShellFiles
|
|
|
|
, nix
|
|
|
|
, boost
|
|
|
|
, darwin
|
2024-02-29 20:42:35 +00:00
|
|
|
, rust-analyzer
|
|
|
|
, clippy
|
|
|
|
, rustfmt
|
2023-12-14 16:09:09 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
ignoredPaths = [ ".github" "target" "book" ];
|
|
|
|
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "magic-nix-cache";
|
|
|
|
version = "0.1.0";
|
|
|
|
|
|
|
|
src = lib.cleanSourceWith {
|
|
|
|
filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) ignoredPaths);
|
|
|
|
src = lib.cleanSource ./.;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
installShellFiles
|
2024-02-29 20:42:35 +00:00
|
|
|
rust-analyzer
|
|
|
|
clippy
|
|
|
|
rustfmt
|
2023-12-14 16:09:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
nix boost
|
|
|
|
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
|
|
SystemConfiguration
|
|
|
|
]);
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
allowBuiltinFetchGit = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
ATTIC_DISTRIBUTOR = "attic";
|
|
|
|
|
2024-01-09 12:32:12 +00:00
|
|
|
# Hack to fix linking on macOS.
|
|
|
|
NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin "-lc++abi";
|
|
|
|
|
2023-12-14 16:09:09 +00:00
|
|
|
# Recursive Nix is not stable yet
|
|
|
|
doCheck = false;
|
2024-01-09 11:02:14 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
rm -f $out/nix-support/propagated-build-inputs
|
|
|
|
'';
|
2023-12-14 16:09:09 +00:00
|
|
|
}
|