git.delta.rocks / fleet / refs/commits / 78bc9187eaae

difftreelog

feat non-interactive run0

rwtspuopYaroslav Bolyukin2026-06-15parent: #210037f.patch.diff

7 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -451,9 +451,9 @@
 
 [[package]]
 name = "bifrostlink"
-version = "0.2.6"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fb01af731c11dd31b23783a83a36a29f644cc1972481f6fa4f4fabc709079eb"
+checksum = "0c8ce9dc1425ee2aaffd3324548f114acccd456b9b1ffb33fe9eb9a7be6475a8"
 dependencies = [
  "async-trait",
  "async_fn_traits",
@@ -465,14 +465,13 @@
  "serde_json",
  "tokio",
  "tracing",
- "uuid",
 ]
 
 [[package]]
 name = "bifrostlink-macros"
-version = "0.2.6"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c4b7a5fb38b36bd81910c17ebf369f9296e508d92b1277a768a63c8a2254fdb"
+checksum = "a7d071add2d3b90486fe141edb2e811f7735155d320aee3936ebd67e535d6ac1"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -481,9 +480,9 @@
 
 [[package]]
 name = "bifrostlink-ports"
-version = "0.2.6"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "977acfcb8ed3c24ab7c2f76fb3eeebff1533c72708733ce6020f2501980b7cf2"
+checksum = "ccf6ba32d0ff83b27a242f9d2fca124ad215ddd9bf99144d66b7ca44a885de50"
 dependencies = [
  "bifrostlink",
  "bytes",
@@ -3654,13 +3653,12 @@
 
 [[package]]
 name = "remowt-client"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34d59c0ce311b4b3c094b0b196a1004aa438b9947c3eace2ca4d2a0ac08fac59"
+checksum = "af0ab07d961f14fa5c4933899a5253341e2044dec71db6e341f80b16beff2c20"
 dependencies = [
  "anyhow",
  "bifrostlink",
- "bifrostlink-ports",
  "bytes",
  "camino",
  "futures",
@@ -3679,13 +3677,11 @@
 
 [[package]]
 name = "remowt-endpoints"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb203856cd5cff27504bd2023c59195b1f1ce1cf5d8ea836598993894eb1b9c0"
+checksum = "9a841eec11d4cc0593188062634f7ee34e87a2052a70c0fa40fbecb4aa8692c0"
 dependencies = [
- "anyhow",
  "bifrostlink",
- "bifrostlink-macros",
  "camino",
  "nix",
  "serde",
@@ -3693,7 +3689,6 @@
  "thiserror 2.0.18",
  "tokio",
  "tracing",
- "uuid",
  "zbus",
 ]
 
@@ -3716,9 +3711,9 @@
 
 [[package]]
 name = "remowt-link-shared"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98ebba5be028a2dfb7f1858bb0ff74037262753eaae4dc6e5d9ae241c4567668"
+checksum = "d5036c5e2d5f47bb7ecb25542268f865c298c2b747d74269ff6b2b387574071a"
 dependencies = [
  "bifrostlink",
  "bytes",
@@ -3732,9 +3727,9 @@
 
 [[package]]
 name = "remowt-plugin"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef73ef3eea5bb6152d01019b5062e51ef258a1ac1c7a6f8cdcdf6fe1eb192cdd"
+checksum = "5ca599e67dc675d8dd59abfe8f08679f7f3c6fd7aa84507ab426839985a142ab"
 dependencies = [
  "anyhow",
  "bifrostlink",
@@ -3742,7 +3737,6 @@
  "remowt-link-shared",
  "serde_json",
  "tokio",
- "tracing",
  "tracing-subscriber",
 ]
 
@@ -3757,15 +3751,14 @@
 
 [[package]]
 name = "remowt-ui-prompt"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acf28ba68e6f8087657157695e9ab42b82a21130e77f6dffd27781062109325d"
+checksum = "2610933566f9b057dc47145b7bfc5876c4139eb766fc2fe9f2ce60baf1856c8c"
 dependencies = [
  "anyhow",
  "bifrostlink",
  "bifrostlink-macros",
  "serde",
- "serde_json",
  "thiserror 2.0.18",
  "tokio",
  "tracing",
modifiedcmds/fleet/src/cmds/rollback.rsdiffbeforeafterboth
--- a/cmds/fleet/src/cmds/rollback.rs
+++ b/cmds/fleet/src/cmds/rollback.rs
@@ -62,7 +62,6 @@
 			warn!("failed to list generations available locally: {e}");
 		})
 		.unwrap_or_default();
-	dbg!(&stored_locally);
 	stored_locally.retain(|g| !on_machine_store_paths.contains(&g.store_path));
 	for ele in stored_locally.iter_mut() {
 		ele.current = false;
modifiedcrates/fleet-base/src/host.rsdiffbeforeafterboth
--- a/crates/fleet-base/src/host.rs
+++ b/crates/fleet-base/src/host.rs
@@ -250,7 +250,7 @@
 		}
 		let bundle = agent_bundle()?;
 		let conn = if self.local {
-			Remowt::connect_local(&bundle)
+			Remowt::connect_local(&bundle, "remowt-fleet".to_owned())
 				.await
 				.context("starting local remowt agent")?
 		} else {
@@ -259,7 +259,7 @@
 				.get()
 				.cloned()
 				.unwrap_or_else(|| self.name.clone());
-			Remowt::connect(&dest, &bundle)
+			Remowt::connect(&dest, &bundle, "remowt-fleet".to_owned())
 				.await
 				.map_err(|e| anyhow!("remowt error while connecting to {}: {e:#?}", self.name))?
 		};
modifiedcrates/nix-eval/src/drv.rsdiffbeforeafterboth
before · crates/nix-eval/src/drv.rs
1use std::collections::{HashMap, HashSet, VecDeque};23use anyhow::{Result, bail};4use camino::{Utf8Component, Utf8Path, Utf8PathBuf};5use serde::Deserialize;67use crate::nix_raw::{derivation_free, derivation_to_json, store_drv_from_store_path};8use crate::{Store, copy_nix_str, with_default_context};910pub struct Derivation(*mut crate::nix_raw::derivation);11unsafe impl Send for Derivation {}1213impl Derivation {14	pub fn from_path(store: &Store, drv_path: &Utf8Path) -> Result<Self> {15		let store_path = store.parse_path(drv_path)?;16		let drv = with_default_context(|c, _| unsafe {17			store_drv_from_store_path(c, store.as_ptr(), store_path.as_ptr())18		});19		let drv = drv?;20		if drv.is_null() {21			bail!("failed to read derivation from {drv_path}");22		}23		Ok(Self(drv))24	}2526	pub fn to_json_string(&self) -> Result<String> {27		let mut out = String::new();28		with_default_context(|c, _| unsafe {29			derivation_to_json(c, self.0, Some(copy_nix_str), (&raw mut out).cast())30		})?;31		Ok(out)32	}3334	pub fn parsed(&self) -> Result<DrvParsed> {35		let s = self.to_json_string()?;36		Ok(serde_json::from_str(&s)?)37	}38}3940impl Drop for Derivation {41	fn drop(&mut self) {42		unsafe { derivation_free(self.0) };43	}44}4546#[derive(Debug, Deserialize)]47pub struct DrvParsed {48	pub inputs: DrvInputs,49	pub outputs: HashMap<String, DrvParsedOutput>,50}5152#[derive(Debug, Deserialize)]53pub struct DrvParsedOutput {54	#[serde(default)]55	pub path: Option<String>,56}5758#[derive(Debug, Deserialize)]59pub struct DrvInputs {60	#[serde(default)]61	pub srcs: Vec<Utf8PathBuf>,62	#[serde(default)]63	pub drvs: HashMap<Utf8PathBuf, DrvInputEntry>,64}6566#[derive(Debug, Deserialize)]67pub struct DrvInputEntry {68	pub outputs: Vec<String>,69}7071#[derive(Debug, Clone)]72pub struct DrvGraph {73	pub root: Utf8PathBuf,74	pub nodes: HashMap<Utf8PathBuf, DrvNode>,75}7677#[derive(Debug, Clone)]78pub struct DrvNode {79	pub name: String,80	pub input_drvs: HashMap<Utf8PathBuf, Vec<String>>,81	pub input_srcs: Vec<Utf8PathBuf>,82	// TODO: CA outputs without a known paths are skipped83	pub outputs: HashMap<String, Utf8PathBuf>,84}8586impl DrvGraph {87	pub fn resolve(store: &Store, drv_path: &Utf8Path) -> Result<Self> {88		let sd = store.store_dir()?;89		let root = sd.join(drv_path);9091		let mut nodes = HashMap::new();92		let mut queue = VecDeque::new();93		let mut visited = HashSet::new();94		queue.push_back(root.clone());95		visited.insert(root.clone());9697		while let Some(path) = queue.pop_front() {98			let drv = Derivation::from_path(store, &path)?;99			let parsed = drv.parsed()?;100101			let input_drvs: HashMap<Utf8PathBuf, Vec<String>> = parsed102				.inputs103				.drvs104				.into_iter()105				.map(|(k, v)| (sd.join(&k), v.outputs))106				.collect();107108			for dep_path in input_drvs.keys() {109				if visited.insert(dep_path.clone()) {110					queue.push_back(dep_path.clone());111				}112			}113114			let outputs: HashMap<String, Utf8PathBuf> = parsed115				.outputs116				.into_iter()117				.filter_map(|(name, out)| out.path.map(|p| (name, sd.join(&p))))118				.collect();119120			nodes.insert(121				path.clone(),122				DrvNode {123					name: extract_drv_name(&path),124					input_drvs,125					input_srcs: parsed.inputs.srcs,126					outputs,127				},128			);129		}130131		Ok(Self { root, nodes })132	}133134	pub fn wanted_outputs(&self, root_outputs: &[String]) -> HashMap<Utf8PathBuf, Vec<String>> {135		let mut wanted: HashMap<Utf8PathBuf, HashSet<String>> = HashMap::new();136		wanted.insert(self.root.clone(), root_outputs.iter().cloned().collect());137138		let mut queue: VecDeque<Utf8PathBuf> = VecDeque::new();139		queue.push_back(self.root.clone());140		while let Some(path) = queue.pop_front() {141			let Some(node) = self.nodes.get(&path) else {142				continue;143			};144			for (dep_path, dep_outputs) in &node.input_drvs {145				let entry = wanted.entry(dep_path.clone()).or_default();146				let mut changed = false;147				for o in dep_outputs {148					if entry.insert(o.clone()) {149						changed = true;150					}151				}152				if changed {153					queue.push_back(dep_path.clone());154				}155			}156		}157158		wanted159			.into_iter()160			.map(|(k, v)| {161				let mut v: Vec<_> = v.into_iter().collect();162				v.sort();163				(k, v)164			})165			.collect()166	}167}168169pub fn extract_drv_name(drv_path: &Utf8Path) -> String {170	let comp = drv_path171		.components()172		.rev()173		.next()174		.expect("drv path is at least one component");175	let Utf8Component::Normal(n) = comp else {176		panic!("drv path is normal");177	};178179	let n = n.strip_suffix(".drv").unwrap_or(n);180181	let n = n.split_once(' ').map(|(_, n)| n).unwrap_or(n);182183	n.to_owned()184}
modifiedflake.lockdiffbeforeafterboth
--- a/flake.lock
+++ b/flake.lock
@@ -188,9 +188,9 @@
         ]
       },
       "locked": {
-        "lastModified": 1781471358,
-        "rev": "c69dddc33f8e2081ef685ae20a7278f92cfcd32e",
-        "revCount": 37,
+        "lastModified": 1781491431,
+        "rev": "c8dca760c1f13e8b65677bac7b21abb487d745c0",
+        "revCount": 40,
         "type": "git",
         "url": "file:/home/lach/build/remowt-agents"
       },
modifiedmodules/nixos/module-list.nixdiffbeforeafterboth
--- a/modules/nixos/module-list.nix
+++ b/modules/nixos/module-list.nix
@@ -4,5 +4,6 @@
   ./rollback.nix
   ./nix-sign.nix
   ./online.nix
+  ./polkit.nix
   ./top-level.nix
 ]
addedmodules/nixos/polkit.nixdiffbeforeafterboth
--- /dev/null
+++ b/modules/nixos/polkit.nix
@@ -0,0 +1,15 @@
+{ ... }:
+{
+  users.groups.fleet-pusher = { };
+
+  security.polkit.extraConfig = ''
+    polkit.addRule(function(action, subject) {
+      if (action.id == "org.freedesktop.systemd1.manage-units" && subject.isInGroup("fleet-pusher")) {
+        const unit = action.lookup("unit");
+        if (unit && unit.indexOf("remowt-fleet-") == 0) {
+          return polkit.Result.YES;
+        }
+      }
+    });
+  '';
+}