olafkfreund/nix-skills

nixos-operations

Operate NixOS systems by choosing rebuild modes, managing generations and rollback, upgrading, cleaning the store, and diagnosing boot and service problems.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/olafkfreund/nix-skills --skill nixos-operations

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

NixOS operations

Establish the setup first

Read the repository instructions and find out how the system is built:

  • a flake with nixosConfigurations.<host>, or channels with

/etc/nixos/configuration.nix;

  • the NixOS release (nixos-version) and system.stateVersion;
  • the host being changed.

The bundled operations reference quotes the NixOS manual at the Nixpkgs master snapshot in sources.json, not necessarily the user's release. Check version-sensitive behaviour against the user's release. Never treat the manual's examples as a reason to move a system between channels and flakes.

Rebuild modes

nixos-rebuild builds a configuration and optionally activates it. Add --flake .#HOST for flake systems.

ModeEffectChanges the running system
dry-buildShow what would be built or fetchedNo
buildBuild into ./resultNo
dry-activateBuild and show what activation would changeNo
testActivate now, but keep the previous boot defaultYes
bootMake it the boot default, activating on next bootYes, at reboot
switchActivate now and make it the boot defaultYes

Start with build or dry-activate to validate a change. test, boot, switch, --rollback, --upgrade and --target-host deployments change a system. Propose them with the exact command, and run them only with the user's authorization. The same applies to restarting services, deleting generations, collecting garbage and changing boot entries.

Generations, rollback and upgrades

nixos-rebuild list-generations lists system generations. For rollback and boot-menu recovery, read Rolling Back Configuration Changes. For channel upgrades and flake input updates, read Upgrading NixOS. Treat an upgrade as a deliberate, reviewable change: update inputs separately from configuration edits, and build before switching.

Store cleaning, boot and services

  • Cleaning the Nix Store explains garbage collection, and how deleting old

generations removes rollback targets. Confirm which generations the user still needs first.

  • Boot Problems covers kernel parameters and emergency shells.
  • Service Management covers systemctl and journalctl. Reading status and

logs is safe. Starting, stopping, restarting and enabling services change the system.

Related skills

Use home-manager for user environments, nixpkgs-development for packaging, nixos-wiki for community guidance, and nix-workflow for general Nix command-line practice, if they are installed. Otherwise use the NixOS manual.

Modified excerpts from the Nixpkgs contributors are covered by COPYING.

Nix style

  • Never search /nix/store (for example find /nix/store/*foo-* -name libfoo.so)

and never copy a literal store path. Find the providing package with nix-locate, and refer to it through Nix: ${pkgs.foo}/lib or lib.makeLibraryPath [ pkgs.foo ].

  • Do not quote attribute names that are valid identifiers

([A-Za-z_][A-Za-z0-9_'-]*, dashes included). Write pkgs.foo-bar and packages.x86_64-linux, not pkgs."foo-bar". Quote only other names (".config/foo", "2.0"), the keywords assert else if in inherit let or rec then with, and interpolations ("${name}"). Upstream examples in references sometimes quote needlessly; do not copy that style.

같은 저장소의 Skills

더 많은 Skills

모든 Skills