ITADN
snowfallorg/flake · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

Snowfall Flake

Nix Flakes Ready Built With Snowfall

在命令行上简化 Nix Flakes。

安装

Nix Profile

你可以使用以下命令以命令式方式安装此包。

nix profile install github:snowfallorg/flake

Nix 配置

您可以通过将此包作为输入添加到您的 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 {
			inherit inputs;
			src = ./.;

			overlays = with inputs; [
				# 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"
			];
		};
}

如果您已从该 flake 添加了 overlay,那么在您的系统配置中 您可以添加 snowfallorg.flake 软件包。

{ pkgs }:

{
	environment.systemPackages = with pkgs; [
		snowfallorg.flake
	];
}

用法

flake new

从 flake 模板创建新项目。

# 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 --pick

flake init

在现有项目中初始化一个 flake。

# 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 --pick

flake dev

运行开发 shell。

# 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 --pick

flake run

从 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 --pick

flake build

从 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 --pick

flake switch

重建并切换系统配置,同时支持 NixOS 和 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 --pick

flake test

测试系统配置

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 --pick

flake boot

更新系统的可启动代。

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 --pick

flake show

显示 flake 输出。

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/config

flake update

更新 Nix Flake 的输入。

# 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 --pick

flake build-<target>

构建 NixOS、nix-darwin 及其他类型的系统。

更多信息请参阅 flake build-system --help

# 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-system

flake option

显示来自 Nix Flakes 的 NixOS 选项。



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