@@ -345,6 +345,7 @@ Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup
345345}
346346
347347static LockFile readLockFile (
348+ const Settings & settings,
348349 const fetchers::Settings & fetchSettings,
349350 const SourcePath & lockFilePath)
350351{
@@ -380,6 +381,7 @@ LockedFlake lockFlake(
380381 }
381382
382383 auto oldLockFile = readLockFile (
384+ settings,
383385 state.fetchSettings ,
384386 lockFlags.referenceLockFilePath .value_or (
385387 flake.lockFilePath ()));
@@ -616,7 +618,7 @@ LockedFlake lockFlake(
616618 inputFlake.inputs , childNode, inputPath,
617619 oldLock
618620 ? std::dynamic_pointer_cast<const Node>(oldLock)
619- : readLockFile (state.fetchSettings , inputFlake.lockFilePath ()).root .get_ptr (),
621+ : readLockFile (settings, state.fetchSettings , inputFlake.lockFilePath ()).root .get_ptr (),
620622 oldLock ? lockRootPath : inputPath,
621623 localPath,
622624 false );
@@ -678,9 +680,11 @@ LockedFlake lockFlake(
678680
679681 if (lockFlags.writeLockFile ) {
680682 if (sourcePath || lockFlags.outputLockFilePath ) {
681- if (auto unlockedInput = newLockFile.isUnlocked ()) {
683+ if (auto unlockedInput = newLockFile.isUnlocked (state. fetchSettings )) {
682684 if (lockFlags.failOnUnlocked )
683- throw Error (" cannot write lock file of flake '%s' because it has an unlocked input ('%s').\n " , topRef, *unlockedInput);
685+ throw Error (
686+ " Will not write lock file of flake '%s' because it has an unlocked input ('%s'). "
687+ " Use '--allow-dirty-locks' to allow this anyway." , topRef, *unlockedInput);
684688 if (state.fetchSettings .warnDirty )
685689 warn (" will not write lock file of flake '%s' because it has an unlocked input ('%s')" , topRef, *unlockedInput);
686690 } else {
@@ -979,9 +983,11 @@ static RegisterPrimOp r4({
979983
980984}
981985
982- std::optional<Fingerprint> LockedFlake::getFingerprint (ref<Store> store) const
986+ std::optional<Fingerprint> LockedFlake::getFingerprint (
987+ ref<Store> store,
988+ const fetchers::Settings & fetchSettings) const
983989{
984- if (lockFile.isUnlocked ()) return std::nullopt ;
990+ if (lockFile.isUnlocked (fetchSettings )) return std::nullopt ;
985991
986992 auto fingerprint = flake.lockedRef .input .getFingerprint (store);
987993 if (!fingerprint) return std::nullopt ;
0 commit comments