From 6216062a32087c21a66e24a80718ff1eec6c8ba8 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Mon, 13 Oct 2025 15:43:07 -0700 Subject: [PATCH] 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. --- pkgs/by-name/dr/drat/package.nix | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pkgs/by-name/dr/drat/package.nix diff --git a/pkgs/by-name/dr/drat/package.nix b/pkgs/by-name/dr/drat/package.nix new file mode 100644 index 000000000000..41911e8ef407 --- /dev/null +++ b/pkgs/by-name/dr/drat/package.nix @@ -0,0 +1,46 @@ +{ + 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; + }; +})