搜索

PythonReactSEOPDF
GitHub Skill

building

Build and evaluate NixOS and Home-Manager configurations

DaRacci☆ 17 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Building

Build Commands

Command Purpose
nix build .#nixosConfigurations.<host>.config.system.build.toplevel Build a host's NixOS system
nix build .#homeConfigurations.<user>@<host>.activationPackage Build a Home-Manager activation
nix fmt Format code and check syntax
nix flake check Evaluate all configurations and run linters
nix flake show Display available outputs
nix develop Open development shell
nix develop --command true Test that devShell can be entered

DevEnv Requirement

This repository uses devenv for devShells and checks. You must provide the devenv-root input override for nix flake check and nix develop:

nix flake check --override-input devenv-root "file+file://$PWD/.devenv/root"

nix develop --override-input devenv-root "file+file://$PWD/.devenv/root"

Common Build Patterns

Build a specific host
# Build nixdev server
nix build .#nixosConfigurations.nixdev.config.system.build.toplevel

# Build nixmi desktop
nix build .#nixosConfigurations.nixmi.config.system.build.toplevel
Build a user's home configuration
# Build racci's config on nixmi
nix build .#homeConfigurations."racci@nixmi".activationPackage
Evaluate without building
# Check if configuration evaluates
nix eval .#nixosConfigurations.nixdev.config.system.build.toplevel --apply 'x: "ok"'

# Get a specific option value
nix eval .#nixosConfigurations.nixdev.config.networking.hostName
Format specific files
# Format changed files
nix fmt path/to/file.nix

# Format multiple files
nix fmt modules/nixos/services/*.nix

Troubleshooting Builds

If a build fails:

  1. Check the error message for the failing derivation
  2. Try nix log <drv> to see build logs
  3. Use --show-trace for evaluation errors: nix build .#... --show-trace
  4. For infinite recursion, check for circular imports or option definitions

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!