Unverified Commit 6216062a authored by Philip Taron's avatar Philip Taron
Browse files

drat: init at 0.1.3-unstable-2024-01-07

> Drat is a tool for analysing and recovering data from [APFS (Apple File System)](https://en.wikipedia.org/wiki/Apple_File_System) partitions. Its creation was inspired by a [personal data loss incident](https://apple.stackexchange.com/questions/373718) and [Jonathan Levin's](https://twitter.com/Morpheus______) closed-source `fsleuth` tool, which he demonstrated in [this lecture](http://docs.macsysadmin.se/2018/video/Day4Session2.mp4).
>
> The name "Drat" is a loose acronym for "Disaster Recovery APFS Tools", and a bad pun on how one might say "drat!" after discovering that their data is corrupted.
parent 2037aaa3
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "drat";
  version = "0.1.3-unstable-2024-01-07";

  src = fetchFromGitHub {
    owner = "jivanpal";
    repo = "drat";
    rev = "af573b9e067e8b6cbcc4825946e7e636b30c748f";
    hash = "sha256-1NmqG73sP25Uqf7DiSPgt7drONOg9ZkrtCS0tYVjSU0=";
  };

  # Don't blow up on warnings; it makes upgrading the compiler difficult.
  postPatch = ''
    substituteInPlace Makefile --replace-fail "-Werror" ""
  '';

  makeFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
    "LD=${stdenv.cc.targetPrefix}cc"
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    install drat $out/bin

    runHook postInstall
  '';

  meta = {
    description = "Utility for performing data recovery and analysis of APFS partitions/containers";
    homepage = "https://github.com/jivanpal/drat";
    changelog = "https://github.com/jivanpal/drat/blob/main/CHANGELOG.md";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ philiptaron ];
    mainProgram = "drat";
    platforms = lib.platforms.all;
  };
})