modules: add actual, nqptp, and voidauth service modules
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
{ inputs, config, ... }:
|
{ inputs, config, ... }:
|
||||||
{
|
{
|
||||||
_module.args = {
|
_module.args = {
|
||||||
pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${config.nixpkgs.hostPlatform.system};
|
pkgs-unstable = import inputs.nixpkgs-unstable {
|
||||||
|
system = config.nixpkgs.hostPlatform.system;
|
||||||
|
config = config.nixpkgs.config;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
|||||||
32
modules/services/actual.nix
Normal file
32
modules/services/actual.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.actual;
|
||||||
|
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.actual = {
|
||||||
|
subdomain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
environmentFile = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services = {
|
||||||
|
webserver = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
vHosts.${fqdn}.locations."/".proxyPort = cfg.settings.port;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.actual = {
|
||||||
|
serviceConfig.EnvironmentFile = cfg.environmentFile;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -26,5 +26,9 @@
|
|||||||
./weechat.nix
|
./weechat.nix
|
||||||
./hledger-web.nix
|
./hledger-web.nix
|
||||||
./glance.nix
|
./glance.nix
|
||||||
|
./sillytavern.nix
|
||||||
|
./nqptp.nix
|
||||||
|
./actual.nix
|
||||||
|
./voidauth.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
27
modules/services/nqptp.nix
Normal file
27
modules/services/nqptp.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.nqptp;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.nqptp = {
|
||||||
|
enable = lib.mkEnableOption "nqptp service for shairport-sync";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.nqptp = {
|
||||||
|
description = "Network Queued PCM Transport Protocol";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = lib.getExe pkgs.nqptp;
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
50
modules/services/voidauth.nix
Normal file
50
modules/services/voidauth.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.voidauth;
|
||||||
|
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||||
|
port = cfg.settings.APP_PORT or 3000;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.voidauth = {
|
||||||
|
subdomain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
inputs.voidauth.nixosModules.voidauth
|
||||||
|
];
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services = {
|
||||||
|
voidauth = {
|
||||||
|
settings = {
|
||||||
|
APP_URL = "https://${fqdn}";
|
||||||
|
DB_SOCKET_PATH = "/run/postgresql";
|
||||||
|
DB_NAME = "voidauth";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
webserver = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
vHosts.${fqdn}.locations."/".proxyPort = port;
|
||||||
|
};
|
||||||
|
|
||||||
|
postgresql = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
ensureDatabases = [ "voidauth" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "voidauth";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user