REFACTOR: Add config vars file

This commit is contained in:
DuN0z 2025-10-09 15:34:37 +02:00
parent 2f0b5cf661
commit 330958fba4
10 changed files with 66 additions and 56 deletions

View file

@ -1,8 +1,6 @@
_: {
networking = {
nameservers = ["1.1.1.1" "8.8.8.8"];
# dhcpcd.extraConfig = "nohook resolv.conf";
firewall.enable = true;
interfaces.enp11s0.wakeOnLan.enable = true;
};
}

View file

@ -1,18 +1,10 @@
{pkgs, ...}: {
imports = [
../common/nix.nix
# Matériel
../hardware/gpu-amd.nix
../hardware/sensors-zenpower.nix
# Virtualisation/tuning
../virtual/kvm-amd.nix
../virtual/vfio.nix
# Dev
# ../dev/qemu.nix
# ../virtual/truenas.nix # seulement si tu lutilises sur ce host
];
environment.systemPackages = with pkgs; [

View file

@ -1,4 +1,7 @@
{pkgs, ...}: {
{pkgs, ...}:
let
import ../../config/globals.nix;
in {
# --- Utilisateur dédié ---
users.users.git = {
isSystemUser = true;
@ -20,10 +23,10 @@
};
settings = {
server = {
DOMAIN = "govel.porzh.me";
ROOT_URL = "https://govel.porzh.me/";
SSH_DOMAIN = "govel.porzh.me";
HTTP_PORT = 3000;
DOMAIN = globals.services.forgejo.url ;
ROOT_URL = "https://${globals.services.forgejo.url}/";
SSH_DOMAIN = globals.services.forgejo.url;
HTTP_PORT = globals.services.forgejo.port;
SSH_PORT = 22;
START_SSH_SERVER = false;
};
@ -32,16 +35,16 @@
REGISTER_EMAIL_CONFIRM = false;
};
repository = {
DEFAULT_BRANCH = "main";
DEFAULT_BRANCH = "master";
};
};
};
openssh.enable = true;
caddy = {
enable = true;
virtualHosts."govel.porzh.me" = {
virtualHosts.${globals.services.forgejo.url} = {
extraConfig = ''
reverse_proxy localhost:3000
reverse_proxy localhost:${globals.services.forgejo.port}
'';
};
};

View file

@ -1,4 +1,7 @@
{pkgs, ...}: {
{pkgs, ...}:
let
imports = ../../config/globals.nix ;
in {
environment.systemPackages = with pkgs; [
goaccess
];
@ -7,7 +10,7 @@
systemd.services.goaccess-report = {
description = "Generate GoAccess HTML report";
serviceConfig = {
ExecStart = "${pkgs.goaccess}/bin/goaccess /var/log/caddy/access-levr.porzh.me.log --log-format=CADDY -o /var/www/goaccess/index.html";
ExecStart = "${pkgs.goaccess}/bin/goaccess /var/log/caddy/access-${globals.services.levr.url}.log --log-format=CADDY -o ${globals.services.goaccess.home}/index.html";
};
};
@ -22,9 +25,9 @@
};
services.caddy = {
virtualHosts = {
"koum.porzh.me" = {
globals.services.goaccess.url = {
extraConfig = ''
root * /var/www/goaccess
root * ${globals.services.goaccess.home}
file_server browse
try_files {path} {path}/ /index.html

View file

@ -1,26 +1,29 @@
{ config, pkgs, lib, ... }: {
{ config, pkgs, lib, ... }:
let
import ../../config/globals.nix ;
in {
services = {
outline = {
enable = true;
port = 3002 ;
publicUrl = "http://notes.porzh.me";
port = globals.services.outline.port ;
publicUrl = "http://${globals.services.outline.url}";
forceHttps = true;
smtp = {
host = "smtp.protonmail.ch";
username = "contact@porzh.me";
host = globals.smtp.host ;
username = globals.smtp.user ;
passwordFile = "/run/secrets/proton_pass";
fromEmail = "contact@porzh.me";
replyEmail = "contact@porzh.me";
port = 587 ;
fromEmail = globals.smtp.user;
replyEmail = globals.smtp.user;
port = globals.smtp.port;
secure = false;
};
storage.storageType = "local";
};
caddy = {
enable = true;
virtualHosts."notes.porzh.me" = {
virtualHosts.${globals.services.outline.url} = {
extraConfig = ''
reverse_proxy localhost:3002
reverse_proxy localhost:${globals.services.outline.port}
'';
};
};

View file

@ -1,4 +1,7 @@
{ pkgs, lib, ...}: {
{ pkgs, lib, ...}:
let
import = ../../config/globals.nix ;
in {
environment.systemPackages = with pkgs; [
hugo
];
@ -6,8 +9,8 @@
description = "Auto build du blog hugo";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog" ;
ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d /srv/blog/public'';
WorkingDirectory = globals.services.levr.home ;
ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d ${globals.services.levr.build}'';
User = "lomig";
};
};
@ -23,7 +26,7 @@
description = "Synchronisation du dépôt Hugo";
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/srv/blog";
WorkingDirectory = globals.services.levr.home;
ExecStart = "${pkgs.git}/bin/git pull origin master";
User = "lomig";
};
@ -41,17 +44,17 @@
services.caddy = {
enable = true;
virtualHosts = {
"levr.porzh.me" = {
globals.services.levr.url = {
extraConfig = ''
@http {
protocol http
}
redir @http https://{host}{uri} permanent
root * /srv/blog/public
root * ${globals.services.levr.build}
file_server
log {
output file /var/log/caddy/access-levr.porzh.me.log
output file /var/log/caddy/access-${global.services.levr.url}.log
}
'';
};

View file

@ -1,4 +1,5 @@
{pkgs, ...}: let
import ../../config/globals.nix ;
porzhSite = pkgs.stdenv.mkDerivation {
pname = "porzh-site";
version = "1.0";
@ -13,8 +14,8 @@ in {
services.caddy = {
enable = true;
virtualHosts = {
"porzh.me" = {
serverAliases = ["www.porzh.me"];
globals.domain = {
serverAliases = [ "www.${globals.domain}" ];
extraConfig = ''
root * ${porzhSite}
file_server