Skip to content

Commit 3a21ca2

Browse files
authored
unifi-controller: patchelf unifi's sdnotify, nixos/unifi: enable sd_notify, always restart service (NixOS#361945)
2 parents 8918f21 + 5d10e2b commit 3a21ca2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

nixos/modules/services/networking/unifi.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ in
143143
restartTriggers = [ cfg.unifiPackage cfg.mongodbPackage ];
144144

145145
serviceConfig = {
146-
Type = "simple";
146+
Type = "notify";
147147
ExecStart = "${cmd} start";
148148
ExecStop = "${cmd} stop";
149-
Restart = "on-failure";
149+
Restart = "always";
150150
TimeoutSec = "5min";
151151
User = "unifi";
152152
UMask = "0077";

pkgs/by-name/un/unifi/package.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
dpkg,
55
fetchurl,
66
nixosTests,
7+
systemd,
78
}:
89

910
stdenv.mkDerivation rec {
@@ -28,6 +29,18 @@ stdenv.mkDerivation rec {
2829
runHook postInstall
2930
'';
3031

32+
postInstall =
33+
if stdenv.hostPlatform.system == "x86_64-linux" then
34+
''
35+
patchelf --add-needed "${systemd}/lib/libsystemd.so.0" "$out/lib/native/Linux/x86_64/libubnt_sdnotify_jni.so"
36+
''
37+
else if stdenv.hostPlatform.system == "aarch64-linux" then
38+
''
39+
patchelf --add-needed "${systemd}/lib/libsystemd.so.0" "$out/lib/native/Linux/aarch64/libubnt_sdnotify_jni.so"
40+
''
41+
else
42+
null;
43+
3144
passthru.tests = {
3245
unifi = nixosTests.unifi;
3346
};

0 commit comments

Comments
 (0)