mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-22 14:01:41 +03:00
Merge pull request #1027 from nix-community/lock-isvalid
lock: expose lock.isValid...
This commit is contained in:
commit
959d6f9678
@ -18,6 +18,7 @@
|
||||
|
||||
invalidationHashCurrent = l.hashString "sha256" (l.toJSON cfg.invalidationData);
|
||||
invalidationHashLocked = fileContent.invalidationHash or null;
|
||||
isValid = invalidationHashCurrent == invalidationHashLocked;
|
||||
|
||||
# script to remove the lock file if no fields are defined
|
||||
removeLockFileScript = config.deps.writePython3Bin "refresh" {} ''
|
||||
@ -182,7 +183,7 @@
|
||||
else throw (errorOutdatedField field);
|
||||
|
||||
loadedContent =
|
||||
if invalidationHashCurrent != invalidationHashLocked
|
||||
if !isValid
|
||||
then throw errorOutdated
|
||||
else l.mapAttrs loadField cfg.fields;
|
||||
|
||||
@ -217,6 +218,7 @@ in {
|
||||
|
||||
lock.content = mkLazy loadedContent;
|
||||
|
||||
lock.isValid = isValid;
|
||||
lock.lib = {inherit computeFODHash;};
|
||||
|
||||
deps = {nixpkgs, ...}:
|
||||
|
@ -83,6 +83,14 @@ in {
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
isValid = l.mkOption {
|
||||
type = t.bool;
|
||||
description = ''
|
||||
Check whether the current lock file is valid, which means we don't need to lock again.
|
||||
'';
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
lib.computeFODHash = l.mkOption {
|
||||
type = t.functionTo t.path;
|
||||
description = ''
|
||||
|
Loading…
Reference in New Issue
Block a user