fakecloud: init at 0.13.3, buildGithubBinary: init#517036
Conversation
Add a generic builder for prebuilt-binary packages distributed via GitHub Releases across multiple platforms. The caller provides GitHub coordinates (owner, repo, optional tagPrefix) and a sources.json with per-system asset filenames and sha256 hashes; the builder fetches the right asset, dispatches unpacking based on file extension (tarball / gzipped single binary / raw), installs the binary to $out/bin, and runs autoPatchelfHook on Linux. An update script is attached to passthru.updateScript automatically; it polls the latest GitHub release and rewrites sources.json, deriving each per-platform asset name from the previous filename by version substitution. Inspired by the inline pattern used in pkgs/by-name/sc/scala-cli.
Free, open-source AWS emulator (LocalStack alternative) covering 33 services and 2,422 operations. Uses prebuilt binary releases via the new buildGithubBinary helper. https://github.com/faiscadev/fakecloud/releases/tag/v0.13.3
|
@pbsds could you have a look, please? |
pbsds
left a comment
There was a problem hiding this comment.
On a first glance:
- I feel the complexity of the unpackPhase can be avoided with
fetchzip - it does not use
lib.extendMkDerivation - it does not have any documentation or a release notes entry, please make sure to also document how to bootstrap a new package
- it only installs
mainProgram, many packages will likely require many more files to function, like desktop entries, dbus entries, icons, assets, and manpages. - having
mainProgramfall back back topnameis a contentious default, for this builder we should makemeta.mainProgram(or a top-level argument like it) be required. - the
nixpkgsRootapproach will not work with flakes.
Zooming out to the bigger picture:
While meta.sourceProvenance is set correctly, we generally want to incentivize building from source in nixpkgs for supply chain security. This builder does push us away from that direction. Aa such, before blazing ahead with this approach I believe some consensus gathering is in order. @nixos/nixpkgs-core.
| | jq --raw-output ".[0].tag_name" \ | ||
| | sed 's/^${tagPrefix}//') |
There was a problem hiding this comment.
| | jq --raw-output ".[0].tag_name" \ | |
| | sed 's/^${tagPrefix}//') | |
| | jq --raw-output ".[].tag_name" \ | |
| | grep -E '^${tagPrefix}' \ | |
| | sed 's/^${tagPrefix}//' \ | |
| | head -n1 ) |
There was a problem hiding this comment.
this can likely all be done in jq btw
|
|
||
| platform_assets=() | ||
|
|
||
| for platform in ${lib.concatStringsSep " " platforms}; do |
There was a problem hiding this comment.
| for platform in ${lib.concatStringsSep " " platforms}; do | |
| for platform in ${lib.escapeShellArgs platforms}; do |
| homepage = "https://github.com/faiscadev/fakecloud"; | ||
| downloadPage = "https://github.com/faiscadev/fakecloud/releases"; |
There was a problem hiding this comment.
these two can safely be set by default
| openjdk = jdk; | ||
| openjdk_headless = jdk_headless; | ||
|
|
||
| buildGithubBinary = callPackage ../build-support/github-binary { }; |
There was a problem hiding this comment.
| buildGithubBinary = callPackage ../build-support/github-binary { }; | |
| packagePrebuiltGithubBinary = callPackage ../build-support/github-binary { }; |
|
|
hmmm, I would recommend reading and abiding by #514587, even before it is merged. That particular build failure is not a good look |
|
Thanks, I'll take this into account :) |
|
I want to give the rest proper attention and time, but I also wanted to comment on this part already:
I agree, building from source is great. But I think there are legit reasons to stray from it here - I'll cite two:
I understand not wanting to make this type of utility very commonly used, but at the same time I don't want to repeat the same updater pattern in each of those packages (I was planning to contribute derivations for the missing ones, right after this PR). On one hand, the builder might not be necessary - the updater is where it's at. But then again, the updater relies on a certain structure of |
That's absolutely nothing for Hydra. I would prefer that the buildGithubBinary builder function not be added. For one thing, builder functions are in general problematic due to not affording composition. Arguably that's not a big deal in this case. But I also think it adds additional friction to porting packages to build from source, to facilitate something we'd rather avoid (packaging pre-built binaries). |
Summary
buildGithubBinary, a generic builder for prebuilt-binary packages distributed as multi-platform GitHub release assets, underpkgs/build-support/github-binary/. This pattern is pretty common, and I intend to upstream a few more packages using it.fakecloud0.13.3 (free, open-source AWS emulator / LocalStack alternative) as the first consumer.Things done
passthru.tests(testers.testVersionagainstfakecloud --version).nixpkgs-reviewon this PR.fakecloud --versionreportsfakecloud 0.13.3).Verification
nix-build -A fakecloudsucceeds on aarch64-darwin.nix-build -A fakecloud.tests.versionpasses.nix-instantiate --evalsucceeds for all four declared platforms.nixfmt --checkclean on all changed files.passthru.updateScriptruns end-to-end (no-ops since 0.13.3 is current).🤖 Built with assistance of Claude Code