Watch
0
0
Fork
You've already forked hyperhive
0

add a per-agent nix builds mode, host or none, carried like privateUsers

This commit is contained in:
atlas 2026-11-03 00:30:55 +01:00 • committed by mara
commit 5485151ba6

View file

@ -7,6 +7,7 @@
use std::time::Duration;
use hive_types::NixBuilds;
use serde::{Deserialize, Serialize};
/// The subject every build goes to. The controller is its one publisher and
@ -154,6 +155,11 @@ pub enum FromMetaReply {
/// predates the field answers without it, which reads as false.
#[serde(default)]
private_users: bool,
/// The agent's `services.hyperhive.agent.nixBuilds`. A builder that
/// predates the field answers without it, which reads as
/// [`NixBuilds::Host`].
#[serde(default)]
nix_builds: NixBuilds,
},
/// The build did not succeed: the last lines `nix` printed, or why it
/// stopped (it timed out, or could not start). The controller holds the
@ -268,6 +274,7 @@ mod tests {
system: "x86_64-linux".to_owned(),
cached: true,
private_users: true,
nix_builds: NixBuilds::Disabled,
},
json!({
"state": "built",
@ -275,6 +282,7 @@ mod tests {
"system": "x86_64-linux",
"cached": true,
"private_users": true,
"nix_builds": "none",
}),
),
(
@ -299,7 +307,8 @@ mod tests {
}
#[test]
fn a_built_reply_from_a_builder_without_the_fields_reads_as_not_cached_and_not_namespaced() {
fn a_built_reply_from_a_builder_without_the_fields_reads_as_not_cached_not_namespaced_and_host_builds()
{
let old = json!({"state": "built", "out_path": "/nix/store/x", "system": "s"});
assert_eq!(
serde_json::from_value::<FromMetaReply>(old).expect("decodes"),
@ -308,6 +317,7 @@ mod tests {
system: "s".to_owned(),
cached: false,
private_users: false,
nix_builds: NixBuilds::Host,
}
);
}