My Nix Configuration

[marvin.services] pingvin-share: dockerize against my will

pyrox.dev 157f72ce fb29ade4

verified
Changed files
+50 -15
systems
x86_64-linux
marvin
prefect
services
mailserver
+49 -14
systems/x86_64-linux/marvin/services/pingvin-share.nix
···
configFormat = pkgs.formats.yaml { };
configFile = configFormat.generate "config.yaml" {
general = {
-
appName = "dishNet Files";
secureCookies = "true";
};
share = {
allowRegistration = "false";
allowUnauthenticatedShares = "false";
};
email.enableShareEmailRecipients = "true";
smtp = {
···
ldap.enabled = "false";
legal.enabled = "false";
s3.enabled = "false";
-
initUser = {
-
enabled = true;
-
username = "dish";
-
email = "pyrox@pyrox.dev";
-
password = "ADMIN_PASSWORD";
-
isAdmin = true;
};
};
in
{
services = {
pingvin-share = {
-
enable = true;
backend.port = d.be-port;
frontend.port = d.port;
hostname = "share.pyrox.dev";
https = true;
};
-
anubis.instances = lib.mkIf cfg.enable {
pingvin-share-be = {
settings = {
BIND = ":${toString d.be-anubis}";
···
};
};
systemd.services.init-pingvin-config = {
-
enable = cfg.enable;
description = "Pingvin Share configuration setup";
wantedBy = [ "multi-user.target" ];
before = [
-
"pingvin-share-backend.service"
-
"pingvin-share-frontend.service"
];
path = [ pkgs.gnused ];
script = ''
rm ${cfg.dataDir}/config.yaml
cp ${configFile} ${cfg.dataDir}/config.yaml
-
sed -i "s/SMTP_PASSWORD/$SMTP_PASSWORD/" ${cfg.dataDir}/config.yaml
-
sed -i "s/ADMIN_PASSWORD/$ADMIN_PASSWORD/" ${cfg.dataDir}/config.yaml
'';
serviceConfig = {
EnvironmentFile = config.age.secrets.pingvin-secrets.path;
···
configFormat = pkgs.formats.yaml { };
configFile = configFormat.generate "config.yaml" {
general = {
+
appName = "dishNet Share";
+
appUrl = "https://share.pyrox.dev";
secureCookies = "true";
+
showHomePage = "false";
};
share = {
allowRegistration = "false";
allowUnauthenticatedShares = "false";
+
maxSize = "10000000000";
};
email.enableShareEmailRecipients = "true";
smtp = {
···
ldap.enabled = "false";
legal.enabled = "false";
s3.enabled = "false";
+
oauth = {
+
ignoreTotp = "true";
+
oidc-enabled = "true";
+
oidc-clientSecret = "CLIENT_SECRET";
+
oidc-clientId = "d83006a6-9b08-47eb-af56-418065db09b5";
+
oidc-discoveryUri = "https://auth.pyrox.dev/.well-known/openid-configuration";
+
oidc-signOut = "false";
+
oidc-scope = "openid email profile groups";
+
oidc-rolePath = "groups";
+
oidc-roleAdminAccess = "admins";
};
+
initUser.enabled = false;
};
in
{
+
virtualisation.oci-containers.containers = {
+
pingvin-share-server = {
+
image = "ghcr.io/stonith404/pingvin-share:latest";
+
ports = [
+
"${toString d.port}:3000"
+
"${toString d.be-port}:8080"
+
];
+
volumes = [
+
"/var/lib/pingvin-share/data:/opt/app/backend/data"
+
"/var/lib/pingvin-share/data/images:/opt/app/frontend/public/img"
+
"/var/lib/pingvin-share/config.yaml:/opt/app/config.yaml"
+
];
+
environment = {
+
API_URL = "https://share.pyrox.dev";
+
PUID = "962";
+
PGID = "959";
+
};
+
};
+
};
+
users.users.pingvin = {
+
uid = 962;
+
group = cfg.group;
+
isSystemUser = true;
+
};
+
users.groups.pingvin = {
+
gid = 959;
+
};
+
services = {
pingvin-share = {
+
enable = false;
backend.port = d.be-port;
frontend.port = d.port;
hostname = "share.pyrox.dev";
https = true;
};
+
anubis.instances = {
pingvin-share-be = {
settings = {
BIND = ":${toString d.be-anubis}";
···
};
};
systemd.services.init-pingvin-config = {
+
enable = true;
description = "Pingvin Share configuration setup";
wantedBy = [ "multi-user.target" ];
before = [
+
"docker-pingvin-share-server.service"
];
path = [ pkgs.gnused ];
script = ''
rm ${cfg.dataDir}/config.yaml
cp ${configFile} ${cfg.dataDir}/config.yaml
+
sed -i "s/SMTP_PASSWORD/\"$SMTP_PASSWORD\"/" ${cfg.dataDir}/config.yaml
+
sed -i "s/CLIENT_SECRET/\"$CLIENT_SECRET\"/" ${cfg.dataDir}/config.yaml
'';
serviceConfig = {
EnvironmentFile = config.age.secrets.pingvin-secrets.path;
systems/x86_64-linux/marvin/services/secrets/pingvin-secrets.age

This is a binary file and will not be displayed.

+1 -1
systems/x86_64-linux/prefect/services/mailserver/logins.nix
···
sendOnly = true;
};
"share@pyrox.dev" = {
-
hashedPassword = "$2b$05$GTK7WRECM2FKlpqUWhsE1e9QaXX5fQ41id.W/PV2TZnOwNtrKJZHe";
sendOnly = true;
};
};
···
sendOnly = true;
};
"share@pyrox.dev" = {
+
hashedPassword = "$2b$05$LDvYYmxYcTgqPMDvvhA.uO8UFh8yLqPzVuOdeYBq0x/WJ/85X3DEC";
sendOnly = true;
};
};