unifi-controller: patchelf unifi's sdnotify, nixos/unifi: enable sd_notify, always restart service (#361945)

Weijia Wang 3a21ca23 8918f21f

Changed files
+15 -2
nixos
modules
services
networking
pkgs
by-name
un
unifi
+2 -2
nixos/modules/services/networking/unifi.nix
···
restartTriggers = [ cfg.unifiPackage cfg.mongodbPackage ];
serviceConfig = {
-
Type = "simple";
+
Type = "notify";
ExecStart = "${cmd} start";
ExecStop = "${cmd} stop";
-
Restart = "on-failure";
+
Restart = "always";
TimeoutSec = "5min";
User = "unifi";
UMask = "0077";
+13
pkgs/by-name/un/unifi/package.nix
···
dpkg,
fetchurl,
nixosTests,
+
systemd,
}:
stdenv.mkDerivation rec {
···
runHook postInstall
'';
+
+
postInstall =
+
if stdenv.hostPlatform.system == "x86_64-linux" then
+
''
+
patchelf --add-needed "${systemd}/lib/libsystemd.so.0" "$out/lib/native/Linux/x86_64/libubnt_sdnotify_jni.so"
+
''
+
else if stdenv.hostPlatform.system == "aarch64-linux" then
+
''
+
patchelf --add-needed "${systemd}/lib/libsystemd.so.0" "$out/lib/native/Linux/aarch64/libubnt_sdnotify_jni.so"
+
''
+
else
+
null;
passthru.tests = {
unifi = nixosTests.unifi;