From 6b684c45c3e3cd31e5b66be108e2a9a286469f17 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 11 Jun 2025 20:05:39 +0200 Subject: [PATCH] feat(flake/select): add apply argument --- pkgs/clan-cli/clan_lib/flake/flake.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/flake/flake.py b/pkgs/clan-cli/clan_lib/flake/flake.py index d8184e258..85ae81e65 100644 --- a/pkgs/clan-cli/clan_lib/flake/flake.py +++ b/pkgs/clan-cli/clan_lib/flake/flake.py @@ -680,6 +680,7 @@ class Flake: self, selectors: list[str], nix_options: list[str] | None = None, + apply: str = "v: v", ) -> None: """ Retrieves specific attributes from a Nix flake using the provided selectors. @@ -754,7 +755,7 @@ class Flake: result = builtins.toJSON [ {" ".join( [ - f"(selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake)" + f"(({apply}) (selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake))" for attr in str_selectors ] )} @@ -823,6 +824,7 @@ class Flake: self, selector: str, nix_options: list[str] | None = None, + apply: str = "v: v", ) -> Any: """ Selects a value from the cache based on the provided selector string. @@ -839,6 +841,6 @@ class Flake: if not self._cache.is_cached(selector): log.debug(f"Cache miss for {selector}") - self.get_from_nix([selector], nix_options) + self.get_from_nix([selector], nix_options, apply=apply) value = self._cache.select(selector) return value