init home assistant
This commit is contained in:
parent
e5ffe5a1d2
commit
fdd0c20725
5 changed files with 222 additions and 14 deletions
|
|
@ -67,12 +67,9 @@
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "lambdaOS"; # Define your hostname.
|
hostName = "lambdaOS"; # Define your hostname.
|
||||||
|
networkmanager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
programs.nm-applet.enable = true;
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Europe/Amsterdam";
|
time.timeZone = "Europe/Amsterdam";
|
||||||
|
|
||||||
|
|
@ -124,26 +121,26 @@
|
||||||
maple-mono-NF
|
maple-mono-NF
|
||||||
];
|
];
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
programs.gnupg.agent = {
|
|
||||||
enable = true;
|
|
||||||
enableSSHSupport = true;
|
|
||||||
pinentryPackage = pkgs.pinentry-curses;
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.portal.enable = true;
|
xdg.portal.enable = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
nm-applet.enable = true;
|
||||||
|
|
||||||
zsh.enable = true;
|
zsh.enable = true;
|
||||||
|
|
||||||
|
gnupg.agent = {
|
||||||
|
enable = true;
|
||||||
|
enableSSHSupport = true;
|
||||||
|
pinentryPackage = pkgs.pinentry-curses;
|
||||||
|
};
|
||||||
|
|
||||||
hyprland = {
|
hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-ld.enable = true;
|
nix-ld.enable = true;
|
||||||
|
|
||||||
nix-ld.libraries = with pkgs; [
|
nix-ld.libraries = with pkgs; [
|
||||||
wayland
|
wayland
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
|
||||||
|
./home-assistant.nix
|
||||||
|
|
||||||
../../common
|
../../common
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -110,7 +112,10 @@
|
||||||
nixos-rebuild
|
nixos-rebuild
|
||||||
git
|
git
|
||||||
];
|
];
|
||||||
script = ''nixos-rebuild switch --flake github:itepastra/nixconf#nuOS'';
|
script = ''
|
||||||
|
nixos-rebuild boot --flake github:itepastra/nixconf#nuOS
|
||||||
|
shutdown -r +5 "System will reboot in 5 minutes"
|
||||||
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "root";
|
User = "root";
|
||||||
|
|
@ -121,6 +126,7 @@
|
||||||
after = [
|
after = [
|
||||||
"network-online.target"
|
"network-online.target"
|
||||||
];
|
];
|
||||||
|
restartIfChanged = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
|
|
@ -259,6 +265,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
"calendar.itepastra.nl" = proxy "itepastra.nl" "http://[::1]:29341";
|
"calendar.itepastra.nl" = proxy "itepastra.nl" "http://[::1]:29341";
|
||||||
|
|
||||||
|
# home-assistant proxy
|
||||||
|
"home.itepastra.nl" = proxy "itepastra.nl" "http://[::1]:8123";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -275,6 +284,7 @@
|
||||||
"itepastra.nl".extraDomainNames = [
|
"itepastra.nl".extraDomainNames = [
|
||||||
"locked.itepastra.nl"
|
"locked.itepastra.nl"
|
||||||
"calendar.itepastra.nl"
|
"calendar.itepastra.nl"
|
||||||
|
"home.itepastra.nl"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
189
hosts/nuos/home-assistant.nix
Normal file
189
hosts/nuos/home-assistant.nix
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
ha = {
|
||||||
|
url = "https://home.itepastra.nl";
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
|
||||||
|
age.secrets = {
|
||||||
|
"ha/ns" = {
|
||||||
|
file = ../../secrets/home-assistant/ns.age;
|
||||||
|
owner = "hass";
|
||||||
|
group = "hass";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.home-assistant = {
|
||||||
|
enable = true;
|
||||||
|
extraComponents = [
|
||||||
|
"esphome"
|
||||||
|
"met"
|
||||||
|
"radio_browser"
|
||||||
|
"wled"
|
||||||
|
"heos"
|
||||||
|
"hue"
|
||||||
|
"tado"
|
||||||
|
"dsmr"
|
||||||
|
"google_translate"
|
||||||
|
"syncthing"
|
||||||
|
"spotify"
|
||||||
|
"github"
|
||||||
|
"nederlandse_spoorwegen"
|
||||||
|
"caldav"
|
||||||
|
"discord"
|
||||||
|
];
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
windowOpenAutomation = device: entity_1: entity_2: name: {
|
||||||
|
alias = "Heater off on window open ${name}";
|
||||||
|
description = "Turn off the heater when the window is opened in the room of ${name}";
|
||||||
|
triggers = [
|
||||||
|
{
|
||||||
|
type = "opened";
|
||||||
|
device_id = device;
|
||||||
|
entity_id = entity_1;
|
||||||
|
domain = "binary_sensor";
|
||||||
|
trigger = "device";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
conditions = [ ];
|
||||||
|
actions = [
|
||||||
|
{
|
||||||
|
device_id = device;
|
||||||
|
domain = "climate";
|
||||||
|
entity_id = entity_2;
|
||||||
|
type = "set_hvac_mode";
|
||||||
|
hvac_mode = "off";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
mode = "single";
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
default_config = { };
|
||||||
|
# "sensor" = [
|
||||||
|
# {
|
||||||
|
# platform = "nederlandse_spoorwegen";
|
||||||
|
# api_key_path = config.age.secrets."ha/ns".path;
|
||||||
|
# routes = [
|
||||||
|
# {
|
||||||
|
# name = "Utrecht_Vaartsche-Leiden";
|
||||||
|
# from = "Utvr";
|
||||||
|
# to = "Ledn";
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# name = "Utrecht-Delft";
|
||||||
|
# from = "Ut";
|
||||||
|
# to = "Dt";
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
"automation manual" = [
|
||||||
|
(windowOpenAutomation "7d597f356438d1d3cd0c2a7d751cc27b" "binary_sensor.kamer_van_noa_window"
|
||||||
|
"climate.kamer_van_noa"
|
||||||
|
"noa"
|
||||||
|
)
|
||||||
|
(windowOpenAutomation "9e94a205cc3d4f4168806e0242763d70" "binary_sensor.kamer_van_sjoerd_window"
|
||||||
|
"climate.kamer_van_sjoerd"
|
||||||
|
"sjoerd"
|
||||||
|
)
|
||||||
|
(windowOpenAutomation "435489996d4fc2bfca3cd8beaf781fe4" "binary_sensor.kamer_van_lars_window"
|
||||||
|
"climate.kamer_van_lars"
|
||||||
|
"lars"
|
||||||
|
)
|
||||||
|
(windowOpenAutomation "d9b52f250a8392bb3b3b49f08b2ae8bf" "binary_sensor.logeerkamer_window"
|
||||||
|
"climate.logeerkamer"
|
||||||
|
"guests"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
alias = "Notify noa when at store";
|
||||||
|
description = "When Noa comes close to the jumbo, send a notification with the shopping list";
|
||||||
|
triggers = [
|
||||||
|
{
|
||||||
|
trigger = "zone";
|
||||||
|
entity_id = "person.noa_aarts";
|
||||||
|
zone = "zone.jumbo";
|
||||||
|
event = "enter";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
conditions = [ ];
|
||||||
|
actions = [
|
||||||
|
{
|
||||||
|
action = "notify.mobile_app_noa_s_phone";
|
||||||
|
data = {
|
||||||
|
title = "Grocery list";
|
||||||
|
message = ''
|
||||||
|
There {% if states('todo.shopping_list') | int < 2 %} is{%else%}
|
||||||
|
are{%endif%} {{ states('todo.shopping_list')}} {% if
|
||||||
|
states('todo.shopping_list') | int < 2 %} product{%else%}
|
||||||
|
products{%endif%} left on the grocery list.
|
||||||
|
'';
|
||||||
|
# data = {
|
||||||
|
# actions = [
|
||||||
|
# {
|
||||||
|
# action = "URI";
|
||||||
|
# title = "Open grocery list";
|
||||||
|
# uri = "${ha.url}/todo?entity_id=todo.shopping_list";
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
mode = "single";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
"automation ui" = "!include automations.yaml";
|
||||||
|
|
||||||
|
http = {
|
||||||
|
server_host = "::1";
|
||||||
|
trusted_proxies = [ "::1" ];
|
||||||
|
use_x_forwarded_for = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
package = (
|
||||||
|
pkgs.home-assistant.override {
|
||||||
|
extraPackages =
|
||||||
|
py: with py; [
|
||||||
|
psycopg2
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
# .overrideAttrs (oldAttrs: {
|
||||||
|
# doInstallCheck = false;
|
||||||
|
# });
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"f ${config.services.home-assistant.configDir}/automations.yaml 0755 hass hass"
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgs.config.permittedInsecurePackages = [
|
||||||
|
"openssl-1.1.1w"
|
||||||
|
];
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ "hass" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "hass";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
8
secrets/home-assistant/ns.age
Normal file
8
secrets/home-assistant/ns.age
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 tcnWbQ uDRGSw7hCiYn+g+elKfM8J+JSN0HeVnpEWTsOCXDGTs
|
||||||
|
3JggsuIG9liwZLsEKNInCbyzJoQgISbG9nV3Z3uEf2k
|
||||||
|
-> ssh-ed25519 ropO2g gj6oA/Yh7R21JPDptxC8vxExD9KbTph7l7i8CO9AcF4
|
||||||
|
Qj//mgeKRtGd0zpC2b++T4+dJHb2/jdTYwbSXGb384Q
|
||||||
|
--- A/SQz9tUiuV2t7uwJcrjUwBp2pEpSZKN9zhyRndJhFo
|
||||||
|
Ä:ˆ.#ü6ì<14><>FŸü>“Æß½Ž=8hý“¼O»iM2$ôr°/›¿
|
||||||
|
÷øÊí¨¾ÃJ½_CeMi8Üê€<EFBFBD>
|
||||||
|
|
@ -26,4 +26,8 @@ in
|
||||||
noa
|
noa
|
||||||
nuOS
|
nuOS
|
||||||
];
|
];
|
||||||
|
"home-assistant/ns.age".publicKeys = [
|
||||||
|
noa
|
||||||
|
nuOS
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue