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 = [
|
||||
../base.nix
|
||||
../services/acme-cert-store.nix
|
||||
../servers/acme-cert-store.nix
|
||||
];
|
||||
|
||||
#Many installs will need this, and it won't hurt either way
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
imports = [
|
||||
../base.nix
|
||||
../services/forgejo.nix
|
||||
../servers/forgejo.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
../base.nix
|
||||
../desktop.nix
|
||||
../users/vili.nix
|
||||
../services/gaming-server.nix
|
||||
../servers/gaming-server.nix
|
||||
../hardware-specific/nvidia.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
imports = [
|
||||
../base.nix
|
||||
../services/nextcloud.nix
|
||||
../servers/nextcloud.nix
|
||||
];
|
||||
|
||||
# Networking conf including WireGuard
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
imports = [
|
||||
../base.nix
|
||||
../services/nextcloud.nix
|
||||
../servers/nextcloud.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
imports = [
|
||||
../base.nix
|
||||
../services/siit-dc.nix
|
||||
../servers/siit-dc.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
imports = [
|
||||
../base.nix
|
||||
../users/vili.nix
|
||||
../services/syncthing.nix
|
||||
../servers/syncthing.nix
|
||||
];
|
||||
|
||||
users.users.vili.hashedPasswordFile = pkgs.lib.mkForce null;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
imports = [
|
||||
../base.nix
|
||||
../services/vaultwarden.nix
|
||||
../servers/vaultwarden.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
|
|
@ -13,5 +13,4 @@
|
|||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsctvJR4JOVoTAas0+lb8662EXFsQVNozTntnR7o5R1 opnsense"
|
||||
];
|
||||
|
||||
}
|
|
@ -1,14 +1,6 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "vili.m.sinerva@gmail.com";
|
||||
};
|
||||
imports = [ ./utils/acme-http-client.nix ];
|
||||
|
||||
services = {
|
||||
forgejo = {
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 443 ];
|
||||
|
||||
services = {
|
||||
nextcloud = {
|
||||
package = pkgs.nextcloud31;
|
||||
|
@ -46,19 +44,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
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";
|
||||
};
|
||||
};
|
||||
nginx.virtualHosts.${config.services.nextcloud.hostName} = { };
|
||||
};
|
||||
}
|
||||
(
|
||||
|
@ -89,10 +75,6 @@
|
|||
};
|
||||
|
||||
nginx.virtualHosts.${config.services.collabora-online.settings.server_name} = {
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
sslCertificate = "/mnt/acme/fullchain.pem";
|
||||
sslCertificateKey = "/mnt/acme/key.pem";
|
||||
locations."/" = {
|
||||
proxyPass = "http://[::1]:${toString config.services.collabora-online.port}";
|
||||
proxyWebsockets = true; # collabora uses websockets
|
|
@ -1,12 +1,5 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.users.users ? "vili";
|
||||
message = "User 'vili' needed for syncthing!";
|
||||
}
|
||||
];
|
||||
|
||||
boot.kernel.sysctl."fs.inotify.max_user_watches" = 204800;
|
||||
|
||||
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 ];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 443 ];
|
||||
networking.firewall.allowedUDPPorts = [ 443 ];
|
||||
|
||||
services = {
|
||||
vaultwarden = {
|
||||
enable = true;
|
||||
|
@ -31,17 +28,7 @@
|
|||
};
|
||||
|
||||
nginx = {
|
||||
enable = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
|
||||
virtualHosts."vaultwarden.vsinerva.fi" = {
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
sslCertificate = "/mnt/acme/fullchain.pem";
|
||||
sslCertificateKey = "/mnt/acme/key.pem";
|
||||
locations."/" = {
|
||||
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