diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 93243f29082a..052efceaa632 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -428,6 +428,7 @@ in cyrus-imap = runTest ./cyrus-imap.nix; dae = runTest ./dae.nix; darling-dmg = runTest ./darling-dmg.nix; + dashy = runTest ./web-apps/dashy.nix; davis = runTest ./davis.nix; db-rest = runTest ./db-rest.nix; dconf = runTest ./dconf.nix; diff --git a/nixos/tests/web-apps/dashy.nix b/nixos/tests/web-apps/dashy.nix new file mode 100644 index 000000000000..39454b5b8d8a --- /dev/null +++ b/nixos/tests/web-apps/dashy.nix @@ -0,0 +1,75 @@ +{ pkgs, lib, ... }: +let + + customSettings = { + pageInfo = { + title = "My Custom Dashy Title"; + }; + + sections = [ + { + name = "My Section"; + items = [ + { + name = "NixOS"; + url = "https://nixos.org"; + } + ]; + } + ]; + }; + + customSettingsYaml = (pkgs.formats.yaml_1_1 { }).generate "custom-conf.yaml" customSettings; +in +{ + name = "dashy"; + meta.maintainers = [ lib.maintainers.therealgramdalf ]; + + defaults = + { config, ... }: + { + services.dashy = { + enable = true; + virtualHost = { + enableNginx = true; + domain = "dashy.local"; + }; + }; + + networking.extraHosts = "127.0.0.1 dashy.local"; + + services.nginx.virtualHosts."${config.services.dashy.virtualHost.domain}".listen = [ + { + addr = "127.0.0.1"; + port = 80; + } + ]; + }; + nodes = { + machine = { }; + + machine-custom = { + services.dashy.settings = customSettings; + }; + }; + + testScript = '' + start_all() + machine.wait_for_unit("nginx.service") + machine.wait_for_open_port(80) + + actual = machine.succeed("curl -v --stderr - http://dashy.local/", timeout=10) + expected = "