flake.nix.md
{
  description = "A very cool Nix flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs, ... }: 
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      packages.${system}.default = self.packages.${system}.myPackage;
      packages.${system}.myPackage = pkgs.vim;

      devShells.${system}.default = self.devShells.${system}.default;
      devShells.${system}.myShell = pkgs.mkShell {
        packages = with pkgs; [
          git
          vim
        ];
      };
    };
}

This is a basic flake.nix file with a single nixpkgs input and a package output.

Run the default package

$ nix run /path/to/flake

Build the named package

$ nix build /path/to/flake#myPackage 

Activate the shell

$ nix develop /path/to/flake

Watch a friendly video!