mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 18:15:13 -05:00
feat: init
This commit is contained in:
commit
c19ea940bd
320 changed files with 23845 additions and 0 deletions
125
nixos/modules/services/nextcloud.nix
Executable file
125
nixos/modules/services/nextcloud.nix
Executable file
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
flake,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.people.user.${user0}) domain;
|
||||
inherit (flake.config.system.device) server wildcard;
|
||||
inherit (flake.config.service.instance) nextcloud nginx;
|
||||
localhost = wildcard.ip.address0;
|
||||
host = "${nextcloud.name}.${domain.url0}";
|
||||
in {
|
||||
imports = [
|
||||
"${fetchTarball {
|
||||
url = "https://github.com/onny/nixos-nextcloud-testumgebung/archive/fa6f062830b4bc3cedb9694c1dbf01d5fdf775ac.tar.gz";
|
||||
sha256 = "0gzd0276b8da3ykapgqks2zhsqdv4jjvbv97dsxg0hgrhb74z0fs";
|
||||
}}/nextcloud-extras.nix"
|
||||
];
|
||||
|
||||
services = {
|
||||
nextcloud = {
|
||||
appstoreEnable = true;
|
||||
autoUpdateApps.enable = true;
|
||||
configureRedis = true;
|
||||
enable = true;
|
||||
hostName = host;
|
||||
https = true;
|
||||
webserver = "caddy";
|
||||
package = pkgs.nextcloud29;
|
||||
phpOptions."opcache.interned_strings_buffer" = "24";
|
||||
extraAppsEnable = true;
|
||||
extraApps = {
|
||||
inherit
|
||||
(config.services.nextcloud.package.packages.apps)
|
||||
calendar
|
||||
;
|
||||
};
|
||||
config = {
|
||||
adminpassFile = config.sops.secrets."${nextcloud.name}-pass".path;
|
||||
dbtype = "pgsql";
|
||||
};
|
||||
database = {
|
||||
createLocally = true;
|
||||
};
|
||||
settings = {
|
||||
default_phone_region = "CA";
|
||||
log_type = "file";
|
||||
mail_sendmailmode = "pipe";
|
||||
mail_smtpmode = "sendmail";
|
||||
maintenance_window_start = 4;
|
||||
overwriteprotocol = "https";
|
||||
enabledPreviewProviders = [
|
||||
"OC\\Preview\\BMP"
|
||||
"OC\\Preview\\GIF"
|
||||
"OC\\Preview\\JPEG"
|
||||
"OC\\Preview\\Krita"
|
||||
"OC\\Preview\\MarkDown"
|
||||
"OC\\Preview\\MP3"
|
||||
"OC\\Preview\\OpenDocument"
|
||||
"OC\\Preview\\PNG"
|
||||
"OC\\Preview\\TXT"
|
||||
"OC\\Preview\\XBitmap"
|
||||
"OC\\Preview\\HEIC"
|
||||
];
|
||||
trusted_proxies = [
|
||||
localhost
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
caddy = {
|
||||
virtualHosts = {
|
||||
"https://${host}" = {
|
||||
extraConfig = ''
|
||||
reverse_proxy ${localhost}:${toString nextcloud.ports.port0}
|
||||
|
||||
tls ${nextcloud.ssl.cert} ${nextcloud.ssl.key}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops = let
|
||||
sopsSecrets = ["pass"];
|
||||
sopsPath = secret: {
|
||||
path = "${nextcloud.sops.path0}/${nextcloud.name}-${secret}";
|
||||
owner = nextcloud.name;
|
||||
mode = "600";
|
||||
};
|
||||
in {
|
||||
secrets = builtins.listToAttrs (
|
||||
map
|
||||
(secret: {
|
||||
name = "${nextcloud.name}-${secret}";
|
||||
value = sopsPath secret;
|
||||
})
|
||||
sopsSecrets
|
||||
);
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/${nextcloud.name}" = {
|
||||
device = nextcloud.paths.path0;
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
depends = [server.storage0.mount];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"Z ${nextcloud.paths.path0} 750 ${nextcloud.name} ${nextcloud.name} -"
|
||||
"Z ${nextcloud.sops.path0} 750 ${nextcloud.name} ${nextcloud.name} -"
|
||||
];
|
||||
|
||||
users.users.${nextcloud.name}.extraGroups = ["caddy" "nginx" "postgres"];
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
nginx.ports.port0
|
||||
nextcloud.ports.port0
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue