wireguard/home: Add basic overview page
It is very basic and not pretty, but it is a base that can be extended.
This commit is contained in:
parent
ea232b1f58
commit
642d97cb52
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{ lib, config, machines, pkgs, ... }:
|
||||
let
|
||||
serverHostName = "vueko";
|
||||
peers = {
|
||||
|
@ -113,8 +113,46 @@ in
|
|||
$TTL 3600
|
||||
@ IN SOA ${serverHostName}.sbruder.de. hostmaster.sbruder.de. ${toString serial} 28800 3600 604800 3600
|
||||
@ IN NS ${serverHostName}.sbruder.de.
|
||||
@ IN A ${peers.${serverHostName}.address}
|
||||
'' + peerRecords);
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = lib.mkIf enableServer {
|
||||
virtualHosts."vpn.sbruder.de" = {
|
||||
root =
|
||||
let
|
||||
templateData = {
|
||||
machines = lib.mapAttrs
|
||||
(machine: { config, ... }: {
|
||||
syncthing = if config.services.syncthing.enable then 8384 else null;
|
||||
})
|
||||
machines;
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "vpn-home";
|
||||
|
||||
src = ./home;
|
||||
|
||||
nativeBuildInputs = with pkgs; [ j2cli ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
j2 -f json -o index.html index.html.j2 - << EOF
|
||||
${builtins.toJSON templateData}
|
||||
EOF
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -D index.html $out/index.html
|
||||
install -D style.css $out/style.css
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
22
modules/wireguard/home/index.html.j2
Normal file
22
modules/wireguard/home/index.html.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>VPN</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>VPN</h1>
|
||||
<h2>Machines</h2>
|
||||
{%- for machine, config in machines.items() %}
|
||||
{%- set base_url = "http://" ~ machine ~ ".vpn.sbruder.de" %}
|
||||
<h3>{{ machine }}</h3>
|
||||
<ul>
|
||||
{% if config.syncthing is not none %}<li><a href="{{ base_url }}:{{ config.syncthing }}/">Syncthing</a></li>{% endif %}
|
||||
</ul>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
modules/wireguard/home/style.css
Normal file
10
modules/wireguard/home/style.css
Normal file
|
@ -0,0 +1,10 @@
|
|||
body {
|
||||
font-family: "PT Sans", "Helvetica", "Helvetica Neue", "Roboto", "Arimo", "Arial", sans-serif;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
Loading…
Reference in a new issue