Compare commits

...

2 commits

Author SHA1 Message Date
1219865a7f
try generalizing? 2024-06-17 17:13:21 +02:00
c1a4c0b7bd
try to improve code 2024-06-17 16:47:54 +02:00
5 changed files with 104 additions and 61 deletions

View file

@ -5,10 +5,11 @@
./ddns.nix
./nginx.nix
./forgejo.nix
#./printing.nix
./restic.nix
./ssh.nix
./vaultwarden.nix
./nextcloud.nix
./domains.nix
];
services.domains.enable = true;
}

View file

@ -0,0 +1,64 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.domains;
in
{
domains = {
enable = mkOption {
default = false;
type = types.nullOr types.bool;
};
domain = mkOption {
description = ''
Domain of the server.
'';
type = types.nullOr types.str;
};
git = mkOption {
description = ''
Subdomain of the git instance.
'';
type = types.nullOr types.str;
default = "git";
};
vaultwarden = mkOption {
description = ''
Subdomain of the vaultwarden instance
'';
default = "vaultwarden";
type = types.nullOr types.str;
};
video = mkOption {
description = ''
Subdomain of the video instance
'';
default = "video";
type = types.nullOr types.str;
};
www = mkOption {
description = ''
Subdomain of the www instance
'';
default = "www";
type = types.nullOr types.str;
};
files = mkOption {
description = ''
Subdomain of the files instance
'';
default = "files";
type = types.nullOr types.str;
};
cloud = mkOption {
description = ''
Subdomain of the cloud instance
'';
default = "cloud";
type = types.nullOr types.str;
};
};
config = mkIf cfg.enable {
gitURL = "${cfg.git}.${cfg.domain}";
};
}

View file

@ -9,7 +9,6 @@
config.adminpassFile = "${../../nix-secrets/dafoe/nextcloud/adminpass}";
configureRedis = true;
maxUploadSize = "1G";
#nginx.enable = true;
settings.overwriteProtocol = "https";
};
}

View file

@ -1,4 +1,4 @@
{ lib, pkgs, inputs, ... }:
{ lib, pkgs, inputs, config, ... }:
{
services.nginx = {
enable = true;
@ -8,36 +8,36 @@
recommendedTlsSettings = true;
};
services.nginx.virtualHosts."git.vatthauer.xyz" = {
services.nginx.virtualHosts = let domain = "vatthauer.xyz"; in
{
"config.domains.gitURL" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:3001/";
};
};
services.nginx.virtualHosts."vaultwarden.vatthauer.xyz" = {
"vaultwarden.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:8222/";
};
};
services.nginx.virtualHosts."video.vatthauer.xyz" = {
"video.${domain}" = {
enableACME = true;
forceSSL = false;
locations."/" = {
proxyPass = "http://localhost:8096";
};
};
services.nginx.virtualHosts."www.vatthauer.xyz" = {
serverAliases = [ "vatthauer.xyz" ];
"www.${domain}" = {
serverAliases = [ domain ];
forceSSL = true;
enableACME = true;
root = pkgs.callPackage ./resumee-website.nix {};
};
services.nginx.virtualHosts."files.vatthauer.xyz" = {
"files.${domain}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@ -45,10 +45,9 @@
extraConfig = "autoindex on;";
};
};
services.nginx.virtualHosts."cloud.vatthauer.xyz" = {
"cloud.${domain}" = {
forceSSL = true;
enableACME = true;
#locations."/".proxyPass = "http://localhost:8080";
# nextcloud does location setup itself
};
};
}

View file

@ -1,20 +0,0 @@
{ pkgs, ... }:
{
# Enable CUPS to print documents.
services.avahi = {
enable = true;
publish.enable = true;
publish.userServices = true;
};
services.printing = {
enable = true;
drivers = [ pkgs.splix ];
browsing = true;
listenAddresses = [ "*:631" ];
allowFrom = [ "all" ];
defaultShared = true;
extraConf = ''
BrowseLocalProtocols all
'';
};
}