Coder Social home page Coder Social logo

dart-flutter-nix's People

Contributors

ckiee avatar flafydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ckiee rummik gilice

dart-flutter-nix's Issues

Web dev target?

This tool is very useful and I've successfuly built flutter projects with it.
But usually for developping apps I use the chrome target because it allows me to experiment with different viewport sizes.
Is support for the web option planned?

derivation has '__noChroot' set, but that's not allowed when 'sandbox' is 'true'

To reproduce:

  • git clone https://github.com/fzyzcjy/flutter_convenient_test
  • cd flutter_convenient_test/packages/convenient_test_manager
  • write the flake.nix:
{
  description = "test runner";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    flake-utils.url = "github:numtide/flake-utils";
    dart-flutter.url = "github:flafydev/dart-flutter-nix";
  };

  outputs = { self, flake-utils, nixpkgs, dart-flutter }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          pkgs = import nixpkgs {
            inherit system;
            overlays = [ dart-flutter.overlays.default ];
          };

        in
        {
          devShells.default = pkgs.mkFlutterShell {
            linux = {
              enable = true;
            };

            nativeBuildInputs = with pkgs; [ pkg-config openssl openssl.dev libdeflate ];
            buildInputs = with pkgs; [ openssl openssl.dev ];
            NIX_LD = pkgs.stdenv.cc.bintools.dynamicLinker;
            OPENSSL_ROOT_DIR = "${pkgs.openssl.dev}/include/openssl";
          };

          packages.default = pkgs.buildFlutterApp
            {
              pname = "convenient_test_manager";
              version = "0.0.1";
              src = ./.;
            };

        });
}
  • run pubspec-nix
  • run nix build
    • fails with error: derivation '/nix/store/rshlbapih5mgmd8s6hppfb54qsygq91k-flutter-desktop-embedding-6c66ad2.drv' has '__noChroot' set, but that's not allowed when 'sandbox' is 'true

temporary solution:

  • be a trusted user
  • nix build --impure --option sandbox false

questions:

  • why does this need noChroot?

Expose flutter for desktop dependencies?

Sometimes it would be useful to have just the dependencies needed for running flutter apps. Because this may change, this repo could serve as a single source o truth.

Context
  • flutter 3.7.3 is out for a while
  • there is a PR for it: NixOS/nixpkgs#215754
    • it is stuck because upstream broke aarch64
  • I rebased it to nixpkgs:master on http://github.com/gilice/nixpkgs
  • dart-flutter-nix wants to build its flutter with the patches for 3.3.8 and it breaks
error: builder for '/nix/store/varcv3marlwkzv49yqbzx2vhi6kf6mqb-flutter-unwrapped-3.7.3.drv' failed with exit code 1;
       last 10 log lines:
       > Hunk #3 succeeded at 299 (offset 1 line).
       > Hunk #4 succeeded at 332 (offset 1 line).
       > Hunk #5 succeeded at 709 (offset 1 line).
       > Hunk #6 succeeded at 719 (offset 1 line).
       > Hunk #7 succeeded at 740 (offset 1 line).
       > applying patch /nix/store/jhbwwixyfra0cchvb646kga9vl6jnc2c-move-cache.patch
       > patching file packages/flutter_tools/lib/src/cache.dart
       > patching file packages/flutter_tools/test/general.shard/artifacts_test.dart
       > Hunk #2 FAILED at 306.
       > 1 out of 2 hunks FAILED -- saving rejects to file packages/flutter_tools/test/general.shard/artifacts_test.dart.rej
       For full logs, run 'nix log /nix/store/varcv3marlwkzv49yqbzx2vhi6kf6mqb-flutter-unwrapped-3.7.3.drv'.
  • I temporarily skip using dart-flutter-nix and use simple nix instead
  • what I am looking for is exposing this libs variable externally for situations like this
