Compare commits
7 commits
ce4201eb4e
...
441cd5eff9
| Author | SHA1 | Date | |
|---|---|---|---|
| 441cd5eff9 | |||
| 845c3373ba | |||
| fd5f22ae65 | |||
| e3c3d5ee8b | |||
| 36d368063a | |||
| 330958fba4 | |||
| 2f0b5cf661 |
13 changed files with 131 additions and 69 deletions
44
config/globals.nix
Normal file
44
config/globals.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
domain = "porzh.me";
|
||||||
|
admin = {
|
||||||
|
email = "dun0z@porzh.me";
|
||||||
|
name = "DuN0z";
|
||||||
|
};
|
||||||
|
|
||||||
|
smtp = {
|
||||||
|
host = "smtp.protonmail.ch";
|
||||||
|
port = 587 ;
|
||||||
|
user = "contact@porzh.me";
|
||||||
|
};
|
||||||
|
|
||||||
|
network = {
|
||||||
|
gateway = "192.168.50.1";
|
||||||
|
pennsardin = {
|
||||||
|
ip = "192.168.50.12";
|
||||||
|
};
|
||||||
|
terre-neuvas = {
|
||||||
|
ip = "192.168.50.11";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
forgejo = {
|
||||||
|
home = "/var/lib/services/forgejo";
|
||||||
|
url = "govel.porzh.me";
|
||||||
|
port = 3000;
|
||||||
|
};
|
||||||
|
goaccess = {
|
||||||
|
home = "/var/lib/www/goaccess";
|
||||||
|
url = "koum.porzh.me";
|
||||||
|
};
|
||||||
|
levr = {
|
||||||
|
home = "/var/lib/services/levr";
|
||||||
|
build = "/var/lib/www/levr";
|
||||||
|
url = "levr.porzh.me";
|
||||||
|
};
|
||||||
|
outline = {
|
||||||
|
url = "notes.porzh.me";
|
||||||
|
port = 3001;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
_: {
|
_:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix;
|
||||||
|
in {
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "DuN0z";
|
userName = globals.admin.name;
|
||||||
userEmail = "dun0z@porzh.me";
|
userEmail = globals.admin.email;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# vim: set ts=2 sw=2 sts=2 et :
|
# vim: set ts=2 sw=2 sts=2 et :
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
../desktop/bspwm.nix
|
../desktop/bspwm.nix
|
||||||
./lomig.nix
|
./lomig.nix
|
||||||
];
|
];
|
||||||
home.stateVersion = "25.05"; # ou ton actuelle
|
|
||||||
home = {
|
home = {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
fastfetch
|
fastfetch
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix;
|
||||||
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
../../profiles/workstation-bspwm.nix
|
../../profiles/workstation-bspwm.nix
|
||||||
../../modules/hardware/bepovim.nix
|
../../modules/hardware/bepovim.nix
|
||||||
|
|
@ -37,7 +40,7 @@
|
||||||
|
|
||||||
users.users.lomig = {
|
users.users.lomig = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = ["networkmanager" "lp" "wheel"];
|
extraGroups = [ "lp" "wheel"];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -49,21 +52,26 @@
|
||||||
networking = {
|
networking = {
|
||||||
useNetworkd = true;
|
useNetworkd = true;
|
||||||
firewall.allowedTCPPorts = [22 80 5900 5901 5902];
|
firewall.allowedTCPPorts = [22 80 5900 5901 5902];
|
||||||
interfaces.enp11s0.useDHCP = false;
|
interfaces = {
|
||||||
interfaces.br0 = {
|
enp11s0 = {
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
ipv4.addresses = [
|
wakeOnLan.enable = true ;
|
||||||
{
|
br0 = {
|
||||||
address = "192.168.50.12";
|
useDHCP = false;
|
||||||
prefixLength = 24;
|
ipv4.addresses = [
|
||||||
}
|
{
|
||||||
];
|
address = globals.network.pennsardin.ip;
|
||||||
|
prefixLength = 24;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultGateway = {
|
defaultGateway = {
|
||||||
interface = "br0";
|
interface = "br0";
|
||||||
address = "192.168.50.1";
|
address = globals.network.gateway;
|
||||||
};
|
};
|
||||||
nameservers = ["192.168.50.1" "1.1.1.1"];
|
nameservers = [ globals.network.gateway "1.1.1.1"];
|
||||||
bridges.br0.interfaces = ["enp11s0"];
|
bridges.br0.interfaces = ["enp11s0"];
|
||||||
};
|
};
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
globals = import ../../config/globals.nix ;
|
||||||
|
in {
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
|
|
@ -55,16 +57,16 @@
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = "192.168.0.3";
|
address = globals.network.terre-neuvas.ip;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
defaultGateway = {
|
defaultGateway = {
|
||||||
interface = "br0";
|
interface = "br0";
|
||||||
address = "192.168.0.254";
|
address = globals.network.gateway;
|
||||||
};
|
};
|
||||||
nameservers = ["192.168.0.254" "1.1.1.1"];
|
nameservers = [ globals.network.gateway "1.1.1.1"];
|
||||||
bridges.br0.interfaces = ["eno1"];
|
bridges.br0.interfaces = ["eno1"];
|
||||||
};
|
};
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
_: {
|
_: {
|
||||||
networking = {
|
networking = {
|
||||||
nameservers = ["1.1.1.1" "8.8.8.8"];
|
nameservers = ["1.1.1.1" "8.8.8.8"];
|
||||||
# dhcpcd.extraConfig = "nohook resolv.conf";
|
|
||||||
firewall.enable = true;
|
firewall.enable = true;
|
||||||
interfaces.enp11s0.wakeOnLan.enable = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix;
|
||||||
|
in {
|
||||||
programs.msmtp = {
|
programs.msmtp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
accounts.default = {
|
accounts.default = {
|
||||||
host = "smtp.protonmail.ch";
|
host = globals.smtp.host;
|
||||||
port = 587;
|
port = globals.smtp.port;
|
||||||
auth = true;
|
auth = true;
|
||||||
tls = true;
|
tls = true;
|
||||||
tls_starttls = true;
|
tls_starttls = true;
|
||||||
user = "contact@porzh.me";
|
user = globals.smtp.user;
|
||||||
passwordeval = "cat /run/secrets/proton_pass";
|
passwordeval = "cat /run/secrets/proton_pass";
|
||||||
from = "contact@porzh.me";
|
from = globals.smtp.user;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -23,4 +26,4 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.pathsToLink = [ "/etc/alternatives" "/usr/sbin" ];
|
environment.pathsToLink = [ "/etc/alternatives" "/usr/sbin" ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,10 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../common/nix.nix
|
../common/nix.nix
|
||||||
|
|
||||||
# Matériel
|
|
||||||
../hardware/gpu-amd.nix
|
../hardware/gpu-amd.nix
|
||||||
../hardware/sensors-zenpower.nix
|
../hardware/sensors-zenpower.nix
|
||||||
|
|
||||||
# Virtualisation/tuning
|
|
||||||
../virtual/kvm-amd.nix
|
../virtual/kvm-amd.nix
|
||||||
../virtual/vfio.nix
|
../virtual/vfio.nix
|
||||||
|
|
||||||
# Dev
|
|
||||||
# ../dev/qemu.nix
|
|
||||||
# ../virtual/truenas.nix # seulement si tu l’utilises sur ce host
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix;
|
||||||
|
in {
|
||||||
# --- Utilisateur dédié ---
|
# --- Utilisateur dédié ---
|
||||||
users.users.git = {
|
users.users.git = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
|
|
@ -20,10 +23,10 @@
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
server = {
|
server = {
|
||||||
DOMAIN = "govel.porzh.me";
|
DOMAIN = globals.services.forgejo.url ;
|
||||||
ROOT_URL = "https://govel.porzh.me/";
|
ROOT_URL = "https://${globals.services.forgejo.url}/";
|
||||||
SSH_DOMAIN = "govel.porzh.me";
|
SSH_DOMAIN = globals.services.forgejo.url;
|
||||||
HTTP_PORT = 3000;
|
HTTP_PORT = globals.services.forgejo.port;
|
||||||
SSH_PORT = 22;
|
SSH_PORT = 22;
|
||||||
START_SSH_SERVER = false;
|
START_SSH_SERVER = false;
|
||||||
};
|
};
|
||||||
|
|
@ -32,16 +35,16 @@
|
||||||
REGISTER_EMAIL_CONFIRM = false;
|
REGISTER_EMAIL_CONFIRM = false;
|
||||||
};
|
};
|
||||||
repository = {
|
repository = {
|
||||||
DEFAULT_BRANCH = "main";
|
DEFAULT_BRANCH = "master";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
caddy = {
|
caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."govel.porzh.me" = {
|
virtualHosts.${globals.services.forgejo.url} = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
reverse_proxy localhost:3000
|
reverse_proxy localhost:${toString globals.services.forgejo.port}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{pkgs, ...}: {
|
{pkgs, ...}:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix ;
|
||||||
|
in {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
goaccess
|
goaccess
|
||||||
];
|
];
|
||||||
|
|
@ -7,7 +10,7 @@
|
||||||
systemd.services.goaccess-report = {
|
systemd.services.goaccess-report = {
|
||||||
description = "Generate GoAccess HTML report";
|
description = "Generate GoAccess HTML report";
|
||||||
serviceConfig = {
|
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 = {
|
services.caddy = {
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"koum.porzh.me" = {
|
"${globals.services.goaccess.url}" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
root * /var/www/goaccess
|
root * ${globals.services.goaccess.home}
|
||||||
file_server browse
|
file_server browse
|
||||||
try_files {path} {path}/ /index.html
|
try_files {path} {path}/ /index.html
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,29 @@
|
||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix ;
|
||||||
|
in {
|
||||||
services = {
|
services = {
|
||||||
outline = {
|
outline = {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = 3002 ;
|
port = globals.services.outline.port ;
|
||||||
publicUrl = "http://notes.porzh.me";
|
publicUrl = "http://${globals.services.outline.url}";
|
||||||
forceHttps = true;
|
forceHttps = true;
|
||||||
smtp = {
|
smtp = {
|
||||||
host = "smtp.protonmail.ch";
|
host = globals.smtp.host ;
|
||||||
username = "contact@porzh.me";
|
username = globals.smtp.user ;
|
||||||
passwordFile = "/run/secrets/proton_pass";
|
passwordFile = "/etc/secrets/protonpass";
|
||||||
fromEmail = "contact@porzh.me";
|
fromEmail = globals.smtp.user;
|
||||||
replyEmail = "contact@porzh.me";
|
replyEmail = globals.smtp.user;
|
||||||
port = 587 ;
|
port = globals.smtp.port;
|
||||||
secure = false;
|
secure = false;
|
||||||
};
|
};
|
||||||
storage.storageType = "local";
|
storage.storageType = "local";
|
||||||
};
|
};
|
||||||
caddy = {
|
caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."notes.porzh.me" = {
|
virtualHosts.${globals.services.outline.url} = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
reverse_proxy localhost:3002
|
reverse_proxy localhost:${toString globals.services.outline.port}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{ pkgs, lib, ...}: {
|
{ pkgs, lib, ...}:
|
||||||
|
let
|
||||||
|
globals = import ../../config/globals.nix ;
|
||||||
|
in {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
hugo
|
hugo
|
||||||
];
|
];
|
||||||
|
|
@ -6,8 +9,8 @@
|
||||||
description = "Auto build du blog hugo";
|
description = "Auto build du blog hugo";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
WorkingDirectory = "/srv/blog" ;
|
WorkingDirectory = globals.services.levr.home ;
|
||||||
ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d /srv/blog/public'';
|
ExecStart = ''${pkgs.hugo}/bin/hugo --minify build -d ${globals.services.levr.build}'';
|
||||||
User = "lomig";
|
User = "lomig";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -23,7 +26,7 @@
|
||||||
description = "Synchronisation du dépôt Hugo";
|
description = "Synchronisation du dépôt Hugo";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
WorkingDirectory = "/srv/blog";
|
WorkingDirectory = globals.services.levr.home;
|
||||||
ExecStart = "${pkgs.git}/bin/git pull origin master";
|
ExecStart = "${pkgs.git}/bin/git pull origin master";
|
||||||
User = "lomig";
|
User = "lomig";
|
||||||
};
|
};
|
||||||
|
|
@ -41,17 +44,17 @@
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"levr.porzh.me" = {
|
"${globals.services.levr.url}" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
@http {
|
@http {
|
||||||
protocol http
|
protocol http
|
||||||
}
|
}
|
||||||
redir @http https://{host}{uri} permanent
|
redir @http https://{host}{uri} permanent
|
||||||
root * /srv/blog/public
|
root * ${globals.services.levr.build}
|
||||||
file_server
|
file_server
|
||||||
|
|
||||||
log {
|
log {
|
||||||
output file /var/log/caddy/access-levr.porzh.me.log
|
output file /var/log/caddy/access-${globals.services.levr.url}.log
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{pkgs, ...}: let
|
{pkgs, ...}: let
|
||||||
|
globals = import ../../config/globals.nix ;
|
||||||
porzhSite = pkgs.stdenv.mkDerivation {
|
porzhSite = pkgs.stdenv.mkDerivation {
|
||||||
pname = "porzh-site";
|
pname = "porzh-site";
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
|
|
@ -13,8 +14,8 @@ in {
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"porzh.me" = {
|
"${globals.domain}" = {
|
||||||
serverAliases = ["www.porzh.me"];
|
serverAliases = [ "www.${globals.domain}" ];
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
root * ${porzhSite}
|
root * ${porzhSite}
|
||||||
file_server
|
file_server
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue