✗ GTK 3.0 development libraries are required for Linux development

Just linking to docs for shell.nix is most likely not especially useful.

I don’t think any of the answers were really helping OP to get a good flutter development experience.

@esmodea, while I don’t think that one should push solutions onto people who are disinterested in those solutions, I certainly recognize that others coming to this thread could be frustrated by the absence of a simple example of a Flutter dev shell. Here is one:

mkShell {
  packages = [
    flutter
  ];
}

If you have further Flutter development questions, I’d recommend starting a new topic for them. This one was rather scattered; even the title suggests that it’s more about ‘how to add generic dependencies’ than ‘how to get started on a Flutter project’.

For reference on other Flutter topics, there is the Flutter section of the Nixpkgs manual (more oriented towards writing a package expression than getting a dev shell, though one can use the former as the latter) and the Flutter wiki page (seems to be mostly focused on the Android target, but anyone could add desktop target tips to it if there are things that trip you up).

1 Like

Sorry, I thought this was pretty copypasteable as mentioned in Declarative shell environments with shell.nix — nix.dev documentation that I had linked last year:

Create a file called shell.nix with these contents:

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
  pkgs = import nixpkgs { config = {}; overlays = []; };
in

pkgs.mkShellNoCC {
  packages = with pkgs; [
    cowsay
    lolcat
  ];
}

Instead of cowsay and lolcat you put the packages you need (flutter at a minimum), and nixos-24.05 should be replaced with a current channel like nixos-25.11 or nixos-unstable.

The only other thing to mention would be that if you do need a C(++) compiler, mkShellNoCC should be mkShell.

Then, as the page says:

Enter the environment by running nix-shell in the same directory as shell.nix

These aren’t new conventions, rather how nix was intended to be used for development for at least the last decade.