at master 1.8 kB view raw
1{ lib, ... }: 2{ 3 name = "homepage-dashboard"; 4 meta.maintainers = with lib.maintainers; [ parthiv-krishna ]; 5 6 nodes.machine = _: { 7 services.homepage-dashboard = { 8 enable = true; 9 settings.title = "test title rodUsEagid"; # something random/unique 10 bookmarks = [ 11 { 12 Developer = [ 13 { 14 nixpkgs = [ 15 { 16 abbr = "NX"; 17 href = "https://github.com/nixos/nixpkgs"; 18 } 19 ]; 20 } 21 ]; 22 } 23 ]; 24 services = [ 25 { 26 Machines = [ 27 { 28 Localhost = { 29 ping = "127.0.0.1"; 30 }; 31 } 32 ]; 33 } 34 ]; 35 }; 36 }; 37 38 testScript = '' 39 import json 40 41 # Ensure the services are started on managed machine 42 machine.wait_for_unit("homepage-dashboard.service") 43 machine.wait_for_open_port(8082) 44 machine.succeed("curl --fail http://localhost:8082/") 45 46 # Ensure /etc/homepage-dashboard is created. 47 machine.succeed("test -d /etc/homepage-dashboard") 48 49 # Ensure that we see the custom title reflected in the manifest 50 page = machine.succeed("curl --fail http://localhost:8082/site.webmanifest?v=4") 51 assert "test title rodUsEagid" in page, "Custom title not found" 52 53 # Ensure that we see the custom bookmarks on the page 54 page = machine.succeed("curl --fail http://127.0.0.1:8082/api/bookmarks") 55 assert "nixpkgs" in page, "Custom bookmarks not found" 56 57 # Ensure that the ping command works 58 response = machine.succeed("curl --fail \"http://localhost:8082/api/ping?groupName=Machines&serviceName=Localhost\"") 59 assert json.loads(response)["alive"] is True, "Ping to localhost failed" 60 ''; 61}