Skip to content

fakecloud: init at 0.13.3, buildGithubBinary: init#517036

Draft
kubukoz wants to merge 2 commits into
NixOS:masterfrom
kubukoz:fakecloud-init
Draft

fakecloud: init at 0.13.3, buildGithubBinary: init#517036
kubukoz wants to merge 2 commits into
NixOS:masterfrom
kubukoz:fakecloud-init

Conversation

@kubukoz

@kubukoz kubukoz commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds buildGithubBinary, a generic builder for prebuilt-binary packages distributed as multi-platform GitHub release assets, under pkgs/build-support/github-binary/. This pattern is pretty common, and I intend to upstream a few more packages using it.
  • Adds fakecloud 0.13.3 (free, open-source AWS emulator / LocalStack alternative) as the first consumer.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR.
  • Tested basic functionality of all binary files (fakecloud --version reports fakecloud 0.13.3).
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Verification

  • nix-build -A fakecloud succeeds on aarch64-darwin.
  • nix-build -A fakecloud.tests.version passes.
  • nix-instantiate --eval succeeds for all four declared platforms.
  • nixfmt --check clean on all changed files.
  • passthru.updateScript runs end-to-end (no-ops since 0.13.3 is current).

🤖 Built with assistance of Claude Code

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels May 5, 2026
kubukoz added 2 commits May 5, 2026 23:49
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
@kubukoz kubukoz marked this pull request as ready for review May 5, 2026 21:59
@nixpkgs-ci nixpkgs-ci Bot requested a review from philiptaron May 5, 2026 22:10
@kubukoz

kubukoz commented May 6, 2026

Copy link
Copy Markdown
Member Author

@pbsds could you have a look, please?

@pbsds pbsds left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mainProgram fall back back to pname is a contentious default, for this builder we should make meta.mainProgram (or a top-level argument like it) be required.
  • the nixpkgsRoot approach 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.

Comment on lines +42 to +43
| jq --raw-output ".[0].tag_name" \
| sed 's/^${tagPrefix}//')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| jq --raw-output ".[0].tag_name" \
| sed 's/^${tagPrefix}//')
| jq --raw-output ".[].tag_name" \
| grep -E '^${tagPrefix}' \
| sed 's/^${tagPrefix}//' \
| head -n1 )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can likely all be done in jq btw


platform_assets=()

for platform in ${lib.concatStringsSep " " platforms}; do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for platform in ${lib.concatStringsSep " " platforms}; do
for platform in ${lib.escapeShellArgs platforms}; do

Comment on lines +21 to +22
homepage = "https://github.com/faiscadev/fakecloud";
downloadPage = "https://github.com/faiscadev/fakecloud/releases";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two can safely be set by default

openjdk = jdk;
openjdk_headless = jdk_headless;

buildGithubBinary = callPackage ../build-support/github-binary { };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buildGithubBinary = callPackage ../build-support/github-binary { };
packagePrebuiltGithubBinary = callPackage ../build-support/github-binary { };

@pbsbot

pbsbot commented May 7, 2026

Copy link
Copy Markdown

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 517036
Commit: 25f55a0e0b0295910d6a0a868c2a31a5fe5fdf71


x86_64-linux

❌ 1 package failed to build:
  • fakecloud

Error logs: `x86_64-linux`
fakecloud
 'libs': [PosixPath('/nix/store/sanx9fg8mry8mq92zhlm5qvb83qlxrlx-gcc-15.2.0/lib'),
          PosixPath('/nix/store/si4q3zks5mn5jhzzyri9hhd3cv789vlm-gcc-15.2.0-lib/lib')],
 'paths': [PosixPath('/nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3')],
 'preserve_origin': False,
 'recursive': True,
 'runtime_dependencies': [],
 'structured_logs': False}
setting interpreter of /nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3/bin/fakecloud
searching for dependencies of /nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3/bin/fakecloud
    libssl.so.3 -> not found!
    libcrypto.so.3 -> not found!
    libz.so.1 -> not found!
    libgcc_s.so.1 -> found: /nix/store/wrxyd3k2f4bmh52pr5rpdjxxsm5r2qxm-gcc-15.2.0-libgcc/lib
setting RPATH to: /nix/store/wrxyd3k2f4bmh52pr5rpdjxxsm5r2qxm-gcc-15.2.0-libgcc/lib
auto-patchelf: 3 dependencies could not be satisfied
error: auto-patchelf could not satisfy dependency libssl.so.3 wanted by /nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3/bin/fakecloud
error: auto-patchelf could not satisfy dependency libcrypto.so.3 wanted by /nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3/bin/fakecloud
error: auto-patchelf could not satisfy dependency libz.so.1 wanted by /nix/store/dril2lspspdz5jalzjdz59x9s43dc6sz-fakecloud-0.13.3/bin/fakecloud
auto-patchelf failed to find all the required dependencies.
Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.

@pbsds

pbsds commented May 7, 2026

Copy link
Copy Markdown
Member

hmmm, I would recommend reading and abiding by #514587, even before it is merged. That particular build failure is not a good look

@kubukoz

kubukoz commented May 7, 2026

Copy link
Copy Markdown
Member Author

Thanks, I'll take this into account :)

@kubukoz kubukoz marked this pull request as draft May 7, 2026 19:44
@kubukoz

kubukoz commented May 8, 2026

Copy link
Copy Markdown
Member Author

I want to give the rest proper attention and time, but I also wanted to comment on this part already:

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.

I agree, building from source is great. But I think there are legit reasons to stray from it here - I'll cite two:

  1. In the case of fakecloud, it's a really long build - took about half an hour to build on my machine (MBP with M1 Max), I don't know how powerful Hydra is but I'd rather avoid hogging the runners if this turns out to require too much compute power. And the project is very actively developed, so rebuilds will happen relatively often.

  2. Scala apps - the binary release distribution model is very common to Scala applications - scala-cli, coursier, scalafmt, sn-bindgen, cellar - for example. Building Scala in Nix is an unsolved mystery (there's a history there, I can expand if needed), and wrapping the binaries is realistically our best bet at this time.


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 sources.json which the builder could help with...

@alyssais

Copy link
Copy Markdown
Member
  1. In the case of fakecloud, it's a really long build - took about half an hour to build on my machine (MBP with M1 Max), I don't know how powerful Hydra is but I'd rather avoid hogging the runners if this turns out to require too much compute power. And the project is very actively developed, so rebuilds will happen relatively often.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants