2021-01-16 12:17:21 +00:00
|
|
|
{ substituteAll
|
|
|
|
, runtimeShell
|
|
|
|
, coreutils
|
|
|
|
, gnused
|
|
|
|
, gnugrep
|
|
|
|
, nix
|
|
|
|
, lib
|
2022-03-08 17:01:40 +00:00
|
|
|
, nixosTests
|
2021-01-16 12:17:21 +00:00
|
|
|
}:
|
2021-01-15 19:03:07 +00:00
|
|
|
let
|
|
|
|
fallback = import ./../../../../nixos/modules/installer/tools/nix-fallback-paths.nix;
|
2021-01-16 12:17:21 +00:00
|
|
|
in
|
|
|
|
substituteAll {
|
2021-01-15 19:03:07 +00:00
|
|
|
name = "nixos-rebuild";
|
|
|
|
src = ./nixos-rebuild.sh;
|
|
|
|
dir = "bin";
|
|
|
|
isExecutable = true;
|
|
|
|
inherit runtimeShell nix;
|
|
|
|
nix_x86_64_linux = fallback.x86_64-linux;
|
|
|
|
nix_i686_linux = fallback.i686-linux;
|
2021-05-14 12:53:57 +00:00
|
|
|
nix_aarch64_linux = fallback.aarch64-linux;
|
2022-01-04 23:02:47 +00:00
|
|
|
path = lib.makeBinPath [ coreutils gnused gnugrep ];
|
2022-03-08 17:01:40 +00:00
|
|
|
|
|
|
|
# run some a simple installer tests to make sure nixos-rebuild still works for them
|
|
|
|
passthru.tests = {
|
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
2022-12-23 20:23:36 +00:00
|
|
|
simple-installer = nixosTests.installer.simple;
|
|
|
|
specialisations = nixosTests.nixos-rebuild-specialisations;
|
2022-03-08 17:01:40 +00:00
|
|
|
};
|
2022-03-22 17:35:33 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Rebuild your NixOS configuration and switch to it, on local hosts and remote.";
|
|
|
|
homepage = "https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/nixos-rebuild";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.Profpatsch ];
|
|
|
|
mainProgram = "nixos-rebuild";
|
|
|
|
};
|
2021-01-15 19:03:07 +00:00
|
|
|
}
|