Simplified Nix Flakes on the command line.
You can install this package imperatively with the following command.
nix profile install github:snowfallorg/flakeYou can install this package by adding it as an input to your Nix Flake.
{description="My system flake";inputs={nixpkgs.url="github:nixos/nixpkgs/nixos-22.05";unstable.url="github:nixos/nixpkgs/nixos-unstable";# Snowfall Lib is not required, but will make configuration easier for you.snowfall-lib={url="github:snowfallorg/lib";inputs.nixpkgs.follows="nixpkgs";};snowfall-flake={url="github:snowfallorg/flake";# Flake requires some packages that aren't on 22.05, but are available on unstable.inputs.nixpkgs.follows="unstable";};};outputs=inputs:
inputs.snowfall-lib.mkFlake{inheritinputs;src=./.;overlays=withinputs;[# Use the overlay provided by this flake.snowfall-flake.overlay# There is also a named overlay, though the output is the same.snowfall-flake.overlays."package/flake"];};}If you've added the overlay from this flake, then in your system configuration you
can add the snowfallorg.flake package.
{pkgs}:
{environment.systemPackages=withpkgs;[snowfallorg.flake];}Create new projects from flake templates.
# Create a new flake and directory my-project with the default template.
flake new my-project
# Create a new flake and directory my-project with a custom template.
flake new my-project --template github:snowfallorg/templates#package
# Create a new flake and directory my-project with a template selected from a list.
flake new my-project --pickInitialize a flake in an existing project.
# Create a new flake in the current directory with the default template.
flake init
# Create a new flake in the current directory with a custom template.
flake init --template github:snowfallorg/templates#package
# Create a new flake in the current directory with a template selected from a list.
flake init --pickRun development shells.
# Open the default development shell of the flake in the current directory.
flake dev
# Open a specific development shell of the flake in the current directory.
flake dev my-shell
# Open a development shell from a specific flake.
flake dev github:snowfall/dotbox#dotbox
# Pick a development shell from the current directory.
flake dev --pick
# Pick a development shell from a specific flake.
flake dev github:snowfall/dotbox --pickRun apps from Nix Flakes.
# Run the default app of the flake in the current directory.
flake run
# Run a specific app of the flake in the current directory.
flake run my-package
# Run a specific app from a specific flake.
flake run github:snowfall/dotbox#dotbox
# Pick an app to run from the current directory.
flake run --pick
# Pick an app to run from a specific flake.
flake run github:snowfall/dotbox --pickBuild packages from Nix Flakes.
# Build the default package of the flake in the current directory.
flake build
# Build a specific package of the flake in the current directory.
flake build my-package
# Build a package from a specific flake.
flake build github:snowfall/dotbox#dotbox
# Pick a package to build from the current directory.
flake build --pick
# Pick a package to build from a specific flake.
flake build github:snowfall/dotbox --pickRebuild and switch system configuration with support for both NixOS and nix-darwin.
# Switch to configuration with the same hostname from the flake in the current directory.
flake switch
# Switch to specific configuration from the flake in the current directory.
flake switch my-system
# Pick a configuration to switch to from the flake in the current directory.
flake switch --pick
# Switch to configuration from a specific flake.
flake switch github:jakehamilton/config#bismuth
# Pick configuration from a specific flake.
flake switch github:jakehamilton/config --pickTest a system configuration
flake test
DESCRIPTION
Test a system configuration with support for both NixOS and nix-darwin.
USAGE
$ flake test<name> [options]
OPTIONS
--help, -h Show this help message
--debug Show debug messages
--show-trace Show a trace when a Nix command fails
EXAMPLES
# Test a configuration with the same hostname from the flake in the current directory.
$ flake test# Test a specific configuration from the flake in the current directory.
$ flake test my-system
# Pick a configuration to test from the flake in the current directory.
$ flake test --pick
# Test a configuration from a specific flake.
$ flake test github:jakehamilton/config#bismuth
# Pick configuration from a specific flake.
$ flake test github:jakehamilton/config --pickUpdate the system's bootable generations.
flake boot
DESCRIPTION
Set a NixOS configuration as the bootable system.
USAGE
$ flake boot <name> [options]
OPTIONS
--help, -h Show this help message
--debug Show debug messages
--show-trace Show a trace when a Nix command fails
EXAMPLES
# Boot a configuration with the same hostname from the flake in the current directory.
$ flake boot
# Boot a specific configuration from the flake in the current directory.
$ flake boot my-system
# Pick a configuration to boot from the flake in the current directory.
$ flake boot --pick
# Boot a configuration from a specific flake.
$ flake boot github:jakehamilton/config#bismuth
# Pick configuration from a specific flake.
$ flake boot github:jakehamilton/config --pickShow flake outputs.
flake show
DESCRIPTION
Show the outputs of a Nix Flake.
USAGE
$ flake show <name> [options]
OPTIONS
--help, -h Show this help message
--debug Show debug messages
--show-trace Show a trace when a Nix command fails
EXAMPLES
# Show outputs from the flake in the current directory.
$ flake show
# Show outputs from a specific flake.
$ flake show github:jakehamilton/configUpdate a Nix Flake's inputs.
# Update all flake inputs.
flake update
# Update one or more specific inputs.
flake update nixpkgs snowfall-lib
# Pick inputs to update from a list.
flake update --pickBuild a NixOS, nix-darwin, and other types of systems.
See
flake build-system --helpfor more information.
# Build the system with the same hostname from the flake in the current directory.
flake build-system
# Build the NixOS system with the same hostname from the flake in the current directory.
flake build-nixos
# Build a specific nix-darwin system from the flake in the current directory.
flake build-darwin my-system
# Build the system with the same hostname from a specific flake.
flake build-system github:jakehamilton/config#bismuth
# Pick and build a system from the flake in the current directory
flake build-system --pick
# Pick and build a system from a specific flake.
flake build-system github:jakehamilton/config --pick
# Build a specific ISO from the flake in the current directory.
flake build-iso my-iso-systemShow NixOS options from Nix Flakes.
flake option
DESCRIPTION
Show NixOS options from Nix Flakes.
USAGE
flake option [option] [options]
flake option <hostname> [option] [options]
flake option <flake-uri> [option] [options]
OPTIONS
--pick, -p Pick options from a list
--help, -h Show this help message
--debug Show debug messages
--show-trace Show a trace when a Nix command fails
EXAMPLES
# Show options for the current host in the current directory.
$ flake option
# Show options for a specific host.
$ flake option my-host
# Show a specific option for a specific host.
$ flake option my-host services.openssh
# Show options for a flake's host.
$ flake option github:jakehamilton/config#bismuth
# Show a specific option for a flake's host.
$ flake option github:jakehamilton/config#bismuth services.openssh
# Pick options for the flake in the current directory.
$ flake option --pick
# Pick options from a specific flake.
$ flake option github:jakehamilton/config --pick