nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 nixVersions,
5 perlPackages,
6 buildEnv,
7 makeWrapper,
8 unzip,
9 pkg-config,
10 libpqxx,
11 top-git,
12 mercurial,
13 darcs,
14 subversion,
15 breezy,
16 openssl,
17 bzip2,
18 libxslt,
19 perl,
20 postgresql,
21 prometheus-cpp,
22 nukeReferences,
23 git,
24 nlohmann_json,
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 mdbook,
39 foreman,
40 python3,
41 netcat,
42 cacert,
43 glibcLocales,
44 meson,
45 ninja,
46 nix-eval-jobs,
47 fetchFromGitHub,
48 nixosTests,
49 unstableGitUpdater,
50}:
51
52let
53 nix = nixVersions.nix_2_33;
54
55 perlDeps = buildEnv {
56 name = "hydra-perl-deps";
57 paths =
58 with perlPackages;
59 lib.closePropagation [
60 AuthenSASL
61 CatalystActionREST
62 CatalystAuthenticationStoreDBIxClass
63 CatalystAuthenticationStoreLDAP
64 CatalystDevel
65 CatalystPluginAccessLog
66 CatalystPluginAuthorizationRoles
67 CatalystPluginCaptcha
68 CatalystPluginPrometheusTiny
69 CatalystPluginSessionStateCookie
70 CatalystPluginSessionStoreFastMmap
71 CatalystPluginStackTrace
72 CatalystRuntime
73 CatalystTraitForRequestProxyBase
74 CatalystViewDownload
75 CatalystViewJSON
76 CatalystViewTT
77 CatalystXScriptServerStarman
78 CatalystXRoleApplicator
79 CryptPassphrase
80 CryptPassphraseArgon2
81 CryptRandPasswd
82 DBDPg
83 DBDSQLite
84 DBIxClassHelpers
85 DataDump
86 DateTime
87 DigestSHA1
88 EmailMIME
89 EmailSender
90 FileCopyRecursive
91 FileLibMagic
92 FileSlurper
93 FileWhich
94 IOCompress
95 IPCRun
96 IPCRun3
97 JSON
98 JSONMaybeXS
99 JSONXS
100 ListSomeUtils
101 LWP
102 LWPProtocolHttps
103 ModulePluggable
104 NetAmazonS3
105 NetPrometheus
106 NetStatsd
107 NumberBytesHuman
108 PadWalker
109 ParallelForkManager
110 PerlCriticCommunity
111 PrometheusTinyShared
112 ReadonlyX
113 SQLSplitStatement
114 SetScalar
115 Starman
116 StringCompareConstantTime
117 SysHostnameLong
118 TermSizeAny
119 TermReadKey
120 Test2Harness
121 TestPostgreSQL
122 TextDiff
123 TextTable
124 UUID4Tiny
125 XMLSimple
126 YAML
127 (nix.libs.nix-perl-bindings or nix.perl-bindings or null)
128 git
129 ];
130 };
131
132in
133stdenv.mkDerivation (finalAttrs: {
134 pname = "hydra";
135 version = "0-unstable-2026-01-23";
136 # nixpkgs-update: no auto update
137
138 src = fetchFromGitHub {
139 owner = "NixOS";
140 repo = "hydra";
141 rev = "8bc95a96f787eb36f29ceec773f5bf48bd121097";
142 hash = "sha256-Ro+qOHWmWuKJiUwX8bmNuGpb0cLUaPr0vsuZGAi2QCI=";
143 };
144
145 outputs = [
146 "out"
147 "doc"
148 ];
149
150 buildInputs = [
151 unzip
152 libpqxx
153 top-git
154 mercurial
155 darcs
156 subversion
157 breezy
158 openssl
159 bzip2
160 libxslt
161 nix
162 perlDeps
163 perl
164 pixz
165 boost
166 nlohmann_json
167 prometheus-cpp
168 ];
169
170 hydraPath = lib.makeBinPath (
171 [
172 subversion
173 openssh
174 nix
175 nix-eval-jobs
176 coreutils
177 findutils
178 pixz
179 gzip
180 bzip2
181 xz
182 gnutar
183 unzip
184 git
185 top-git
186 mercurial
187 darcs
188 gnused
189 breezy
190 ]
191 ++ lib.optionals stdenv.hostPlatform.isLinux [
192 rpm
193 dpkg
194 cdrkit
195 ]
196 );
197
198 nativeBuildInputs = [
199 meson
200 ninja
201 makeWrapper
202 pkg-config
203 mdbook
204 nukeReferences
205 ];
206
207 nativeCheckInputs = [
208 cacert
209 foreman
210 glibcLocales
211 python3
212 netcat
213 nix-eval-jobs
214 openldap
215 postgresql
216 ];
217
218 env = {
219 OPENLDAP_ROOT = openldap;
220 };
221
222 shellHook = ''
223 PATH=$(pwd)/src/script:$(pwd)/src/hydra-queue-runner:$(pwd)/src/hydra-evaluator:$PATH
224 PERL5LIB=$(pwd)/src/lib:$PERL5LIB;
225 '';
226
227 mesonBuildType = "release";
228
229 postPatch = ''
230 patchShebangs .
231 '';
232
233 preCheck = ''
234 export LOGNAME=''${LOGNAME:-foo}
235 # set $HOME for bzr so it can create its trace file
236 export HOME=$(mktemp -d)
237 '';
238
239 postInstall = ''
240 mkdir -p $out/nix-support
241 for i in $out/bin/*; do
242 read -n 4 chars < $i
243 if [[ $chars =~ ELF ]]; then continue; fi
244 wrapProgram $i \
245 --prefix PERL5LIB ':' "$out/libexec/hydra/lib:${perlPackages.makePerlPath [ perlDeps ]}" \
246 --prefix PATH ':' $out/bin:$hydraPath \
247 --set-default HYDRA_RELEASE ${finalAttrs.version} \
248 --set HYDRA_HOME $out/libexec/hydra \
249 --set NIX_RELEASE ${nix.name or "unknown"} \
250 --set NIX_EVAL_JOBS_RELEASE ${nix-eval-jobs.name or "unknown"}
251 done
252 '';
253
254 doCheck = true;
255
256 passthru = {
257 inherit nix perlDeps;
258 tests = { inherit (nixosTests) hydra; };
259 updateScript = unstableGitUpdater { };
260 };
261
262 meta = {
263 description = "Nix-based continuous build system";
264 homepage = "https://nixos.org/hydra";
265 license = lib.licenses.gpl3;
266 platforms = lib.platforms.linux;
267 maintainers = with lib.maintainers; [
268 conni2461
269 das_j
270 helsinki-Jo
271 mindavi
272 ];
273 };
274})