aboutsummaryrefslogtreecommitdiff
path: root/perl/default.nix
blob: af700eabec3bfe4d989796219972102f64bcd7cf (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
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
79
80
{
  lib,
  fileset,
  stdenv,
  perl,
  perlPackages,
  autoconf-archive,
  autoreconfHook,
  pkg-config,
  nix,
  curl,
  bzip2,
  xz,
  boost,
  libsodium,
  darwin,
  meson,
  ninja,
  buildWithMeson ? false,
}:

perl.pkgs.toPerlModule (
  stdenv.mkDerivation {
    name = "nix-perl-${nix.version}";

    src = fileset.toSource {
      root = ../.;
      fileset = fileset.unions (
        [
          ../.version
          ./lib
        ]
        ++ lib.optionals (!buildWithMeson) [
          # FIXME(Qyriad): What the hell is this?
          # What is it used for and do we still need it?
          ./MANIFEST
          ../m4
          ../mk
          ./Makefile
          ./Makefile.config.in
          ./configure.ac
          ./local.mk
        ]
        ++ lib.optionals buildWithMeson [ ./meson.build ]
      );
    };

    nativeBuildInputs =
      [ pkg-config ]
      ++ lib.optionals (!buildWithMeson) [
        autoconf-archive
        autoreconfHook
      ]
      ++ lib.optionals buildWithMeson [
        meson
        ninja
      ];

    buildInputs =
      [
        nix
        curl
        bzip2
        xz
        perl
        boost
        perlPackages.DBI
        perlPackages.DBDSQLite
      ]
      ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
      ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;

    # Nixpkgs' Meson hook likes to set this to "plain".
    mesonBuildType = "debugoptimized";

    enableParallelBuilding = true;

    postUnpack = "sourceRoot=$sourceRoot/perl";
  }
)