mirror of
https://codeberg.org/muon/home.git
synced 2026-07-03 23:49:35 +00:00
| .. | ||
| default.nix | ||
| README.md | ||
nvft (nvfetcher + tools)
A Nix package that combines nvfetcher source updates with automatic Go vendor hash calculation.
Usage
# Enter the nix-shell (makes nvft available)
nix-shell
# Run the updater
nvft
This will:
- Save existing vendorHash and source hashes
- Run
nvfetcherto update all source versions and hashes in_sources/generated.nix - Restore saved vendorHash values
- Check if source hash changed - if yes, recalculate vendorHash; if no, skip (fast!)
- Update
vendorHashin_sources/generated.nixonly if needed
Configuration
Go packages that need vendor hash updates are configured in the GO_PACKAGES array within the script.
Currently configured packages:
mender-cli->modules/home/terminal/hr/mender-cli.nix
To add more Go packages, edit pkgs/nvft/default.nix and add entries to the GO_PACKAGES array.
How it Works
For each Go package:
- Compares old vs new source hash to detect updates
- If source unchanged, keeps existing vendorHash (fast)
- If source changed, creates a temporary build with
lib.fakeHash - Attempts to build, which fails with the correct hash
- Extracts the correct hash from the error message
- Updates
vendorHashdirectly in_sources/generated.nixalongside the source information
Package Usage
Go packages read vendorHash from the sources:
let
src = sources.mender-cli;
in
buildGoModule {
inherit (src) pname version src vendorHash;
# ... rest of package
}
The vendorHash is stored in _sources/generated.nix alongside the version and source hash, keeping all auto-generated values in one place.