Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 145 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[workspace]

members = [ "subprojects/hydra-builder", "subprojects/hydra-queue-runner", "subprojects/crates/*" ]
members = [
"subprojects/hydra-builder",
"subprojects/hydra-drv-daemon",
"subprojects/hydra-evaluator",
"subprojects/hydra-queue-runner",
"subprojects/crates/*",
]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -29,10 +35,13 @@ futures = "0.3"
futures-util = "0.3"
gethostname = "1"
h2 = "0.4"
harmonia-protocol = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-aterm = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-core = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-remote = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-base-encoding = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-hash = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-io = { git = "https://github.com/nix-community/harmonia.git" }
hashbrown = "0.16"
http = "1.1"
http-body-util = "0.1"
Expand Down Expand Up @@ -94,7 +103,12 @@ uuid = "1.16"
zerocopy = { version = "0.8", features = [ "derive" ] }

[patch.crates-io]
harmonia-nar = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-protocol = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-protocol-derive = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-aterm = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-core = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-store-remote = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-base-encoding = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-hash = { git = "https://github.com/nix-community/harmonia.git" }
harmonia-utils-io = { git = "https://github.com/nix-community/harmonia.git" }
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
hydra-evaluator: ./foreman/start-evaluator.sh
hydra-queue-runner: ./foreman/start-queue-runner.sh
hydra-builder: ./foreman/start-builder.sh
hydra-drv-daemon: ./foreman/start-drv-daemon.sh
hydra-notify: ./foreman/start-notify.sh
hydra-server: ./foreman/start-hydra.sh
manual: ./foreman/start-manual.sh
Expand Down
10 changes: 10 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
hydra-builder = self'.callPackage ./subprojects/hydra-builder/package.nix {
inherit nixComponents;
};
hydra-drv-daemon = self'.callPackage ./subprojects/hydra-drv-daemon/package.nix { };
hydra-evaluator = self'.callPackage ./subprojects/hydra-evaluator/package.nix {
inherit nixComponents;
};
});
mkHydraBuilder =
{ pkgs, nixComponents }:
Expand Down Expand Up @@ -137,6 +141,8 @@
hydra-linters
hydra-queue-runner
hydra-builder
hydra-drv-daemon
hydra-evaluator
;
};

Expand All @@ -153,6 +159,8 @@

builder = forEachSystemIncDarwin (system: packages.${system}.hydra-builder);

drvDaemon = forEachSystem (system: packages.${system}.hydra-drv-daemon);

nixosTests = import ./nixos-tests.nix {
inherit forEachSystem nixpkgs nixosModules;
};
Expand Down Expand Up @@ -280,6 +288,8 @@
hydra-linters
hydra-queue-runner
hydra-builder
hydra-evaluator
hydra-drv-daemon
;
foreman = pkgs.callPackage ./packaging/foreman/package.nix {
foreman-src = foreman;
Expand Down
19 changes: 19 additions & 0 deletions foreman/start-drv-daemon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

. ./foreman/common.sh

wait_for_postgres

# wait until the hydra database exists (hydra-server creates it)
while ! psql -h "$HYDRA_PG_SOCKET_DIR" -p "$HYDRA_PG_PORT" -d hydra -c 'SELECT 1' >/dev/null 2>&1; do sleep 1; done

wait_for_hydra_server

DAEMON_SOCK="$HYDRA_DATA/drv-daemon.sock"
UPSTREAM_SOCK="${NIX_DAEMON_SOCKET_PATH:-/nix/var/nix/daemon-socket/socket}"

export HYDRA_DBA="postgres://${USER}@localhost:$HYDRA_PG_PORT/hydra"

exec hydra-drv-daemon \
--socket "$DAEMON_SOCK" \
--upstream-socket "$UPSTREAM_SOCK"
7 changes: 7 additions & 0 deletions foreman/start-evaluator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ wait_for_postgres
wait_for_hydra_db
wait_for_hydra_server

# Route IFD store ops through the drv-daemon when its socket is up.
# When the socket is missing the evaluator falls back to the local nix-daemon.
DAEMON_SOCK="$HYDRA_DATA/drv-daemon.sock"
if [ -S "$DAEMON_SOCK" ]; then
export NIX_REMOTE="unix://$DAEMON_SOCK"
fi

HYDRA_CONFIG=$HYDRA_DATA/hydra.conf exec hydra-evaluator
Loading
Loading