-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
54 lines (51 loc) · 1.38 KB
/
flake.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
{
description = "Protofetch - A source dependency management tool for Protobuf files";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
crane,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
protofetch = craneLib.buildPackage {
pname = "protofetch";
src = lib.cleanSourceWith {
src = ./.; # The original, unfiltered source
filter = path: type: (lib.hasSuffix "\.proto" path) || (craneLib.filterCargoSources path type);
};
buildInputs = [
pkgs.openssl
pkgs.libgit2
pkgs.pkg-config
] ++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security ];
preBuild = ''
export HOME=$(mktemp -d)
'';
};
in
{
packages = rec {
inherit protofetch;
default = protofetch;
};
checks = {
# Build the crate as part of `nix flake check`
inherit protofetch;
};
}
);
}