330 lines
10 KiB
Nix
330 lines
10 KiB
Nix
{
|
||
pkgs,
|
||
namespace,
|
||
...
|
||
}:
|
||
{
|
||
${namespace} = {
|
||
sops.enable = true;
|
||
# ###################################################
|
||
# # Boot # #
|
||
# ###################################################
|
||
|
||
bootloader.lanzaboote.enable = true;
|
||
|
||
# ###################################################
|
||
# # Hardware # #
|
||
# ###################################################
|
||
|
||
hardware.disko = {
|
||
enable = true;
|
||
enableLuks = true;
|
||
filesystem = "btrfs";
|
||
# rootDisk = "/dev/loop0";
|
||
};
|
||
|
||
headless.enable = true;
|
||
|
||
# ###################################################
|
||
# # Impermanence # #
|
||
# ###################################################
|
||
|
||
impermanence = {
|
||
enable = true;
|
||
extraDirectories = [
|
||
"/esphome"
|
||
"/var/lib/homeassistant"
|
||
"/var/lib/mosquitto"
|
||
"/var/lib/music-assistant"
|
||
"/var/lib/postgresql"
|
||
"/var/lib/zigbee2mqtt"
|
||
];
|
||
};
|
||
|
||
# ###################################################
|
||
# # Network # #
|
||
# ###################################################
|
||
|
||
network = {
|
||
hostName = "nuc-nixos";
|
||
ipv4 = {
|
||
method = "manual";
|
||
address = "10.0.1.4/24";
|
||
gateway = "10.0.1.1";
|
||
dns = "10.0.1.1";
|
||
interface = "enp2s0";
|
||
};
|
||
firewall = {
|
||
enable = true;
|
||
allowPing = true;
|
||
allowedTCPPorts = [
|
||
1883 # MQTT broker (mosquitto) for IoT devices
|
||
8192
|
||
8880
|
||
8881
|
||
];
|
||
allowedUDPPorts = [
|
||
8192
|
||
8880
|
||
8881
|
||
];
|
||
};
|
||
};
|
||
|
||
# ###################################################
|
||
# # Security # #
|
||
# ###################################################
|
||
|
||
security.tpm.enable = true;
|
||
|
||
# ###################################################
|
||
# # Services # #
|
||
# ###################################################
|
||
|
||
services = {
|
||
home-assistant = {
|
||
enable = true;
|
||
dashboards = [
|
||
{
|
||
title = "Pets & Air Quality";
|
||
path = "pets-air";
|
||
icon = "mdi:paw";
|
||
cards = [
|
||
{
|
||
type = "markdown";
|
||
title = "🐾 Pets";
|
||
content = "## Pet Management";
|
||
}
|
||
{
|
||
type = "horizontal-stack";
|
||
cards = [
|
||
{
|
||
type = "entity";
|
||
entity = "select.joey_smart_feeder_manual_feed_quantity";
|
||
name = "Joey Feed";
|
||
}
|
||
{
|
||
type = "entity";
|
||
entity = "select.luci_smart_feeder_manual_feed_quantity";
|
||
name = "Luci Feed";
|
||
}
|
||
{
|
||
type = "entity";
|
||
entity = "text.joey_smart_feeder_text_on_display";
|
||
name = "Joey Display";
|
||
}
|
||
{
|
||
type = "entity";
|
||
entity = "text.luci_smart_feeder_text_on_display";
|
||
name = "Luci Display";
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "entities";
|
||
title = "🐱 Litter Robot";
|
||
show_header_toggle = false;
|
||
entities = [
|
||
"vacuum.litter_robot_4_litter_box"
|
||
{
|
||
type = "button";
|
||
entity = "button.garbage_goober_deep";
|
||
name = "Deep Clean";
|
||
}
|
||
{
|
||
type = "button";
|
||
entity = "button.garbage_goober_pet_area_cleaning";
|
||
name = "Pet Area";
|
||
}
|
||
{
|
||
type = "button";
|
||
entity = "button.garbage_goober_intensive_sweeping";
|
||
name = "Intensive";
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "markdown";
|
||
title = "🌬️ Air Quality";
|
||
content = "## Air Purifiers & Humidity";
|
||
}
|
||
{
|
||
type = "horizontal-stack";
|
||
cards = [
|
||
{
|
||
type = "tile";
|
||
entity = "fan.living_room_air_purifier";
|
||
name = "Living Room";
|
||
icon = "mdi:air-purifier";
|
||
features = [
|
||
{
|
||
type = "fan-speed";
|
||
speed_count = 3;
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "tile";
|
||
entity = "fan.bedroom_air_purifier";
|
||
name = "Bedroom";
|
||
icon = "mdi:air-purifier";
|
||
features = [
|
||
{
|
||
type = "fan-speed";
|
||
speed_count = 3;
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "tile";
|
||
entity = "fan.bedroom_fan";
|
||
name = "Bedroom Fan";
|
||
icon = "mdi:fan";
|
||
features = [
|
||
{
|
||
type = "fan-speed";
|
||
speed_count = 4;
|
||
presets = [
|
||
{
|
||
name = "auto";
|
||
icon = "mdi:fan-auto";
|
||
}
|
||
{
|
||
name = "low";
|
||
icon = "mdi:fan-speed-1";
|
||
}
|
||
{
|
||
name = "medium";
|
||
icon = "mdi:fan-speed-2";
|
||
}
|
||
{
|
||
name = "high";
|
||
icon = "mdi:fan-speed-3";
|
||
}
|
||
];
|
||
}
|
||
];
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "horizontal-stack";
|
||
cards = [
|
||
{
|
||
type = "tile";
|
||
entity = "humidifier.bedroom_humidifier";
|
||
name = "Bedroom Humidifier";
|
||
icon = "mdi:water-percent";
|
||
features = [
|
||
{
|
||
type = "humidifier-toggle";
|
||
}
|
||
{
|
||
type = "humidifier-modes";
|
||
modes = [
|
||
{
|
||
name = "auto";
|
||
icon = "mdi:refresh-auto";
|
||
}
|
||
{
|
||
name = "low";
|
||
icon = "mdi:water-percent";
|
||
}
|
||
{
|
||
name = "medium";
|
||
icon = "mdi:water-percent";
|
||
}
|
||
{
|
||
name = "high";
|
||
icon = "mdi:water-percent";
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "humidifier-target-humidity";
|
||
}
|
||
];
|
||
}
|
||
];
|
||
}
|
||
{
|
||
type = "entities";
|
||
title = "⚠️ Status";
|
||
show_header_toggle = false;
|
||
entities = [
|
||
"binary_sensor.bedroom_humidifier_low_water"
|
||
"binary_sensor.bedroom_humidifier_water_tank_lifted"
|
||
];
|
||
}
|
||
];
|
||
}
|
||
];
|
||
automation = {
|
||
lightswitch = {
|
||
living-room-lights = {
|
||
id = 1741726347213;
|
||
alias = "Living Room Light Switch";
|
||
mqttDeviceId = "c90174f076a500c6fd531ecd7e5e259b";
|
||
lightEntityId = "light.living_room_lights";
|
||
};
|
||
bedroom-lights = {
|
||
id = 1741726231261;
|
||
alias = "Bedroom Light Switch";
|
||
mqttDeviceId = "7578af456fc02ac36bf3c4e414ac0bd9";
|
||
lightEntityId = "light.bedroom_lights";
|
||
};
|
||
};
|
||
|
||
motion-light = {
|
||
bedroom-closet-lights = {
|
||
id = 1769548321857;
|
||
alias = "Bedroom Closet Lights";
|
||
motion-sensor = {
|
||
mqttDeviceId = "fd73c1f3dfe08ab13d187fb49d781060";
|
||
mqttEntityId = "33b83e8db95b213b16b4b8c1f591ec92";
|
||
};
|
||
switch = {
|
||
deviceId = "a3dfab0c8d91554a7c92c65cdf655c86";
|
||
entityId = "645855b6f4347d65f5a54c33b3a9a1d0";
|
||
};
|
||
};
|
||
front-closet-lights = {
|
||
id = 1769548321857;
|
||
alias = "Front Closet Lights";
|
||
motion-sensor = {
|
||
mqttDeviceId = "7eb61ed09e48c1dcef8bcc0f7765c459";
|
||
mqttEntityId = "a8b48ad080e70a0cdbb991b79c607ca1";
|
||
};
|
||
light = {
|
||
entityId = "light.front_closet_lights";
|
||
};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
otbr = {
|
||
enable = true;
|
||
restPort = 8881;
|
||
port = 8880;
|
||
};
|
||
};
|
||
|
||
# ###################################################
|
||
# # User # #
|
||
# ###################################################
|
||
|
||
user = {
|
||
name = "admin";
|
||
linger = true;
|
||
};
|
||
};
|
||
|
||
# ###################################################
|
||
# # Boot # #
|
||
# ###################################################
|
||
|
||
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest-lto-x86_64-v4;
|
||
fileSystems."/etc".neededForBoot = true;
|
||
|
||
}
|