Fix asterisk-sounds-de

There was a race condition that lead to incorrect user permissions on
the sounds directory. The solution to use the preStart script is better
and fixes this issue as well.
This commit is contained in:
Jakob Lechner 2023-11-22 14:49:55 +00:00
parent aba0d00afd
commit 2e65116d2d
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
5 changed files with 17 additions and 9 deletions

View file

@ -172,14 +172,6 @@ in
];
};
system.activationScripts.symlink-asterisk-sounds-de = lib.stringAfter [ "var" ] ''
sounds="/var/lib/asterisk/sounds"
sounds_de="$sounds/de"
mkdir -p "$sounds"
[ -L "$sounds_de" ] && rm "$sounds_de"
ln -s "${pkgs.asterisk-sounds-de}/" "$sounds_de"
'';
systemd.services."asterisk-reload-endpoint@" = {
description = "Check if asterisk endpoint is identified and reload it when it is not.";
serviceConfig = {

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
let cfg = config;
in
{
config = lib.mkIf cfg.services.asterisk.enable {
systemd.services.asterisk.preStart = lib.mkMerge [
(lib.mkAfter ''
sounds_de="/var/lib/asterisk/sounds/de"
[ -L "$sounds_de" ] && rm "$sounds_de"
ln -s "${pkgs.asterisk-sounds-de}/" "$sounds_de"
'')
];
};
}

View file

@ -6,7 +6,7 @@ let
in
{
ariang = callPackage ./ariang { };
asterisk-sounds-de = callPackage ./asterisk/sounds-de.nix { };
asterisk-sounds-de = callPackage ./asterisk-sounds-de { };
docker-machine-driver-hetzner = callPackage ./docker-machine-driver-hetzner {
inherit (inputs.gomod2nix.legacyPackages.${system}) buildGoApplication;
};

View file

@ -2,6 +2,7 @@
{
imports = [
./asterisk-sounds-de/module.nix
./myintercom-doorbell/module.nix
./pretix/module.nix
];