Instruction file imported from Cosmian/kms (
.github/instructions/nix.instructions.md). Copyright stays with the author.
Nix packaging rules
Structure
nix/contains build expressions for the KMS server, CLI, UI, OpenSSL, and HSM backends.nix/expected-hashes/stores vendor hashes for reproducible builds (Cargo deps, npm deps).- Deb and RPM packages are built via Nix derivations.
Vendor hash mismatch workflow
When CI reports a hash mismatch:
- Verify intent: Check if
Cargo.lockorui/pnpm-lock.yamlactually changed in this PR. - If unintentional: Revert the lock file change.
- If intentional: Retrieve the correct hash from the CI log output (
got: sha256-...) and update the corresponding file innix/expected-hashes/.
CI entry point
All CI runs go through Nix:
mise run [--variant fips|non-fips] [--link static|dynamic] <task>
OpenSSL bootstrap
nix/openssl.nixhandles the OpenSSL 3.6.2 build for Nix environments.nix/openssl-fips-bootstrap.c+nix/openssl-fips-bootstrap.nixhandle FIPS module initialization.
Best practices
- Pin all inputs — never use
fetchurlwithout a hash. - Keep derivations minimal — build logic belongs in
build.rsorMakefile, not Nix. - Test locally with
nix-buildbefore pushing hash changes.