Add Nginx and Hydra config

This commit is contained in:
Victor Mignot 2023-11-20 21:37:14 +01:00
parent c0510abf49
commit 4ef795afb1
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
5 changed files with 20 additions and 9 deletions

View file

@ -23,7 +23,7 @@
extra-config.url = "git+ssh://git@git.sr.ht/~dala/extra-config"; extra-config.url = "git+ssh://git@git.sr.ht/~dala/extra-config";
}; };
outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager, sops-nix, flake-utils }: outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager, sops-nix, flake-utils, extra-config }:
let let
machines = import ./machines.nix; machines = import ./machines.nix;
in in
@ -45,6 +45,8 @@
} // value; } // value;
sopsHmModule = sops-nix.homeManagerModules.sops; sopsHmModule = sops-nix.homeManagerModules.sops;
extraInfo = extra-config.extraSecrets;
}; };
modules = [ modules = [

View file

@ -2,5 +2,6 @@
imports = [ imports = [
./network.nix ./network.nix
./hydra.nix ./hydra.nix
./nginx.nix
]; ];
} }

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, extraInfo, ... }:
with lib; with lib;
{ {
options.server.builder.enableHydra = mkOption { options.server.builder.enableHydra = mkOption {
@ -16,7 +16,10 @@ with lib;
useSubstitutes = true; useSubstitutes = true;
}; };
services.nginx.virtualHosts.localhost = mkIf config.services.nginx.enable { services.nginx.virtualHosts.${extraInfo.hydraURI} = mkIf config.services.nginx.enable {
enableACME = true;
forceSSL = true;
locations."/" = { locations."/" = {
recommendedProxySettings = true; recommendedProxySettings = true;
proxyPass = config.services.hydra.hydraURL; proxyPass = config.services.hydra.hydraURL;

View file

@ -7,12 +7,6 @@ with lib;
example = false; example = false;
}; };
options.server.networking.enableNginx = mkOption {
type = types.bool;
default = true;
example = false;
};
config = { config = {
services.openssh = mkIf config.server.networking.enableSSH { services.openssh = mkIf config.server.networking.enableSSH {
enable = true; enable = true;

11
modules/server/nginx.nix Normal file
View file

@ -0,0 +1,11 @@
{
security.acme.acceptTerms = true;
security.acme.defaults.email = "dala@dalaran.fr";
services.nginx = {
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
}