2022-12-04 08:53:28 +01:00
|
|
|
{ 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
|
2022-11-26 15:59:39 +01:00
|
|
|
python310Packages.flask
|
2022-10-02 16:22:52 +02:00
|
|
|
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-26 15:59:39 +01:00
|
|
|
openssh.authorizedKeys.keys = with import ../../users.nix;
|
|
|
|
leon.sshKeys;
|
2022-11-26 15:58:23 +01:00
|
|
|
};
|
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-12-07 18:41:07 +01:00
|
|
|
allowedTCPPorts = [ 80 443 8080 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 = [
|
|
|
|
{
|
2022-11-26 00:27:45 +01:00
|
|
|
publicKey = "iEVq4lvvKFfqjcoYYyNkA0MS8rcSGaDfPwQGN3C7+D0=";
|
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-12-07 18:41:07 +01:00
|
|
|
extraTrustedDomains = ["10.10.11.4" "10.10.11.1" "45.158.40.165" "bicospacetech.cloud.c3d2.de"];
|
|
|
|
};
|
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-11-26 15:53:02 +01:00
|
|
|
# services.nginx.virtualHosts."localhost".listen = [ { addr = "127.0.0.1"; port = 8080; } ];
|
2022-11-26 02:47:34 +01:00
|
|
|
|
|
|
|
|
2022-10-02 16:22:52 +02:00
|
|
|
#<-----------------nextcloud----------------------
|
2022-11-26 02:47:34 +01:00
|
|
|
#-----------------------------ngin-X--------------------------------
|
|
|
|
|
2022-11-26 02:48:17 +01:00
|
|
|
# services.nginx = {
|
|
|
|
# enable = true;
|
2022-11-26 02:47:34 +01:00
|
|
|
|
|
|
|
# virtualHosts."bicospacetech.c3d2.de" = {
|
|
|
|
# forceSSL = true;
|
|
|
|
# enableACME = true;
|
|
|
|
# locations."/" = {
|
|
|
|
# proxyPass = "http://45.158.40.162:12000";
|
|
|
|
# proxyWebsockets = true;
|
|
|
|
# };
|
|
|
|
|
|
|
|
#};
|
|
|
|
#-----------------------------ngin-X--------------------------------
|
2022-10-02 16:22:52 +02:00
|
|
|
|
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
|
|
|
}
|