2024-12-20 10:55:06 +00:00
|
|
|
# Nixin web site
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
2024-12-20 09:45:32 +00:00
|
|
|
let
|
2024-12-20 10:55:06 +00:00
|
|
|
inherit (lib) mkOption mkDefault;
|
|
|
|
|
2024-12-20 09:45:32 +00:00
|
|
|
nixin-web = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "nixin-web";
|
|
|
|
version = "0.1-alpha";
|
|
|
|
src = pkgs.fetchzip {
|
|
|
|
url = "https://git.distrilab.fr/NixiN/nixin-web/actions/runs/85/artifacts/nixin-website.zip";
|
|
|
|
hash = "sha256-+cgWvbmjV9xckRCeRaj1dWqowBRbe/5497FcoZW+5ec=";
|
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -a -T $src $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2024-12-20 10:55:06 +00:00
|
|
|
options = {
|
|
|
|
nixin.web = {
|
|
|
|
http-port = mkOption { type = lib.types.int; };
|
|
|
|
domain = mkOption { type = lib.types.str; };
|
|
|
|
};
|
2024-12-20 09:45:32 +00:00
|
|
|
};
|
|
|
|
|
2024-12-20 10:55:06 +00:00
|
|
|
config = {
|
|
|
|
services.nginx.virtualHosts."${config.nixin.web.domain}" = {
|
|
|
|
listen = [
|
|
|
|
{
|
|
|
|
addr = "127.0.0.1";
|
|
|
|
port = config.nixin.web.http-port;
|
|
|
|
ssl = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
addr = "[::1]";
|
|
|
|
port = config.nixin.web.http-port;
|
|
|
|
ssl = false;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
forceSSL = false;
|
|
|
|
enableACME = false;
|
|
|
|
locations."/".root = ''${nixin-web}'';
|
|
|
|
locations."/".index = "index.html";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.traefik.dynamicConfigOptions.http.services."service-nixin-web" = {
|
|
|
|
loadBalancer.servers = [
|
|
|
|
{ url = "http://localhost:${toString config.nixin.web.http-port}"; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
services.traefik.dynamicConfigOptions.http.routers."router-nixin-web" = {
|
|
|
|
rule = "Host(`${config.nixin.web.domain}`)";
|
|
|
|
service = "service-nixin-web";
|
|
|
|
};
|
2024-12-20 09:45:32 +00:00
|
|
|
};
|
|
|
|
}
|