mirror of
https://github.com/Nickiel12/nicks-nix-config.git
synced 2024-11-22 20:59:32 -08:00
Working nextcloud container setup
This commit is contained in:
parent
b62d1d9210
commit
39e25fd6c3
3 changed files with 81 additions and 30 deletions
|
@ -10,45 +10,88 @@
|
||||||
localAddress = "192.168.100.11";
|
localAddress = "192.168.100.11";
|
||||||
hostAddress6 = "fc00::1";
|
hostAddress6 = "fc00::1";
|
||||||
localAddress6 = "fc00::2";
|
localAddress6 = "fc00::2";
|
||||||
|
|
||||||
|
# allowed filepaths and container-internal mount points
|
||||||
bindMounts = {
|
bindMounts = {
|
||||||
"/nextcloud" = {
|
"/Aurora/nextcloud" = {
|
||||||
hostPath = "/Aurora/nextcloud";
|
hostPath = "/Aurora/nextcloud";
|
||||||
isReadOnly = false;
|
isReadOnly = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# If, when you nix-container root-login and systemctl status nextcloud-setup says the
|
||||||
|
# password files are unreadable, log in as root and `chown nextcloud:nextcloud` the password files
|
||||||
config = { config, pkgs, ... }: {
|
config = { config, pkgs, ... }: {
|
||||||
|
|
||||||
|
# A lot of this nextcloud configuration was pulled from this post:
|
||||||
|
# https://jacobneplokh.com/how-to-setup-nextcloud-on-nixos/
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.nextcloud25;
|
package = pkgs.nextcloud25;
|
||||||
|
enableBrokenCiphersForSSE = false;
|
||||||
|
|
||||||
|
#nginx.enable = true;
|
||||||
|
#https = true;
|
||||||
hostName = "192.168.100.10";
|
hostName = "192.168.100.10";
|
||||||
|
home = "/Aurora/nextcloud";
|
||||||
|
|
||||||
|
autoUpdateApps = {
|
||||||
|
enable = true;
|
||||||
|
startAt = "05:00:00";
|
||||||
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
#overwriteProtocal = "https";
|
||||||
extraTrustedDomains = [
|
extraTrustedDomains = [
|
||||||
"10.0.0.206"
|
"10.0.0.206"
|
||||||
];
|
];
|
||||||
#adminpassFile = "${pkgs.writeText "adminpass" (builtins.readFile ~/nextcloud-admin-password)}";
|
|
||||||
adminpassFile = "/nextcloud/nextcloud-admin-password";
|
dbtype = "pgsql";
|
||||||
|
dbuser = "nextcloud";
|
||||||
|
dbhost = "/run/postgresql";
|
||||||
|
dbname = "nextcloud";
|
||||||
|
dbpassFile = "/Aurora/nextcloud/nextcloud-db-password";
|
||||||
|
|
||||||
|
# This doesn't seem to be working, see this documation:
|
||||||
|
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/reset_admin_password.html
|
||||||
|
adminpassFile = "/Aurora/nextcloud/nextcloud-admin-password";
|
||||||
|
adminuser = "admin";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home = "/nextcloud";
|
services.postgresql = {
|
||||||
datadir = "/nextcloud";
|
enable = true;
|
||||||
|
ensureDatabases = [ "nextcloud" ];
|
||||||
enableBrokenCiphersForSSE = false;
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "nextcloud";
|
||||||
|
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
authentication = lib.mkForce ''
|
||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
local all all trust
|
||||||
|
host all all 127.0.0.1/32 trust
|
||||||
|
host all all ::1/128 trust
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Make sure PostSQL is running before nextcloud
|
||||||
|
systemd.services."nextcloud-setup" = {
|
||||||
|
requires = ["postgresql.service"];
|
||||||
|
after = ["postgresql.service"];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# Container nixos state configurations
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [ 80 ];
|
allowedTCPPorts = [ 80 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Manually configure nameserver. Using resolved inside the container seems to fail
|
# Manually configure nameserver. Using resolved inside the container seems to fail
|
||||||
# currently
|
# currently
|
||||||
environment.etc."resolv.conf".text = "nameserver 8.8.8.8";
|
environment.etc."resolv.conf".text = "nameserver 8.8.8.8";
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,23 +6,9 @@
|
||||||
imports = [
|
imports = [
|
||||||
(import ./hardware-configuration.nix)
|
(import ./hardware-configuration.nix)
|
||||||
(import ./containers/nextcloud.nix)
|
(import ./containers/nextcloud.nix)
|
||||||
|
(import ./modules/nginx.nix)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
security.acme = {
|
|
||||||
acceptTerms = true;
|
|
||||||
defaults.email = "nicholasyoungsumner@gmail.com";
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nginx = {
|
|
||||||
enable = false;
|
|
||||||
virtualHosts."10.0.0.206" = {
|
|
||||||
addSSL = true;
|
|
||||||
enableACME = true;
|
|
||||||
root = "/var/www/test.com";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.mdadm
|
pkgs.mdadm
|
||||||
];
|
];
|
||||||
|
@ -58,6 +44,7 @@
|
||||||
};
|
};
|
||||||
systemd.services.sshd.wantedBy = [ "multi-user.target" ];
|
systemd.services.sshd.wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
boot.initrd.services.swraid.mdadmConf = builtins.readFile ./rsrcs/mdadm.conf;
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
efi = {
|
efi = {
|
||||||
|
@ -66,12 +53,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.services.swraid.mdadmConf = builtins.readFile ./rsrcs/mdadm.conf;
|
|
||||||
|
|
||||||
programs.msmtp = {
|
programs.msmtp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.etc."mdadm.conf".text = ''
|
environment.etc."mdadm.conf".text = ''
|
||||||
MAILADDR nicholasyoungsumner@gmail.com
|
MAILADDR nicholasyoungsumner@gmail.com
|
||||||
'';
|
'';
|
||||||
|
|
23
hosts/Alaska/modules/nginx.nix
Normal file
23
hosts/Alaska/modules/nginx.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults.email = "nicholasyoungsumner@gmail.com";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = false;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
|
virtualHosts."10.0.0.206" = {
|
||||||
|
addSSL = true;
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue