nix3-key-generate-secret(1)
π nix3-key-generate-secret(1) β from the General Commands Manual, bestie π
β οΈ Warning, no cap: this program is experimental and its interface is subject to change. So like... learn it, love it, but don't get too attached to the exact vibes. β¨
πΈ Name
nix key generate-secret β generate a secret key for signing store paths π
β¨ Synopsis
nix key generate-secret [optionβ¦]
π Examples
- Okay so first, manifest a brand new secret key:
# nix key generate-secret --key-name cache.example.org-1 > ./secret-key
Now bestie, we can use that key to sign the closure of the Hello package:
# nix build nixpkgs#hello
# nix store sign --key-file ./secret-key --recursive ./result
And finally (the glow-up moment π), we verify the store paths using the corresponding public key:
# nix store verify --trusted-public-keys $(nix key convert-secret-to-public < ./secret-key) ./result
π¦ Description
This command generates a new Ed25519 secret key for signing store paths and prints it on standard output. And then, to get the corresponding public key for verifying signed store paths, you hit up nix key convert-secret-to-public. iconic duo fr fr π«
The mandatory argument --key-name specifies a key name (such as cache.example.org-1). It's used to look up keys on the client when it verifies signatures β like a lil name tag so the client knows who's who π. It can literally be anything, but it's suggested to use the host name of your cache (e.g. cache.example.org) with a suffix denoting the number of the key β and you bump that number up every single time you need to revoke a key. Stay safe out there π
π Format
Both secret and public keys are represented as the key name followed by a Base64 encoding of the Ed25519 key data, e.g.
cache.example.org-0:E7lAO+MsPwTFfPXsdPtW8GKui/5ho4KQHVcAGnX+Tti1V4dUxoVoqLyWJ4YESuZJwQ67GVIksDt47og+tPVUZw==
π Options
--key-namename β Identifier of the key (e.g.cache.example.org-1).
πΈ Logging-related options
--debugβ Set the logging verbosity level to 'debug'. (maximum yapping, we love that π«Ά)--log-formatformat β Set the format of log output; one ofraw,internal-json,barorbar-with-logs.--print-build-logs,-Lβ Print full build logs on standard error.--quietβ Decrease the logging verbosity level. (shhh π€«)--verbose,-vβ Increase the logging verbosity level.
β Miscellaneous global options
--helpβ Show usage information. (your bestie when you're lost π§)--offlineβ Disable substituters and consider all previously downloaded files up-to-date.--optionname value β Set the Nix configuration setting name to value (overridingnix.conf).--refreshβ Consider all previously downloaded files out-of-date.--versionβ Show version information.
π Note: See man nix.conf for overriding configuration settings with command line flags. iykyk π
And that's the whole page, babe β signed, sealed, delivered β¨ This was page nix3-key-generate-secret(1) from the General Commands Manual, brought to you by the absolute legends behind Nix. now go sign some store paths, you main character ππ
π₯
π¦ where this page comes from
- fedora 44: nix-core 2.35.3-2.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms