Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mini-graph-card: init at v0.9.3; mini-media-player: init at v1.8.1 #89136

Closed
wants to merge 2 commits into from

Conversation

mweinelt
Copy link
Member

@mweinelt mweinelt commented May 29, 2020

Motivation for this change

Gauging interest for integrating Home-Assistant custom lovelace modules, that are widely used within the hass community.

I'm currently installing them into home-assistant like this, something that could very well be abstracted away into a module option (thinking services.home-assistant.lovelaceModules) instead.

{
  # Custom Lovelace Modules
  systemd.tmpfiles.rules = [
    "d /var/lib/hass/www 0755 hass hass"
    "L /var/lib/hass/www/mini-graph-card.js - - - - ${pkgs.callPackage ./packages/mini-graph-card {}}/mini-graph-card-bundle.js"
    "L /var/lib/hass/www/mini-media-player.js - - - - ${pkgs.callPackage ./packages/mini-media-player {}}/mini-media-player-bundle.js"
  ];

  services.home-assistant.lovelaceConfig = {
    resources = [
      { url = "local/mini-graph-card-bundle.js";
        type = "module"; }
      { url = "local/mini-media-player-bundle.js";
        type = "module"; }
    ];
  };
}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

CCing @dotlambda @globin @Mic92

@Mic92
Copy link
Member

Mic92 commented May 29, 2020

I think the easiest ways to manage those is to have home-assistant manage the whole www directory in home-assistant (symlinkJoin ?).

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but 8000 lines of nix expressions for two simple home-assistant costum cards is too much. I would say either you can add those modules to our common pkgs/development/node-packagesnode-modules` directory or they can be distributed in a separate repository (NUR?).

@@ -5209,6 +5209,10 @@ in

minetime = callPackage ../applications/office/minetime { };

mini-graph-card = callPackage ../servers/home-assistant/lovelaceModules/mini-graph-card {};

mini-media-player = callPackage ../servers/home-assistant/lovelaceModules/mini-media-player {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually group packages like that into a common attribute set for better discoveribility, maybe hassCustomCards?
It could be similar to vimPlugins or mpvScripts or passExtension.

@@ -0,0 +1,4 @@
[
{"mini-media-player": "git+https://github.com/kalkih/mini-media-player.git#v1.8.1" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able do drop this line into our node-packages file as well.

@mweinelt
Copy link
Member Author

I tried quickly to move it into nodePackages, but that's not really working, since the package needs it's development dependencies to be built and nodePackages (rightfully) don't include that.

The npmjs version of these packages are immensly outdated, so I can track the git version. But then I'd need to overwrite "mini-graph-card-git+https://github.com/kalkih/mini-graph-card.git#v0.9.3" in default-v10.nix, which carries another version reference, which puts burden on other maintainers, when generate.sh is called.

Node is just a very dissatisfactory ecosystem. I'll probably try out NUR next.

@mweinelt mweinelt closed this May 30, 2020
@mweinelt mweinelt deleted the lovelace branch May 30, 2020 01:39
@mweinelt
Copy link
Member Author

NUR repository up at https://github.com/mweinelt/nur-packages.

@Mic92
Copy link
Member

Mic92 commented May 30, 2020

Thanks. I still see value in having a common abstraction that makes it easy to add custom cards though!

@Mic92
Copy link
Member

Mic92 commented May 30, 2020

I documented this lovelaceModules stuff in the wiki: https://nixos.wiki/wiki/Home-assistant

@mweinelt
Copy link
Member Author

I documented this lovelaceModules stuff in the wiki: https://nixos.wiki/wiki/Home-assistant

Thanks, though slight hickup. The internal webservers serving the www directory does not follow symlinks. See https://github.com/home-assistant/core/blob/dev/homeassistant/components/http/static.py#L28-L29. I haven't dug too deep yet on how to overwrite this, but if that's not exposed we might want to patch that.

Thanks. I still see value in having a common abstraction that makes it easy to add custom cards though!

So do I, just not in this pull request. Same goes for themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants