From e99981cfafdc5fc2496b67a04a21332e183aa5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 29 Jul 2025 14:58:29 +0200 Subject: [PATCH] flake: fix privateInputs loading in nix store contexts When clan-core is fetched via fetchgit (e.g. in tests), the devFlake/private directory exists but cannot be loaded as a flake. This causes errors when building test machines. Fix by: 1. Adding a .skip-private-inputs marker file in clan-core-for-checks to explicitly disable private inputs in test contexts 2. Checking for this marker file before attempting to load private inputs 3. Keeping the original tryEval approach as a fallback for compatibility This ensures tests can run without errors while preserving the ability to load private inputs in development environments. --- checks/flake-module.nix | 5 ++++- flake.nix | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/checks/flake-module.nix b/checks/flake-module.nix index ea86afb52..aa783d219 100644 --- a/checks/flake-module.nix +++ b/checks/flake-module.nix @@ -158,8 +158,11 @@ in clan-core-for-checks = pkgs.runCommand "clan-core-for-checks" { } '' cp -r ${pkgs.callPackage ./clan-core-for-checks.nix { }} $out - chmod +w $out/flake.lock + chmod -R +w $out cp ${../flake.lock} $out/flake.lock + + # Create marker file to disable private flake loading in tests + touch $out/.skip-private-inputs ''; }; packages = lib.optionalAttrs (pkgs.stdenv.isLinux) { diff --git a/flake.nix b/flake.nix index bf242c40c..643f74439 100644 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,7 @@ pathExists ; + # Load private flake inputs if available loadDevFlake = path: let @@ -60,7 +61,13 @@ devFlake = builtins.tryEval (loadDevFlake ./devFlake/private); - privateInputs = if devFlake.success then devFlake.value.inputs else { }; + privateInputs = + if pathExists ./.skip-private-inputs then + { } + else if devFlake.success then + devFlake.value.inputs + else + { }; in flake-parts.lib.mkFlake { inherit inputs; } ( { ... }: