summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mk/mktemp/package.nix
blob: 56d24f7ede8a20b749bbe6c5e3b075ec9c728cca (plain)
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
{
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  groff,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "mktemp";
  version = "1.7";

  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
  env.NROFF = "${groff}/bin/nroff";

  patches = [
    # Pull upstream fix for parallel install failures.
    (fetchpatch {
      name = "parallel-install.patch";
      url = "https://www.mktemp.org/repos/mktemp/raw-rev/eb87d96ce8b7";
      hash = "sha256-cJ/0pFj8tOkByUwhlMwLNSQgTHyAU8svEkjKWWwsNmY=";
    })
  ];

  # Don't use "install -s"
  postPatch = ''
    substituteInPlace Makefile.in --replace " 0555 -s " " 0555 "
  '';

  src = fetchurl {
    url = "ftp://ftp.mktemp.org/pub/mktemp/mktemp-${finalAttrs.version}.tar.gz";
    sha256 = "0x969152znxxjbj7387xb38waslr4yv6bnj5jmhb4rpqxphvk54f";
  };

  enableParallelBuilding = true;

  meta = {
    description = "Simple tool to make temporary file handling in shells scripts safe and simple";
    mainProgram = "mktemp";
    homepage = "https://www.mktemp.org";
    license = lib.licenses.isc;
    platforms = lib.platforms.unix;
  };
})