Refactor server files
This commit is contained in:
parent
c3f87354a9
commit
0a78188848
21 changed files with 90 additions and 111 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/acme-cert-store.nix
|
../servers/acme-cert-store.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
#Many installs will need this, and it won't hurt either way
|
#Many installs will need this, and it won't hurt either way
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/forgejo.nix
|
../servers/forgejo.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# HARDWARE SPECIFIC
|
# HARDWARE SPECIFIC
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
../base.nix
|
../base.nix
|
||||||
../desktop.nix
|
../desktop.nix
|
||||||
../users/vili.nix
|
../users/vili.nix
|
||||||
../services/gaming-server.nix
|
../servers/gaming-server.nix
|
||||||
../hardware-specific/nvidia.nix
|
../hardware-specific/nvidia.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/nextcloud.nix
|
../servers/nextcloud.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Networking conf including WireGuard
|
# Networking conf including WireGuard
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/nextcloud.nix
|
../servers/nextcloud.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# HARDWARE SPECIFIC
|
# HARDWARE SPECIFIC
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/siit-dc.nix
|
../servers/siit-dc.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# HARDWARE SPECIFIC
|
# HARDWARE SPECIFIC
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../users/vili.nix
|
../users/vili.nix
|
||||||
../services/syncthing.nix
|
../servers/syncthing.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.vili.hashedPasswordFile = pkgs.lib.mkForce null;
|
users.users.vili.hashedPasswordFile = pkgs.lib.mkForce null;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../base.nix
|
../base.nix
|
||||||
../services/vaultwarden.nix
|
../servers/vaultwarden.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# HARDWARE SPECIFIC
|
# HARDWARE SPECIFIC
|
||||||
|
|
|
@ -13,5 +13,4 @@
|
||||||
users.users.root.openssh.authorizedKeys.keys = [
|
users.users.root.openssh.authorizedKeys.keys = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsctvJR4JOVoTAas0+lb8662EXFsQVNozTntnR7o5R1 opnsense"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsctvJR4JOVoTAas0+lb8662EXFsQVNozTntnR7o5R1 opnsense"
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,14 +1,6 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
networking.firewall.allowedTCPPorts = [
|
imports = [ ./utils/acme-http-client.nix ];
|
||||||
80
|
|
||||||
443
|
|
||||||
];
|
|
||||||
|
|
||||||
security.acme = {
|
|
||||||
acceptTerms = true;
|
|
||||||
defaults.email = "vili.m.sinerva@gmail.com";
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
forgejo = {
|
forgejo = {
|
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
networking.firewall.allowedTCPPorts = [ 443 ];
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
package = pkgs.nextcloud31;
|
package = pkgs.nextcloud31;
|
||||||
|
@ -46,19 +44,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx = {
|
nginx.virtualHosts.${config.services.nextcloud.hostName} = { };
|
||||||
recommendedGzipSettings = true;
|
|
||||||
recommendedOptimisation = true;
|
|
||||||
recommendedTlsSettings = true;
|
|
||||||
recommendedProxySettings = true;
|
|
||||||
|
|
||||||
virtualHosts.${config.services.nextcloud.hostName} = {
|
|
||||||
forceSSL = true;
|
|
||||||
kTLS = true;
|
|
||||||
sslCertificate = "/mnt/acme/fullchain.pem";
|
|
||||||
sslCertificateKey = "/mnt/acme/key.pem";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
|
@ -89,10 +75,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx.virtualHosts.${config.services.collabora-online.settings.server_name} = {
|
nginx.virtualHosts.${config.services.collabora-online.settings.server_name} = {
|
||||||
forceSSL = true;
|
|
||||||
kTLS = true;
|
|
||||||
sslCertificate = "/mnt/acme/fullchain.pem";
|
|
||||||
sslCertificateKey = "/mnt/acme/key.pem";
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://[::1]:${toString config.services.collabora-online.port}";
|
proxyPass = "http://[::1]:${toString config.services.collabora-online.port}";
|
||||||
proxyWebsockets = true; # collabora uses websockets
|
proxyWebsockets = true; # collabora uses websockets
|
|
@ -1,12 +1,5 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = config.users.users ? "vili";
|
|
||||||
message = "User 'vili' needed for syncthing!";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernel.sysctl."fs.inotify.max_user_watches" = 204800;
|
boot.kernel.sysctl."fs.inotify.max_user_watches" = 204800;
|
||||||
|
|
||||||
services.syncthing = {
|
services.syncthing = {
|
21
servers/utils/acme-http-client.nix
Normal file
21
servers/utils/acme-http-client.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
options.services.nginx.virtualHosts = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
config = lib.mkDefault {
|
||||||
|
enableACME = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
|
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults.email = "vili.m.sinerva@gmail.com";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
34
servers/utils/cert-store-client.nix
Normal file
34
servers/utils/cert-store-client.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
options.services.nginx.virtualHosts = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
config = lib.mkDefault {
|
||||||
|
sslCertificate = "/mnt/acme/fullchain.pem";
|
||||||
|
sslCertificateKey = "/mnt/acme/key.pem";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
services.openssh.knownHosts."cert-store.vsinerva.fi".publicKey =
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP4FaKqA2rQbxpdRBdGtb2lb5El/zbGnvmDfdYJdrxH7";
|
||||||
|
|
||||||
|
systemd.services.nginx = {
|
||||||
|
wants = [ "mnt-acme.mount" ];
|
||||||
|
after = [ "mnt-acme.mount" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/mnt/acme" = {
|
||||||
|
device = "cert-store@cert-store.vsinerva.fi:/home/cert-store/acme/-.vsinerva.fi";
|
||||||
|
fsType = "sshfs";
|
||||||
|
options = [
|
||||||
|
"nodev"
|
||||||
|
"noatime"
|
||||||
|
"allow_other"
|
||||||
|
"IdentityFile=/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
25
servers/utils/nginx-https-server.nix
Normal file
25
servers/utils/nginx-https-server.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
options.services.nginx.virtualHosts = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
config = lib.mkDefault {
|
||||||
|
forceSSL = true;
|
||||||
|
kTLS = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
networking.firewall.allowedTCPPorts = [ 443 ];
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,9 +2,6 @@
|
||||||
{
|
{
|
||||||
imports = [ ./cert-store-client.nix ];
|
imports = [ ./cert-store-client.nix ];
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 443 ];
|
|
||||||
networking.firewall.allowedUDPPorts = [ 443 ];
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
vaultwarden = {
|
vaultwarden = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -31,17 +28,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx = {
|
nginx = {
|
||||||
enable = true;
|
|
||||||
recommendedGzipSettings = true;
|
|
||||||
recommendedOptimisation = true;
|
|
||||||
recommendedTlsSettings = true;
|
|
||||||
recommendedProxySettings = true;
|
|
||||||
|
|
||||||
virtualHosts."vaultwarden.vsinerva.fi" = {
|
virtualHosts."vaultwarden.vsinerva.fi" = {
|
||||||
forceSSL = true;
|
|
||||||
kTLS = true;
|
|
||||||
sslCertificate = "/mnt/acme/fullchain.pem";
|
|
||||||
sslCertificateKey = "/mnt/acme/key.pem";
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:8000";
|
proxyPass = "http://localhost:8000";
|
||||||
};
|
};
|
|
@ -1,21 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
services.openssh.knownHosts."cert-store.vsinerva.fi".publicKey =
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP4FaKqA2rQbxpdRBdGtb2lb5El/zbGnvmDfdYJdrxH7";
|
|
||||||
|
|
||||||
systemd.services.nginx = {
|
|
||||||
wants = [ "mnt-acme.mount" ];
|
|
||||||
after = [ "mnt-acme.mount" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/mnt/acme" = {
|
|
||||||
device = "cert-store@cert-store.vsinerva.fi:/home/cert-store/acme/-.vsinerva.fi";
|
|
||||||
fsType = "sshfs";
|
|
||||||
options = [
|
|
||||||
"nodev"
|
|
||||||
"noatime"
|
|
||||||
"allow_other"
|
|
||||||
"IdentityFile=/etc/ssh/ssh_host_ed25519_key"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
moonlight-qt
|
|
||||||
parsec-bin
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = config.services.xserver.enable;
|
|
||||||
message = "Redshift does not work without a desktop!";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
services.redshift = {
|
|
||||||
executable = "/bin/redshift-gtk";
|
|
||||||
enable = true;
|
|
||||||
temperature = {
|
|
||||||
night = 2800;
|
|
||||||
day = 6500;
|
|
||||||
};
|
|
||||||
brightness = {
|
|
||||||
night = "0.5";
|
|
||||||
day = "1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
location = {
|
|
||||||
latitude = 60.17;
|
|
||||||
longitude = 24.94;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue