Closed Losses closed 2 months ago
Try this flake:
{
description = "A combined Flutter and Rust devShell";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
android-nixpkgs = {
url = "github:tadfisher/android-nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, flake-compat, android-nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
android_sdk = {
accept_license = true;
};
};
};
androidEnvCustomPackage = pkgs.androidenv.composeAndroidPackages {
toolsVersion = "26.1.1";
platformToolsVersion = "34.0.5";
buildToolsVersions = [ "30.0.3" "34.0.0" ];
includeEmulator = true;
emulatorVersion = "34.1.9";
platformVersions = [ "28" "29" "30" "31" "32" "33" "34" ];
includeSources = false;
includeSystemImages = false;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "22.0.7026061" ];
useGoogleAPIs = false;
useGoogleTVAddOns = false;
};
androidCustomPackage = android-nixpkgs.sdk.${system} (
sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-30-0-3
build-tools-33-0-2
build-tools-34-0-0
platform-tools
emulator
platforms-android-28
platforms-android-29
platforms-android-30
platforms-android-31
platforms-android-32
platforms-android-33
platforms-android-34
]
);
pinnedJDK = pkgs.jdk17;
in {
devShells.default = pkgs.mkShell {
name = "Combined Flutter and Rust Dev Shell";
buildInputs = with pkgs; [
flutter
android-studio
rust-bin.beta.latest.default
openssl
pkg-config
eza
fd
alsa-lib
libpulseaudio
pulseaudioFull
rustup
] ++ [
gtk3
pinnedJDK
androidCustomPackage
protobuf_26
pcre2
ninja
clang
cmake
stdenv
mount
libsecret
jsoncpp
];
shellHook = ''
alias ls=exa
alias find=fd
alias rinf='flutter pub run rinf'
export RUST_BACKTRACE=1
export CMAKE_INSTALL_PREFIX=$HOME/.local
export JAVA_HOME=${pinnedJDK}
export ANDROID_HOME=${androidCustomPackage}/share/android-sdk
export GRADLE_USER_HOME=$HOME/.gradle
export GRADLE_OPTS="-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidCustomPackage}/share/android-sdk/build-tools/34.0.0/aapt2"
export PATH=${androidCustomPackage}/share/android-sdk/platform-tools:${androidCustomPackage}/share/android-sdk/tools:${androidCustomPackage}/share/android-sdk/tools/bin:$HOME/.cargo/bin:$HOME/.pub-cache/bin:$PATH
export PKG_CONFIG_PATH=${pkgs.util-linux}/lib/pkgconfig:${pkgs.mount}/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH
'';
};
}
);
}
Building log
Flakes config: