46 lines
915 B
Nix
46 lines
915 B
Nix
{
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
serviceName = "${config.networking.hostName}-pingvin";
|
|
domain-name = "${
|
|
config.clan.core.vars.generators."${serviceName}".files.subdomain.value
|
|
}.${config.networking.fqdn}";
|
|
in
|
|
{
|
|
clan.core.vars.generators."${serviceName}" = {
|
|
files = {
|
|
subdomain.secret = false;
|
|
};
|
|
prompts = {
|
|
subdomain = {
|
|
persist = true;
|
|
type = "line";
|
|
description = "Sub-domain for Pingvin. Default:(share)";
|
|
};
|
|
};
|
|
|
|
runtimeInputs = [
|
|
pkgs.xkcdpass
|
|
pkgs.coreutils
|
|
];
|
|
|
|
script = ''
|
|
prompt_domain=$(cat "$prompts"/subdomain)
|
|
if [[ -n "''${prompt_domain-}" ]]; then
|
|
echo $prompt_domain | tr -d "\n" > "$out"/subdomain
|
|
else
|
|
echo -n "share" > "$out"/subdomain
|
|
fi
|
|
'';
|
|
};
|
|
|
|
services.pingvin-share = {
|
|
nginx.enable = true;
|
|
https = true;
|
|
hostname = domain-name;
|
|
};
|
|
}
|