-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the builtin hashTo
#3151
Comments
@nlewo what is the motivation of doing the transformation at evaluation time? |
@zimbatm For example, I needed it for NixOS/nixpkgs#53787 |
Yep, this is in the same kind of contexts. |
I marked this as stale due to inactivity. → More info |
This would still be useful. |
It looks like |
I marked this as stale due to inactivity. → More info |
It's still important to me. BTW, is it possible to implement it inside the nixpkgs/lib first? |
Theoretically, yes. Practically, writing parsers is absolutely not what the Nix language is tailored to. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/the-length-of-integer-in-the-nix-language/24958/1 |
Thu correct synopsis would be builtins.hashTo algo base hash so that the hash algorithm would be available to the function. It is similar to the We could define an additional |
Now that #7708 is merged, I believe this is resolved and can be closed. |
I would like to add a builtin to convert a hash from one representation to another. Several Nix sub-commands (
to-base16
,to-sri
, ...) already exist to do such conversion but I would like to do that at evaluation time.Spec
builtins.hashTo <type> <hash-string>
where
<type>
is the expected representation.<type>
could be one of the hash representations supported by Nix, which are currentlybase16
,base32
,base64
andsri
.<hash-string>
is a string representing a hash. The format of this hash can be inferred.It would return the hash to the expected representation or an error if the input string doesn't represent a hash.
What do you think?
The text was updated successfully, but these errors were encountered: