about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/filesystems/btrfs-heatmap/default.nix
blob: ee09a25ceb14623c0dbb177b68cb38a25d4a05b4 (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
{ stdenv, lib
, fetchFromGitHub
, python3
, installShellFiles
}:

stdenv.mkDerivation rec {
  pname = "btrfs-heatmap";
  version = "9";

  src = fetchFromGitHub {
    owner = "knorrie";
    repo = "btrfs-heatmap";
    rev = "v${version}";
    sha256 = "sha256-yCkuZqWwxrs2eS7EXY6pAOVVVSq7dAMxJtf581gX8vg=";
  };

  buildInputs = [ python3 ];
  nativeBuildInputs = [ python3.pkgs.wrapPython installShellFiles ];

  outputs = [ "out" "man" ];

  installPhase = ''
    runHook preInstall

    install -Dm 0755 btrfs-heatmap $out/sbin/btrfs-heatmap
    installManPage man/btrfs-heatmap.1

    buildPythonPath ${python3.pkgs.btrfs}
    patchPythonScript $out/sbin/btrfs-heatmap

    runHook postInstall
  '';

  meta = with lib; {
    description = "Visualize the layout of a mounted btrfs";
    mainProgram = "btrfs-heatmap";
    homepage = "https://github.com/knorrie/btrfs-heatmap";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = [ maintainers.evils ];
  };
}