Open colemickens opened 5 years ago
I've managed to put up a package which fetches the stable ZIP and patches AWK/Java/bash paths, then a module file which writes up a service config, and all this loads and runs but-- it wouldn't open any HTTP/HTTPS ports for listening, only the control port which it uses for shutting down or whatever. Based on the logs, it gets stuck on startlevel 100
. Will be trying to dig this further. I attribute the trouble to the fact that native OpenHAB folder structure is a total mess of R/O, one-time-config, and full R/W userdata folders, so it won't run off the /nix/store/...
path for sure; I've overridden the paths I felt relevant (to go under /var/lib
, /var/log
, and /run
, but something isn't firing up, and it won't tell it right away.
@hypersw any progress on getting openhab to run? I'd love to see it working under NixOS :)
Not really. I've reproduced the setup "locally" (not inside a service), but didn't get much further with that. My next thoughts were to contact the OpenHAB community for comments, because Apache Karaf and its peculiarities are a bit off what I'm usually dealing with. In the meantime I were a bit disappointed with OpenHAB UI and were exploring other suff, like making core automation over raw MQTT with some external UI. I think I should push this to some conclusion anyway.
@dniku: well, this does not mean you cannot run OpenHAB on NixOS, this is just lacking a nice way of installing it along the NixOS lines, and backing up the settings. But if you bother to download the ZIP https://bintray.com/openhab/mvn/download_file?file_path=org%2Fopenhab%2Fdistro%2Fopenhab%2F2.4.0%2Fopenhab-2.4.0.zip and expand it and kick together a service like this...
{ config, lib, pkgs, ... }:
let
username = "openhabsrvtry";
pathTmpOpenhab = "/var/lib/try.openhab";
in
{
imports = [ ];
environment = with pkgs;
{
systemPackages =
[
mc
jre
gawk
procps
];
};
users.users = lib.singleton
{
name = username;
description = "OpenHAB Server User (Try)";
};
systemd.services.openhabtry =
{
description = "OpenHAB Server Try";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; ## TODO: is it?
environment =
{
JAVA_HOME = "${pkgs.jre}"; # where to look for java.exe
};
path = [ "${pkgs.gawk}/bin" "${pkgs.procps}/bin"];
serviceConfig =
{
ExecStart = "${pathTmpOpenhab}/runtime/bin/karaf server";
ExecStop = "${pathTmpOpenhab}/runtime/bin/karaf stop";
Restart = "always";
RestartSec = "10";
TimeoutStopSec = "30"; # Assume might be executing shutdown scripts
User = username;
};
};
# Otherwise it's UTC
time.timeZone = "Europe/Moscow";
}
(that's taken from a container declaration I've been playing with, file mounted with
containers =
{
#openhab = { autoStart = true; config = { config, pkgs, ... }: { imports = [ ./openhab.nix ]; }; };
try = { autoStart = true; config = { config, pkgs, ... }: { imports = [ ./try.nix ]; }; };
};
to the main OS config)
... then it would be up and running (and shutting down and restarting as needed), but not as a real package (yet).
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
still important to me
I marked this as stale due to inactivity. → More info
since there is no openhab package for nixos, how about a declarative way to install it via docker or some other packages?
An issue that I’m seeing with openhab’s progress is that every attempt to add this is trying really hard to do everything, while just having the package definitions in nixpkgs would be a really good start. Adding a good nixos module on top of that would a cherry on cake, but its also perfectly reasonable for it to be configured with plain environment."etc"...
and systemd.service
declarations at first (so people can experiment and find what works well.)
Issue description
Hello,
openhab
seems like an identical candidate for usage under NixOS. It would be great to see a package and module for it.I might try to look at this soon but I'm not experienced with Java.
Steps to reproduce
Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the results.