Repository navigation
Nix flake: pin the toolchain Edge uses - #109
mikenrafter wants to merge 3 commits into
Conversation
Reviewer's GuideConfigurationDefine the Linux development shell with the pinned Flutter toolchain, required tools, and an FHS entry point for native builds.
Lock files and vendored codeRecord the resolved Nix flake inputs for reproducible development environments.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="flake.nix" line_range="23" />
<code_context>
+ };
+ flutter = flutterPkgs.flutterPackages.v3_41;
+ tools = with pkgs; [
+ flutter git ripgrep jq python3 gnumake unzip which
+ clang cmake ninja pkg-config
+ ];
</code_context>
<issue_to_address>
**Developers get a different Flutter toolchain**
When the shell or its FHS environment is entered while `pkgs.flutter` differs from `flutterPkgs.flutterPackages.v3_41`, `tools` resolves `flutter` from `with pkgs` as `pkgs.flutter` instead of the outer `flutter` binding, so the shell uses the nixpkgs Flutter version rather than the Edge-pinned SDK and developers get a mismatched toolchain.
Reference the outer pinned `flutter` binding explicitly in `tools` so `with pkgs` does not select `pkgs.flutter`.
</issue_to_address>
### Comment 2
<location path="flake.nix" line_range="45-46" />
<code_context>
+ # Let the packaged Flutter wrapper select its complete SDK,
+ # including prebuilt engine/test artifacts.
+ unset FLUTTER_ROOT
+ if [[ -z "$IN_ANALYTICS_FHS" && $- == *i* ]]; then
+ exec analytics-fhs
+ fi
+ '';
</code_context>
<issue_to_address>
**Non-interactive native builds fail**
When a developer starts a native build through a non-interactive `nix develop -c` or `--command` invocation, the shell hook skips `analytics-fhs` for non-interactive shells, so the native build runs without the FHS environment's system libraries and headers and fails.
Route non-interactive native build invocations through `analytics-fhs` as well.
</issue_to_address>
### Comment 3
<location path="flake.nix" line_range="11-21" />
<code_context>
+
+ outputs = { nixpkgs, nixpkgs-flutter, ... }:
+ let
+ systems = [ "x86_64-linux" "aarch64-linux" ];
+ forAllSystems = nixpkgs.lib.genAttrs systems;
+ in {
+ devShells = forAllSystems (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ flutterPkgs = import nixpkgs-flutter {
+ inherit system;
+ config.allowUnfree = true;
+ };
+ flutter = flutterPkgs.flutterPackages.v3_41;
+ tools = with pkgs; [
+ flutter git ripgrep jq python3 gnumake unzip which
</code_context>
<issue_to_address>
**ARM64 shell cannot run Flutter**
When a developer uses the shell on an `aarch64-linux` host, the dev shell includes `aarch64-linux` but selects the Linux Flutter SDK package without an ARM64-specific implementation; that SDK uses Linux x86_64 artifacts, which cannot run on an ARM64 host, so developers on that advertised system cannot use the shell.
Restrict the shell to architectures supported by the Flutter SDK, or provide a Flutter SDK package that runs natively on ARM64 Linux.
</issue_to_address>
### Comment 4
<location path="flake.nix" line_range="45" />
<code_context>
+ # Let the packaged Flutter wrapper select its complete SDK,
+ # including prebuilt engine/test artifacts.
+ unset FLUTTER_ROOT
+ if [[ -z "$IN_ANALYTICS_FHS" && $- == *i* ]]; then
+ exec analytics-fhs
+ fi
</code_context>
<issue_to_address>
**Shell startup fails with nounset**
When the shell running the hook has `nounset` enabled and `IN_ANALYTICS_FHS` is unset, `$IN_ANALYTICS_FHS` is unset in the initial shell, so Bash with `nounset` enabled aborts while expanding it and the development shell fails to start.
Use a default-value expansion such as `${IN_ANALYTICS_FHS:-}` in the condition.
</issue_to_address>Sourcery assessment
Approval pending. 4 findings to address first.
Blocking findings: flake.nix:23, flake.nix:46, flake.nix:21, flake.nix:45
This adds the Nix flake from #99 as its own PR, as asked in the #99 review. It pins Flutter 3.41.6 and Dart 3.11.4 and provides the development shell Edge uses, including the FHS shell for native builds.
What changes
flake.nixandflake.lock, byte for byte as they were in Performance: 15x cheaper night recalculation with streams and monoidic accumulators #99.Tests
dart analyzereports no issues and the full suite passes: 954 passed, 6 skipped, 0 failed. The 6 skips need a localwhoop_hist.jsonlcapture. I haven't run a Nix build of the flake on this branch.Change size
2 files, +96.
Question for the reviewer
Summary by Sourcery
Provide a reproducible Nix-based development environment with the pinned Edge toolchain and native-build support.
New Features:
Enhancements:
Build: