From 7902cea1de8c45732aebd8b4a24f7be661890766 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 25 Sep 2024 12:43:11 +0200 Subject: [PATCH] nixos: Update documentation to refer to bin/apply --- nixos/doc/manual/administration/rollback.section.md | 8 ++++---- .../manual/development/non-switchable-systems.section.md | 2 +- .../what-happens-during-a-system-switch.chapter.md | 4 ++-- .../installation/installing-from-other-distro.section.md | 2 +- nixos/lib/testing/nixos-test-base.nix | 2 +- nixos/modules/system/activation/specialisation.nix | 2 +- nixos/modules/system/activation/top-level.nix | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nixos/doc/manual/administration/rollback.section.md b/nixos/doc/manual/administration/rollback.section.md index 290d685a2a18..4e596fde8894 100644 --- a/nixos/doc/manual/administration/rollback.section.md +++ b/nixos/doc/manual/administration/rollback.section.md @@ -12,7 +12,7 @@ system has booted, you can make the selected configuration the default for subsequent boots: ```ShellSession -# /run/current-system/bin/switch-to-configuration boot +# /run/current-system/bin/apply boot ``` Second, you can switch to the previous configuration in a running @@ -25,11 +25,11 @@ system: This is equivalent to running: ```ShellSession -# /nix/var/nix/profiles/system-N-link/bin/switch-to-configuration switch +# /nix/var/nix/profiles/system-N-link/bin/apply switch ``` -where `N` is the number of the NixOS system configuration. To get a -list of the available configurations, do: +where `N` is the number of the NixOS system configuration to roll back to. +To get a list of the available configurations, run: ```ShellSession $ ls -l /nix/var/nix/profiles/system-*-link diff --git a/nixos/doc/manual/development/non-switchable-systems.section.md b/nixos/doc/manual/development/non-switchable-systems.section.md index a51e8233f30b..a8cbcdd865fd 100644 --- a/nixos/doc/manual/development/non-switchable-systems.section.md +++ b/nixos/doc/manual/development/non-switchable-systems.section.md @@ -16,6 +16,6 @@ profile: The most notable deviation of this profile from a standard NixOS configuration is that after building it, you cannot switch *to* the configuration anymore. The profile sets `config.system.switch.enable = false;`, which excludes -`switch-to-configuration`, the central script called by `nixos-rebuild`, from +`apply` and `switch-to-configuration`, the central scripts called by `nixos-rebuild`, from your system. Removing this script makes the image lighter and slightly more secure. diff --git a/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md b/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md index 28c06f999dac..a3e921569caa 100644 --- a/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md +++ b/nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md @@ -5,8 +5,8 @@ This chapter explains some of the internals of this command to make it simpler for new module developers to configure their units correctly and to make it easier to understand what is happening and why for curious administrators. -`nixos-rebuild`, like many deployment solutions, calls `switch-to-configuration` -which resides in a NixOS system at `$out/bin/switch-to-configuration`. The +`nixos-rebuild`, like many deployment solutions, calls `apply` (or for NixOS older than 24.11, `switch-to-configuration`) +which resides in a NixOS system at `$out/bin/apply`. The script is called with the action that is to be performed like `switch`, `test`, `boot`. There is also the `dry-activate` action which does not really perform the actions but rather prints what it would do if you called it with `test`. diff --git a/nixos/doc/manual/installation/installing-from-other-distro.section.md b/nixos/doc/manual/installation/installing-from-other-distro.section.md index 2d9818e6805c..0b8dbd78c392 100644 --- a/nixos/doc/manual/installation/installing-from-other-distro.section.md +++ b/nixos/doc/manual/installation/installing-from-other-distro.section.md @@ -247,7 +247,7 @@ The first steps to all these are the same: ```ShellSession $ sudo mv -v /boot /boot.bak && - sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot + sudo /nix/var/nix/profiles/system/bin/apply boot ``` Cross your fingers, reboot, hopefully you should get a NixOS prompt! diff --git a/nixos/lib/testing/nixos-test-base.nix b/nixos/lib/testing/nixos-test-base.nix index c8b15a0ecce4..3793fd5b9819 100644 --- a/nixos/lib/testing/nixos-test-base.nix +++ b/nixos/lib/testing/nixos-test-base.nix @@ -23,7 +23,7 @@ in }; } ({ config, ... }: { - # Don't pull in switch-to-configuration by default, except when specialisations or early boot shenanigans are involved. + # Don't pull in apply and switch-to-configuration by default, except when specialisations or early boot shenanigans are involved. # This is mostly a Hydra optimization, so we don't rebuild all the tests every time switch-to-configuration-ng changes. key = "no-switch-to-configuration"; system.switch.enable = mkDefault (config.isSpecialisation || config.specialisation != {} || config.virtualisation.installBootLoader); diff --git a/nixos/modules/system/activation/specialisation.nix b/nixos/modules/system/activation/specialisation.nix index 41491b67ff03..2b1fed44bbed 100644 --- a/nixos/modules/system/activation/specialisation.nix +++ b/nixos/modules/system/activation/specialisation.nix @@ -42,7 +42,7 @@ in (e.g. `fewJobsManyCores`) at runtime, run: ``` - sudo /run/current-system/specialisation/fewJobsManyCores/bin/switch-to-configuration test + sudo /run/current-system/specialisation/fewJobsManyCores/bin/apply test ``` ''; type = types.attrsOf (types.submodule ( diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 6abbd4b673c0..4ac7bda0cc2f 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -49,8 +49,8 @@ let # Putting it all together. This builds a store path containing # symlinks to the various parts of the built configuration (the # kernel, systemd units, init scripts, etc.) as well as a script - # `switch-to-configuration' that activates the configuration and - # makes it bootable. See `activatable-system.nix`. + # `bin/apply` that activates the configuration and + # makes it bootable. See `activatable-system.nix` and `switchable-system.nix`. baseSystem = pkgs.stdenvNoCC.mkDerivation ({ name = "nixos-system-${config.system.name}-${config.system.nixos.label}"; preferLocalBuild = true;