From 2d77e6d1b2fb58df5a27cbf70ca5080ba642f786 Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 27 Sep 2026 18:03:46 -0400 Subject: [PATCH] fix(natu): track selected dependencies --- .../nixos/modules/desktop/session/waybar.nix | 3 ++- src/dotfiles/default.nix | 12 +++++----- src/natu/natu_test.rs | 24 +++++++++++++++++++ src/natu/scope_graph.rs | 2 +- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/configs/nixos/modules/desktop/session/waybar.nix b/configs/nixos/modules/desktop/session/waybar.nix index cfb3d4f..f05f047 100644 --- a/configs/nixos/modules/desktop/session/waybar.nix +++ b/configs/nixos/modules/desktop/session/waybar.nix @@ -8,10 +8,11 @@ let cfg = config.modules.desktop.session.waybar; # NOLINT(let_order) + vpnClient = config.modules.network.vpn-client; + # A Nerd Font Private-Use-Area codepoint as a literal character, decoded # through JSON so the glyph survives as bytes rather than an editor paste. g = code: builtins.fromJSON ''"\u${code}"''; - vpnClient = config.modules.network.vpn-client; user = config.user.name; sleepOffIcon = builtins.fromJSON ''"\udb81\udcb3"''; diff --git a/src/dotfiles/default.nix b/src/dotfiles/default.nix index 98dcaeb..996c130 100644 --- a/src/dotfiles/default.nix +++ b/src/dotfiles/default.nix @@ -16,6 +16,12 @@ let util = import ./util.nix { inherit lib; }; + registry = import ./registry.nix { + inherit lib util; + hosts = self.nixosConfigurations; + root = root + "/registry"; + }; + guestModules = import ./guests.nix { inherit inputs @@ -27,12 +33,6 @@ let root = root + "/guests"; }; - registry = import ./registry.nix { - inherit lib util; - hosts = self.nixosConfigurations; - root = root + "/registry"; - }; - modules = import ./modules.nix { inherit util; root = root + "/modules"; diff --git a/src/natu/natu_test.rs b/src/natu/natu_test.rs index a2817c0..90078bf 100644 --- a/src/natu/natu_test.rs +++ b/src/natu/natu_test.rs @@ -77,6 +77,30 @@ fn natu_preserves_suppressed_bindings() -> googletest::Result<()> { Ok(()) } +#[gtest] +fn natu_reports_select_dependency_order() -> googletest::Result<()> { + let report = natu::future_sight(vec![SourceFile { + path: PathBuf::from("testdata/select_dependencies.nix"), + source: r#" +let + dependency = { value = 1; }; + entry = dependency.value; +in +entry +"# + .into(), + }]) + .or_fail()?; + + let count = report + .diagnostics + .iter() + .filter(|diagnostic| diagnostic.finding.rule_id == "let_order") + .count(); + expect_that!(count, eq(1)); + Ok(()) +} + #[gtest] fn natu_reports_list_to_attrs_after_map() -> googletest::Result<()> { let report = natu::future_sight(vec![SourceFile { diff --git a/src/natu/scope_graph.rs b/src/natu/scope_graph.rs index 0bbc9ab..2dd2139 100644 --- a/src/natu/scope_graph.rs +++ b/src/natu/scope_graph.rs @@ -51,7 +51,7 @@ impl ScopeGraph { .iter() .flat_map(|expression| self.build_expr(expression, scope)) .collect(), - ast::Expr::Select(_) => Vec::new(), + ast::Expr::Select(select) => vec![self.add_reference(&select.receiver, scope)], } }