WIP
This commit is contained in:
1 parent
13e407847f
commit
374428658a
80 files changed
+2517
-1058
No files matched your search
@@ -1,24 +1,26 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.selfhosted;
|
||||
cfg = config.selfhosted.zerobyte;
|
||||
domain = "${config.sops.placeholder."domains/serv"}";
|
||||
zerobyteDomain = "${cfg.zerobyte.subdomain}.${domain}";
|
||||
zerobyteDomain = "${cfg.subdomain}.${domain}";
|
||||
trustedOrigins = [
|
||||
"https://${zerobyteDomain}"
|
||||
"https://${cfg.pocket-id.subdomain}.${domain}"
|
||||
"https://${config.selfhosted.pocket-id.subdomain}.${domain}"
|
||||
];
|
||||
in
|
||||
{
|
||||
sops.secrets = {
|
||||
"zerobyte/app_secret" = { };
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
sops.secrets = {
|
||||
"zerobyte/app_secret" = { };
|
||||
};
|
||||
|
||||
sops.templates."zerobyte.env".content = ''
|
||||
TZ=${config.time.timeZone}
|
||||
BASE_URL=https://${zerobyteDomain}
|
||||
APP_SECRET=${config.sops.placeholder."zerobyte/app_secret"}
|
||||
TRUST_PROXY=true
|
||||
TRUSTED_ORIGINS=${(concatStringsSep "," trustedOrigins)}
|
||||
'';
|
||||
sops.templates."zerobyte.env".content = ''
|
||||
TZ=${config.time.timeZone}
|
||||
BASE_URL=https://${zerobyteDomain}
|
||||
APP_SECRET=${config.sops.placeholder."zerobyte/app_secret"}
|
||||
TRUST_PROXY=true
|
||||
TRUSTED_ORIGINS=${(concatStringsSep "," trustedOrigins)}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
@@ -14,23 +9,24 @@ in
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.selfhosted.zerobyte = {
|
||||
enable = mkEnableOption "Enable ${cfg.targetName}";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
hostPort = mkOption {
|
||||
hostHttpPort = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "ghcr.io/nicotsx/zerobyte:latest";
|
||||
image = "ghcr.io/nicotsx/zerobyte:v0.41";
|
||||
environmentFiles = [ config.sops.templates."zerobyte.env".path ];
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.hostPort}:4096"
|
||||
"0.0.0.0:${toString cfg.hostHttpPort}:4096"
|
||||
];
|
||||
volumes = [
|
||||
"/etc/localtime:/etc/localtime:ro"
|
||||
@@ -43,16 +39,9 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"${common.backend}-network-${common.network.name}.service"
|
||||
"${common.backend}-${config.selfhosted.traefik.name}.service"
|
||||
];
|
||||
requires = [
|
||||
"${common.backend}-network-${common.network.name}.service"
|
||||
"${common.backend}-${config.selfhosted.traefik.name}.service"
|
||||
];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
after = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/{data,backups}
|
||||
'';
|
||||
|
||||
Reference in new issue
Block a user