1{
2 fetchFromGitHub,
3 lib,
4 nix,
5 ronn,
6 rustPlatform,
7}:
8
9let
10 blake3-src = fetchFromGitHub {
11 owner = "BLAKE3-team";
12 repo = "BLAKE3";
13 rev = "refs/tags/1.5.1";
14 hash = "sha256-STWAnJjKrtb2Xyj6i1ACwxX/gTkQo5jUHilcqcgJYxc=";
15 };
16in
17rustPlatform.buildRustPackage rec {
18 pname = "cached-nix-shell";
19 version = "0.1.6";
20
21 src = fetchFromGitHub {
22 owner = "xzfc";
23 repo = "cached-nix-shell";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-LI/hecqeRg3eCzU2bASJA8VoG4nvrSeHSeaGYn7M/UI=";
26 };
27
28 cargoHash = "sha256-Rl+PgNr29OAl6P/iUfkuFlQycyeYNmxUIIdigk7PgV4=";
29
30 nativeBuildInputs = [
31 nix
32 ronn
33 ];
34
35 # The BLAKE3 C library is intended to be built by the project depending on it
36 # rather than as a standalone library.
37 # https://github.com/BLAKE3-team/BLAKE3/blob/0.3.1/c/README.md#building
38 env.BLAKE3_CSRC = "${blake3-src}/c";
39
40 postBuild = ''
41 make -f nix/Makefile post-build
42 '';
43
44 postInstall = ''
45 make -f nix/Makefile post-install
46 '';
47
48 meta = {
49 description = "Instant startup time for nix-shell";
50 mainProgram = "cached-nix-shell";
51 homepage = "https://github.com/xzfc/cached-nix-shell";
52 changelog = "https://github.com/xzfc/cached-nix-shell/releases/tag/v${version}";
53 license = with lib.licenses; [
54 unlicense
55 # or
56 mit
57 ];
58 maintainers = with lib.maintainers; [ xzfc ];
59 platforms = lib.platforms.linux ++ lib.platforms.darwin;
60 };
61}