nixpkgs/nixos/tests/nixos-generate-config.nix
hand7s c464c44a42
nixos/gnome & nixos/gdm: move out of x11
Since DEs like KDE Plasma 6, GNOME and COSMIC are not designed to be X11-exclusive, putting them under `services.xserver` is misleading. In particular, GNOME defaults to Wayland these days and X11 support is going to be dropped in near future.

Let’s follow Plasma and move GNOME NixOS options out of `xserver` attribute.

This patch does not include any changes to X11 support itself.

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-05-28 13:27:36 +02:00

50 lines
1.6 KiB
Nix

{ lib, ... }:
{
name = "nixos-generate-config";
meta.maintainers = with lib.maintainers; [ basvandijk ];
nodes.machine = {
system.nixos-generate-config.configuration = ''
# OVERRIDDEN
{ config, pkgs, ... }: {
imports = [ ./hardware-configuration.nix ];
$bootLoaderConfig
$desktopConfiguration
}
'';
system.nixos-generate-config.desktopConfiguration = [
''
# DESKTOP
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
''
];
};
testScript = ''
start_all()
machine.wait_for_unit("multi-user.target")
machine.succeed("nixos-generate-config")
machine.succeed("nix-instantiate --parse /etc/nixos/configuration.nix /etc/nixos/hardware-configuration.nix")
# Test if the configuration really is overridden
machine.succeed("grep 'OVERRIDDEN' /etc/nixos/configuration.nix")
# Test if desktop configuration really is overridden
machine.succeed("grep 'DESKTOP' /etc/nixos/configuration.nix")
# Test of if the Perl variable $bootLoaderConfig is spliced correctly:
machine.succeed(
"grep 'boot\\.loader\\.grub\\.enable = true;' /etc/nixos/configuration.nix"
)
# Test if the Perl variable $desktopConfiguration is spliced correctly
machine.succeed(
"grep 'services\\.desktopManager\\.gnome\\.enable = true;' /etc/nixos/configuration.nix"
)
machine.succeed("rm -rf /etc/nixos")
machine.succeed("nixos-generate-config --flake")
machine.succeed("nix-instantiate --parse /etc/nixos/flake.nix /etc/nixos/configuration.nix /etc/nixos/hardware-configuration.nix")
'';
}