about summary refs log tree commit diff
path: root/pkgs/by-name/ca/cached-nix-shell/package.nix
blob: 71256c2b1b5cbfcb46ce254bcd678c5464d6826d (plain) (blame)
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
{
  fetchFromGitHub,
  lib,
  nix,
  ronn,
  rustPlatform,
}:

let
  blake3-src = fetchFromGitHub {
    owner = "BLAKE3-team";
    repo = "BLAKE3";
    rev = "refs/tags/1.5.1";
    hash = "sha256-STWAnJjKrtb2Xyj6i1ACwxX/gTkQo5jUHilcqcgJYxc=";
  };
in
rustPlatform.buildRustPackage rec {
  pname = "cached-nix-shell";
  version = "0.1.6";

  src = fetchFromGitHub {
    owner = "xzfc";
    repo = "cached-nix-shell";
    rev = "refs/tags/v${version}";
    hash = "sha256-LI/hecqeRg3eCzU2bASJA8VoG4nvrSeHSeaGYn7M/UI=";
  };

  cargoHash = "sha256-Jf0VRTGwdKxCwyb9hVKDQcdZsHHWaedrDbwq9MK1tn4=";

  nativeBuildInputs = [
    nix
    ronn
  ];

  # The BLAKE3 C library is intended to be built by the project depending on it
  # rather than as a standalone library.
  # https://github.com/BLAKE3-team/BLAKE3/blob/0.3.1/c/README.md#building
  env.BLAKE3_CSRC = "${blake3-src}/c";

  postBuild = ''
    make -f nix/Makefile post-build
  '';

  postInstall = ''
    make -f nix/Makefile post-install
  '';

  meta = {
    description = "Instant startup time for nix-shell";
    mainProgram = "cached-nix-shell";
    homepage = "https://github.com/xzfc/cached-nix-shell";
    changelog = "https://github.com/xzfc/cached-nix-shell/releases/tag/v${version}";
    license = with lib.licenses; [
      unlicense
      # or
      mit
    ];
    maintainers = with lib.maintainers; [ xzfc ];
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
  };
}