infrastructure/nixos/hosts/olympus/hedgedoc/configuration.nix

82 lines
2.3 KiB
Nix
Raw Normal View History

2022-05-15 01:24:06 +02:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ lib, config, pkgs, inputs, ... }:
let
db_name = "hedgedoc";
db_user = "hedgedoc";
vs = config.vault-secrets.secrets;
in
{
imports = [ ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
# Additional packages
environment.systemPackages = with pkgs; [ ];
environment.noXlibs = lib.mkForce false;
2022-07-28 12:36:55 +02:00
networking.firewall.allowedTCPPorts = [ config.services.hedgedoc.settings.port ];
2022-05-15 01:24:06 +02:00
vault-secrets.secrets.hedgedoc = { };
services.postgresql =
{
enable = true;
package = pkgs.postgresql_13;
ensureDatabases = [ db_name ];
ensureUsers = [
{
name = db_user;
ensurePermissions = { "DATABASE ${db_name}" = "ALL PRIVILEGES"; };
}
];
};
services.hedgedoc = {
enable = true;
environmentFile = "${vs.hedgedoc}/environment";
2022-07-28 12:36:55 +02:00
settings = {
2022-05-15 01:24:06 +02:00
host = "0.0.0.0";
port = 3000;
sessionSecret = "$SESSION_SECRET";
domain = "md.0x76.dev";
protocolUseSSL = true;
hsts.enable = true;
allowOrigin = [
2022-07-28 12:36:55 +02:00
config.services.hedgedoc.settings.domain
2022-05-15 01:24:06 +02:00
"hedgedoc"
];
2022-05-16 14:17:55 +02:00
allowAnonymous = false;
2022-05-15 01:24:06 +02:00
allowEmailRegister = false;
2022-05-16 14:17:55 +02:00
allowAnonymousEdits = true;
2022-05-15 10:54:26 +02:00
allowFreeURL = true;
requireFreeURLAuthentication = true;
2022-05-15 01:24:06 +02:00
imageUploadType = "minio";
db = {
dialect = "postgres";
username = db_user;
database = db_name;
host = "/run/postgresql";
};
s3bucket = "hedgedoc";
minio = {
2022-05-15 10:54:26 +02:00
secure = true;
endPoint = "o.0x76.dev";
port = 443;
2022-05-15 01:24:06 +02:00
accessKey = "$MINIO_ACCESS_KEY";
secretKey = "$MINIO_SECRET_KEY";
};
2022-05-18 15:56:40 +02:00
email = true;
2022-05-15 01:24:06 +02:00
};
};
}