about summary refs log tree commit diff
path: root/pkgs/tools/security/munge/default.nix
blob: f21a9e17add38783e61ce725c1eaf651b7a88288 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  lib,
  stdenv,
  fetchFromGitHub,
  autoreconfHook,
  libgcrypt,
  zlib,
  bzip2,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "munge";
  version = "0.5.16";

  src = fetchFromGitHub {
    owner = "dun";
    repo = "munge";
    rev = "munge-${finalAttrs.version}";
    sha256 = "sha256-fv42RMUAP8Os33/iHXr70i5Pt2JWZK71DN5vFI3q7Ak=";
  };

  nativeBuildInputs = [
    autoreconfHook
    libgcrypt # provides libgcrypt.m4
  ];

  buildInputs = [
    libgcrypt
    zlib
    bzip2
  ];

  strictDeps = true;

  configureFlags = [
    # Load data from proper global paths
    "--localstatedir=/var"
    "--sysconfdir=/etc"
    "--runstatedir=/run"
    "--with-sysconfigdir=/etc/default"

    # Install data to proper directories
    "--with-pkgconfigdir=${placeholder "out"}/lib/pkgconfig"
    "--with-systemdunitdir=${placeholder "out"}/lib/systemd/system"

    # Cross-compilation hacks
    "--with-libgcrypt-prefix=${lib.getDev libgcrypt}"
    # workaround for cross compilation: https://github.com/dun/munge/issues/103
    "ac_cv_file__dev_spx=no"
    "x_ac_cv_check_fifo_recvfd=no"
  ];

  installFlags = [
    "localstatedir=${placeholder "out"}/var"
    "runstatedir=${placeholder "out"}/run"
    "sysconfdir=${placeholder "out"}/etc"
    "sysconfigdir=${placeholder "out"}/etc/default"
  ];

  postInstall = ''
    # rmdir will notify us if anything new is installed to the directories.
    rmdir "$out"/{var{/{lib,log}{/munge,},},etc/munge}
  '';

  meta = with lib; {
    description = ''
      An authentication service for creating and validating credentials
    '';
    license = [
      # MUNGE
      licenses.gpl3Plus
      # libmunge
      licenses.lgpl3Plus
    ];
    platforms = platforms.unix;
    maintainers = [ maintainers.rickynils ];
  };
})