Skip to content

Commit

Permalink
nixos/homer: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Dec 27, 2024
1 parent d3f0f06 commit 2bfb232
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ in {
hedgedoc = handleTest ./hedgedoc.nix {};
herbstluftwm = handleTest ./herbstluftwm.nix {};
homebox = handleTest ./homebox.nix {};
homer = handleTest ./homer.nix {};
homepage-dashboard = handleTest ./homepage-dashboard.nix {};
honk = runTest ./honk.nix;
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
Expand Down
30 changes: 30 additions & 0 deletions nixos/tests/homer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import ./make-test-python.nix (
{ lib, ... }:

{
name = "homer";
meta.maintainers = with lib.maintainers; [ stunkymonkey ];

nodes.machine =
{ pkgs, ... }:
{
services.homer = {
enable = true;
virtualHost = {
enableNginx = true;
domain = "localhost";
};
settings = {
title = "testing";
};
};
};

testScript = ''
machine.wait_for_unit("nginx.service")
machine.wait_for_open_port(80)
machine.succeed("curl --fail --show-error --silent http://localhost:80/ | grep '<title>Homer</title>'")
machine.succeed("curl --fail --show-error --silent http://localhost:80/assets/config.yml | grep 'title: testing'")
'';
}
)
6 changes: 6 additions & 0 deletions pkgs/by-name/ho/homer/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pnpm,
nodejs,
dart-sass,
nixosTests,
}:
stdenvNoCC.mkDerivation rec {
pname = "homer";
Expand Down Expand Up @@ -53,6 +54,11 @@ stdenvNoCC.mkDerivation rec {
runHook postInstall
'';


passthru.tests = {
inherit (nixosTests) homer;
};

meta = with lib; {
description = "A very simple static homepage for your server.";
homepage = "https://homer-demo.netlify.app/";
Expand Down

0 comments on commit 2bfb232

Please sign in to comment.