Hello all. I am trying to package a flutter app into master and having the devil of a time getting it to work. I’m hoping y’all might have some advice.
The app is Release v0.9.3 · interstellar-app/interstellar · GitHub.
This is the package.nix I have so far: nixpkgs/pkgs/by-name/in/interstellar at jollydev/interstellar-at-0p9p3 · JollyDevelopment/nixpkgs · GitHub
The error I keep getting is during the packageRun build_runner build -d
step:
[SEVERE] freezed on lib/src/widgets/content_item/content_item.dart:
This builder requires Dart inputs without syntax errors.
However, package:interstellar/src/widgets/content_item/content_item.dart (or an existing part) contains the following errors.
content_item.dart:622:69: This requires the 'null-aware-elements' language feature to be enabled.
content_item.dart:624:39: This requires the 'null-aware-elements' language feature to be enabled.
content_item.dart:649:68: This requires the 'null-aware-elements' language feature to be enabled.
And 6 more...
Try fixing the errors and re-running the build.
package:build_resolvers/src/resolver.dart 244:9 AnalyzerResolver.compilationUnitFor.<fn>
package:pool/pool.dart 127:28 Pool.withResource
package:source_gen/src/builder.dart 389:18 _hasAnyTopLevelAnnotations
package:source_gen/src/builder.dart 97:11 _Builder.build
[SEVERE] freezed on lib/src/widgets/user_status_icons.dart:
This builder requires Dart inputs without syntax errors.
However, package:interstellar/src/widgets/user_status_icons.dart (or an existing part) contains the following errors.
user_status_icons.dart:61:18: This requires the 'null-aware-elements' language feature to be enabled.
user_status_icons.dart:61:30: This requires the 'null-aware-elements' language feature to be enabled.
Try fixing the errors and re-running the build.
package:build_resolvers/src/resolver.dart 244:9 AnalyzerResolver.compilationUnitFor.<fn>
package:pool/pool.dart 127:28 Pool.withResource
package:source_gen/src/builder.dart 389:18 _hasAnyTopLevelAnnotations
package:source_gen/src/builder.dart 97:11 _Builder.build
As far as I can tell that error indicates that the dart
being used in the build is lower than 3.8.0, which is when the null-aware-elements
feature came in. The problem is that the dart inside the build process reports as either 3.8.0-278.4.beta
(when building from the nixos-25.05 branch), 3.8.0
(when building from master), or even 3.8.1
when building from the branch in this PR flutter332: 3.32.0 -> 3.32.2 by emaryn · Pull Request #412226 · NixOS/nixpkgs · GitHub.
Things I have tried so far:
- just a regular build from a branch off of master with
nix-build -A insterstellar
- making a temporary directory and creating a nix-shell build env with:
nix-shell -E "with import <nixpkgs> {}; callPackage /path/to/nixpkgs/pkgs/by-name/in/interstellar/package.nix {}"
then doing therunPhase unpackPhase
,runPhase otherPhase
as in Nixpkgs/Create and debug packages - NixOS Wiki. - adding the nixpkgs master clone on disc to the NIX_PATH with:
export NIX_PATH=masterpkgs=/path/to//nixpkgs:$NIX_PATH
and doing the same nix-shell from #2 but with<masterpkgs>
- doing the same as #3, but with the branch from the PR mentioned above.
I was able to get the prior version of the app to build using flutter329 here: nixpkgs/pkgs/by-name/in/interstellar at jollydev/interstellar-at-0p9p2 · JollyDevelopment/nixpkgs · GitHub but that version is missing a bunch of features so I did not submit the PR.
I can also do a local build in a nix-shell on my machine for development and that works. But that’s using a buildFHSEnv
to make a shell with vscode and extensions and dev dependencies in it so I dont know if that would help. That one is here: nixpkgs/scratch/interstellar_dev_shell.nix at jollydev/interstellar-scratch · JollyDevelopment/nixpkgs · GitHub (please forgive its untidiness, its an evolved-over-time-but-not-optimized kludged together setup.)
Every time I get that null-aware-elements error.
My guess is there is some setting or flag I need to provide that I am just not aware of as I am new(-ish) to both flutter/dart and nixpkgs.
Does anyone have any advice or pointers on what I should try next?
Thanks in advance!