Skip to content

Nix flake: pin the toolchain Edge uses - #109

Merged
abdulsaheel merged 3 commits into
OpenStrap:mainfrom
mikenrafter:split/flake
Nov 14, 2026
Merged

abdulsaheel merged 3 commits into
OpenStrap:mainfrom
mikenrafter:split/flake

Conversation

@mikenrafter

@mikenrafter mikenrafter commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

Tests

dart analyze reports no issues and the full suite passes: 954 passed, 6 skipped, 0 failed. The 6 skips need a local whoop_hist.jsonl capture. I haven't run a Nix build of the flake on this branch.

Change size

2 files, +96.

Question for the reviewer

  • Are the pinned SDK and the shell entry points right for the Linux hosts you develop on?

Summary by Sourcery

Provide a reproducible Nix-based development environment with the pinned Edge toolchain and native-build support.

New Features:

  • Add a Nix flake providing pinned Flutter and Dart development environments for supported Linux systems, including an FHS shell for native builds.

Enhancements:

  • Pin the development toolchain and required build utilities for reproducible local development.

Build:

  • Add Nix flake configuration and lockfile for the development environment.

Summary by CodeRabbit

  • Chores
    • Added Nix-based development shells for Linux on x86_64 and ARM64, with Flutter and supporting development tools.
    • Included an environment with native library support and options to run commands within it.

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Define the Linux development shell with the pinned Flutter toolchain, required tools, and an FHS entry point for native builds.

  • flake.nix L1-52

Lock files and vendored code

Record the resolved Nix flake inputs for reproducible development environments.

  • flake.lock L1-44

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The new Nix flake defines development shells for x86_64-linux and aarch64-linux. It configures Flutter and development tools, and provides an FHS environment with interactive shell entry behavior.

Changes: Development Shell Setup

Layer / File(s) Summary
Configure development shells
flake.nix
The flake defines shells for two Linux architectures, uses unstable nixpkgs and a pinned nixpkgs revision for Flutter 3.41, and includes development tools and native libraries in an FHS environment. The shell unsets FLUTTER_ROOT and launches analytics-fhs when interactive and outside the FHS environment. The FHS environment opens Bash without a command or executes the supplied command.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: Minimal · up to d64b7

This change adds a pinned Nix development shell for Edge's toolchain and does not touch application code or metric outputs. No concrete problems were found. The Nix build was not run on this branch, but the change only affects developers who opt into the flake.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Nix flake: pin the toolchain Edge uses" matches the main change. The PR adds flake.nix, which pins Flutter 3.41 and provides the development shells, including an FHS shell for native builds…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Nix flake: pin the toolchain Edge uses" matches the main change. The PR adds flake.nix, which pins Flutter 3.41 and provides the development shells, including an FHS shell for native builds. The raw summary describes the flake as a dev shell provider, and the objectives describe the pinned Flutter 3.41.6 and Dart 3.11.4 toolchain. The title is specific and clear, though it does not mention the FHS environment, which is expected.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a748409c-9f90-446c-a227-61ae61b1b026
Commits

Reviewing files that changed from the base of the PR and between d200ad5 and d64b77c.

Files ignored due to path filters: 1

  • flake.lock is excluded by !**/*.lock
Files selected for processing: 1

  • flake.nix

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread flake.nix Resolved
Comment thread flake.nix Resolved
Comment thread flake.nix Resolved
Comment thread flake.nix Resolved
@abdulsaheel

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

@abdulsaheel

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@abdulsaheel
abdulsaheel merged commit 95244e3 into OpenStrap:main Nov 14, 2026
4 checks passed
@mikenrafter
mikenrafter deleted the split/flake branch November 15, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants