From 09881853976dc8cc0e2498a4db5719fce140096c Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Mon, 7 Jun 2021 22:17:02 +0200 Subject: [PATCH] Update home-assistant --- cachix/mweinelt.nix | 11 +++++++ nix/sources.json | 12 ++++++++ nixos/roles/home-assistant/default.nix | 16 +++++++++++ nixos/roles/home-assistant/hexa-cards.nix | 35 +++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 cachix/mweinelt.nix create mode 100644 nixos/roles/home-assistant/hexa-cards.nix diff --git a/cachix/mweinelt.nix b/cachix/mweinelt.nix new file mode 100644 index 00000000..60860809 --- /dev/null +++ b/cachix/mweinelt.nix @@ -0,0 +1,11 @@ +{ + nix = { + binaryCaches = [ + "https://mweinelt.cachix.org" + ]; + binaryCachePublicKeys = [ + "mweinelt.cachix.org-1:J9OCu2VAPJ2IHzpOfoJt16Fm5xl9q8VOHqcqCGSNKsM=" + ]; + }; +} + \ No newline at end of file diff --git a/nix/sources.json b/nix/sources.json index 57b20e52..4a7f6716 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -75,6 +75,18 @@ "url": "https://github.com/NixOS/nixpkgs/archive/1ca6b0a0cc38dbba0441202535c92841dd39d1ae.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "hexa-nur-packages": { + "branch": "master", + "description": "My personal NUR repository: [maintainer=@mweinelt] ", + "homepage": "", + "owner": "mweinelt", + "repo": "nur-packages", + "rev": "0e816f9438fa9049ffbed03db576948ddf51e419", + "sha256": "1zr6dad3d9dc6lq1r1cdrrnpypix3qffjwgvy181ld5f8zg069ir", + "type": "tarball", + "url": "https://github.com/mweinelt/nur-packages/archive/0e816f9438fa9049ffbed03db576948ddf51e419.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "obelisk": { "branch": "master", "description": "Obelisk provides an easy way to develop and deploy your Reflex project for web and mobile", diff --git a/nixos/roles/home-assistant/default.nix b/nixos/roles/home-assistant/default.nix index 019db592..470a9b02 100644 --- a/nixos/roles/home-assistant/default.nix +++ b/nixos/roles/home-assistant/default.nix @@ -1,5 +1,7 @@ { pkgs, ... }: { + imports = [ ./hexa-cards.nix ]; + services.home-assistant = { enable = true; package = pkgs.home-assistant.overrideAttrs ( @@ -43,6 +45,9 @@ type = "weather-forecast"; entity = "weather.dwd_darmstadt"; } + { + type = "custom:sun-card"; + } { type = "picture"; image = "https://www.dwd.de/DWD/wetter/radar/radfilm_hes_akt.gif"; @@ -56,6 +61,10 @@ "sensor.kalliope_battery_state" ]; } + { + type = "custom:rmv-card"; + entity = "sensor.darmstadt_schulstrasse"; + } ]; } ]; @@ -70,6 +79,13 @@ proxyPass = "http://[::1]:8123"; proxyWebsockets = true; }; + locations."/custom/" = { + alias = "/run/hass/"; + }; + extraConfig = '' + proxy_buffering off; + ''; + }; }; diff --git a/nixos/roles/home-assistant/hexa-cards.nix b/nixos/roles/home-assistant/hexa-cards.nix new file mode 100644 index 00000000..ac69eff4 --- /dev/null +++ b/nixos/roles/home-assistant/hexa-cards.nix @@ -0,0 +1,35 @@ +{ pkgs, ... }: +let + nur = import pkgs.sources.hexa-nur-packages { }; + + mkLovelaceModule = name: { + url = "custom/${name}.js?${nur.hassLovelaceModules."${name}".version}"; + type = "module"; + }; +in +{ + systemd.tmpfiles.rules = [ + # Lovelace Cards + "d /run/hass 0700 nginx nginx" + "L+ /run/hass/mini-graph-card.js - - - - ${nur.hassLovelaceModules.mini-graph-card}/mini-graph-card-bundle.js" + "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/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" + ]; + + services.home-assistant.config.lovelace = { + resources = [ + (mkLovelaceModule "mini-graph-card") + (mkLovelaceModule "mini-media-player") + (mkLovelaceModule "multiple-entity-row") + (mkLovelaceModule "rmv-card") + (mkLovelaceModule "weather-card-chart") + (mkLovelaceModule "sun-card") + (mkLovelaceModule "swipe-navigation") + ]; + }; +} +