1
0
Fork 0

Add fluffy vpn

This commit is contained in:
Malte Brandy 2021-12-16 23:02:31 +01:00
parent 78c4b35218
commit 6baca7e408
7 changed files with 100 additions and 84 deletions

View file

@ -80,6 +80,13 @@ with lib;
in
rec {
hera = "${p}::1";
vpn = rec {
prefix = "fdc0:7";
hera = "${prefix}::1";
fluffy = "${prefix}::2";
apollo = "${prefix}::5";
zeus = "${prefix}::4";
};
hera-wg-host = "${p}::100:0:1";
hera-v4 = "213.136.94.190";

View file

@ -4,5 +4,6 @@
hera = "npDW4BUiXcxPXQ/MObP6PlK8/PcMlz/Bwo5FlCCUx3E=";
apollo = "hYziEwk74g7v7GpIafLvC95dje2BI4saoEtJXXu2txs=";
zeus = "GmMgJForLglBmXhvLD/sUoZMy2xwavHietmBOLTSvkI=";
fluffy = "uA9hJWDjAQENPtPPb/osNyfchy++k8TrohxXnrp9nSs=";
};
}

View file

@ -98,24 +98,21 @@ in
ipv6.addresses = [{ address = localAddress; prefixLength = 64; }];
useDHCP = true;
};
#wireguard.interfaces = {
# m0wire = {
# allowedIPsAsRoutes = false;
# ips = [ "${hosts.zeus-wg}/112" ];
# privateKeyFile = "/disk/persist/wireguard-private-key";
# peers = [
# {
# publicKey = wireguard.pub.hera;
# allowedIPs = [ "::/0" ];
# endpoint = "[${hosts.hera-wg-host}]:${builtins.toString wireguard.port}";
# presharedKeyFile = pkgs.privatePath "wireguard/psk";
# persistentKeepalive = 25;
# }
# ];
# postSetup =
# [ "${pkgs.iproute}/bin/ip route add ${prefix}::/96 dev m0wire" ];
# };
#};
wireguard.interfaces = {
m0wire = {
ips = [ "${hosts.vpn.fluffy}/64" ];
privateKeyFile = "/disk/persist/wireguard-private-key";
peers = [
{
publicKey = wireguard.pub.hera;
allowedIPs = [ "${hosts.vpn.prefix}::/64" ];
endpoint = "[${hosts.hera-wg-host}]:${builtins.toString wireguard.port}";
presharedKeyFile = pkgs.privatePath "wireguard/psk";
persistentKeepalive = 25;
}
];
};
};
};
programs = {

View file

@ -61,19 +61,26 @@ in
firewall.allowedUDPPorts = [ wireguard.port ];
wireguard.interfaces = {
m0wire = {
ips = [ "${hosts.hera-wg}/112" ];
ips = [ "${hosts.hera-wg}/112" "${hosts.vpn.hera}/64" ];
privateKeyFile = pkgs.privatePath "wireguard/hera-private";
listenPort = wireguard.port;
peers = [{
publicKey = wireguard.pub.zeus;
allowedIPs = [ "${hosts.zeus-wg}/128" ];
presharedKeyFile = pkgs.privatePath "wireguard/psk";
}
peers = [
{
publicKey = wireguard.pub.zeus;
allowedIPs = [ "${hosts.zeus-wg}/128" "${hosts.vpn.zeus}/128" ];
presharedKeyFile = pkgs.privatePath "wireguard/psk";
}
{
publicKey = wireguard.pub.apollo;
allowedIPs = [ "${hosts.apollo-wg}/128" ];
allowedIPs = [ "${hosts.apollo-wg}/128" "${hosts.vpn.apollo}/128" ];
presharedKeyFile = pkgs.privatePath "wireguard/psk";
}];
}
{
publicKey = wireguard.pub.fluffy;
allowedIPs = [ "${hosts.vpn.fluffy}/128" ];
presharedKeyFile = pkgs.privatePath "wireguard/psk";
}
];
};
};
};

View file

@ -15,7 +15,7 @@
useDHCP = false;
hosts = lib.zipAttrs
(
lib.mapAttrsToList (host: ip: { "${ip}" = "${host} ${host}.m-0.eu"; })
lib.mapAttrsToList (host: ip: if builtins.typeOf ip == "set" then { } else { "${ip}" = "${host} ${host}.m-0.eu"; })
config.m-0.hosts
);
};

View file

