pingvin service
This commit is contained in:
45
machines/b4l/services/pingvin.nix
Normal file
45
machines/b4l/services/pingvin.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user