at 23.11-pre 1.4 kB view raw
1import ./make-test-python.nix ({ lib, ... } : { 2 name = "nixos-generate-config"; 3 meta.maintainers = with lib.maintainers; [ basvandijk ]; 4 nodes.machine = { 5 system.nixos-generate-config.configuration = '' 6 # OVERRIDDEN 7 { config, pkgs, ... }: { 8 imports = [ ./hardware-configuration.nix ]; 9 $bootLoaderConfig 10 $desktopConfiguration 11 } 12 ''; 13 14 system.nixos-generate-config.desktopConfiguration = ['' 15 # DESKTOP 16 services.xserver.displayManager.gdm.enable = true; 17 services.xserver.desktopManager.gnome.enable = true; 18 '']; 19 }; 20 testScript = '' 21 start_all() 22 machine.wait_for_unit("multi-user.target") 23 machine.succeed("nixos-generate-config") 24 25 # Test if the configuration really is overridden 26 machine.succeed("grep 'OVERRIDDEN' /etc/nixos/configuration.nix") 27 28 # Test if desktop configuration really is overridden 29 machine.succeed("grep 'DESKTOP' /etc/nixos/configuration.nix") 30 31 # Test of if the Perl variable $bootLoaderConfig is spliced correctly: 32 machine.succeed( 33 "grep 'boot\\.loader\\.grub\\.enable = true;' /etc/nixos/configuration.nix" 34 ) 35 36 # Test if the Perl variable $desktopConfiguration is spliced correctly 37 machine.succeed( 38 "grep 'services\\.xserver\\.desktopManager\\.gnome\\.enable = true;' /etc/nixos/configuration.nix" 39 ) 40 ''; 41})