Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] languages.flutter (not android but desktop) #1425

Open
ppenguin opened this issue Sep 6, 2024 · 2 comments
Open

[FEAT] languages.flutter (not android but desktop) #1425

ppenguin opened this issue Sep 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ppenguin
Copy link
Contributor

ppenguin commented Sep 6, 2024

Would be cool to have. Some ideas:

  • possibly refactor such that android.flutter disappears and instead have language.flutter with a list of targets (desktop/android/etc). Rationale: main reason for using flutter is to target multiple platforms with one code base.
  • Probably should use some clang stdenv override per default, since a lot of (at least) flutter desktop uses it anyway.
  • ...

I might try my hand at this some time (now using custom devShell flakes, though I'm not the one actually devving in flutter), but it won't be very soon probably. So if anyone is "itching", be my guest 😉
If not, let's regard this as a placeholder/reminder.

@ppenguin ppenguin added the enhancement New feature or request label Sep 6, 2024
@clotodex
Copy link
Contributor

Feels like a good idea (since I took a week to realize flutter is natively supported).
However what should the default be?
You cant install flutter without setting up android - should that setup be minimal or not, etc
Like the configuration of flutter is mainly configuring how much and which android you want.
If others are ok with a "default" flutter minimal setup and android still being fully configurable I can see this work.
What do you think?

@ppenguin
Copy link
Contributor Author

ppenguin commented Sep 22, 2024

Feels like a good idea (since I took a week to realize flutter is natively supported). However what should the default be? You cant install flutter without setting up android

I'm currently using the following flake for a devShell in which a flutter app is developed, that has also CI runners (private gitlab) for most other platforms. It is pretty much hands-off, i.e. after choosing the libraries specifically for multi-platform usage, not too much tweaking is necessary to make it run on all platforms, i.e. the linux devShell is pretty representative. (My colleage writes the code though, so I'm not too deep into the actual flutter dev stuff).

{
  description = "flutter shell";

  inputs = {
    # nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, flake-utils, nixpkgs }:
    flake-utils.lib.eachDefaultSystem (system: {
      devShell =
        let
          pkgs = import nixpkgs {
            inherit system;
          };

          inherit (pkgs) lib;

          myllvm = pkgs.llvmPackages_15;
          # clang = pkgs.llvmPackages_15.clangUseLLVM;
          libs = with pkgs; [
            atk at-spi2-core.dev
            dbus.dev
            gtk3
            pango cairo harfbuzz gdk-pixbuf glib # these are transitive but explicit here for the LD_LIBRARY_PATH
            fontconfig
            libdatrie
            libselinux libsepol pcre
            libthai
            libxkbcommon
            pcre2
            util-linux.dev
            xorg.libX11.dev xorg.libXdmcp xorg.libXtst
            libappindicator.dev
            libepoxy
            libdeflate
            gnome.zenity
          ];
        in
        (pkgs.mkShell.override { stdenv = myllvm.stdenv; }) {
          nativeBuildInputs = with pkgs; [
            pkg-config
            ninja
            cmake
            dart
            flutter
            go_1_20
          ] ++ [
            myllvm.bintools # https://matklad.github.io/2022/03/14/rpath-or-why-lld-doesnt-work-on-nixos.html
          ];

          buildInputs = libs ++ (with myllvm; [
            libcxxClang
            libunwind
          ]);

          shellHook = ''
            # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib.makeLibraryPath [ pkgs.libepoxy ]}
            # unset NIX_LDFLAGS
            # unset NIX_CFLAGS_COMPILE
            # unset NIX_CFLAGS_LINK
            # export LD_LIBRARY_PATH=${lib.makeLibraryPath [ pkgs.libepoxy ]}
            # export GLIBC_LIB_PATH=${lib.makeLibraryPath [ pkgs.glibc ]}
          '';
        };
    });
}

In any case we've been doing everything without worrying about android here, and just at some point built (I think) an android build on one of the other platform's VMs (may have been windows?), because we had some obscure problem on nixos with android (That's some time ago though).

But I guess it would be best for devenv if the hierarchy would somehow mirror flutter's, i.e. top level is flutter and android and linux-desktop would be features that could be switched on. (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants