# NixOS VM configuration for testing Movie Map in CI/CD # This VM includes all dependencies needed for testing # Usage: nixos-rebuild build-vm -I nixos-config=./nix/test-vm.nix { config, pkgs, lib, ... }: { imports = [ ]; # VM-specific configuration virtualisation = { memorySize = 2048; # 2GB RAM cores = 2; graphics = false; # Headless }; networking = { hostName = "moviemap-test-vm"; firewall = { enable = true; allowedTCPPorts = [ 8080 # Movie Map backend 5432 # PostgreSQL 22 # SSH ]; }; }; # Enable SSH for remote access services.openssh = { enable = true; settings = { PermitRootLogin = "yes"; PasswordAuthentication = true; }; }; # Set root password for SSH access users.users.root.password = "test"; # PostgreSQL configuration services.postgresql = { enable = true; ensureDatabases = [ "moviemap_test" ]; ensureUsers = [ { name = "moviemap"; ensureDBOwnership = true; } ]; authentication = '' local all all trust host all all 0.0.0.0/0 trust ''; settings = { listen_addresses = "'*'"; }; }; # Python and Node.js for testing environment.systemPackages = with pkgs; [ python3 python3Packages.pip nodejs_20 nodePackages.npm postgresql curl jq git vim # Testing tools python3Packages.pytest python3Packages.pytest-asyncio python3Packages.pytest-cov python3Packages.httpx ]; # Create a test user users.users.test = { isNormalUser = true; extraGroups = [ "wheel" ]; password = "test"; openssh.authorizedKeys.keys = []; }; # Allow passwordless sudo for test user security.sudo.wheelNeedsPassword = false; # System configuration system.stateVersion = "23.11"; }