about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/zpool-auto-expand-partitions/default.nix
blob: 8fced13e93db404ae7cf7572e96bd43bfc8308b9 (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
{ lib
, rustPlatform
, cloud-utils
, fetchFromGitHub
, pkg-config
, util-linux
, zfs
}:
rustPlatform.buildRustPackage rec {
  pname = "zpool-auto-expand-partitions";
  version = "0.1.1";

  src = fetchFromGitHub {
    owner = "DeterminateSystems";
    repo = "zpool-auto-expand-partitions";
    rev = "v${version}";
    hash = "sha256-N1znZbJULEeNR4ABSrUtHHkmz08N+CZqX6Ni7jFzc4c=";
  };

  cargoLock.lockFile = ./Cargo.lock;
  # We rely on a fork of libzfs in order to bump the bindgen version to fix
  # builds against LLVM 16.
  cargoLock.outputHashes = {
    "libzfs-0.6.16" = "sha256-kQunP/xW1Zb1q+TcgAkmZkt1yDnJo9CwF5qldikVN94=";
  };

  preBuild = ''
    substituteInPlace src/grow.rs \
      --replace '"growpart"' '"${cloud-utils}/bin/growpart"'
    substituteInPlace src/lsblk.rs \
      --replace '"lsblk"' '"${util-linux}/bin/lsblk"'
  '';

  nativeBuildInputs = [
    pkg-config
    rustPlatform.bindgenHook
  ];

  buildInputs = [
    util-linux
    zfs
  ];

  meta = with lib; {
    description = "A tool that aims to expand all partitions in a specified zpool to fill the available space";
    homepage = "https://github.com/DeterminateSystems/zpool-auto-expand-partitions";
    license = licenses.asl20;
    maintainers = teams.determinatesystems.members;
    mainProgram = "zpool_part_disks";
  };
}