Skip to content

Commit

Permalink
home-assistant-custom-{components,lovelace-modules}: implement auto-c…
Browse files Browse the repository at this point in the history
…alling

Kill the tedious work of setting up attributes manually.
  • Loading branch information
mweinelt committed Sep 7, 2024
1 parent 80fd10b commit 02cc60e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 119 deletions.
21 changes: 21 additions & 0 deletions pkgs/servers/home-assistant/autocalling-package-set.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
lib,
callPackage,
baseDirectory,
}:

let
inherit (lib)
filterAttrs
mapAttrs'
nameValuePair
;

inherit (builtins)
readDir
;

toPackageAttribute =
dir: type: nameValuePair dir (callPackage (baseDirectory + "/${dir}/default.nix") { });
in
mapAttrs' toPackageAttribute (filterAttrs (_: type: type == "directory") (readDir baseDirectory))
86 changes: 7 additions & 79 deletions pkgs/servers/home-assistant/custom-components/default.nix
Original file line number Diff line number Diff line change
@@ -1,82 +1,10 @@
{ callPackage
}:

{
adaptive_lighting = callPackage ./adaptive_lighting {};

alarmo = callPackage ./alarmo {};

auth-header = callPackage ./auth-header {};

awtrix = callPackage ./awtrix {};

better_thermostat = callPackage ./better_thermostat {};

dwd = callPackage ./dwd { };

elevenlabs_tts = callPackage ./elevenlabs_tts {};

emporia_vue = callPackage ./emporia_vue {};

epex_spot = callPackage ./epex_spot {};

frigate = callPackage ./frigate {};

garmin_connect = callPackage ./garmin_connect {};

govee-lan = callPackage ./govee-lan {};

gpio = callPackage ./gpio {};

homematicip_local = callPackage ./homematicip_local { };

indego = callPackage ./indego { };

local_luftdaten = callPackage ./local_luftdaten { };

localtuya = callPackage ./localtuya {};

mass = callPackage ./mass { };

midea_ac_lan = callPackage ./midea_ac_lan {};

midea-air-appliances-lan = callPackage ./midea-air-appliances-lan {};

miele = callPackage ./miele {};

moonraker = callPackage ./moonraker {};

ntfy = callPackage ./ntfy {};

omnik_inverter = callPackage ./omnik_inverter {};

prometheus_sensor = callPackage ./prometheus_sensor {};

samsungtv-smart = callPackage ./samsungtv-smart {};

sensi = callPackage ./sensi {};

smartir = callPackage ./smartir {};

smartthinq-sensors = callPackage ./smartthinq-sensors {};

solis-sensor = callPackage ./solis-sensor {};

somweb = callPackage ./somweb {};

spook = callPackage ./spook {};

tuya_local = callPackage ./tuya_local {};

volkswagen_we_connect_id = callPackage ./volkswagen_we_connect_id { };

volkswagencarnet = callPackage ./volkswagencarnet { };

waste_collection_schedule = callPackage ./waste_collection_schedule {};

xiaomi_gateway3 = callPackage ./xiaomi_gateway3 {};

xiaomi_miot = callPackage ./xiaomi_miot {};
callPackage,
lib,
...
}:

yassi = callPackage ./yassi {};
import ../autocalling-package-set.nix {
inherit callPackage lib;
baseDirectory = ./.;
}
47 changes: 7 additions & 40 deletions pkgs/servers/home-assistant/custom-lovelace-modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,13 @@
{
callPackage,
lib,
pkgs,
callPackage,
...
}:

{
apexcharts-card = callPackage ./apexcharts-card { };

atomic-calendar-revive = callPackage ./atomic-calendar-revive { };

button-card = callPackage ./button-card { };

card-mod = callPackage ./card-mod { };

decluttering-card = callPackage ./decluttering-card { };

hourly-weather = callPackage ./hourly-weather { };

lg-webos-remote-control = callPackage ./lg-webos-remote-control { };

light-entity-card = callPackage ./light-entity-card { };

mini-graph-card = callPackage ./mini-graph-card {};

mini-media-player = callPackage ./mini-media-player {};

multiple-entity-row = callPackage ./multiple-entity-row { };

mushroom = callPackage ./mushroom { };

rmv-card = callPackage ./rmv-card { };

template-entity-row = callPackage ./template-entity-row { };

universal-remote-card = callPackage ./universal-remote-card { };

valetudo-map-card = callPackage ./valetudo-map-card { };

zigbee2mqtt-networkmap = callPackage ./zigbee2mqtt-networkmap { };
}
// lib.optionalAttrs pkgs.config.allowAliases {
android-tv-card =
lib.warn "`home-assistant-custom-lovelace-modules.android-tv-card` has been renamed to `universal-remote-card`"
pkgs.home-assistant-custom-lovelace-modules.universal-remote-card;
(import ../autocalling-package-set.nix {
inherit callPackage lib;
baseDirectory = ./.;
}) // lib.optionalAttrs pkgs.config.allowAliases {
android-tv-card = lib.warn "`home-assistant-custom-lovelace-modules.android-tv-card` has been renamed to `universal-remote-card`" pkgs.home-assistant-custom-lovelace-modules.universal-remote-card;
}

0 comments on commit 02cc60e

Please sign in to comment.