summary refs log tree commit diff
path: root/pkgs/servers/rt/default.nix
blob: 894da7a652eefd7a597283f184fc2cbd90ae8f7e (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{ lib, stdenv, autoreconfHook, buildEnv, fetchFromGitHub, perl, perlPackages, makeWrapper, gnupg, openssl }:

stdenv.mkDerivation rec {
  pname = "rt";
  version = "5.0.3";

  src = fetchFromGitHub {
    repo = pname;
    rev = "${pname}-${version}";
    owner = "bestpractical";
    hash = "sha256-ZitlueLEbV3mGJg0aDrLa5IReJiOVaEf+JicbA9zUS4=";
  };

  patches = [
    ./dont-check-users_groups.patch  # needed for "make testdeps" to work in the build
    ./override-generated.patch
  ];

  nativeBuildInputs = [
    autoreconfHook
    makeWrapper
  ];

  buildInputs = [
    perl
    (buildEnv {
      name = "rt-perl-deps";
      paths = with perlPackages; (requiredPerlModules [
        ApacheSession
        BusinessHours
        CGIEmulatePSGI
        CGIPSGI
        CSSMinifierXS
        CSSSquish
        ConvertColor
        CryptEksblowfish
        CryptSSLeay
        CryptX509
        DBDPg
        DBIxSearchBuilder
        DataGUID
        DataICal
        DataPage
        DataPagePageset
        DateExtract
        DateManip
        DateTimeFormatNatural
        DevelGlobalDestruction
        EmailAddress
        EmailAddressList
        EncodeDetect
        EncodeHanExtra
        FCGI
        FCGIProcManager
        FileShareDir
        FileWhich
        GD
        GDGraph
        GnuPGInterface
        GraphViz
        HTMLFormatExternal
        HTMLFormatTextWithLinks
        HTMLFormatTextWithLinksAndTables
        HTMLGumbo
        HTMLMason
        HTMLMasonPSGIHandler
        HTMLQuoted
        HTMLRewriteAttributes
        HTMLScrubber
        IPCRun
        IPCRun3
        JSON
        JavaScriptMinifierXS
        LWP
        LWPProtocolHttps
        LocaleMaketextFuzzy
        LocaleMaketextLexicon
        LogDispatch
        MIMETools
        MIMETypes
        MailTools
        ModulePath
        ModuleRefresh
        ModuleVersionsReport
        Moose
        MooseXNonMoose
        MooseXRoleParameterized
        MozillaCA
        NetCIDR
        NetIP
        ParallelForkManager
        PathDispatcher
        PerlIOeol
        Plack
        PodParser
        RegexpCommon
        RegexpCommonnetCIDR
        RegexpIPv6
        RoleBasic
        ScopeUpper
        Starlet
        Starman
        StringShellQuote
        SymbolGlobalName
        TermReadKey
        TextPasswordPronounceable
        TextQuoted
        TextTemplate
        TextWikiFormat
        TextWordDiff
        TextWrapper
        TimeParseDate
        TreeSimple
        UNIVERSALrequire
        WebMachine
        XMLRSS
        perlldap
      ]);
    })
  ];

  preAutoreconf = ''
    echo rt-${version} > .tag
  '';
  preConfigure = ''
    configureFlags="$configureFlags --with-web-user=$UID"
    configureFlags="$configureFlags --with-web-group=$(id -g)"
    configureFlags="$configureFlags --with-rt-group=$(id -g)"
    configureFlags="$configureFlags --with-bin-owner=$UID"
    configureFlags="$configureFlags --with-libs-owner=$UID"
    configureFlags="$configureFlags --with-libs-group=$(id -g)"
  '';
  configureFlags = [
    "--enable-graphviz"
    "--enable-gd"
    "--enable-gpg"
    "--enable-smime"
    "--with-db-type=Pg"
  ];

  buildPhase = ''
    make testdeps
  '';

  postFixup = ''
    for i in $(find $out/bin -type f); do
      wrapProgram $i --prefix PERL5LIB ':' $PERL5LIB \
        --prefix PATH ":" "${lib.makeBinPath [ openssl gnupg ]}"
    done

    rm -r $out/var
    mkdir -p $out/var/data
    ln -s /var/log/rt $out/var/log
    ln -s /run/rt/mason_data $out/var/mason_data
    ln -s /var/lib/rt/shredder $out/var/data/RT-Shredder
    ln -s /var/lib/rt/smime $out/var/data/smime
    ln -s /var/lib/rt/gpg $out/var/data/gpg
  '';

  meta = {
    platforms = lib.platforms.unix;
  };
}