Skip to content

Nix flake: pin the toolchain Edge uses - #109

Open
mikenrafter wants to merge 2 commits into
OpenStrap:mainfrom
mikenrafter:split/flake
Open

mikenrafter wants to merge 2 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

Add a reproducible Nix development environment with the pinned Flutter and Dart toolchain used by Edge.

New Features:

  • Add a Nix flake development environment for Edge analytics development on x86_64 and aarch64 Linux systems.

Enhancements:

  • Pin the Flutter and Dart toolchain versions used by the project.
  • Provide a development shell with required tooling and an FHS environment for native builds.

Build:

  • Add Nix flake configuration and lock data for reproducible development environments.

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Add the Nix development shell and its pinned inputs so Linux developers can use Edge’s Flutter and Dart toolchain, with the lock file recording those input revisions.

  • flake.lock L1-44
  • flake.nix L1-52

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

Warning

Review limit reached

You'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 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: f526d5a9-baa9-4103-9eb7-9aea058a320b
Commits

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

Files ignored due to path filters: 1

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

  • flake.nix
  • 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

@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
};
flutter = flutterPkgs.flutterPackages.v3_41;
tools = with pkgs; [
flutter git ripgrep jq python3 gnumake unzip which

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · 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.

Prompt for AI agents
In `flake.nix` at line 23:

**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`.

Comment thread flake.nix
Comment on lines +45 to +46
if [[ -z "$IN_ANALYTICS_FHS" && $- == *i* ]]; then
exec analytics-fhs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · 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.

Prompt for AI agents
In `flake.nix` at lines 45-46:

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

Comment thread flake.nix
Comment on lines +11 to +21
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · 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.

Prompt for AI agents
In `flake.nix` at lines 11-21:

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

Comment thread flake.nix
# Let the packaged Flutter wrapper select its complete SDK,
# including prebuilt engine/test artifacts.
unset FLUTTER_ROOT
if [[ -z "$IN_ANALYTICS_FHS" && $- == *i* ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · 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.

Prompt for AI agents
In `flake.nix` at line 45:

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

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.

1 participant