at master 952 B view raw
1{ pkgs, ... }: 2 3let 4 port = 8081; 5in 6{ 7 name = "magnetico"; 8 meta = with pkgs.lib.maintainers; { 9 maintainers = [ rnhmjoj ]; 10 }; 11 12 nodes.machine = 13 { ... }: 14 { 15 imports = [ ../modules/profiles/minimal.nix ]; 16 17 networking.firewall.allowedTCPPorts = [ 9000 ]; 18 19 services.magnetico = { 20 enable = true; 21 crawler.port = 9000; 22 web.port = port; 23 web.credentials.user = "$2y$12$P88ZF6soFthiiAeXnz64aOWDsY3Dw7Yw8fZ6GtiqFNjknD70zDmNe"; 24 }; 25 }; 26 27 testScript = '' 28 start_all() 29 machine.wait_for_unit("magneticod") 30 machine.wait_for_unit("magneticow") 31 machine.wait_for_open_port(${toString port}) 32 machine.succeed( 33 "${pkgs.curl}/bin/curl --fail " 34 + "-u user:password http://localhost:${toString port}" 35 ) 36 machine.fail( 37 "${pkgs.curl}/bin/curl --fail " 38 + "-u user:wrongpwd http://localhost:${toString port}" 39 ) 40 machine.shutdown() 41 ''; 42}