mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: add croc
This commit is contained in:
parent
6b44dcb023
commit
91fc0227bf
8 changed files with 169 additions and 11 deletions
59
modules/nixos/server/croc.nix
Normal file
59
modules/nixos/server/croc.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
serviceDomain = "send.swarsel.win";
|
||||
servicePorts = [
|
||||
9009
|
||||
9010
|
||||
9011
|
||||
9012
|
||||
9013
|
||||
];
|
||||
serviceName = "croc";
|
||||
|
||||
cfg = config.services.croc;
|
||||
in
|
||||
{
|
||||
options.swarselsystems.modules.server."${serviceName}" = lib.mkEnableOption "enable ${serviceName} on server";
|
||||
config = lib.mkIf config.swarselsystems.modules.server."${serviceName}" {
|
||||
|
||||
sops = {
|
||||
secrets = {
|
||||
croc-password = { };
|
||||
};
|
||||
|
||||
templates = {
|
||||
"croc-env" = {
|
||||
content = ''
|
||||
CROC_PASS="${config.sops.placeholder.croc-password}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
topology.self.services.croc.info = "https://${serviceDomain}";
|
||||
|
||||
services.croc = {
|
||||
enable = true;
|
||||
ports = servicePorts;
|
||||
pass = config.sops.secrets.croc-password.path;
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
|
||||
systemd.services = {
|
||||
"${serviceName}" = {
|
||||
serviceConfig = {
|
||||
ExecStart = lib.mkForce "${pkgs.croc}/bin/croc ${lib.optionalString cfg.debug "--debug"} relay --ports ${
|
||||
lib.concatMapStringsSep "," toString cfg.ports}";
|
||||
EnvironmentFile = [
|
||||
config.sops.templates.croc-env.path
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# ports are opened on the firewall for croc, no nginx config
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue