From 9d0d48f4c3d2fb1a8c8607da143bb567a741d914 Mon Sep 17 00:00:00 2001 From: Anton Tetov Date: Mon, 17 Feb 2025 15:36:35 +0100 Subject: [PATCH] nh: fixes and addition to warnings/assertions (#6470) * nh: fix auto clean - ~Fix `PATH` variable~ - Remove flake path assertion - Add warning when HM's `nix.gc.automatic` is enabled * nh: simplify logic for warning related to cfg.clean --------- Co-authored-by: Nikita Pedorich --- modules/programs/nh.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/programs/nh.nix b/modules/programs/nh.nix index cb3d85e5..7e6e993f 100644 --- a/modules/programs/nh.nix +++ b/modules/programs/nh.nix @@ -52,15 +52,11 @@ in { }; config = { - warnings = lib.optionals - (osConfig != null && !(cfg.clean.enable -> !osConfig.nix.gc.automatic)) [ - "programs.nh.clean.enable and nix.gc.automatic (system-wide in configuration.nix) are both enabled. Please use one or the other to avoid conflict." - ]; - - assertions = [{ - assertion = (cfg.flake != null) -> !(lib.hasSuffix ".nix" cfg.flake); - message = "nh.flake must be a directory, not a nix file"; - }]; + warnings = (lib.optional + (cfg.clean.enable && osConfig != null && osConfig.nix.gc.automatic) + "programs.nh.clean.enable and nix.gc.automatic (system-wide in configuration.nix) are both enabled. Please use one or the other to avoid conflict.") + ++ (lib.optional (cfg.clean.enable && config.nix.gc.automatic) + "programs.nh.clean.enable and nix.gc.automatic (Home-Manager) are both enabled. Please use one or the other to avoid conflict."); home = lib.mkIf cfg.enable { packages = [ cfg.package ];