From 6a66cf1b901efaf1b711c7d4423fc09e001ad13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 10 Sep 2022 17:56:33 +0200 Subject: [PATCH 1/2] nixos/gollum: add package option --- nixos/modules/services/misc/gollum.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/gollum.nix b/nixos/modules/services/misc/gollum.nix index a4bed2da8a2f..ca6f42736a10 100644 --- a/nixos/modules/services/misc/gollum.nix +++ b/nixos/modules/services/misc/gollum.nix @@ -87,6 +87,14 @@ in description = lib.mdDoc "Specifies the path of the repository directory. If it does not exist, Gollum will create it on startup."; }; + package = mkOption { + type = types.package; + default = pkgs.gollum; + defaultText = literalExpression "pkgs.gollum"; + description = lib.mdDoc '' + The package used in the service + ''; + }; }; config = mkIf cfg.enable { @@ -120,7 +128,7 @@ in Group = config.users.groups.gollum.name; WorkingDirectory = cfg.stateDir; ExecStart = '' - ${pkgs.gollum}/bin/gollum \ + ${cfg.package}/bin/gollum \ --port ${toString cfg.port} \ --host ${cfg.address} \ --config ${pkgs.writeText "gollum-config.rb" cfg.extraConfig} \ From ad0108d803c9e74c08d70061301d8780e428abe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 10 Sep 2022 18:01:37 +0200 Subject: [PATCH 2/2] nixos/gollum: add test --- nixos/tests/all-tests.nix | 1 + nixos/tests/gollum.nix | 14 ++++++++++++++ pkgs/applications/misc/gollum/default.nix | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/gollum.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index f3cde7e23a16..230ad47f3bfa 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -189,6 +189,7 @@ in { gobgpd = handleTest ./gobgpd.nix {}; gocd-agent = handleTest ./gocd-agent.nix {}; gocd-server = handleTest ./gocd-server.nix {}; + gollum = handleTest ./gollum.nix {}; google-oslogin = handleTest ./google-oslogin {}; gotify-server = handleTest ./gotify-server.nix {}; grafana = handleTest ./grafana.nix {}; diff --git a/nixos/tests/gollum.nix b/nixos/tests/gollum.nix new file mode 100644 index 000000000000..833db87f2f32 --- /dev/null +++ b/nixos/tests/gollum.nix @@ -0,0 +1,14 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "gollum"; + + nodes = { + webserver = { pkgs, lib, ... }: { + services.gollum.enable = true; + }; + }; + + testScript = { nodes, ... }: '' + webserver.wait_for_unit("gollum") + webserver.wait_for_open_port(${toString nodes.webserver.config.services.gollum.port}) + ''; +}) diff --git a/pkgs/applications/misc/gollum/default.nix b/pkgs/applications/misc/gollum/default.nix index 3f77b890455b..cafebfad39a2 100644 --- a/pkgs/applications/misc/gollum/default.nix +++ b/pkgs/applications/misc/gollum/default.nix @@ -1,4 +1,4 @@ -{ lib, bundlerApp, bundlerUpdateScript, ruby, makeWrapper, git, docutils }: +{ lib, bundlerApp, bundlerUpdateScript, ruby, makeWrapper, git, docutils, nixosTests }: bundlerApp rec { pname = "gollum"; @@ -10,6 +10,7 @@ bundlerApp rec { nativeBuildInputs = [ makeWrapper ]; passthru.updateScript = bundlerUpdateScript "gollum"; + passthru.tests.gollum = nixosTests.gollum; meta = with lib; { description = "A simple, Git-powered wiki with a sweet API and local frontend";