# Flake outputs the `outputs` in `flake.nix` are what a flake produces as part of its build. Each flake can have many different outputs simultaneously, including but not limited to: - Nix packages: named `apps..`, `packages..`, or `legacyPackages..` - we can build a package by command `nix build .#` - Nix Helper Functions: named `lib`., which means a library for other flakes. - Nix development environments: named `devShells` - `devShells` can be used by command `nix develop`, will be introduced later. - NixOS configuration: named `nixosConfiguration` - `nixosConfiguration` will be used by command `nixos-rebuild switch --flake .#` - Nix templates: named `templates` - templates can be used by command `nix flake init --template ` - Other user defined outputs, may be parsed by other nix-related tools. An example copy from NixOS Wiki: ```nix { self, ... }@inputs: { # Executed by `nix flake check` checks.""."" = derivation; # Executed by `nix build .#` packages.""."" = derivation; # Executed by `nix build .` packages."".default = derivation; # Executed by `nix run .#` apps.""."" = { type = "app"; program = ""; }; # Executed by `nix run . -- ` apps."".default = { type = "app"; program = "..."; }; # Formatter (alejandra, nixfmt or nixpkgs-fmt) formatter."" = derivation; # Used for nixpkgs packages, also accessible via `nix build .#` legacyPackages.""."" = derivation; # Overlay, consumed by other flakes overlays."" = final: prev: { }; # Default overlay overlays.default = {}; # Nixos module, consumed by other flakes nixosModules."" = { config }: { options = {}; config = {}; }; # Default module nixosModules.default = {}; # Used with `nixos-rebuild --flake .#` # nixosConfigurations."".config.system.build.toplevel must be a derivation nixosConfigurations."" = {}; # Used by `nix develop .#` devShells.""."" = derivation; # Used by `nix develop` devShells."".default = derivation; # Hydra build jobs hydraJobs.""."" = derivation; # Used by `nix flake init -t #` templates."" = { path = ""; description = "template description goes here?"; }; # Used by `nix flake init -t ` templates.default = { path = ""; description = ""; }; } ```