3
0
Fork 0
forked from mirrors/nixpkgs

nixos/shiori: init with test

This commit is contained in:
Minijackson 2019-09-22 17:54:16 +02:00
parent 7ebb3f5818
commit 367cd2c7f8
No known key found for this signature in database
GPG key ID: FEA888C9F5D64F62
3 changed files with 68 additions and 0 deletions

View file

@ -805,6 +805,7 @@
./services/web-apps/restya-board.nix
./services/web-apps/tt-rss.nix
./services/web-apps/selfoss.nix
./services/web-apps/shiori.nix
./services/web-apps/virtlyst.nix
./services/web-apps/wordpress.nix
./services/web-apps/youtrack.nix

View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.shiori;
in {
options = {
services.shiori = {
enable = mkEnableOption "Shiori simple bookmarks manager";
package = mkOption {
type = types.package;
default = pkgs.shiori;
defaultText = "pkgs.shiori";
description = "The Shiori package to use.";
};
address = mkOption {
type = types.str;
default = "";
description = ''
The IP address on which Shiori will listen.
If empty, listens on all interfaces.
'';
};
port = mkOption {
type = types.port;
default = 8080;
description = "The port of the Shiori web application";
};
};
};
config = mkIf cfg.enable {
systemd.services.shiori = with cfg; {
description = "Shiori simple bookmarks manager";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${package}/bin/shiori serve --address '${address}' --port '${toString port}'";
DynamicUser = true;
Environment = "SHIORI_DIR=/var/lib/shiori";
StateDirectory = "shiori";
};
};
};
meta.maintainers = with maintainers; [ minijackson ];
}

17
nixos/tests/shiori.nix Normal file
View file

@ -0,0 +1,17 @@
import ./make-test.nix ({ lib, ...}:
{
name = "shiori";
meta.maintainers = with lib.maintainers; [ minijackson ];
machine =
{ ... }:
{ services.shiori.enable = true; };
testScript = ''
$machine->waitForUnit('shiori.service');
$machine->waitForOpenPort('8080');
$machine->succeed("curl --fail http://localhost:8080/");
$machine->succeed("curl --fail --location http://localhost:8080/ | grep -qi shiori");
'';
})