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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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; } (
|
||||
{ ... }:
|
||||
|
||||
Reference in New Issue
Block a user