mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
Migrate Nextcloud to hcloud
This commit is contained in:
parent
600844c56d
commit
39f20ed89d
10 changed files with 110 additions and 17 deletions
64
modules/nextcloud.nix
Normal file
64
modules/nextcloud.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
uidFile = pkgs.writeText "uidfile" ''
|
||||
nextcloud:33
|
||||
'';
|
||||
gidFile = pkgs.writeText "gidfile" ''
|
||||
nextcloud:33
|
||||
'';
|
||||
sshfsOptions = [
|
||||
"nofail"
|
||||
"identityfile=/var/keys/sshfs-ssh-key"
|
||||
"ServerAliveInterval=15"
|
||||
"idmap=file"
|
||||
"uidfile=${uidFile}"
|
||||
"gidfile=${gidFile}"
|
||||
"allow_other"
|
||||
"default_permissions"
|
||||
"nomap=ignore"
|
||||
];
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
sshfs
|
||||
];
|
||||
|
||||
fileSystems."/var/lib/nextcloud/data" =
|
||||
{
|
||||
device = " www-data@10.0.2.2:/var/lib/nextcloud/data";
|
||||
fsType = "fuse.sshfs";
|
||||
options = sshfsOptions;
|
||||
};
|
||||
|
||||
fileSystems."/run/mount/media" =
|
||||
{
|
||||
device = " www-data@10.0.2.2:/data";
|
||||
fsType = "fuse.sshfs";
|
||||
options = sshfsOptions;
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"${config.services.nextcloud.hostName}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud21;
|
||||
hostName = "cloud.${config.networking.domain}";
|
||||
config = {
|
||||
dbtype = "pgsql";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "10.0.1.11";
|
||||
dbname = "nextcloud";
|
||||
dbpassFile = "/var/keys/nextcloud-db-pass";
|
||||
adminpassFile = "/var/keys/nextcloud-admin-pass";
|
||||
adminuser = "root";
|
||||
};
|
||||
};
|
||||
users.users.nextcloud.extraGroups = [ "keys" ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue