about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/ap/apfsprogs/package.nix
blob: 526cff28dbca1c791e93d49424a39566806d22ee (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
{ lib
, stdenv
, fetchFromGitHub
, nixosTests
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "apfsprogs";
  version = "unstable-2023-11-30";

  src = fetchFromGitHub {
    owner = "linux-apfs";
    repo = "apfsprogs";
    rev = "990163894d871f51ba102a75aed384a275c5991b";
    hash = "sha256-yCShZ+ALzSe/svErt9/i1JyyEvbIeABGPbpS4lVil0A=";
  };

  postPatch = let
    shortRev = builtins.substring 0 9 finalAttrs.src.rev;
  in ''
    substituteInPlace \
      apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile \
      --replace \
        '$(shell git describe --always HEAD | tail -c 9)' \
        '${shortRev}'
  '';

  buildPhase = ''
    runHook preBuild
    make -C apfs-snap $makeFlags
    make -C apfsck $makeFlags
    make -C mkapfs $makeFlags
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    make -C apfs-snap install DESTDIR="$out" $installFlags
    make -C apfsck install DESTDIR="$out" $installFlags
    make -C mkapfs install DESTDIR="$out" $installFlags
    runHook postInstall
  '';

  passthru.tests = {
    apfs = nixosTests.apfs;
  };

  strictDeps = true;

  meta = with lib; {
    description = "Experimental APFS tools for linux";
    homepage = "https://github.com/linux-apfs/apfsprogs";
    license = licenses.gpl2Only;
    platforms = platforms.linux;
    maintainers = with maintainers; [ Luflosi ];
  };
})