1
Fork 0
solar-conflux/dart/freeform-gradient
nanashi0x74 c2c48d2cdb
dart(freeform-gradient): Add Documentation on how to update the environment
Signed-off-by: prescientmoon <git@moonythm.dev>
2020-10-19 14:11:31 +02:00
..
android dart(freeform-gradient): Gradle needs updating as well 2020-10-19 18:09:34 +02:00
ios dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
lib dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
nix dart(freeform-gradient): Update niv, sources, android and flutter 2020-10-19 13:43:29 +02:00
test dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
web dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
.envrc dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
.gitignore dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
.metadata dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
pubspec.lock dart(freeform-gradient): Update niv, sources, android and flutter 2020-10-19 13:43:29 +02:00
pubspec.yaml dart(freeform-gradient): Initial commit 2020-01-09 10:52:31 +01:00
README.md dart(freeform-gradient): Add Documentation on how to update the environment 2020-10-19 14:11:31 +02:00
shell.nix dart(freeform-gradient): Add niv to shell.nix 2020-10-19 13:34:22 +02:00

Hello World application with Flutter + Nix

This is a demonstration project to show usage of Flutter with Nix.

Getting Started

If you have direnv installed, run:

direnv allow

Otherwise, enter in the nix-shell:

nix-shell

After this, you can either build this project with:

flutter build apk

Or run it:

flutter run

If you have any issue, you can run flutter doctor to get a diagnostic and potential solution to fix your issues.

How to use it with your projects

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.

Updating

To update the whole environment, do the following in order:

  • niv init will update nix/sources.nix if a new one is available
  • backup your nix/sources.json: cp nix/sources.json nix/sources.json.bak
  • niv update will 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 reload will rebuild/reload your environment (may not be necessary if it automatically reloads)
    • alternatively, run nix-shell again (?)
  • flutter packages update to update flutter/dart packages and get rid of the warning that you're using a different version of flutter than what was last referenced

Global install

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
  ];
}

Have an issue ?

Create an issue on this repository with your issue and I will try to help you as much as I can !