2024-09-13 17:26:50 -04:00
|
|
|
{pkgs, ...}: {
|
2024-09-05 21:33:06 -04:00
|
|
|
imports = [
|
|
|
|
./assist.nix
|
2024-09-10 01:21:08 -04:00
|
|
|
./bluetooth.nix
|
2024-09-05 21:33:06 -04:00
|
|
|
./firmware.nix
|
|
|
|
./frontend.nix
|
2024-09-16 22:54:18 -04:00
|
|
|
./timer.nix
|
2024-09-05 21:33:06 -04:00
|
|
|
];
|
|
|
|
|
2024-09-13 17:26:50 -04:00
|
|
|
environment.systemPackages = [
|
|
|
|
(pkgs.writeShellApplication {
|
|
|
|
name = "yaml2nix";
|
|
|
|
runtimeInputs = with pkgs; [yj];
|
|
|
|
text = ''
|
|
|
|
input="$(yj < "$1")"
|
|
|
|
output="''${2:-""}"
|
|
|
|
|
|
|
|
nixCode="$(nix eval --expr "builtins.fromJSON '''$input'''" --impure | alejandra -q | sed 's/ = null;/ = {};/g')"
|
|
|
|
|
|
|
|
if [[ "$output" != "" ]]; then
|
|
|
|
echo "$nixCode" > "$output"
|
|
|
|
else
|
|
|
|
echo "$nixCode"
|
|
|
|
fi
|
2024-09-16 22:54:18 -04:00
|
|
|
'';
|
|
|
|
})
|
|
|
|
|
|
|
|
(pkgs.writeShellApplication {
|
|
|
|
name = "nix2yaml";
|
|
|
|
runtimeInputs = with pkgs; [remarshal];
|
|
|
|
text = ''
|
|
|
|
input="$1"
|
|
|
|
output="''${2:-""}"
|
|
|
|
|
|
|
|
yamlCode="$(nix eval --json --file "$input" | remarshal --if json --of yaml)"
|
|
|
|
|
|
|
|
if [[ "$output" != "" ]]; then
|
|
|
|
echo "$yamlCode" > "$output"
|
|
|
|
else
|
|
|
|
echo "$yamlCode"
|
|
|
|
fi
|
2024-09-13 17:26:50 -04:00
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-05 21:33:06 -04:00
|
|
|
# TODO: some components / integrations / addons require manual interaction in the GUI, find way to make it all declarative
|
|
|
|
services.home-assistant = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
extraComponents = [
|
|
|
|
"caldav"
|
|
|
|
"holiday"
|
|
|
|
"isal"
|
|
|
|
"met"
|
|
|
|
"spotify"
|
|
|
|
"upnp"
|
|
|
|
"yamaha_musiccast"
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
2024-09-06 10:14:03 -04:00
|
|
|
homeassistant = {
|
|
|
|
name = "Home";
|
|
|
|
unit_system = "metric";
|
|
|
|
currency = "CAD";
|
|
|
|
country = "CA";
|
|
|
|
time_zone = "America/Montreal";
|
|
|
|
external_url = "https://homie.nelim.org";
|
|
|
|
};
|
|
|
|
|
2024-09-05 21:33:06 -04:00
|
|
|
# Proxy settings
|
|
|
|
http = {
|
|
|
|
server_host = "0.0.0.0";
|
|
|
|
trusted_proxies = ["100.64.0.8" "100.64.0.9"];
|
|
|
|
use_x_forwarded_for = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# `default_config` enables too much stuff. this is what I want from it
|
|
|
|
config = {};
|
|
|
|
dhcp = {};
|
|
|
|
history = {};
|
|
|
|
image_upload = {};
|
|
|
|
logbook = {};
|
|
|
|
mobile_app = {};
|
|
|
|
my = {};
|
|
|
|
sun = {};
|
|
|
|
zeroconf = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|