run nixfmt
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
{ lib, inputs, config, pkgs, ... }:
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.dnote;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
@@ -40,10 +46,8 @@ let
|
||||
WebURL = "https://${fqdn}";
|
||||
};
|
||||
|
||||
serializeEnvVar = value:
|
||||
if (lib.isBool value)
|
||||
then if value then "true" else "false"
|
||||
else toString value;
|
||||
serializeEnvVar =
|
||||
value: if (lib.isBool value) then if value then "true" else "false" else toString value;
|
||||
in
|
||||
{
|
||||
options.services.dnote = {
|
||||
@@ -81,7 +85,9 @@ in
|
||||
systemd.services.dnote = {
|
||||
enable = true;
|
||||
description = "Dnote server";
|
||||
environment = lib.mapAttrs (_: value: serializeEnvVar value) (cfg.environment // immutableEnvironment);
|
||||
environment = lib.mapAttrs (_: value: serializeEnvVar value) (
|
||||
cfg.environment // immutableEnvironment
|
||||
);
|
||||
after = [ "postgresql.service" ];
|
||||
requires = [ "postgresql.service" ];
|
||||
serviceConfig = {
|
||||
@@ -113,10 +119,12 @@ in
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ cfg.environment.DBName ];
|
||||
ensureUsers = [{
|
||||
name = cfg.user;
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = cfg.user;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
webserver = {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
types = {
|
||||
jwtSettings = {
|
||||
@@ -206,7 +211,7 @@ in
|
||||
|
||||
services.webserver = {
|
||||
enable = lib.mkDefault true;
|
||||
vHosts.${fqdn}.locations."/" .proxyPort = cfg.settings.server.port;
|
||||
vHosts.${fqdn}.locations."/".proxyPort = cfg.settings.server.port;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,11 +38,12 @@ in
|
||||
value.extraConfig = ''
|
||||
rewrite ^.*$ https://${fqdn}/.well-known/${path} permanent;
|
||||
'';
|
||||
}) [
|
||||
"host-meta"
|
||||
"webfinger"
|
||||
"nodeinfo"
|
||||
]
|
||||
})
|
||||
[
|
||||
"host-meta"
|
||||
"webfinger"
|
||||
"nodeinfo"
|
||||
]
|
||||
);
|
||||
|
||||
"${fqdn}".locations."/".proxyPort = port;
|
||||
|
||||
@@ -50,10 +50,12 @@ in
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ "grafana" ];
|
||||
ensureUsers = [{
|
||||
name = "grafana";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "grafana";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ lib, config, inputs, ... }:
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.gtrackmap;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ lib, config, inputs, ... }:
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.hastebin;
|
||||
secrets = config.age.secrets;
|
||||
|
||||
@@ -25,10 +25,12 @@ in
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ "mealie" ];
|
||||
ensureUsers = [{
|
||||
name = "mealie";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "mealie";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.octodns;
|
||||
secrets = config.age.secrets;
|
||||
@@ -125,37 +130,46 @@ let
|
||||
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
|
||||
zoneFile = yamlFormat.generate "octodns-zone"
|
||||
(
|
||||
lib.filterAttrs (_: records: (lib.length records) > 0)
|
||||
(lib.mapAttrs
|
||||
(_: types:
|
||||
lib.filter
|
||||
({ values ? [ ], value ? null, ... }: (lib.length values) > 0 || !(builtins.isNull value))
|
||||
(lib.mapAttrsToList
|
||||
(type: { ttl, ... }@options:
|
||||
if (type == "CNAME")
|
||||
then
|
||||
let
|
||||
inherit (options) target toRoot;
|
||||
value = if toRoot then "${config.networking.domain}." else target;
|
||||
in
|
||||
{ inherit type ttl value; }
|
||||
else
|
||||
{ inherit type ttl; inherit (options) values; }
|
||||
)
|
||||
types
|
||||
)
|
||||
zoneFile = yamlFormat.generate "octodns-zone" (
|
||||
lib.filterAttrs (_: records: (lib.length records) > 0) (
|
||||
lib.mapAttrs (
|
||||
_: types:
|
||||
lib.filter
|
||||
(
|
||||
{
|
||||
values ? [ ],
|
||||
value ? null,
|
||||
...
|
||||
}:
|
||||
(lib.length values) > 0 || !(builtins.isNull value)
|
||||
)
|
||||
cfg.records
|
||||
)
|
||||
);
|
||||
(
|
||||
lib.mapAttrsToList (
|
||||
type:
|
||||
{ ttl, ... }@options:
|
||||
if (type == "CNAME") then
|
||||
let
|
||||
inherit (options) target toRoot;
|
||||
value = if toRoot then "${config.networking.domain}." else target;
|
||||
in
|
||||
{
|
||||
inherit type ttl value;
|
||||
}
|
||||
else
|
||||
{
|
||||
inherit type ttl;
|
||||
inherit (options) values;
|
||||
}
|
||||
) types
|
||||
)
|
||||
) cfg.records
|
||||
)
|
||||
);
|
||||
|
||||
zonesDir = pkgs.linkFarm "octodns-zones" {
|
||||
"${config.networking.domain}.yaml" = zoneFile;
|
||||
};
|
||||
|
||||
|
||||
configFile = yamlFormat.generate "octodns-config.yaml" {
|
||||
providers = {
|
||||
config = {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{ lib, inputs, config, pkgs, ... }:
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.readeck;
|
||||
secrets = config.age.secrets;
|
||||
@@ -40,10 +46,12 @@ in
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ "readeck" ];
|
||||
ensureUsers = [{
|
||||
name = "readeck";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "readeck";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,10 +36,12 @@ in
|
||||
postgresql = {
|
||||
enable = lib.mkDefault true;
|
||||
ensureDatabases = [ "vaultwarden" ];
|
||||
ensureUsers = [{
|
||||
name = "vaultwarden";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "vaultwarden";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -69,8 +69,10 @@ in
|
||||
virtualHosts = tailscaleAuthVhosts;
|
||||
};
|
||||
|
||||
virtualHosts = lib.mapAttrs
|
||||
(_: { proxyBuffering, locations, ... }: {
|
||||
virtualHosts = lib.mapAttrs (
|
||||
_:
|
||||
{ proxyBuffering, locations, ... }:
|
||||
{
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
http2 = true;
|
||||
@@ -79,26 +81,33 @@ in
|
||||
(lib.optionalString (!proxyBuffering) "proxy_buffering off;")
|
||||
"charset utf-8;"
|
||||
];
|
||||
locations = lib.mapAttrs
|
||||
(_: { proxyPort, extraConfig }: lib.mergeAttrsList [
|
||||
locations = lib.mapAttrs (
|
||||
_:
|
||||
{ proxyPort, extraConfig }:
|
||||
lib.mergeAttrsList [
|
||||
{ inherit extraConfig; }
|
||||
(if (lib.isInt proxyPort) then {
|
||||
proxyWebsockets = true;
|
||||
proxyPass = "http://localhost:${toString proxyPort}";
|
||||
} else { })
|
||||
])
|
||||
locations;
|
||||
})
|
||||
cfg.vHosts;
|
||||
(
|
||||
if (lib.isInt proxyPort) then
|
||||
{
|
||||
proxyWebsockets = true;
|
||||
proxyPass = "http://localhost:${toString proxyPort}";
|
||||
}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
]
|
||||
) locations;
|
||||
}
|
||||
) cfg.vHosts;
|
||||
};
|
||||
|
||||
octodns.records = lib.filterAttrs (name: _: name != config.networking.domain) (
|
||||
lib.mapAttrs'
|
||||
(fqdn: _: {
|
||||
name = lib.removeSuffix ".${config.networking.domain}" fqdn;
|
||||
value = { CNAME.toRoot = true; };
|
||||
})
|
||||
cfg.vHosts
|
||||
lib.mapAttrs' (fqdn: _: {
|
||||
name = lib.removeSuffix ".${config.networking.domain}" fqdn;
|
||||
value = {
|
||||
CNAME.toRoot = true;
|
||||
};
|
||||
}) cfg.vHosts
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{ pkgs, inputs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.workout-sync;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{ pkgs, config, lib, inputs, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.workout-tracker;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
|
||||
Reference in New Issue
Block a user