diff --git a/pkgs/os-specific/linux/tomb/default.nix b/pkgs/os-specific/linux/tomb/default.nix index 141af86a337b..f1347c197bf6 100644 --- a/pkgs/os-specific/linux/tomb/default.nix +++ b/pkgs/os-specific/linux/tomb/default.nix @@ -1,18 +1,23 @@ -{ stdenv, fetchurl, zsh, pinentry, cryptsetup, gnupg1orig, makeWrapper }: - -let - version = "2.4"; -in +{ stdenv, lib, fetchFromGitHub, gettext, zsh, pinentry, cryptsetup, gnupg, makeWrapper }: stdenv.mkDerivation rec { name = "tomb-${version}"; + version = "2.4"; - src = fetchurl { - url = "https://files.dyne.org/tomb/Tomb-${version}.tar.gz"; - sha256 = "1hv1w79as7swqj0n137vz8n8mwvcgwlvd91sdyssz41jarg7f1vr"; + src = fetchFromGitHub { + owner = "dyne"; + repo = "Tomb"; + rev = "v${version}"; + sha256 = "192jpgn02mvi4d4inbq2q11zl7xw6njymvali7al8wmygkkycrw4"; }; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; + + postPatch = '' + # if not, it shows .tomb-wrapped when running + substituteInPlace tomb \ + --replace 'TOMBEXEC=$0' 'TOMBEXEC=tomb' + ''; buildPhase = '' # manually patch the interpreter @@ -20,22 +25,21 @@ stdenv.mkDerivation rec { ''; installPhase = '' - mkdir -p $out/bin - mkdir -p $out/share/man/man1 + install -Dm755 tomb $out/bin/tomb + install -Dm644 doc/tomb.1 $out/share/man/man1/tomb.1 - cp tomb $out/bin/tomb - cp doc/tomb.1 $out/share/man/man1 + # it works fine with gnupg v2, but it looks for an executable named gpg + ln -s ${gnupg}/bin/gpg2 $out/bin/gpg wrapProgram $out/bin/tomb \ - --prefix PATH : "${pinentry}/bin" \ - --prefix PATH : "${cryptsetup}/bin" \ - --prefix PATH : "${gnupg1orig}/bin" + --prefix PATH : $out/bin:${lib.makeBinPath [ cryptsetup gettext pinentry ]} ''; - meta = { + meta = with stdenv.lib; { description = "File encryption on GNU/Linux"; - homepage = https://www.dyne.org/software/tomb/; - license = stdenv.lib.licenses.gpl3; - platforms = stdenv.lib.platforms.linux; + homepage = https://www.dyne.org/software/tomb/; + license = licenses.gpl3; + maintainers = with maintainers; [ peterhoeg ]; + platforms = platforms.linux; }; }