biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / misc / hydra / unstable.nix
blob972f137034415266606d97dfd40fd3f6a107ef21
1 { stdenv
2 , lib
3 , nix
4 , perlPackages
5 , buildEnv
6 , makeWrapper
7 , unzip
8 , pkg-config
9 , libpqxx
10 , top-git
11 , mercurial
12 , darcs
13 , subversion
14 , breezy
15 , openssl
16 , bzip2
17 , libxslt
18 , perl
19 , postgresql
20 , prometheus-cpp
21 , nukeReferences
22 , git
23 , nlohmann_json
24 , docbook_xsl
25 , openssh
26 , openldap
27 , gnused
28 , coreutils
29 , findutils
30 , gzip
31 , xz
32 , gnutar
33 , rpm
34 , dpkg
35 , cdrkit
36 , pixz
37 , boost
38 , autoreconfHook
39 , mdbook
40 , foreman
41 , python3
42 , libressl
43 , cacert
44 , glibcLocales
45 , fetchFromGitHub
46 , fetchpatch2
47 , nixosTests
50 let
51   perlDeps = buildEnv {
52     name = "hydra-perl-deps";
53     paths = with perlPackages; lib.closePropagation
54       [
55         AuthenSASL
56         CatalystActionREST
57         CatalystAuthenticationStoreDBIxClass
58         CatalystAuthenticationStoreLDAP
59         CatalystDevel
60         CatalystPluginAccessLog
61         CatalystPluginAuthorizationRoles
62         CatalystPluginCaptcha
63         CatalystPluginPrometheusTiny
64         CatalystPluginSessionStateCookie
65         CatalystPluginSessionStoreFastMmap
66         CatalystPluginStackTrace
67         CatalystRuntime
68         CatalystTraitForRequestProxyBase
69         CatalystViewDownload
70         CatalystViewJSON
71         CatalystViewTT
72         CatalystXScriptServerStarman
73         CatalystXRoleApplicator
74         CryptPassphrase
75         CryptPassphraseArgon2
76         CryptRandPasswd
77         DBDPg
78         DBDSQLite
79         DataDump
80         DateTime
81         DigestSHA1
82         EmailMIME
83         EmailSender
84         FileLibMagic
85         FileSlurper
86         FileWhich
87         IOCompress
88         IPCRun
89         IPCRun3
90         JSON
91         JSONMaybeXS
92         JSONXS
93         ListSomeUtils
94         LWP
95         LWPProtocolHttps
96         ModulePluggable
97         NetAmazonS3
98         NetPrometheus
99         NetStatsd
100         PadWalker
101         ParallelForkManager
102         PerlCriticCommunity
103         PrometheusTinyShared
104         ReadonlyX
105         SQLSplitStatement
106         SetScalar
107         Starman
108         StringCompareConstantTime
109         SysHostnameLong
110         TermSizeAny
111         TermReadKey
112         Test2Harness
113         TestPostgreSQL
114         TestSimple13
115         TextDiff
116         TextTable
117         UUID4Tiny
118         XMLSimple
119         YAML
120         nix.perl-bindings
121         git
122       ];
123   };
125 stdenv.mkDerivation rec {
126   pname = "hydra";
127   version = "2024-03-08";
129   src = fetchFromGitHub {
130     owner = "NixOS";
131     repo = "hydra";
132     rev = "8f56209bd6f3b9ec53d50a23812a800dee7a1969";
133     hash = "sha256-mhEj02VruXPmxz3jsKHMov2ERNXk9DwaTAunWEO1iIQ=";
134   };
136   buildInputs = [
137     unzip
138     libpqxx
139     top-git
140     mercurial
141     darcs
142     subversion
143     breezy
144     openssl
145     bzip2
146     libxslt
147     nix
148     perlDeps
149     perl
150     pixz
151     boost
152     postgresql
153     nlohmann_json
154     prometheus-cpp
155   ];
157   hydraPath = lib.makeBinPath (
158     [
159       subversion
160       openssh
161       nix
162       coreutils
163       findutils
164       pixz
165       gzip
166       bzip2
167       xz
168       gnutar
169       unzip
170       git
171       top-git
172       mercurial
173       darcs
174       gnused
175       breezy
176     ] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ]
177   );
179   nativeBuildInputs = [
180     autoreconfHook
181     makeWrapper
182     pkg-config
183     mdbook
184     nukeReferences
185   ];
187   nativeCheckInputs = [
188     cacert
189     foreman
190     glibcLocales
191     python3
192     libressl.nc
193     openldap
194   ];
196   configureFlags = [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ];
198   env.NIX_CFLAGS_COMPILE = "-pthread";
200   OPENLDAP_ROOT = openldap;
202   shellHook = ''
203     PATH=$(pwd)/src/script:$(pwd)/src/hydra-eval-jobs:$(pwd)/src/hydra-queue-runner:$(pwd)/src/hydra-evaluator:$PATH
204     PERL5LIB=$(pwd)/src/lib:$PERL5LIB;
205   '';
207   enableParallelBuilding = true;
209   patches = [
210     # https://github.com/NixOS/hydra/security/advisories/GHSA-2p75-6g9f-pqgx
211     (fetchpatch2 {
212       name = "CVE-2024-32657.patch";
213       url = "https://github.com/NixOS/hydra/commit/b72528be5074f3e62e9ae2c2ae8ef9c07a0b4dd3.patch";
214       hash = "sha256-+y27N8AIaHj13mj0LwW7dkpzfzZ4xfjN8Ld23c5mzuU=";
215     })
216   ];
218   postPatch = ''
219     # Change 5s timeout for init to 30s
220     substituteInPlace t/lib/HydraTestContext.pm \
221       --replace 'expectOkay(5, ("hydra-init"));' 'expectOkay(30, ("hydra-init"));'
222   '';
224   preCheck = ''
225     patchShebangs .
226     export LOGNAME=''${LOGNAME:-foo}
227     # set $HOME for bzr so it can create its trace file
228     export HOME=$(mktemp -d)
229     # remove flaky test
230     rm t/Hydra/Controller/User/ldap-legacy.t
231   '';
233   postInstall = ''
234     mkdir -p $out/nix-support
235     for i in $out/bin/*; do
236         read -n 4 chars < $i
237         if [[ $chars =~ ELF ]]; then continue; fi
238         wrapProgram $i \
239             --prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \
240             --prefix PATH ':' $out/bin:$hydraPath \
241             --set-default HYDRA_RELEASE ${version} \
242             --set HYDRA_HOME $out/libexec/hydra \
243             --set NIX_RELEASE ${nix.name or "unknown"}
244     done
245   '';
247   doCheck = true;
249   passthru = {
250     inherit nix perlDeps;
251     tests.basic = nixosTests.hydra.hydra_unstable;
252   };
254   meta = with lib; {
255     description = "Nix-based continuous build system";
256     homepage = "https://nixos.org/hydra";
257     license = licenses.gpl3;
258     platforms = platforms.linux;
259     maintainers = with maintainers; [ lheckemann mindavi ] ++ teams.helsinki-systems.members;
260   };