forked from zhaofengli/attic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
72 lines (59 loc) · 1.83 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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`.
{ 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 [ "attic-client" "attic-server" ]
}:
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
]);
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
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";
license = licenses.asl20;
maintainers = with maintainers; [ zhaofengli ];
platforms = platforms.linux ++ platforms.darwin;
};
}