Open ppenguin opened 2 months ago
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?
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. (
Would be cool to have. Some ideas:
android.flutter
disappears and instead havelanguage.flutter
with a list of targets (desktop/android/etc). Rationale: main reason for using flutter is to target multiple platforms with one code base.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 :wink: If not, let's regard this as a placeholder/reminder.