@ -264,6 +264,11 @@ in
mobile_app = { };
recorder = { };
ssdp = { };
template = [
{ sensor = [{ state = "{% if is_state('switch.luftentfeuchter', 'on') %}1{% else %}0{% endif %}"; name = "Luftentfeuchter"; }]; }
{ sensor = [{ state = "{% if is_state('binary_sensor.schlafzimmerfenster', 'on') %}1{% else %}0{% endif %}"; name = "Schlafzimmerfenster"; }]; }
{ sensor = [{ state = "{% if is_state('climate.schlafzimmer', 'heat') %}1{% else %}0{% endif %}"; name = "Schlafzimmerheizung"; }]; }
];
input_number = {
target_temperature_schlafzimmer = {
name = "Zieltemperatur Schlafzimmer";
@ -465,69 +470,68 @@ in
inherit badges;
cards = [
{
type = "entities";
title = "Schlafzimmer";
icon = "mdi:bed-king";
show_header_toggle = false;
entities = [
type = "vertical-stack";
cards = [
{
type = "custom:multiple-entity-row";
entity = "sensor.schlafzimmer_temperature";
name = "Temperatur";
unit = false;
entities = [{ entity = "climate.schlafzimmer"; name = "Heizung"; }
{ entity = "climate.schlafzimmer"; attribute = "temperature"; name = "Zieltemp. an Heizung"; }
{ entity = "climate.schlafzimmer"; attribute = "current_temperature"; name = "Temp. an Heizung"; unit = false; }
{ entity = "input_number.target_temperature_schlafzimmer"; name = "Zieltemp."; unit = false; }];
}
{
type = "custom:multiple-entity-row";
entity = "switch.luftentfeuchter";
toggle = true;
state_color = true;
entities = [{ entity = "sensor.schlafzimmer_humidity"; name = "Luftfeuchtigkeit"; }];
}
{
type = "custom:multiple-entity-row";
entity = "group.schlafzimmer_lights";
toggle = true;
state_color = true;
name = "Lichter";
type = "custom:mini-graph-card";
entities = [
# { entity = "switch.lichterkette_schlafzimmer"; state_color = true; toggle = true; name = "Lichterkette"; }
{ entity = "switch.weihnachtsstern_schlafzimmer"; state_color = true; toggle = true; name = "Stern"; }
{ entity = "sensor.schlafzimmer_humidity"; name = "Luftfeuchtigkeit"; show_fill = false; state_adaptive_color = true; }
{ entity = "sensor.luftentfeuchter"; name = "Entfeuchter"; color = "#0000ff"; y_axis = "secondary"; show_fill = true; show_points = false; show_line = false; smoothing = false; }
{ entity = "sensor.schlafzimmerfenster"; name = "Fenster"; color = "#ff0000"; y_axis = "secondary"; show_fill = true; show_points = false; show_line = false; smoothing = false; }
];
color_thresholds = [{ value = 0; color = "#009933"; } { value = 64; color = "#ffbf00"; } { value = 66; color = "#ff0000"; }];
color_thresholds_transition = "hard";
show = {
labels = true;
labels_secondary = "hover";
};
lower_bound_secondary = 0;
upper_bound_secondary = 1;
hour24 = true;
decimals = 1;
points_per_hour = 6;
hours_to_show = 6;
update_interval = 30;
line_width = 3;
state_map = [
{ value = 0; label = "Zu/Aus"; }
{ value = 1; label = "An/Auf"; }
];
}
{
type = "custom:mini-graph-card";
entities = [
{ entity = "sensor.schlafzimmer_temperature"; name = "Temperatur"; show_fill = false; }
{ entity = "input_number.target_temperature_schlafzimmer"; name = "Zieltemperatur"; show_fill = false; }
{ entity = "sensor.schlafzimmerheizung"; name = "Heizung"; y_axis = "secondary"; show_fill = true; show_points = false; show_line = false; smoothing = false; }
];
show = {
labels = true;
labels_secondary = "hover";
};
lower_bound_secondary = 0;
upper_bound_secondary = 1;
hours_to_show = 6;
update_interval = 30;
line_width = 3;
hour24 = true;
decimals = 1;
points_per_hour = 6;
state_map = [
{ value = 0; label = "Aus"; }
{ value = 1; label = "An"; }
];
}
{ entity = "binary_sensor.schlafzimmerfenster"; secondary_info = "last-changed"; name = "Fenster"; }
];
}
{
type = "custom:mini-graph-card";
entities = [
{ entity = "sensor.schlafzimmer_humidity"; state_adaptive_color = true; }
];
color_thresholds = [{ value = 0; color = "#009933"; } { value = 64; color = "#ffbf00"; } { value = 66; color = "#ff0000"; }];
color_thresholds_transition = "hard";
show = {
fill = "fade";
labels = true;
};
upper_bound = "~70";
hour24 = true;
lower_bound = "~50";
decimals = 1;
update_interval = 30;
points_per_hour = 12;
}
{
type = "history-graph";
entities = [
"sensor.schlafzimmer_temperature"
"input_number.target_temperature_schlafzimmer"
"sensor.schlafzimmer_humidity"
"climate.schlafzimmer"
"switch.luftentfeuchter"
type = "grid";
cards = [
{ type = "custom:slider-button-card"; entity = "switch.weihnachtsstern_schlafzimmer"; }
{ type = "custom:slider-button-card"; entity = "switch.luftentfeuchter"; }
{ type = "custom:slider-button-card"; entity = "climate.schlafzimmer"; }
];
}
];
}

View file

@ -15,7 +15,7 @@ in
"L+ /run/hass/mini-media-player.js - - - - ${nur.hassLovelaceModules.mini-media-player}/mini-media-player-bundle.js"
"L+ /run/hass/multiple-entity-row.js - - - - ${nur.hassLovelaceModules.multiple-entity-row}/multiple-entity-row.js"
"L+ /run/hass/sun-card.js - - - - ${nur.hassLovelaceModules.sun-card}/sun-card.js"
"L+ /run/hass/swipe-navigation.js - - - - ${nur.hassLovelaceModules.swipe-navigation}/swipe-navigation.js"
"L+ /run/hass/slider-button-card.js - - - - ${nur.hassLovelaceModules.slider-button-card}/slider-button-card.js"
"L+ /run/hass/rmv-card.js - - - - ${nur.hassLovelaceModules.rmv-card}/rmv-card.js"
"L+ /run/hass/weather-card-chart.js - - - - ${nur.hassLovelaceModules.weather-card-chart}/weather-card-chart.js"
];
@ -28,7 +28,7 @@ in
(mkLovelaceModule "rmv-card")
(mkLovelaceModule "weather-card-chart")
(mkLovelaceModule "sun-card")
(mkLovelaceModule "swipe-navigation")
(mkLovelaceModule "slider-button-card")
];
};
}