Add nixin-web to the arachnide server

This commit is contained in:
Douze Bé 2024-12-20 10:45:32 +01:00
parent 8773346e88
commit 56a57675a1
5 changed files with 73 additions and 7 deletions

View file

@ -4,10 +4,12 @@
imports =
[
./hardware-configuration.nix
/var/src/modules/nixin.nix
/var/src/modules/nixin-base.nix
/var/src/modules/users.nix
/var/src/modules/wireguard-client.nix
/var/src/modules/reverse-proxy.nix
/var/src/modules/nginx.nix
/var/src/modules/nixin-web.nix
];
# Bootloader.

16
modules/nginx.nix Normal file
View file

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}:
{
services.nginx = {
enable = true;
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
};
}

53
modules/nixin-web.nix Normal file
View file

@ -0,0 +1,53 @@
{
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";
};
}

View file

@ -77,12 +77,7 @@ in
};
# Example proxy for a local service listening on port 8012
services.traefik.dynamicConfigOptions.http.services."example.lab12.fr" = {
loadBalancer.servers = [
{ url = "http://127.0.0.1:8012"; }
];
};
# You can find and example proxy for a non-docker service in the nixin-web.nix module
# Example docker service with traefik proxy enabled through labels
virtualisation.oci-containers.containers.whoami = {