2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ lib, ... } : {
|
|
|
|
name = "nixos-generate-config";
|
|
|
|
meta.maintainers = with lib.maintainers; [ basvandijk ];
|
|
|
|
machine = {
|
|
|
|
system.nixos-generate-config.configuration = ''
|
|
|
|
# OVERRIDDEN
|
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
imports = [ ./hardware-configuration.nix ];
|
|
|
|
$bootLoaderConfig
|
2020-10-27 00:29:36 +00:00
|
|
|
$desktopConfiguration
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|
|
|
|
'';
|
2020-10-27 00:29:36 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
system.nixos-generate-config.desktopConfiguration = [''
|
2020-10-27 00:29:36 +00:00
|
|
|
# DESKTOP
|
2021-02-17 17:02:09 +00:00
|
|
|
services.xserver.displayManager.gdm.enable = true;
|
2021-05-20 23:08:51 +00:00
|
|
|
services.xserver.desktopManager.gnome.enable = true;
|
2021-02-17 17:02:09 +00:00
|
|
|
''];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.succeed("nixos-generate-config")
|
|
|
|
|
|
|
|
# Test if the configuration really is overridden
|
|
|
|
machine.succeed("grep 'OVERRIDDEN' /etc/nixos/configuration.nix")
|
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
# Test if desktop configuration really is overridden
|
|
|
|
machine.succeed("grep 'DESKTOP' /etc/nixos/configuration.nix")
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Test of if the Perl variable $bootLoaderConfig is spliced correctly:
|
|
|
|
machine.succeed(
|
|
|
|
"grep 'boot\\.loader\\.grub\\.enable = true;' /etc/nixos/configuration.nix"
|
|
|
|
)
|
2020-10-27 00:29:36 +00:00
|
|
|
|
|
|
|
# Test if the Perl variable $desktopConfiguration is spliced correctly
|
|
|
|
machine.succeed(
|
2021-05-20 23:08:51 +00:00
|
|
|
"grep 'services\\.xserver\\.desktopManager\\.gnome\\.enable = true;' /etc/nixos/configuration.nix"
|
2020-10-27 00:29:36 +00:00
|
|
|
)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
})
|