New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated updates for buildRustPackage Applications #156
Conversation
ad61f89
to
ca3d7a7
Compare
ca3d7a7
to
336aad5
Compare
2d8a696
to
b5d6a3a
Compare
b5d6a3a
to
3da9745
Compare
So far I have tested this by:
|
numberOfHashes :: Text -> Int | ||
numberOfHashes derivationContents = countUp "sha256 =" + countUp "sha256=" | ||
numberOfHashes derivationContents = | ||
sum $ map countUp ["sha256 =", "sha256=", "cargoSha256 =", "modSha256 ="] | ||
where | ||
countUp x = T.count x derivationContents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to get something that isn't a heuristic here; without my update, the regular version
updater will kick and do a half-baked job on the Rust upgrade, since it thinks it just has 1 hash. This fixes it by teaching it about cargoSha256
, and while I'm here adding modSha256
(the Go equivalent).
I haven't seen examples in the wild without the space before =
, though it'd be nice if everything were hosed down with nixpkgs-fmt so that were an actual robust assumption.
Having merged an update to make go packages passthru the `modSha256` [1], we can now have `nixpkgs-update` inspect it and make updates, just as it now does for Rust packages as of [2]. As a slight detail, because the attribute is in `passthru` rather than actually being available in the derivation, we just do the equivalent of `nix eval -f . <attrPath>.<attr>` rather than going through the `drvAttrs` as before. [1] NixOS/nixpkgs#82027 [2] nix-community#156
Having merged an update to make go packages passthru the `modSha256` [1], we can now have `nixpkgs-update` inspect it and make updates, just as it now does for Rust packages as of [2]. As a slight detail, because the attribute is in `passthru` rather than actually being available in the derivation, we just do the equivalent of `nix eval -f . <attrPath>.<attr>` rather than going through the `drvAttrs` as before. This version has been tested successfully with at least one go update [3], but not thoroughly vetted. That said, it's essentially identical to the Rust implementation that has been working well for some time now. [1] NixOS/nixpkgs#82027 [2] nix-community#156 [3] NixOS/nixpkgs#82465
Adds our first non-trivial rewriter that makes real updates!