@cryptotaxi247 / infra-1 / commits / 38cf54ee

Consume hydra-queue-runner/builder module from upstream repo

Martin Weinelt committed Dec 17, 2025 at 23:57 UTC 38cf54eec25babc31711dcbdc66302c9928027ac
7 files changed +45 -709
flake.lock
+30
@@ -315,6 +315,35 @@
315 "type": "github"
316 }
317 },
318 + "hydra-queue-runner": {
319 + "inputs": {
320 + "flake-utils": [
321 + "flake-utils"
322 + ],
323 + "nixpkgs": [
324 + "nixpkgs"
325 + ],
326 + "nixpkgs-unstable": [
327 + "nixpkgs-unstable"
328 + ],
329 + "treefmt-nix": [
330 + "treefmt-nix"
331 + ]
332 + },
333 + "locked": {
334 + "lastModified": 1769551408,
335 + "narHash": "sha256-8FaW2OxI5JVjU8ONvK9rH4xQfDA/MAaI5YXvsFuPyP4=",
336 + "owner": "helsinki-systems",
337 + "repo": "hydra-queue-runner",
338 + "rev": "3d54e589b425fceaf5c59ba61613544e04fc8ff8",
339 + "type": "github"
340 + },
341 + "original": {
342 + "owner": "helsinki-systems",
343 + "repo": "hydra-queue-runner",
344 + "type": "github"
345 + }
346 + },
347 "nft-prefix-import": {
348 "inputs": {
349 "nixpkgs": [
@@ -492,6 +521,7 @@
521 "flake-utils": "flake-utils",
522 "freescout": "freescout",
523 "hydra": "hydra",
524 + "hydra-queue-runner": "hydra-queue-runner",
525 "nft-prefix-import": "nft-prefix-import",
526 "nixos-channel-scripts": "nixos-channel-scripts",
527 "nixpkgs": "nixpkgs",
flake.nix
+8
@@ -17,6 +17,14 @@
17 inputs.nixpkgs.follows = "nixpkgs";
18 };
19
20 + hydra-queue-runner = {
21 + url = "github:helsinki-systems/hydra-queue-runner";
22 + inputs.flake-utils.follows = "flake-utils";
23 + inputs.nixpkgs.follows = "nixpkgs";
24 + inputs.nixpkgs-unstable.follows = "nixpkgs-unstable";
25 + inputs.treefmt-nix.follows = "treefmt-nix";
26 + };
27 +
28 nixos-channel-scripts = {
29 url = "github:NixOS/nixos-channel-scripts";
30 inputs.nixpkgs.follows = "nixpkgs";
non-critical-infra/hosts/staging-hydra/default.nix
-3
@@ -5,11 +5,8 @@
5 inputs.srvos.nixosModules.server
6 inputs.srvos.nixosModules.hardware-hetzner-cloud-arm
7 ../../modules/common.nix
8 - ../../modules/hydra-queue-runner-v2.nix
9 - ../../modules/hydra-queue-builder-v2.nix
8 ./hydra-proxy.nix
9 ./hydra.nix
12 - inputs.hydra.nixosModules.hydra
10 ];
11
12 nixpkgs.overlays = [
non-critical-infra/hosts/staging-hydra/hydra.nix
+7 -1
@@ -2,6 +2,7 @@
2 lib,
3 pkgs,
4 config,
5 + inputs,
6 ...
7 }:
8 let
@@ -12,6 +13,11 @@ let
13 ];
14 in
15 {
16 + imports = [
17 + inputs.hydra.nixosModules.hydra
18 + inputs.hydra-queue-runner.nixosModules.queue-runner
19 + ];
20 +
21 networking.firewall.allowedTCPPorts = [
22 9198 # queue-runnner metrics
23 9199 # hydra-notify metrics
@@ -118,7 +124,7 @@ in
124 '';
125 };
126
121 - hydra-queue-runner-v2 = {
127 + queue-runner-dev = {
128 enable = true;
129 settings = {
130 queueTriggerTimerInS = 300;
non-critical-infra/modules/hydra-queue-builder-v2.nix deleted
-285
@@ -1,285 +0,0 @@
1 -{
2 - config,
3 - pkgs,
4 - lib,
5 - ...
6 -}:
7 -let
8 - cfg = config.services.hydra-queue-builder-v2;
9 -in
10 -{
11 - options = {
12 - services.hydra-queue-builder-v2 = {
13 - enable = lib.mkEnableOption "QueueBuilder";
14 -
15 - queueRunnerAddr = lib.mkOption {
16 - description = "Queue Runner address to the grpc server";
17 - type = lib.types.singleLineStr;
18 - };
19 -
20 - pingInterval = lib.mkOption {
21 - description = "Interval in which pings are send to the runner";
22 - type = lib.types.ints.positive;
23 - default = 10;
24 - };
25 -
26 - speedFactor = lib.mkOption {
27 - description = "Additional Speed factor for this machine";
28 - type = lib.types.oneOf [
29 - lib.types.ints.positive
30 - lib.types.float
31 - ];
32 - default = 1;
33 - };
34 -
35 - maxJobs = lib.mkOption {
36 - description = "Maximum allowed of jobs. This only is used if the queue runner uses this metrics for determining free machines.";
37 - type = lib.types.ints.positive;
38 - default = 4;
39 - };
40 -
41 - tmpAvailThreshold = lib.mkOption {
42 - description = "Threshold in percent free for /tmp before jobs are no longer scheduled on the machine";
43 - type = lib.types.float;
44 - default = 10.0;
45 - };
46 -
47 - storeAvailThreshold = lib.mkOption {
48 - description = "Threshold in percent free for /nix/store before jobs are no longer scheduled on the machine";
49 - type = lib.types.float;
50 - default = 10.0;
51 - };
52 -
53 - load1Threshold = lib.mkOption {
54 - description = "Maximum Load1 threshold before we stop scheduling jobs on that node. Only used if PSI is not available.";
55 - type = lib.types.float;
56 - default = 8.0;
57 - };
58 -
59 - cpuPsiThreshold = lib.mkOption {
60 - description = "Maximum CPU PSI in the last 10s before we stop scheduling jobs on that node";
61 - type = lib.types.float;
62 - default = 75.0;
63 - };
64 -
65 - memPsiThreshold = lib.mkOption {
66 - description = "Maximum Memory PSI in the last 10s before we stop scheduling jobs on that node";
67 - type = lib.types.float;
68 - default = 80.0;
69 - };
70 -
71 - ioPsiThreshold = lib.mkOption {
72 - description = "Maximum IO PSI in the last 10s before we stop scheduling jobs on that node. If null then this pressure check is disabled.";
73 - type = lib.types.nullOr lib.types.float;
74 - default = null;
75 - };
76 -
77 - systems = lib.mkOption {
78 - description = "List of supported systems. If none are passed, system and extra-platforms are read from nix.";
79 - type = lib.types.listOf lib.types.singleLineStr;
80 - default = [ ];
81 - };
82 -
83 - supportedFeatures = lib.mkOption {
84 - description = "Pass supported features to the builder. If none are passed, system features will be used.";
85 - type = lib.types.listOf lib.types.singleLineStr;
86 - default = [ ];
87 - };
88 -
89 - mandatoryFeatures = lib.mkOption {
90 - description = "Pass mandatory features to the builder.";
91 - type = lib.types.listOf lib.types.singleLineStr;
92 - default = [ ];
93 - };
94 -
95 - useSubstitutes = lib.mkOption {
96 - description = "Use substitution for paths";
97 - type = lib.types.bool;
98 - default = true;
99 - };
100 -
101 - authorizationFile = lib.mkOption {
102 - description = "Path to token authorization file if token auth should be used.";
103 - type = lib.types.nullOr lib.types.path;
104 - default = null;
105 - };
106 -
107 - mtls = lib.mkOption {
108 - description = "mtls options";
109 - default = null;
110 - type = lib.types.nullOr (
111 - lib.types.submodule {
112 - options = {
113 - serverRootCaCertPath = lib.mkOption {
114 - description = "Server root ca certificate path";
115 - type = lib.types.path;
116 - };
117 - clientCertPath = lib.mkOption {
118 - description = "Client certificate path";
119 - type = lib.types.path;
120 - };
121 - clientKeyPath = lib.mkOption {
122 - description = "Client key path";
123 - type = lib.types.path;
124 - };
125 - domainName = lib.mkOption {
126 - description = "Domain name for mtls";
127 - type = lib.types.singleLineStr;
128 - };
129 - };
130 - }
131 - );
132 - };
133 -
134 - package = lib.mkOption {
135 - type = lib.types.package;
136 - default = (lib.recurseIntoAttrs (pkgs.callPackage ../packages/hydra-queue-runner { })).builder;
137 - };
138 - };
139 - };
140 -
141 - config = lib.mkIf cfg.enable {
142 - systemd.services.hydra-queue-builder-v2 = {
143 - description = "hydra-queue-builder-v2 main service";
144 -
145 - requires = [ "nix-daemon.socket" ];
146 - after = [ "network.target" ];
147 - wantedBy = [ "multi-user.target" ];
148 -
149 - environment = {
150 - NIX_REMOTE = "daemon";
151 - LIBEV_FLAGS = "4"; # go ahead and mandate epoll(2)
152 - RUST_BACKTRACE = "1";
153 -
154 - # Note: it's important to set this for nix-store, because it wants to use
155 - # $HOME in order to use a temporary cache dir. bizarre failures will occur
156 - # otherwise
157 - HOME = "/run/hydra-queue-builder-v2";
158 - };
159 -
160 - serviceConfig = {
161 - Type = "notify";
162 - Restart = "always";
163 - RestartSec = "5s";
164 -
165 - ExecStart = lib.escapeShellArgs (
166 - [
167 - (lib.getExe cfg.package)
168 - "--gateway-endpoint"
169 - cfg.queueRunnerAddr
170 - "--ping-interval"
171 - cfg.pingInterval
172 - "--speed-factor"
173 - cfg.speedFactor
174 - "--max-jobs"
175 - cfg.maxJobs
176 - "--tmp-avail-threshold"
177 - cfg.tmpAvailThreshold
178 - "--store-avail-threshold"
179 - cfg.storeAvailThreshold
180 - "--load1-threshold"
181 - cfg.load1Threshold
182 - "--cpu-psi-threshold"
183 - cfg.cpuPsiThreshold
184 - "--mem-psi-threshold"
185 - cfg.memPsiThreshold
186 - ]
187 - ++ lib.optionals (cfg.ioPsiThreshold != null) [
188 - "--io-psi-threshold"
189 - cfg.ioPsiThreshold
190 - ]
191 - ++ (builtins.concatMap (v: [
192 - "--systems"
193 - v
194 - ]) cfg.systems)
195 - ++ (builtins.concatMap (v: [
196 - "--supported-features"
197 - v
198 - ]) cfg.supportedFeatures)
199 - ++ (builtins.concatMap (v: [
200 - "--mandatory-features"
201 - v
202 - ]) cfg.mandatoryFeatures)
203 - ++ lib.optionals (cfg.useSubstitutes != null) [
204 - "--use-substitutes"
205 - ]
206 - ++ lib.optionals (cfg.authorizationFile != null) [
207 - "--authorization-file"
208 - cfg.authorizationFile
209 - ]
210 - ++ lib.optionals (cfg.mtls != null) [
211 - "--server-root-ca-cert-path"
212 - cfg.mtls.serverRootCaCertPath
213 - "--client-cert-path"
214 - cfg.mtls.clientCertPath
215 - "--client-key-path"
216 - cfg.mtls.clientKeyPath
217 - "--domain-name"
218 - cfg.mtls.domainName
219 - ]
220 - );
221 -
222 - User = "hydra-queue-builder";
223 - Group = "hydra";
224 -
225 - ReadWritePaths = [
226 - "/nix/var/nix/gcroots/"
227 - "/nix/var/nix/daemon-socket/socket"
228 - ];
229 - ReadOnlyPaths = [ "/nix/" ];
230 - RuntimeDirectory = "hydra-queue-builder-v2";
231 -
232 - PrivateNetwork = false;
233 - SystemCallFilter = [
234 - "@system-service"
235 - "~@privileged"
236 - "~@resources"
237 - ];
238 -
239 - ProtectSystem = "strict";
240 - ProtectHome = true;
241 - PrivateTmp = true;
242 - PrivateDevices = true;
243 - ProtectKernelTunables = true;
244 - ProtectControlGroups = true;
245 - RestrictSUIDSGID = true;
246 - PrivateMounts = true;
247 - RemoveIPC = true;
248 - UMask = "0077";
249 -
250 - CapabilityBoundingSet = "";
251 - NoNewPrivileges = true;
252 -
253 - ProtectKernelModules = true;
254 - SystemCallArchitectures = "native";
255 - ProtectKernelLogs = true;
256 - ProtectClock = true;
257 -
258 - RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
259 -
260 - LockPersonality = true;
261 - ProtectHostname = true;
262 - RestrictRealtime = true;
263 - MemoryDenyWriteExecute = true;
264 - PrivateUsers = true;
265 - RestrictNamespaces = true;
266 - };
267 - };
268 - systemd.tmpfiles.rules = [
269 - "d /nix/var/nix/gcroots/per-user/hydra-queue-builder 0755 hydra-queue-builder hydra -"
270 - ];
271 - nix.settings = {
272 - allowed-users = [ "hydra-queue-builder" ];
273 - experimental-features = [ "nix-command" ];
274 - trusted-users = [ "hydra-queue-builder" ];
275 - };
276 -
277 - users = {
278 - groups.hydra = { };
279 - users.hydra-queue-builder = {
280 - group = "hydra";
281 - isSystemUser = true;
282 - };
283 - };
284 - };
285 -}
non-critical-infra/modules/hydra-queue-runner-v2.nix deleted
-318
@@ -1,318 +0,0 @@
1 -{
2 - config,
3 - pkgs,
4 - lib,
5 - ...
6 -}:
7 -let
8 - cfg = config.services.hydra-queue-runner-v2;
9 -
10 - format = pkgs.formats.toml { };
11 -in
12 -{
13 - options = {
14 - services.hydra-queue-runner-v2 = {
15 - enable = lib.mkEnableOption "QueueRunner";
16 -
17 - settings = lib.mkOption {
18 - description = "Reloadable settings for queue runner";
19 - type = lib.types.submodule {
20 - options = {
21 - hydraDataDir = lib.mkOption {
22 - description = "Hydra data directory";
23 - type = lib.types.path;
24 - default = "/var/lib/hydra";
25 - };
26 - dbUrl = lib.mkOption {
27 - description = "Postgresql database url";
28 - type = lib.types.singleLineStr;
29 - default = "postgres://hydra@%2Frun%2Fpostgresql:5432/hydra";
30 - };
31 - maxDbConnections = lib.mkOption {
32 - description = "Postgresql maximum db connections";
33 - type = lib.types.ints.positive;
34 - default = 128;
35 - };
36 - machineSortFn = lib.mkOption {
37 - description = "Function name for sorting machines";
38 - type = lib.types.enum [
39 - "SpeedFactorOnly"
40 - "CpuCoreCountWithSpeedFactor"
41 - "BogomipsWithSpeedFactor"
42 - ];
43 - default = "SpeedFactorOnly";
44 - };
45 - machineFreeFn = lib.mkOption {
46 - description = "Function name for determining \"idle\" machines";
47 - type = lib.types.enum [
48 - "Dynamic"
49 - "DynamicWithMaxJobLimit"
50 - "Static"
51 - ];
52 - default = "Static";
53 - };
54 - dispatchTriggerTimerInS = lib.mkOption {
55 - description = "Timer for triggering dispatch in an interval in seconds. Setting this to a value <= 0 will disable this timer and only trigger the dispatcher if queue changes happend.";
56 - type = lib.types.int;
57 - default = 120;
58 - };
59 - queueTriggerTimerInS = lib.mkOption {
60 - description = "Timer for triggering queue in an interval in seconds. Setting this to a value <= 0 will disable this timer and only trigger via pg notifications.";
61 - type = lib.types.int;
62 - default = -1;
63 - };
64 - remoteStoreAddr = lib.mkOption {
65 - description = "Remote store address";
66 - type = lib.types.listOf lib.types.singleLineStr;
67 - default = [ ];
68 - };
69 - useSubstitutes = lib.mkOption {
70 - description = "Use substitution for paths";
71 - type = lib.types.bool;
72 - default = false;
73 - };
74 - rootsDir = lib.mkOption {
75 - description = "Gcroots directory, defaults to /nix/var/nix/gcroots/per-user/$LOGNAME/hydra-roots";
76 - type = lib.types.nullOr lib.types.path;
77 - default = null;
78 - };
79 - maxRetries = lib.mkOption {
80 - description = "Number of maximum amount of retries for a build step.";
81 - type = lib.types.ints.positive;
82 - default = 5;
83 - };
84 - retryInterval = lib.mkOption {
85 - description = "Interval in which retires should be able to be attempted again.";
86 - type = lib.types.ints.positive;
87 - default = 60;
88 - };
89 - retryBackoff = lib.mkOption {
90 - description = "Additional backoff on top of the retry interval.";
91 - type = lib.types.float;
92 - default = 3.0;
93 - };
94 - maxUnsupportedTimeInS = lib.mkOption {
95 - description = "Time until unsupported steps are aborted.";
96 - type = lib.types.ints.unsigned;
97 - default = 120;
98 - };
99 - stopQueueRunAfterInS = lib.mkOption {
100 - description = "Seconds after which the queue run should be interupted early. Setting this to a value <= 0 will disable this feature and the queue run will never exit early.";
101 - type = lib.types.int;
102 - default = 60;
103 - };
104 - maxConcurrentDownloads = lib.mkOption {
105 - description = "Max count of concurrent downloads per build. Increasing this will increase memory usage of the queue runner.";
106 - type = lib.types.ints.positive;
107 - default = 5;
108 - };
109 - concurrentUploadLimit = lib.mkOption {
110 - description = "Concurrent limit for uploading to s3.";
111 - type = lib.types.ints.positive;
112 - default = 5;
113 - };
114 - tokenListPath = lib.mkOption {
115 - description = "Path to a list of allowed authentication tokens.";
116 - type = lib.types.nullOr lib.types.path;
117 - default = null;
118 - };
119 - };
120 - };
121 - default = { };
122 - };
123 -
124 - grpc = lib.mkOption {
125 - description = "grpc options";
126 - default = { };
127 - type = lib.types.submodule {
128 - options = {
129 - address = lib.mkOption {
130 - type = lib.types.singleLineStr;
131 - default = "[::1]";
132 - description = "The IP address the grpc listener should bound to";
133 - };
134 -
135 - port = lib.mkOption {
136 - description = "Which grpc port this app should listen on";
137 - type = lib.types.port;
138 - default = 50051;
139 - };
140 - };
141 - };
142 - };
143 -
144 - rest = lib.mkOption {
145 - description = "rest options";
146 - default = { };
147 - type = lib.types.submodule {
148 - options = {
149 - address = lib.mkOption {
150 - type = lib.types.singleLineStr;
151 - default = "[::1]";
152 - description = "The IP address the rest listener should bound to";
153 - };
154 -
155 - port = lib.mkOption {
156 - description = "Which rest port this app should listen on";
157 - type = lib.types.port;
158 - default = 8080;
159 - };
160 - };
161 - };
162 - };
163 -
164 - mtls = lib.mkOption {
165 - description = "mtls options";
166 - default = null;
167 - type = lib.types.nullOr (
168 - lib.types.submodule {
169 - options = {
170 - serverCertPath = lib.mkOption {
171 - description = "Server certificate path";
172 - type = lib.types.path;
173 - };
174 - serverKeyPath = lib.mkOption {
175 - description = "Server key path";
176 - type = lib.types.path;
177 - };
178 - clientCaCertPath = lib.mkOption {
179 - description = "Client ca certificate path";
180 - type = lib.types.path;
181 - };
182 - };
183 - }
184 - );
185 - };
186 - package = lib.mkOption {
187 - type = lib.types.package;
188 - default = (lib.recurseIntoAttrs (pkgs.callPackage ../packages/hydra-queue-runner { })).runner;
189 - };
190 - };
191 - };
192 -
193 - config = lib.mkIf cfg.enable {
194 - systemd.services.hydra-queue-runner-v2 = {
195 - description = "hydra queue-runner-v2 main service";
196 -
197 - requires = [ "nix-daemon.socket" ];
198 - after = [
199 - "network.target"
200 - "postgresql.service"
201 - ];
202 - wantedBy = [ "multi-user.target" ];
203 - reloadTriggers = [ config.environment.etc."hydra/queue-runner.toml".source ];
204 -
205 - environment = {
206 - NIX_REMOTE = "daemon";
207 - LIBEV_FLAGS = "4"; # go ahead and mandate epoll(2)
208 - RUST_BACKTRACE = "1";
209 -
210 - # Note: it's important to set this for nix-store, because it wants to use
211 - # $HOME in order to use a temporary cache dir. bizarre failures will occur
212 - # otherwise
213 - HOME = "/var/lib/hydra/queue-runner";
214 - };
215 -
216 - restartIfChanged = false;
217 - serviceConfig = {
218 - Type = "notify";
219 - Restart = "always";
220 - RestartSec = "5s";
221 -
222 - ExecStart = lib.escapeShellArgs (
223 - [
224 - (lib.getExe cfg.package)
225 - "--rest-bind"
226 - "${cfg.rest.address}:${toString cfg.rest.port}"
227 - "--grpc-bind"
228 - "${cfg.grpc.address}:${toString cfg.grpc.port}"
229 - "--config-path"
230 - "/etc/hydra/queue-runner.toml"
231 - ]
232 - ++ lib.optionals (cfg.mtls != null) [
233 - "--server-cert-path"
234 - cfg.mtls.serverCertPath
235 - "--server-key-path"
236 - cfg.mtls.serverKeyPath
237 - "--client-ca-cert-path"
238 - cfg.mtls.clientCaCertPath
239 - ]
240 - );
241 - ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
242 -
243 - User = "hydra-queue-runner";
244 - Group = "hydra";
245 -
246 - StateDirectory = [ "hydra/queue-runner" ];
247 - StateDirectoryMode = "0700";
248 - ReadWritePaths = [
249 - "/nix/var/nix/gcroots/"
250 - "/run/postgresql/.s.PGSQL.${toString config.services.postgresql.settings.port}"
251 - "/nix/var/nix/daemon-socket/socket"
252 - "/var/lib/hydra/build-logs/"
253 - ];
254 - ReadOnlyPaths = [ "/nix/" ];
255 - WorkingDirectory = "/var/lib/hydra/queue-runner";
256 -
257 - PrivateNetwork = false;
258 - SystemCallFilter = [
259 - "@system-service"
260 - "~@privileged"
261 - "~@resources"
262 - ];
263 - ManagedOOMPreference = "avoid";
264 - LimitNOFILE = 65536;
265 -
266 - ProtectSystem = "strict";
267 - ProtectHome = true;
268 - PrivateTmp = true;
269 - PrivateDevices = true;
270 - ProtectKernelTunables = true;
271 - ProtectControlGroups = true;
272 - RestrictSUIDSGID = true;
273 - PrivateMounts = true;
274 - RemoveIPC = true;
275 - UMask = "0022";
276 -
277 - CapabilityBoundingSet = "";
278 - NoNewPrivileges = true;
279 -
280 - ProtectKernelModules = true;
281 - SystemCallArchitectures = "native";
282 - ProtectKernelLogs = true;
283 - ProtectClock = true;
284 -
285 - RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
286 -
287 - LockPersonality = true;
288 - ProtectHostname = true;
289 - RestrictRealtime = true;
290 - MemoryDenyWriteExecute = true;
291 - PrivateUsers = true;
292 - RestrictNamespaces = true;
293 - };
294 - };
295 -
296 - environment.etc."hydra/queue-runner.toml".source = format.generate "queue-runner.toml" (
297 - lib.filterAttrsRecursive (_: v: v != null) cfg.settings
298 - );
299 - systemd.tmpfiles.rules = [
300 - "d /nix/var/nix/gcroots/per-user/hydra-queue-runner 0755 hydra-queue-runner hydra -"
301 - "d /var/lib/hydra/build-logs/ 0755 hydra-queue-runner hydra -"
302 - ];
303 -
304 - nix.settings = {
305 - allowed-users = [ "hydra-queue-runner" ];
306 - experimental-features = [ "nix-command" ];
307 - trusted-users = [ "hydra-queue-runner" ];
308 - };
309 -
310 - users = {
311 - groups.hydra = { };
312 - users.hydra-queue-runner = {
313 - group = "hydra";
314 - isSystemUser = true;
315 - };
316 - };
317 - };
318 -}
non-critical-infra/packages/hydra-queue-runner/default.nix deleted
-102
@@ -1,102 +0,0 @@
1 -{
2 - rustPackages_1_91,
3 - fetchFromGitHub,
4 - pkg-config,
5 - openssl,
6 - zlib,
7 - protobuf,
8 - lib,
9 - makeWrapper,
10 - nixVersions,
11 - nlohmann_json,
12 - libsodium,
13 - boost,
14 - withOtel ? false,
15 -}:
16 -let
17 - version = "unstable-2025-11-27";
18 - src = fetchFromGitHub {
19 - owner = "helsinki-systems";
20 - repo = "hydra-queue-runner";
21 - rev = "8266ce9818393ee9d0fe3ffd7bcde3eb09c2221f";
22 - hash = "sha256-tC4s+opt4BpN0qFx96AXhtUEJj8T7J5C68Hjj2OEetM=";
23 - };
24 - cargoHash = "sha256-49p2mC0DmsdgWdj4mWZf7SZj4Gd9eQFqTGRDzvMYSQM=";
25 - nativeBuildInputs = [
26 - pkg-config
27 - protobuf
28 - makeWrapper
29 - ];
30 - buildInputs = [
31 - openssl
32 - zlib
33 - protobuf
34 -
35 - nixVersions.nix_2_32
36 - nlohmann_json
37 - libsodium
38 - boost
39 - ];
40 - meta = {
41 - description = "Hydra Queue-Runner implemented in rust";
42 - homepage = "https://github.com/helsinki-systems/hydra-queue-runner";
43 - license = [ lib.licenses.gpl3 ];
44 - maintainers = [ lib.maintainers.conni2461 ];
45 - platforms = lib.platforms.all;
46 - };
47 -in
48 -{
49 - runner = rustPackages_1_91.rustPlatform.buildRustPackage {
50 - pname = "hydra-queue-runner";
51 - inherit version src;
52 - __structuredAttrs = true;
53 - strictDeps = true;
54 -
55 - inherit
56 - cargoHash
57 - nativeBuildInputs
58 - buildInputs
59 - ;
60 -
61 - buildAndTestSubdir = "queue-runner";
62 - buildFeatures = lib.optional withOtel "otel";
63 - doCheck = false;
64 -
65 - postInstall = ''
66 - wrapProgram $out/bin/queue-runner \
67 - --prefix PATH : ${lib.makeBinPath [ nixVersions.nix_2_32 ]} \
68 - --set-default JEMALLOC_SYS_WITH_MALLOC_CONF "background_thread:true,narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true"
69 - '';
70 -
71 - meta = meta // {
72 - mainProgram = "queue-runner";
73 - };
74 - };
75 -
76 - builder = rustPackages_1_91.rustPlatform.buildRustPackage {
77 - pname = "hydra-queue-builder";
78 - inherit src version;
79 - __structuredAttrs = true;
80 - strictDeps = true;
81 -
82 - inherit
83 - cargoHash
84 - nativeBuildInputs
85 - buildInputs
86 - ;
87 -
88 - buildAndTestSubdir = "builder";
89 - buildFeatures = lib.optional withOtel "otel";
90 - doCheck = false;
91 -
92 - postInstall = ''
93 - wrapProgram $out/bin/builder \
94 - --prefix PATH : ${lib.makeBinPath [ nixVersions.nix_2_32 ]} \
95 - --set-default JEMALLOC_SYS_WITH_MALLOC_CONF "background_thread:true,narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true"
96 - '';
97 -
98 - meta = meta // {
99 - mainProgram = "builder";
100 - };
101 - };
102 -}