nix-rebuild命令
目录
nix-rebuil命令
nixos-rebuild {switch | boot | test | build | dry-build | dry-activate | edit | build-vm | build-vm-with-bootloader}
[{ --upgrade | --upgrade-all }] [--install-bootloader] [--no-build-nix] [--fast] [--rollback] [--builders builder-spec]
[--flake flake-uri] [--override-input input-name flake-uri]
[{ --profile-name | -p } name]
[--build-host host] [--target-host host] [--use-remote-sudo]
[--show-trace] [-I path] [{--verbose | -v}] [{--impure}] [{--max-jobs | -j} number] [{--keep-failed | -K}] [{--keep-going | -k}]几个常见的命令
nixos-rebuild list-generations
sudo nix-collect-garbage -d
sudo nixos-rebuild boot
sudo nixos-rebuild switch -p profile-name 其中最后一条命令详解如下:
--profile-name, -p
Instead of using the Nix profile /nix/var/nix/profiles/system to keep track of the current and previous system configurations, use /nix/var/nix/profiles/system-profiles/name. When you use GRUB 2, for every system profile created with this flag, NixOS will create a submenu named “NixOS - Profile 'name'” in GRUB’s boot menu, containing the current and previous configurations of this profile.
For instance, if you want to test a configuration file named test.nix without affecting the default system profile, you would do:
$ nixos-rebuild switch -p test -I nixos-config=./test.nix
The new configuration will appear in the GRUB 2 submenu “NixOS - Profile 'test'”.可以在/nix/var/nix/profiles/system-profiles/ 目录下找到标签相关的文件,删除掉标签目录,重新执行一次sudo nixos-rebuild boot 就可以删除标签相关grub启动项目。