magic-nix-cache/package.nix

59 lines
1.1 KiB
Nix
Raw Normal View History

2024-05-24 15:28:14 +00:00
{ lib
, stdenv
, rustPlatform
, pkg-config
, installShellFiles
, nix
, boost
, darwin
2024-02-29 20:42:35 +00:00
, rust-analyzer
, clippy
, rustfmt
}:
let
ignoredPaths = [ ".github" "target" "book" ];
version = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package.version;
2024-05-24 15:28:14 +00:00
in
rustPlatform.buildRustPackage rec {
pname = "magic-nix-cache";
2024-05-24 15:28:14 +00:00
inherit version;
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
];
buildInputs = [
2024-05-24 15:28:14 +00:00
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";
# 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
'';
}