Skip to content

Commit

Permalink
unifi-controller: patchelf unifi's sdnotify, nixos/unifi: enable sd_n…
Browse files Browse the repository at this point in the history
…otify, always restart service (NixOS#361945)
  • Loading branch information
wegank authored Jan 4, 2025
2 parents 8918f21 + 5d10e2b commit 3a21ca2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/services/networking/unifi.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ in
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";
Expand Down
13 changes: 13 additions & 0 deletions pkgs/by-name/un/unifi/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
dpkg,
fetchurl,
nixosTests,
systemd,
}:

stdenv.mkDerivation rec {
Expand All @@ -28,6 +29,18 @@ 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;
};
Expand Down

0 comments on commit 3a21ca2

Please sign in to comment.