about summary refs log tree commit diff
diff options
context:
space:
mode:
authordanbst <abcz2.uprola@gmail.com>2019-01-10 15:08:50 +0200
committerdanbst <abcz2.uprola@gmail.com>2019-01-10 19:27:35 +0200
commit68a6b47b8cdbcef4cab3a1f5fae7667a792c27eb (patch)
tree9c98f952a38026501ea56976af4e3795dd5631cc
parent7d864c6bd6391baa516118051ec5fb7e9836280e (diff)
lib: add shortcuts for fake hashes (fakeSha256, fakeSha512)
Fake hashes can be used as placeholders for all the places, where
Nix expression requires a hash, but we don't yet have one.

This should be more convenient than following:
- echo|sha256sum, copy into clipboard, go to editor, paste into previously
  edited place
- search nixpkgs for a random package, copy it's hash to cliboard, go to
  editor, paste into previously edited place

Nix can add support for these fake hashes. In that case printed error should contain
only 1 hash, so no more problem "which of two hashes from error should I use?"

Idea by irc:Synthetica
-rw-r--r--lib/default.nix1
-rw-r--r--lib/deprecated.nix4
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 916f6e05190b0..7e0311f6d1f19 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -132,6 +132,7 @@ let
       mergeAttrsWithFunc mergeAttrsConcatenateValues
       mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
       mergeAttrsByFuncDefaultsClean mergeAttrBy
+      fakeSha256 fakeSha512
       nixType imap;
   });
 in lib
diff --git a/lib/deprecated.nix b/lib/deprecated.nix
index 5a3a97c476dca..15de504566128 100644
--- a/lib/deprecated.nix
+++ b/lib/deprecated.nix
@@ -270,4 +270,8 @@ rec {
      starting at zero.
   */
   imap = imap1;
+
+  # Fake hashes. Can be used as hash placeholders, when computing hash ahead isn't trivial
+  fakeSha256 = "0000000000000000000000000000000000000000000000000000000000000000";
+  fakeSha512 = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
 }