summary refs log tree commit diff
path: root/nixos/tests/all-tests.nix
diff options
context:
space:
mode:
authorPatryk Wychowaniec <pwychowaniec@pm.me>2022-12-23 21:23:36 +0100
committerPatryk Wychowaniec <pwychowaniec@pm.me>2023-01-15 18:16:49 +0100
commit2c55eba8f4604d1eef22f7bfd7df01312fe07272 (patch)
treefd0cf784c145f78b4321fb3b5069e49e5cf6c9ad /nixos/tests/all-tests.nix
parent65e07f20cf04f5db9921dcfa202591997e0f7cd2 (diff)
downloadnixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar.gz
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar.bz2
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar.lz
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar.xz
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.tar.zst
nixpkgs-2c55eba8f4604d1eef22f7bfd7df01312fe07272.zip
nixos: add --specialisation to nixos-rebuild
This commit fixes a papercut in nixos-rebuild where people wanting to
switch to a specialisation (or test one) were forced to manually figure
out the specialisation's path and run its activation script - since now,
there's a dedicated option to do just that.

This is a backwards-compatible change which doesn't affect the existing
behavior, which - to be fair - might still be considered sus by some
people, the painful scenario here being:

- you boot into specialisation `foo`,
- you run `nixos-rebuild switch`,
- whoops, you're no longer at specialisation `foo`, but you're rather
  brought back to the base system.

(it's especially painful for cases where specialisation is used to load
extra drivers, e.g. Nvidia, since then launching `nixos-rebuild switch`,
while forgetting that you're inside a specialisation, can cause some
parts of your system to get accidentally unloaded.)

I've tried to mitigate that by improving specialisations so that they
create a dedicated file somewhere in `/run/current-system` containing
the specialisation's name (which `nixos-rebuild` could then use as the
default value for `--specialisation`), but I haven't been able to come
up with anything working (plus it would be a breaking change then).

Closes https://github.com/NixOS/nixpkgs/issues/174065
Diffstat (limited to 'nixos/tests/all-tests.nix')
-rw-r--r--nixos/tests/all-tests.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index acc42acf37a..35d0fc0b978 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -436,7 +436,6 @@ in {
   netdata = handleTest ./netdata.nix {};
   networking.networkd = handleTest ./networking.nix { networkd = true; };
   networking.scripted = handleTest ./networking.nix { networkd = false; };
-  specialisation = handleTest ./specialisation.nix {};
   netbox = handleTest ./web-apps/netbox.nix {};
   # TODO: put in networking.nix after the test becomes more complete
   networkingProxy = handleTest ./networking-proxy.nix {};
@@ -464,6 +463,7 @@ in {
   nix-serve-ssh = handleTest ./nix-serve-ssh.nix {};
   nixops = handleTest ./nixops/default.nix {};
   nixos-generate-config = handleTest ./nixos-generate-config.nix {};
+  nixos-rebuild-specialisations = handleTest ./nixos-rebuild-specialisations.nix {};
   nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
   node-red = handleTest ./node-red.nix {};
   nomad = handleTest ./nomad.nix {};