Skip to content

Stabilise nix hash and subcommands #8876

@fricklerhandwerk

Description

@fricklerhandwerk

This implements NixOS/rfcs#136. This issue is agreed-upon by the https://github.com/orgs/NixOS/teams/nix-team.

Only leave these two commands, collapsing the existing ones into them:

  • nix hash convert

    
    nix hash convert [--hash-algo (sha256|md5|...)] --from base16|...|sri --to (base64|...) <strings>...
    
    • the current implementation makes --from optional, but we are not quite sure how that works. If it doesn't seem robust, we can make it mandatory instead.

    • --algo is optional but will error if it can't infer from SRI or guess

  • nix hash path:

    nix hash path --hash-algo (sha256|md5|...) --to (base16|...|sri) --mode nar|flat|git <path>
    
    • algo is mandatory, any default would be arbitrary
    • collapse modes to nar (serialise the directory as a NAR and hash that), flat (single file, error on directory), git (directory, according to RFC 133)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRelated to an accepted RFCidea approvedThe given proposal has been discussed and approved by the Nix team. An implementation is welcome.new-cliRelating to the "nix" command

    Projects

    Status

    Done

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions