difftreelog
fix post-refactor
in: trunk
3 files changed
cmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/secrets/mod.rs
+++ b/cmds/fleet/src/cmds/secrets/mod.rs
@@ -167,13 +167,12 @@
let on: String = nix_go_json!(default_generator.impureOn);
let call_package = nix_go!(
- config_field.buildableSystems(Obj {
- localSystem: { config.local_system.clone() },
- })[{ on }]
- .config
- .nixpkgs
- .resolvedPkgs
- .callPackage
+ config_field.hosts[{ on }]
+ .nixosSystem
+ .config
+ .nixpkgs
+ .resolvedPkgs
+ .callPackage
);
let host = config.host(&on).await?;
@@ -486,7 +485,6 @@
}
let config_field = &config.config_unchecked_field;
- let config_field = nix_go!(config_field.configUnchecked);
let field = nix_go!(config_field.sharedSecrets[{ name }]);
let updated = update_owner_set(
@@ -512,7 +510,6 @@
let shared_set = config.list_shared().into_iter().collect::<HashSet<_>>();
for missing in expected_shared_set.difference(&shared_set) {
let config_field = &config.config_unchecked_field;
- let config_field = nix_go!(config_field.configUnchecked);
let secret = nix_go!(config_field.sharedSecrets[{ missing }]);
let expected_owners: Option<Vec<String>> =
nix_go_json!(secret.expectedOwners);
@@ -561,7 +558,6 @@
info!("updating secret: {name}");
let data = config.shared_secret(name)?;
let config_field = &config.config_unchecked_field;
- let config_field = nix_go!(config_field.configUnchecked);
let expected_owners: Vec<String> =
nix_go_json!(config_field.sharedSecrets[{ name }].expectedOwners);
if expected_owners.is_empty() {
cmds/fleet/src/host.rsdiffbeforeafterboth--- a/cmds/fleet/src/host.rs
+++ b/cmds/fleet/src/host.rs
@@ -204,7 +204,7 @@
pub async fn host(&self, name: &str) -> Result<ConfigHost> {
let config = &self.config_unchecked_field;
- let nixos_config = nix_go!(config.configuredSystems[{ name }].config);
+ let nixos_config = nix_go!(config.hosts[{ name }].nixosSystem.config);
Ok(ConfigHost {
config: self.clone(),
name: name.to_owned(),
@@ -236,9 +236,7 @@
/// Shared secrets configured in fleet.nix or in flake
pub async fn list_configured_shared(&self) -> Result<Vec<String>> {
let config_field = &self.config_unchecked_field;
- nix_go!(config_field.configUnchecked.sharedSecrets)
- .list_fields()
- .await
+ nix_go!(config_field.sharedSecrets).list_fields().await
}
/// Shared secrets configured in fleet.nix
pub fn list_shared(&self) -> Vec<String> {
@@ -299,7 +297,7 @@
pub async fn shared_secret_expected_owners(&self, secret: &str) -> Result<Vec<String>> {
let config_field = &self.config_unchecked_field;
Ok(nix_go_json!(
- config_field.configUnchecked.sharedSecrets[{ secret }].expectedOwners
+ config_field.sharedSecrets[{ secret }].expectedOwners
))
}
lib/default.nixdiffbeforeafterboth1{flake-utils}: {2 fleetConfiguration = {3 # TODO: Provide by fleet, instead of requesting user to provide it.4 # This is not good that user needs to provide it, as it becomes a flake data, and fleet arbitrarily rewriting it5 # always dirnets the flake. Instead, fleetConfiguration should return function, parameters of which should be filled6 # by fleet itself, which is possible since fleet moving to nix repl execution.7 data,8 nixpkgs,9 overlays ? [],10 hosts,11 modules,12 globalModules ? [],13 }: let14 hostNames = nixpkgs.lib.attrNames hosts;15 fleetLib = import ./fleetLib.nix {16 inherit nixpkgs hostNames;17 };18 in let19 root = nixpkgs.lib.evalModules {20 modules =21 (import ../modules/fleet/_modules.nix)22 ++ [23 data24 ({...}: {25 inherit globalModules hosts;26 })27 ]28 ++ modules;29 specialArgs = {30 inherit nixpkgs fleetLib;31 };32 };33 failedAssertions = map (x: x.message) (nixpkgs.lib.filter (x: !x.assertion) root.config.assertions);34 checkedRoot =35 if failedAssertions != []36 then throw "Fleet failed assertions:\n${nixpkgs.lib.concatStringsSep"\n"(map(x"- ${x}")failedAssertions)}"37 else nixpkgs.lib.showWarnings root.config.warnings root;38 withData = {39 root,40 data,41 }: {42 configuredHosts = root.config.hosts;43 config = root.config;44 };45 defaultData = withData {46 inherit data;47 root = checkedRoot;48 };49 uncheckedData = withData {inherit data root;};50 in {51 inherit nixpkgs overlays;52 inherit (defaultData) configuredHosts configuredSystems config buildableSystems;53 unchecked = {54 inherit (uncheckedData) configuredHosts configuredSystems config buildableSystems;55 };56 };57}1{flake-utils}: {2 fleetConfiguration = {3 # TODO: Provide by fleet, instead of requesting user to provide it.4 # This is not good that user needs to provide it, as it becomes a flake data, and fleet arbitrarily rewriting it5 # always dirnets the flake. Instead, fleetConfiguration should return function, parameters of which should be filled6 # by fleet itself, which is possible since fleet moving to nix repl execution.7 data,8 nixpkgs,9 overlays ? [],10 hosts,11 modules,12 globalModules ? [],13 }: let14 hostNames = nixpkgs.lib.attrNames hosts;15 fleetLib = import ./fleetLib.nix {16 inherit nixpkgs hostNames;17 };18 in let19 root = nixpkgs.lib.evalModules {20 modules =21 (import ../modules/fleet/_modules.nix)22 ++ [23 data24 ({...}: {25 inherit globalModules hosts overlays;26 })27 ]28 ++ modules;29 specialArgs = {30 inherit nixpkgs fleetLib;31 };32 };33 failedAssertions = map (x: x.message) (nixpkgs.lib.filter (x: !x.assertion) root.config.assertions);34 checkedRoot =35 if failedAssertions != []36 then throw "Fleet failed assertions:\n${nixpkgs.lib.concatStringsSep"\n"(map(x"- ${x}")failedAssertions)}"37 else nixpkgs.lib.showWarnings root.config.warnings root;38 withData = {39 root,40 data,41 }: {42 config = root.config;43 };44 defaultData = withData {45 inherit data;46 root = checkedRoot;47 };48 uncheckedData = withData {inherit data root;};49 in {50 inherit nixpkgs overlays;51 inherit (defaultData) config;52 unchecked = {53 inherit (uncheckedData) config;54 };55 };56}