nixpkgs/pkgs/os-specific/linux/nixos-rebuild/default.nix
Michael Lohmann cc625486c4 nixos-rebuild: Add list-generations
Add new command `nixos-rebuild list-generations`. It will show an output
like

```
$ nixos-rebuild list-generations
Generation      Build-date               NixOS version           Kernel  Configuration Revision                    Specialisations
52   (current)  Fri 2023-08-18 08:17:27  23.11.20230817.0f46300  6.4.10  448160aeccf6a7184bd8a84290d527819f1c552c  *
51              Mon 2023-08-07 17:56:41  23.11.20230807.31b1eed  6.4.8   99ef480007ca51e3d440aa4fa6558178d63f9c42  *
```

This also mentions the change in the upcoming release notes
2023-09-10 15:13:04 +02:00

47 lines
1.2 KiB
Nix

{ substituteAll
, runtimeShell
, coreutils
, gnused
, gnugrep
, jq
, util-linux
, nix
, lib
, nixosTests
, installShellFiles
}:
let
fallback = import ./../../../../nixos/modules/installer/tools/nix-fallback-paths.nix;
in
substituteAll {
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;
nix_aarch64_linux = fallback.aarch64-linux;
path = lib.makeBinPath [ coreutils gnused gnugrep jq util-linux ];
nativeBuildInputs = [
installShellFiles
];
postInstall = ''
installManPage ${./nixos-rebuild.8}
'';
# run some a simple installer tests to make sure nixos-rebuild still works for them
passthru.tests = {
simple-installer = nixosTests.installer.simple;
specialisations = nixosTests.nixos-rebuild-specialisations;
};
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";
};
}