From af37c0c34afd9c35b3034404ff2c1aa1d0c88daa Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 21 Jul 2024 18:40:13 +0100 Subject: [PATCH] Add home-assistant container service Move home/default into personal.nix and work.nix instead of flake, was pulling in whole desktop config for server and wasting time/space --- flake.nix | 1 - home/personal.nix | 1 + home/work.nix | 1 + system/Legion.nix | 4 +++- system/services/home-assistant.nix | 12 ++++++++++++ 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 system/services/home-assistant.nix diff --git a/flake.nix b/flake.nix index 1e6812c0..3f275e3c 100644 --- a/flake.nix +++ b/flake.nix @@ -109,7 +109,6 @@ imports = [ base16.homeManagerModule {scheme = "${tt-schemes}/base16/one-light.yaml";} - ./home/default.nix ./home/${hostName}.nix ]; home = { diff --git a/home/personal.nix b/home/personal.nix index b5b1b45e..595df512 100644 --- a/home/personal.nix +++ b/home/personal.nix @@ -1,3 +1,4 @@ {pkgs, ...}: { + imports = [./default.nix]; home.packages = with pkgs; [kdePackages.ktorrent]; } diff --git a/home/work.nix b/home/work.nix index ee6bd4f3..a107f575 100644 --- a/home/work.nix +++ b/home/work.nix @@ -4,6 +4,7 @@ pkgs, ... }: { + imports = [./default.nix]; home.packages = with pkgs; [ twinkle (import ./scripts/ukaea-vpn.nix pkgs) diff --git a/system/Legion.nix b/system/Legion.nix index 69826b24..bf79d8ae 100644 --- a/system/Legion.nix +++ b/system/Legion.nix @@ -3,9 +3,10 @@ ./services/caddy.nix ./services/forgejo.nix ./services/grafana.nix + ./services/home-assistant.nix ./services/minecraft.nix ./services/nix-serve.nix - ./services/radicale.nix + # ./services/radicale.nix ./services/sshd.nix ./services/syncthing.nix # ./services/znc.nix @@ -16,4 +17,5 @@ }; users.mutableUsers = false; system.autoUpgrade.operation = "switch"; + hardware.bluetooth.enable = true; } diff --git a/system/services/home-assistant.nix b/system/services/home-assistant.nix new file mode 100644 index 00000000..26c88ccc --- /dev/null +++ b/system/services/home-assistant.nix @@ -0,0 +1,12 @@ +{config, ...}: { + virtualisation.oci-containers = { + backend = "podman"; + containers.homeassistant = { + volumes = ["home-assistant:/config" "/run/dbus:/run/dbus:ro"]; + environment.TZ = config.time.timeZone; + image = "ghcr.io/home-assistant/home-assistant:2024.8.0.dev202407210221"; + extraOptions = ["--network=host"]; + }; + }; + services.caddy.virtualHosts."home.xenia.me.uk".extraConfig = "reverse_proxy http://localhost:8123"; +}