git.delta.rocks / jrsonnet / refs/commits / 505f82ed3097

difftreelog

refactor remove _resolvedPkgs option

Yaroslav Bolyukin2024-08-18parent: #d2cec5d.patch.diff
in: trunk

2 files changed

modifiedcmds/fleet/src/host.rsdiffbeforeafterboth
--- a/cmds/fleet/src/host.rs
+++ b/cmds/fleet/src/host.rs
@@ -301,8 +301,11 @@
 
 	/// Packages for this host, resolved with nixpkgs overlays
 	pub async fn pkgs(&self) -> Result<Value> {
-		let nixos = self.nixos_config().await?;
-		Ok(nix_go!(nixos._resolvedPkgs))
+		let Some(host_config) = &self.host_config else {
+			bail!("local host has no host_config");
+		};
+		// TODO: Should nixos.options be cached?
+		Ok(nix_go!(host_config.nixos.options._module.args.value.pkgs))
 	}
 }
 
@@ -395,7 +398,6 @@
 	pub async fn host(&self, name: &str) -> Result<ConfigHost> {
 		let config = &self.config_field;
 		let host_config = nix_go!(config.hosts[{ name }]);
-
 
 		Ok(ConfigHost {
 			config: self.clone(),
modifiedmodules/nixos/meta.nixdiffbeforeafterboth
before · modules/nixos/meta.nix
1{2  lib,3  pkgs,4  ...5}: let6  inherit (lib.options) mkOption;7  inherit (lib.modules) mkRemovedOptionModule;8in {9  options = {10    # TODO: Give a real name.11    # Previously it was nixpkgs.resolvedPkgs, which was erroreously merged with nixpkgs override attribute.12    _resolvedPkgs = mkOption {13      type = lib.types.pkgs // {description = "nixpkgs.pkgs";};14      description = "Value of pkgs";15    };16  };17  imports = [18    (mkRemovedOptionModule ["tags"] "tags are now defined at the host level, not the nixos system level for fast filtering without evaluating unnecessary hosts.")19    (mkRemovedOptionModule ["network"] "network is now defined at the host level, not the nixos system level")20  ];21  config = {22    _resolvedPkgs = pkgs;23  };24}
after · modules/nixos/meta.nix
1{lib, ...}: let2  inherit (lib.modules) mkRemovedOptionModule;3in {4  imports = [5    (mkRemovedOptionModule ["tags"] "tags are now defined at the host level, not the nixos system level for fast filtering without evaluating unnecessary hosts.")6    (mkRemovedOptionModule ["network"] "network is now defined at the host level, not the nixos system level")7  ];8}