2019-11-04 23:39:07 +00:00
|
|
|
import ./make-test-python.nix ({ lib, ... } : {
|
2019-08-07 17:04:18 +01:00
|
|
|
name = "nixos-generate-config";
|
|
|
|
meta.maintainers = with lib.maintainers; [ basvandijk ];
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = {
|
2019-08-07 17:04:18 +01:00
|
|
|
system.nixos-generate-config.configuration = ''
|
|
|
|
# OVERRIDDEN
|
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
imports = [ ./hardware-configuration.nix ];
|
|
|
|
$bootLoaderConfig
|
2020-10-11 03:44:36 +01:00
|
|
|
$desktopConfiguration
|
2019-08-07 17:04:18 +01:00
|
|
|
}
|
|
|
|
'';
|
2020-10-11 03:44:36 +01:00
|
|
|
|
2021-02-13 23:45:27 +00:00
|
|
|
system.nixos-generate-config.desktopConfiguration = [''
|
2020-10-11 03:44:36 +01:00
|
|
|
# DESKTOP
|
2021-02-13 22:42:34 +00:00
|
|
|
services.xserver.displayManager.gdm.enable = true;
|
2021-05-07 22:18:14 +01:00
|
|
|
services.xserver.desktopManager.gnome.enable = true;
|
2021-02-13 23:45:27 +00:00
|
|
|
''];
|
2019-08-07 17:04:18 +01:00
|
|
|
};
|
|
|
|
testScript = ''
|
2019-11-04 23:39:07 +00:00
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.succeed("nixos-generate-config")
|
2019-08-07 17:04:18 +01:00
|
|
|
|
|
|
|
# Test if the configuration really is overridden
|
2019-11-04 23:39:07 +00:00
|
|
|
machine.succeed("grep 'OVERRIDDEN' /etc/nixos/configuration.nix")
|
2019-08-07 17:04:18 +01:00
|
|
|
|
2020-10-11 03:44:36 +01:00
|
|
|
# Test if desktop configuration really is overridden
|
|
|
|
machine.succeed("grep 'DESKTOP' /etc/nixos/configuration.nix")
|
|
|
|
|
2019-08-07 17:04:18 +01:00
|
|
|
# Test of if the Perl variable $bootLoaderConfig is spliced correctly:
|
2019-11-04 23:39:07 +00:00
|
|
|
machine.succeed(
|
|
|
|
"grep 'boot\\.loader\\.grub\\.enable = true;' /etc/nixos/configuration.nix"
|
|
|
|
)
|
2020-10-11 03:44:36 +01:00
|
|
|
|
|
|
|
# Test if the Perl variable $desktopConfiguration is spliced correctly
|
|
|
|
machine.succeed(
|
2021-05-07 22:18:14 +01:00
|
|
|
"grep 'services\\.xserver\\.desktopManager\\.gnome\\.enable = true;' /etc/nixos/configuration.nix"
|
2020-10-11 03:44:36 +01:00
|
|
|
)
|
2019-08-07 17:04:18 +01:00
|
|
|
'';
|
|
|
|
})
|