feat(web/portefolio): adding the portefolio configuration to self host

This commit is contained in:
Raphael 2025-06-10 22:41:23 +02:00
parent def9e16c65
commit 54080cfa18
3 changed files with 71 additions and 0 deletions

21
services/web.nix Normal file
View file

@ -0,0 +1,21 @@
{ inputs, config, pkgs, lib, ... }:
let
portefolio = import ./web/portefolio.nix {
inherit inputs config pkgs lib;
};
cfg = config.service.web;
in
{
imports = [
portefolio
];
options.service.web = {
portefolio = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the portefolio";
};
};
}

View file

@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
let
cfg = config.service.web.portefolio;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
pnpm
];
users = {
groups.web_portefolio = {
name = "web_portefolio";
};
users.web_portefolio = {
description = "Utilisateur pour le bot BDE";
group = "web_portefolio";
home = "/opt/portefolio/";
isSystemUser = true;
};
};
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
virtualHosts."raphael.parodi.pro" = {
forceSSL = true;
enableACME = true;
locations."/" = {
root = "/opt/portefolio/dist";
index = "index.html";
extraConfig = ''
try_files $uri /index.html;
'';
};
};
};
security.acme = {
acceptTerms = true;
email = "raphael@parodi.pro";
certs = {
"raphael.parodi.pro" = {};
};
};
};
}