nixin-krops/modules/nixin-web.nix

53 lines
1.2 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
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
{
services.nginx.virtualHosts."nixin.lab12.fr" = {
listen = [
{
addr = "127.0.0.1";
port = 8081;
ssl = false;
}
{
addr = "[::1]";
port = 8081;
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:8081"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nixin-web" = {
rule = "Host(`nixin.lab12.fr`)";
service = "service-nixin-web";
};
}