2023-01-02 14:46:12 +00:00
|
|
|
# This is an alternative package expression of Attic in a nixpkgs-acceptable
|
|
|
|
# form. It will be submitted when the Attic API is considered stable.
|
|
|
|
#
|
|
|
|
# For the expression used for CI as well as distribution from this repo, see
|
|
|
|
# `crane.nix`.
|
|
|
|
|
2023-01-01 00:01:07 +00:00
|
|
|
{ lib, stdenv, rustPlatform
|
|
|
|
, pkg-config
|
|
|
|
, installShellFiles
|
|
|
|
, nix
|
|
|
|
, boost
|
|
|
|
, darwin
|
|
|
|
|
|
|
|
# Only build the client
|
|
|
|
, clientOnly ? false
|
|
|
|
|
|
|
|
# Only build certain crates
|
|
|
|
, crates ? if clientOnly then [ "attic-client" ] else []
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
ignoredPaths = [ ".github" "target" "book" ];
|
|
|
|
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "attic";
|
|
|
|
version = "0.1.0";
|
|
|
|
|
|
|
|
src = lib.cleanSourceWith {
|
|
|
|
filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) ignoredPaths);
|
|
|
|
src = lib.cleanSource ./.;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
pkg-config
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
nix boost
|
|
|
|
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
|
|
SystemConfiguration
|
|
|
|
]);
|
|
|
|
|
2023-01-06 22:55:18 +00:00
|
|
|
cargoHash = "sha256-FpA7dbK/3+cW53bSP27ylxBZSIUzBNXpuEBz4mJNZ8g=";
|
2023-01-01 00:01:07 +00:00
|
|
|
cargoBuildFlags = lib.concatMapStrings (c: "-p ${c} ") crates;
|
|
|
|
|
|
|
|
ATTIC_DISTRIBUTOR = "attic";
|
|
|
|
|
|
|
|
# Recursive Nix is not stable yet
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
|
|
|
|
if [[ -f $out/bin/attic ]]; then
|
|
|
|
installShellCompletion --cmd attic \
|
|
|
|
--bash <($out/bin/attic gen-completions bash) \
|
|
|
|
--zsh <($out/bin/attic gen-completions zsh) \
|
|
|
|
--fish <($out/bin/attic gen-completions fish)
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Multi-tenant Nix binary cache system";
|
|
|
|
homepage = "https://github.com/zhaofengli/attic";
|
2023-01-02 03:59:02 +00:00
|
|
|
license = licenses.asl20;
|
2023-01-01 00:01:07 +00:00
|
|
|
maintainers = with maintainers; [ zhaofengli ];
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|