I’m trying to create an overlay inside a flake.nix
for a package like so:
{
description = "Polkadot overlay";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
polkadot = {
url = github:paritytech/polkadot/release;
flake = false;
};
};
outputs = { self, nixpkgs, polkadot }: {
overlay = final: prev:
let
pkgs = nixpkgs.legacyPackages.${final.system};
# this returns v.0.8.29
vers = pkgs.lib.strings.fileContents ./version;
in
{
polkadot-unstable = pkgs.polkadot.overrideAttrs (_: {
pname = "polkadot-unstable";
# remove v
version = with builtins; substring 1 (stringLength vers) vers;
src = polkadot;
cargoSha256 = pkgs.lib.fakeSha256;
});
};
defaultPackage.x86_64-linux =
let
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ self.overlay ]; };
in
pkgs.polkadot-unstable;
};
}
The build fails with:
error: --- Error ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
builder for '/nix/store/74p8x7h9dah5bld1w2fymdjb300khb4x-polkadot-0.8.29.drv' failed with exit code 1; last 10 log lines:
ERROR: cargoSha256 is out of date
Cargo.lock is not the same in polkadot-0.8.28-1-vendor.tar.gz
To fix the issue:
1. Use "0000000000000000000000000000000000000000000000000000" as the cargoSha256 value
2. Build the derivation and wait for it to fail with a hash mismatch
3. Copy the 'got: sha256:' value back into the cargoSha256 field
I don’t understand why the vendor tarball derivation is for the wrong package version (0.8.28-1 instead of 0.8.29).
There’s also the issue of getting the right sha256 hash, but I can deal with that once this first issue is fixed.
There seems to be something I don’t understand about how overrideAttrs
works, (at least) in conjunction with buildRustPackage
's machinery.
Any ideas?