git.delta.rocks / jrsonnet / refs/commits / 13f8ec8b964e

difftreelog

fix secret generation

Yaroslav Bolyukin2024-09-09parent: #ef18a9f.patch.diff
in: trunk

3 files changed

modifiedcrates/fleet-base/src/host.rsdiffbeforeafterboth
--- a/crates/fleet-base/src/host.rs
+++ b/crates/fleet-base/src/host.rs
@@ -61,6 +61,7 @@
 
 	pub host_config: Option<Value>,
 	pub nixos_config: OnceCell<Value>,
+	pub pkgs_override: Option<Value>,
 
 	// TODO: Move command helpers away with connectivity refactor
 	pub local: bool,
@@ -297,6 +298,9 @@
 
 	/// Packages for this host, resolved with nixpkgs overlays
 	pub async fn pkgs(&self) -> Result<Value> {
+		if let Some(value) = &self.pkgs_override {
+			return Ok(value.clone());
+		}
 		let Some(host_config) = &self.host_config else {
 			bail!("local host has no host_config");
 		};
@@ -310,8 +314,6 @@
 		ConfigHost {
 			config: self.clone(),
 			name: "<virtual localhost>".to_owned(),
-			local: true,
-			session: OnceLock::new(),
 			host_config: None,
 			nixos_config: OnceCell::new(),
 			groups: {
@@ -319,6 +321,10 @@
 				let _ = cell.set(vec![]);
 				cell
 			},
+			pkgs_override: Some(self.default_pkgs.clone()),
+
+			local: true,
+			session: OnceLock::new(),
 		}
 	}
 
@@ -332,7 +338,8 @@
 			host_config: Some(host_config),
 			nixos_config: OnceCell::new(),
 			groups: OnceCell::new(),
-			
+			pkgs_override: None,
+
 			// TODO: Remove with connectivit refactor
 			local: self.localhost == name,
 			session: OnceLock::new(),
modifiedcrates/fleet-base/src/opts.rsdiffbeforeafterboth
--- a/crates/fleet-base/src/opts.rs
+++ b/crates/fleet-base/src/opts.rs
@@ -196,11 +196,11 @@
 
 		let import = nix_go!(builtins_field.import);
 		let overlays = nix_go!(config_field.nixpkgs.overlays);
-		let nixpkgs = nix_go!(fleet_field.nixpkgs.buildUsing | import);
+		let nixpkgs = nix_go!(config_field.nixpkgs.buildUsing | import);
 
 		let default_pkgs = nix_go!(nixpkgs(Obj {
 			overlays,
-			system: { self.local_system.clone() },
+			system: { local_system.clone() },
 		}));
 
 		Ok(Config(Arc::new(FleetConfigInternals {
modifiedlib/flakePart.nixdiffbeforeafterboth
9 inherit (lib.attrsets) mapAttrs;9 inherit (lib.attrsets) mapAttrs;
10 inherit (lib.types) lazyAttrsOf deferredModule unspecified;10 inherit (lib.types) lazyAttrsOf deferredModule unspecified;
11 inherit (lib.strings) isPath;11 inherit (lib.strings) isPath;
12 inherit (fleetLib.options) mkHostsOption;
13in {12in {
14 options.fleetModules = mkOption {13 options.fleetModules = mkOption {
15 type = lazyAttrsOf unspecified;14 type = lazyAttrsOf unspecified;
42 ++ [41 ++ [
43 module42 module
44 {43 {
45 options.hosts = mkHostsOption {44 config = {
45 data =
46 if isPath data
47 then import data
48 else data;
46 nixos.nixpkgs.overlays = [49 nixpkgs.overlays = [
47 (final: prev:50 (final: prev:
48 import ../pkgs {51 import ../pkgs {
49 inherit (prev) callPackage;52 inherit (prev) callPackage;
50 craneLib = crane.mkLib prev;53 craneLib = crane.mkLib prev;
51 })54 })
52 ];55 ];
53 };56 };
54 config = {
55 data =
56 if isPath data
57 then import data
58 else data;
59 };
60 }57 }
61 ];58 ];
62 specialArgs = {59 specialArgs = {