Hi there. I’ve been trying for hours to get flutter development up and running on NixOS. Ideally, I want to build for all supported platforms, but Linux and Android are most important to get started.
I’ve got a flake that makes it work for linux. But the Android build fails because something is trying to write to the flutter install dir, which is in the store. Interestingly, another flutter project doesn’t have that issue, but it might be an older flutter version or something. I’m not very familiar with flutter or Android.
There are a few example flakes/repos out there, but they are quite outdated.
I’ve now tried just downloading the official flutter SDK and making it run with nix-ld (as that would allow writing to the flutter SDK dir), but even that fails because I just can’t make it find libepoxy.so.0 and libfontconfig.so.1, though I have added fontconfig
and libepoxy
and libepoxy.dev
to the NIX_LD_LIBRARY_PATH
.
Does anyone have a working config for flutter development (a flake, preferably) that will allow me to get up and running on a recent flutter version for Linux and Android? At my wits end, afraid of having to do this in a Ubuntu VM
This is my current nix-ld shell.nix
:
{pkgs ? import <nixpkgs> {}}:
with pkgs;
mkShell {
buildInputs = [
cmake
clang
ninja
pkg-config
gtk3
fontconfig
];
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
libsysprof-capture
libepoxy
fontconfig.lib
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
fuse3
gdk-pixbuf
glib
gtk3
icu
libGL
libappindicator-gtk3
libdrm
libglvnd
libnotify
libpulseaudio
libunwind
libusb1
libuuid
libxkbcommon
libxml2
mesa
nspr
nss
openssl
pango
pipewire
stdenv.cc.cc
systemd
vulkan-loader
xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libxcb
xorg.libxkbfile
xorg.libxshmfence
zlib
];
NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker";
shellHook = ''
export PATH="$PATH:/home/myuser/flutter_sdk/flutter/bin";
'';
}