2022-09-23 21:57:20 +02:00
|
|
|
{ zentralwerk, config, lib, pkgs, ... }:
|
2022-09-05 22:17:11 +02:00
|
|
|
|
|
|
|
{
|
2022-11-25 23:05:32 +01:00
|
|
|
deployment = {
|
|
|
|
persistedShares = [ "/etc" "/home" "/var" ];
|
|
|
|
storage = "big";
|
|
|
|
mem = 2048;
|
2022-09-23 21:33:38 +02:00
|
|
|
};
|
2022-09-23 18:28:38 +02:00
|
|
|
|
2022-09-23 21:57:20 +02:00
|
|
|
nix.settings.auto-optimise-store = lib.mkForce false;
|
2022-09-23 18:28:38 +02:00
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
networking = {
|
2022-09-25 20:29:42 +02:00
|
|
|
hostName = "leoncloud";
|
2022-09-05 22:17:11 +02:00
|
|
|
firewall.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
security.sudo = {
|
|
|
|
enable = true;
|
|
|
|
wheelNeedsPassword = false;
|
|
|
|
};
|
2022-09-29 04:21:30 +02:00
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
c3d2.hq.statistics.enable = true;
|
2022-10-02 16:22:52 +02:00
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
# $ nix search wget
|
|
|
|
environment.systemPackages = with pkgs; [
|
2022-10-02 16:22:52 +02:00
|
|
|
wget
|
|
|
|
vim
|
|
|
|
python3Full
|
|
|
|
python310Packages.pip
|
|
|
|
nmap
|
|
|
|
htop
|
|
|
|
wireguard-tools
|
|
|
|
docker-compose
|
2022-09-05 22:17:11 +02:00
|
|
|
];
|
|
|
|
|
2022-09-26 01:34:52 +02:00
|
|
|
users.users.leon-docker = {
|
2022-09-05 22:17:11 +02:00
|
|
|
isNormalUser = true;
|
2022-09-24 03:00:42 +02:00
|
|
|
extraGroups = [ "wheel" "docker" ];
|
2022-09-05 22:17:11 +02:00
|
|
|
createHome = true;
|
2022-11-21 03:44:40 +01:00
|
|
|
openssh.authorizedKeys.keys = with import ../../users.nix;
|
|
|
|
leon.sshKeys;
|
2022-09-05 22:17:11 +02:00
|
|
|
};
|
|
|
|
|
2022-11-13 12:44:43 +01:00
|
|
|
|
|
|
|
# enable IP routing
|
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
networking.firewall = {
|
2022-09-26 01:34:52 +02:00
|
|
|
allowedTCPPorts = [ 80 443 22 53 14000 14500 15000 ];
|
2022-09-29 16:35:59 +02:00
|
|
|
allowedUDPPorts = [ 18900 53 ];
|
2022-09-05 22:17:11 +02:00
|
|
|
};
|
2022-10-02 16:22:52 +02:00
|
|
|
|
|
|
|
#>-----------------docker-------------------------
|
2022-09-19 21:13:38 +02:00
|
|
|
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
2022-10-02 16:22:52 +02:00
|
|
|
#<-----------------docker-------------------------
|
2022-09-05 22:17:11 +02:00
|
|
|
|
2022-10-02 16:22:52 +02:00
|
|
|
#>-----------------wireguard client---------------
|
2022-09-24 03:00:42 +02:00
|
|
|
|
|
|
|
# Enable WireGuard
|
|
|
|
networking.wireguard.interfaces = {
|
2022-09-25 21:11:03 +02:00
|
|
|
vpn = {
|
2022-09-24 03:00:42 +02:00
|
|
|
ips = [ "10.10.11.4/24" ];
|
|
|
|
privateKeyFile = "/etc/nixos/wireguard-keys/private-key";
|
|
|
|
peers = [
|
|
|
|
{
|
|
|
|
publicKey = "w3qegSSuqFTFrGk4XJaWBSwGDOiqbnnAIR9MzwjYVA8=";
|
2022-09-25 23:09:48 +02:00
|
|
|
allowedIPs = [ "10.10.11.0/24" ];
|
|
|
|
endpoint = "45.158.40.162:18900";
|
2022-09-24 03:00:42 +02:00
|
|
|
persistentKeepalive = 25;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2022-09-28 18:55:57 +02:00
|
|
|
|
2022-10-02 16:22:52 +02:00
|
|
|
#<-----------------wireguard client---------------
|
|
|
|
|
|
|
|
#>-----------------nextcloud----------------------
|
|
|
|
|
2022-09-28 18:55:57 +02:00
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
2022-09-29 04:21:30 +02:00
|
|
|
hostName = "cloud";
|
2022-09-28 18:55:57 +02:00
|
|
|
config = {
|
|
|
|
dbtype = "pgsql";
|
|
|
|
dbuser = "nextcloud";
|
|
|
|
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
|
|
|
dbname = "nextcloud";
|
|
|
|
adminpassFile = "/etc/nixos/next-cloud/pass";
|
|
|
|
adminuser = "root";
|
2022-11-17 16:07:56 +01:00
|
|
|
extraTrustedDomains = ["45.158.40.165" "172.20.79.254" "10.10.11.4" "10.10.11.1" ];
|
2022-10-02 16:22:52 +02:00
|
|
|
};
|
2022-09-28 18:55:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [ "nextcloud" ];
|
|
|
|
ensureUsers = [
|
2022-10-02 16:22:52 +02:00
|
|
|
{
|
|
|
|
name = "nextcloud";
|
|
|
|
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
|
|
|
}
|
2022-09-28 18:55:57 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# ensure that postgres is running *before* running the setup
|
|
|
|
systemd.services."nextcloud-setup" = {
|
|
|
|
requires = ["postgresql.service"];
|
|
|
|
after = ["postgresql.service"];
|
|
|
|
};
|
|
|
|
|
2022-10-02 16:22:52 +02:00
|
|
|
#<-----------------nextcloud----------------------
|
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
system.stateVersion = "22.05";
|
2022-10-02 16:22:52 +02:00
|
|
|
|
2022-09-05 22:17:11 +02:00
|
|
|
}
|