nixos/komga: add module
This commit is contained in:
parent
8896455eb3
commit
6c55578c7e
7 changed files with 137 additions and 0 deletions
|
@ -138,6 +138,13 @@
|
|||
<link linkend="opt-services.dragonflydb.enable">services.dragonflydb</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<link xlink:href="https://komga.org/">Komga</link>, a free and
|
||||
open source comics/mangas media server. Available as
|
||||
<link linkend="opt-services.komga.enable">services.komga</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<link xlink:href="https://hbase.apache.org/">HBase
|
||||
|
|
|
@ -59,6 +59,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||
|
||||
- [dragonflydb](https://dragonflydb.io/), a modern replacement for Redis and Memcached. Available as [services.dragonflydb](#opt-services.dragonflydb.enable).
|
||||
|
||||
- [Komga](https://komga.org/), a free and open source comics/mangas media server. Available as [services.komga](#opt-services.komga.enable).
|
||||
|
||||
- [HBase cluster](https://hbase.apache.org/), a distributed, scalable, big data store. Available as [services.hadoop.hbase](options.html#opt-services.hadoop.hbase.enable).
|
||||
|
||||
- [infnoise](https://github.com/leetronics/infnoise), a hardware True Random Number Generator dongle.
|
||||
|
|
|
@ -1078,6 +1078,7 @@
|
|||
./services/web-apps/jirafeau.nix
|
||||
./services/web-apps/jitsi-meet.nix
|
||||
./services/web-apps/keycloak.nix
|
||||
./services/web-apps/komga.nix
|
||||
./services/web-apps/lemmy.nix
|
||||
./services/web-apps/invidious.nix
|
||||
./services/web-apps/invoiceplane.nix
|
||||
|
|
99
nixos/modules/services/web-apps/komga.nix
Normal file
99
nixos/modules/services/web-apps/komga.nix
Normal file
|
@ -0,0 +1,99 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.komga;
|
||||
|
||||
in {
|
||||
options = {
|
||||
services.komga = {
|
||||
enable = mkEnableOption "Komga, a free and open source comics/mangas media server";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
description = lib.mdDoc ''
|
||||
The port that Komga will listen on.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "komga";
|
||||
description = lib.mdDoc ''
|
||||
User account under which Komga runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "komga";
|
||||
description = lib.mdDoc ''
|
||||
Group under which Komga runs.
|
||||
'';
|
||||
};
|
||||
|
||||
stateDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/lib/komga";
|
||||
description = lib.mdDoc ''
|
||||
State and configuration directory Komga will use.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Whether to open the firewall for the port in {option}`services.komga.port`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
|
||||
|
||||
users.groups = mkIf (cfg.group == "komga") {
|
||||
komga = {};
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "komga") {
|
||||
komga = {
|
||||
group = cfg.group;
|
||||
home = cfg.stateDir;
|
||||
description = "Komga Daemon user";
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.komga = {
|
||||
environment = {
|
||||
SERVER_PORT = builtins.toString cfg.port;
|
||||
KOMGA_CONFIGDIR = cfg.stateDir;
|
||||
};
|
||||
|
||||
description = "Komga is a free and open source comics/mangas media server";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.komga}/bin/komga";
|
||||
|
||||
StateDirectory = mkIf (cfg.stateDir == "/var/lib/komga") "komga";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ govanify ];
|
||||
}
|
|
@ -272,6 +272,7 @@ in {
|
|||
keycloak = discoverTests (import ./keycloak.nix);
|
||||
keymap = handleTest ./keymap.nix {};
|
||||
knot = handleTest ./knot.nix {};
|
||||
komga = handleTest ./komga.nix {};
|
||||
krb5 = discoverTests (import ./krb5 {});
|
||||
ksm = handleTest ./ksm.nix {};
|
||||
kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {};
|
||||
|
|
22
nixos/tests/komga.nix
Normal file
22
nixos/tests/komga.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
import ./make-test-python.nix ({ lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
name = "komga";
|
||||
meta.maintainers = with maintainers; [ govanify ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{ services.komga = {
|
||||
enable = true;
|
||||
port = 1234;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("komga.service")
|
||||
machine.wait_for_open_port(1234)
|
||||
machine.succeed("curl --fail http://localhost:1234/")
|
||||
'';
|
||||
})
|
|
@ -3,6 +3,7 @@
|
|||
, fetchurl
|
||||
, makeWrapper
|
||||
, jdk11_headless
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
|
@ -22,6 +23,10 @@ stdenvNoCC.mkDerivation rec {
|
|||
makeWrapper ${jdk11_headless}/bin/java $out/bin/komga --add-flags "-jar $src"
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
komga = nixosTests.komga;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Free and open source comics/mangas server";
|
||||
homepage = "https://komga.org/";
|
||||
|
|
Loading…
Reference in a new issue