flake.nix
{
  inputs = {
    nixpkgs.url = "github:gilice/nixpkgs";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, flake-utils, nixpkgs, }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          pkgs = import nixpkgs {
            inherit system;
          };
          libs = with pkgs; [
            openssl.dev
            libvlc
            libdeflate
            gtk3.dev
            glib
            lz4
            libxkbcommon
            zstd
            libffi
            pango
            libpng
            libgcrypt
            libgpg-error
            libcap
            libcap.lib
            fontconfig.lib
            xorg.libXdmcp
            fribidi
            tracker
            wayland
            xorg.libXrandr
            xorg.libXinerama
            at-spi2-atk
            libthai
            freetype
            icu
            graphite2
            sqlite
            libxml2
            json-glib
            brotli.lib
            pixman
            libjpeg
            libselinux
            pcre2
            pcre
            xorg.libXau
						xorg.libX11.dev
          ];
        in
        {
          devShells.default = pkgs.mkShell {

            nativeBuildInputs = (with pkgs; [ pkg-config openssl flutter cmake ninja ]) ++ libs;

            NIX_LD = pkgs.stdenv.cc.bintools.dynamicLinker;
            LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
            OPENSSL_ROOT_DIR = "${pkgs.openssl.dev}/include/openssl";
          };
        });
}

Parallel dependency fetching?

pubspec-nix is pretty slow for even medium-sized projects, taking about 3 minutes to run here.

I wonder if we could improve on this by fetching dependencies in parallel, instead of sequentially.
I am not sure how one would do this in Python, as I haven't used that language much.

If no one else wants this, I might do a rewrite in Rust (oh god) using tokio just for fun.
We could even (oh god x2) do downloading one file in parallel with aria2.

Can't run "flutter run"

Hi, I can't build my existing app on nixos in the CLI. Not sure why though, maybe someone can shed light on this:

> flutter run
Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable:
/nix/store/msz7vyhbjshnhpvh4fqggw7629xqkjmx-android-sdk-env/share/android-sdk/platform-tools/adb

then

> adb
Android Debug Bridge version 1.0.41
... (works fine)
> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.7.9, on NixOS 23.05 (Stoat) 6.2.9, locale de_DE.UTF-8)
    ! Warning: `flutter` on your path resolves to /nix/store/0abd2ziinn63rhjbf3nhrq5490njp87r-flutter-3.7.9-fhs/bin/flutter, which is not inside your current Flutter SDK checkout at
      /nix/store/bygzpzn8775z5d1bqdf878f719nd2qik-flutter-3.7.9. Consider adding /nix/store/bygzpzn8775z5d1bqdf878f719nd2qik-flutter-3.7.9/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /nix/store/k41nsymj245kz7kdd9w61cz84ygx2jix-dart-2.19.6/bin/dart, which is not inside your current Flutter SDK checkout at
      /nix/store/bygzpzn8775z5d1bqdf878f719nd2qik-flutter-3.7.9. Consider adding /nix/store/bygzpzn8775z5d1bqdf878f719nd2qik-flutter-3.7.9/bin to the front of your path.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[☠] Connected device (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ Exception: Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable:
      /nix/store/msz7vyhbjshnhpvh4fqggw7629xqkjmx-android-sdk-env/share/android-sdk/platform-tools/adb
[✓] HTTP Host Availability

! Doctor found issues in 5 categories.

Finally, this is my flake.nix:

{
  description = "App to find missing pets";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    flake-utils.url = "github:numtide/flake-utils";
    dart-flutter.url = "github:flafydev/dart-flutter-nix";
  };

  outputs = { self, flake-utils, nixpkgs, dart-flutter }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
        config = {
            android_sdk.accept_license = true;
            allowUnfree = true;
          };
        overlays = [ dart-flutter.overlays.default ];
      }; 
    in {
      packages = rec {
        findet-bella = pkgs.callPackage ./nix/package.nix { };
        default = findet-bella;
      };
      devShell = pkgs.mkFlutterShell {
        android = {
          enable = true;
          sdkPackages = sdkPkgs:
            with sdkPkgs; [
              build-tools-30-0-3
              platforms-android-31
              platforms-android-33
            ];
          androidStudio = true; # Default: false
          emulator = true; # Default: false
        };

        buildInputs = with pkgs; [
          at-spi2-core.dev
          clang
          cmake
          dart
          dbus.dev
          flutter
          gtk3
          libdatrie
          libepoxy.dev
          libselinux
          libsepol
          libthai
          libxkbcommon
          ninja
          pcre
          pkg-config
          util-linux.dev
          xorg.libXdmcp
          xorg.libXtst
        ];
        shellHook = ''
          export LD_LIBRARY_PATH=${pkgs.libepoxy}/lib
        '';
      };
    }) // {
      overlays.default = final: prev: let 
        pkgs = import nixpkgs { 
          inherit (prev) system;
          overlays = [ dart-flutter.overlays.default ];
        };
      in {
        findet-bella = pkgs.callPackage ./nix/package.nix { };
      };
    };
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.