mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
Pass through alembic and waitress so that it uses the versions from the package definition and not from the evaluation of the module. This allows the module to be imported and used even if it is ported to NixOS versions that use a different default python3 version. This should be more robust against divergence in version numbers between the system and package. Also add a `host` config option to set the bind address. Waitress would otherwise bind to 0.0.0.0, which isn't preferable since it's usually the case the szurubooru is being run behind a reverse proxy.
54 lines
1.4 KiB
Nix
54 lines
1.4 KiB
Nix
import ./make-test-python.nix (
|
|
{ lib, pkgs, ... }:
|
|
{
|
|
name = "szurubooru";
|
|
meta.maintainers = with lib.maintainers; [ ratcornu ];
|
|
|
|
nodes.machine =
|
|
let
|
|
dbpass = "changeme";
|
|
in
|
|
|
|
{ config, ... }:
|
|
{
|
|
services.postgresql = {
|
|
enable = true;
|
|
initialScript = pkgs.writeText "init.sql" ''
|
|
CREATE USER ${config.services.szurubooru.database.user} WITH PASSWORD '${dbpass}';
|
|
CREATE DATABASE ${config.services.szurubooru.database.name} WITH OWNER ${config.services.szurubooru.database.user};
|
|
'';
|
|
};
|
|
|
|
services.szurubooru = {
|
|
enable = true;
|
|
|
|
dataDir = "/var/lib/szurubooru";
|
|
|
|
server = {
|
|
port = 6666;
|
|
host = "127.0.0.1";
|
|
settings = {
|
|
domain = "http://127.0.0.1";
|
|
secretFile = pkgs.writeText "secret" "secret";
|
|
debug = 1;
|
|
};
|
|
};
|
|
|
|
database = {
|
|
host = "localhost";
|
|
port = 5432;
|
|
name = "szurubooru";
|
|
user = "szurubooru";
|
|
passwordFile = pkgs.writeText "pass" "${dbpass}";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("szurubooru.service")
|
|
machine.wait_for_open_port(6666)
|
|
machine.succeed('curl -H "Content-Type: application/json" -H "Accept: application/json" --fail http://127.0.0.1:6666/info')
|
|
'';
|
|
}
|
|
)
|