about summary refs log tree commit diff
path: root/pkgs/by-name/ni/nix-inspect/package.nix
blob: a77365dcc18fe6983c618e37130840a37d2d3ef3 (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
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  boost,
  nlohmann_json,
  nixVersions,
  pkg-config,
  meson,
  ninja,
  stdenv,
}: let
  src = fetchFromGitHub {
    owner = "bluskript";
    repo = "nix-inspect";
    rev = "74007c580b8282bd336130ddf354e71502b421a6";
    hash = "sha256-JichXRSfTLfy+7fhbTvA89rQLkqsY2eHgEAeAHWbA9s=";
  };

  workerPackage = stdenv.mkDerivation {
    inherit src;

    pname = "nix-inspect-worker";
    version = "0.1.1";
    sourceRoot = "source/worker";

    nativeBuildInputs = [meson ninja pkg-config];

    buildInputs = [
      boost
      nlohmann_json
      nixVersions.nix_2_19.dev
    ];

    mesonBuildType = "release";
  };
in
  rustPlatform.buildRustPackage {
    inherit src;
    pname = "nix-inspect";
    version = "0.1.1";

    cargoHash = "sha256-l+R7BLgJvK9mQ89GVAdTyQX81VMoV11h5KFlMUqAH30=";

    buildInputs = [workerPackage];

    postPatch = ''
      substituteInPlace src/workers.rs \
        --replace-fail 'env!("WORKER_BINARY_PATH")' '"${workerPackage}/bin/nix-inspect"'
    '';

    meta = with lib; {
      description = "Interactive TUI for inspecting nix configs and other expressions";
      homepage = "https://github.com/bluskript/nix-inspect";
      license = licenses.mit;
      maintainers = with maintainers; [blusk];
      platforms = platforms.unix;
      mainProgram = "nix-inspect";
    };
  }