Hi all,
I’m trying to build a Flutter Web app. I have an existing flake.nix
that works great for Android development (combined with some local adb setup in my configuration.nix
):
{
description = "A Flutter app";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flutter-nix.url = "github:ilkecan/flutter-nix";
flutter-nix.inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, nixpkgs, flake-utils, flutter-nix }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
buildToolsVersion = "30.0.3";
androidComposition = pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ buildToolsVersion "28.0.3" ];
platformVersions = [ "31" "28" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
};
androidSdk = androidComposition.androidsdk;
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
flutter
dart
androidSdk
jdk11
];
};
};
}
If I plug my phone in and run flutter run
, it works fine. If I unplug my phone, I get given the choice between building for linux or web. If I choose web, I get the following error:
Launching lib/main.dart on Chrome in debug mode...
Error: Unable to read the 'libraries.json' specification file:
"include" path 'file:///home/cameron/.cache/flutter/dart-sdk/lib/libraries.json' could not be read: FileSystemException(uri=file:///home/cameron/.cache/flutter/dart-sdk/lib/libraries.json; message=No such file or directory).
Waiting for connection from debug service on Chrome...
I’m aware that Flutter doesn’t play nicely with Nix, but I’m not sure how to get this to work. Flutter has almost no documentation on libraries.json
. Has anyone got this to work?