This is a demonstration project to show usage of Flutter with Nix.
If you have direnv installed, run:
direnv allowOtherwise, enter in the nix-shell:
nix-shellAfter this, you can either build this project with:
flutter build apkOr run it:
flutter runIf you have any issue, you can run flutter doctor to get a diagnostic and potential solution to fix your issues.
Create a shell.nix file with this content:
{ pkgs ? import <nixpkgs> {} }:
let
flutter = (import (builtins.fetchTarball
"https://github.com/babariviere/nixpkgs/archive/flutter-init.tar.gz") {}).flutter; # this will be replaced when merged into NixOS
in pkgs.mkShell {
buildInputs = [ flutter ];
}After this, enter into your nix-shell and you are good to go.
niv initwill update nix/sources.nix if a new one is available- Make sure you have a backup of your nix/sources.json. If you're not in a git repo or use another vcs:
cp nix/sources.json nix/sources.json.bak niv updatewill update sources.json i.e. your version of nixpkgs used in this environment- you may need to edit nix/android.nix if any of the attributes in there can't be found after this.
direnv reloadwill rebuild/reload your environment (may not be necessary if it automatically reloads)- alternatively, run
nix-shellagain (?)
- alternatively, run
flutter packages updateto update flutter/dart packages and get rid of the warning that you're using a different version of flutter than what was last referenced
If you want to install flutter on your system, add this to your /etc/nixos/configuration.nix:
{
environment.systemPackages = [
(import (builtins.fetchTarball
"https://github.com/babariviere/nixpkgs/archive/flutter-init.tar.gz") {}).flutter
];
}Create an issue on this repository with your issue and I will try to help you as much as I can !