treewide: format all inactive Nix files

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
Silvan Mosberger 2024-12-10 20:26:33 +01:00
commit 4f0dadbf38
21293 changed files with 706929 additions and 433885 deletions

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.jigasi;
homeDirName = "jigasi-home";
@ -113,119 +118,127 @@ in
"org.jitsi.jigasi.BRIDGE_MUC" = cfg.bridgeMuc;
};
users.groups.jitsi-meet = {};
users.groups.jitsi-meet = { };
systemd.services.jigasi = let
jigasiProps = {
"-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION" = "${stateDir}";
"-Dnet.java.sip.communicator.SC_HOME_DIR_NAME" = "${homeDirName}";
"-Djava.util.logging.config.file" = "${pkgs.jigasi}/etc/jitsi/jigasi/logging.properties";
systemd.services.jigasi =
let
jigasiProps = {
"-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION" = "${stateDir}";
"-Dnet.java.sip.communicator.SC_HOME_DIR_NAME" = "${homeDirName}";
"-Djava.util.logging.config.file" = "${pkgs.jigasi}/etc/jitsi/jigasi/logging.properties";
};
in
{
description = "Jitsi Gateway to SIP";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
preStart = ''
[ -f "${sipCommunicatorPropertiesFile}" ] && rm -f "${sipCommunicatorPropertiesFile}"
mkdir -p "$(dirname ${sipCommunicatorPropertiesFile})"
temp="${sipCommunicatorPropertiesFile}.unsubstituted"
export DOMAIN_BASE="${cfg.xmppDomain}"
export JIGASI_XMPP_PASSWORD=$(cat "${cfg.userPasswordFile}")
export JIGASI_DEFAULT_JVB_ROOM_NAME="${cfg.defaultJvbRoomName}"
# encode the credentials to base64
export JIGASI_SIPPWD=$(echo -n "$JIGASI_SIPPWD" | base64 -w 0)
export JIGASI_XMPP_PASSWORD_BASE64=$(cat "${cfg.userPasswordFile}" | base64 -w 0)
cp "${sipCommunicatorPropertiesFileUnsubstituted}" "$temp"
chmod 644 "$temp"
cat <<EOF >>"$temp"
net.java.sip.communicator.impl.protocol.sip.acc1403273890647.SERVER_PORT=$JIGASI_SIPPORT
net.java.sip.communicator.impl.protocol.sip.acc1403273890647.PREFERRED_TRANSPORT=udp
EOF
chmod 444 "$temp"
# Replace <<$VAR_NAME>> from example config to $VAR_NAME for environment substitution
sed -i -E \
's/<<([^>]+)>>/\$\1/g' \
"$temp"
sed -i \
's|\(net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc-xmpp-1\.PASSWORD=\).*|\1\$JIGASI_XMPP_PASSWORD_BASE64|g' \
"$temp"
sed -i \
's|\(#\)\(org.jitsi.jigasi.DEFAULT_JVB_ROOM_NAME=\).*|\2\$JIGASI_DEFAULT_JVB_ROOM_NAME|g' \
"$temp"
${pkgs.envsubst}/bin/envsubst \
-o "${sipCommunicatorPropertiesFile}" \
-i "$temp"
# Set the brewery room name
sed -i \
's|\(net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc-xmpp-1\.BREWERY=\).*|\1${cfg.bridgeMuc}|g' \
"${sipCommunicatorPropertiesFile}"
sed -i \
's|\(org\.jitsi\.jigasi\.ALLOWED_JID=\).*|\1${cfg.bridgeMuc}|g' \
"${sipCommunicatorPropertiesFile}"
# Disable certificate verification for self-signed certificates
sed -i \
's|\(# \)\(net.java.sip.communicator.service.gui.ALWAYS_TRUST_MODE_ENABLED=true\)|\2|g' \
"${sipCommunicatorPropertiesFile}"
'';
restartTriggers = [
config.environment.etc."jitsi/jigasi/sip-communicator.properties".source
];
environment.JAVA_SYS_PROPS = lib.concatStringsSep " " (
lib.mapAttrsToList (k: v: "${k}=${toString v}") jigasiProps
);
script = ''
${pkgs.jigasi}/bin/jigasi \
--host="${cfg.xmppHost}" \
--domain="${if cfg.xmppDomain == null then cfg.xmppHost else cfg.xmppDomain}" \
--secret="$(cat ${cfg.componentPasswordFile})" \
--user_name="${cfg.userName}" \
--user_domain="${cfg.userDomain}" \
--user_password="$(cat ${cfg.userPasswordFile})" \
--configdir="${stateDir}" \
--configdirname="${homeDirName}"
'';
serviceConfig = {
Type = "exec";
DynamicUser = true;
User = "jigasi";
Group = "jitsi-meet";
CapabilityBoundingSet = "";
NoNewPrivileges = true;
ProtectSystem = "strict";
ProtectHome = true;
PrivateTmp = true;
PrivateDevices = true;
ProtectHostname = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
];
RestrictNamespaces = true;
LockPersonality = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
StateDirectory = baseNameOf stateDir;
EnvironmentFile = cfg.environmentFile;
};
};
in
{
description = "Jitsi Gateway to SIP";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
preStart = ''
[ -f "${sipCommunicatorPropertiesFile}" ] && rm -f "${sipCommunicatorPropertiesFile}"
mkdir -p "$(dirname ${sipCommunicatorPropertiesFile})"
temp="${sipCommunicatorPropertiesFile}.unsubstituted"
export DOMAIN_BASE="${cfg.xmppDomain}"
export JIGASI_XMPP_PASSWORD=$(cat "${cfg.userPasswordFile}")
export JIGASI_DEFAULT_JVB_ROOM_NAME="${cfg.defaultJvbRoomName}"
# encode the credentials to base64
export JIGASI_SIPPWD=$(echo -n "$JIGASI_SIPPWD" | base64 -w 0)
export JIGASI_XMPP_PASSWORD_BASE64=$(cat "${cfg.userPasswordFile}" | base64 -w 0)
cp "${sipCommunicatorPropertiesFileUnsubstituted}" "$temp"
chmod 644 "$temp"
cat <<EOF >>"$temp"
net.java.sip.communicator.impl.protocol.sip.acc1403273890647.SERVER_PORT=$JIGASI_SIPPORT
net.java.sip.communicator.impl.protocol.sip.acc1403273890647.PREFERRED_TRANSPORT=udp
EOF
chmod 444 "$temp"
# Replace <<$VAR_NAME>> from example config to $VAR_NAME for environment substitution
sed -i -E \
's/<<([^>]+)>>/\$\1/g' \
"$temp"
sed -i \
's|\(net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc-xmpp-1\.PASSWORD=\).*|\1\$JIGASI_XMPP_PASSWORD_BASE64|g' \
"$temp"
sed -i \
's|\(#\)\(org.jitsi.jigasi.DEFAULT_JVB_ROOM_NAME=\).*|\2\$JIGASI_DEFAULT_JVB_ROOM_NAME|g' \
"$temp"
${pkgs.envsubst}/bin/envsubst \
-o "${sipCommunicatorPropertiesFile}" \
-i "$temp"
# Set the brewery room name
sed -i \
's|\(net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc-xmpp-1\.BREWERY=\).*|\1${cfg.bridgeMuc}|g' \
"${sipCommunicatorPropertiesFile}"
sed -i \
's|\(org\.jitsi\.jigasi\.ALLOWED_JID=\).*|\1${cfg.bridgeMuc}|g' \
"${sipCommunicatorPropertiesFile}"
# Disable certificate verification for self-signed certificates
sed -i \
's|\(# \)\(net.java.sip.communicator.service.gui.ALWAYS_TRUST_MODE_ENABLED=true\)|\2|g' \
"${sipCommunicatorPropertiesFile}"
'';
restartTriggers = [
config.environment.etc."jitsi/jigasi/sip-communicator.properties".source
];
environment.JAVA_SYS_PROPS = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${toString v}") jigasiProps);
script = ''
${pkgs.jigasi}/bin/jigasi \
--host="${cfg.xmppHost}" \
--domain="${if cfg.xmppDomain == null then cfg.xmppHost else cfg.xmppDomain}" \
--secret="$(cat ${cfg.componentPasswordFile})" \
--user_name="${cfg.userName}" \
--user_domain="${cfg.userDomain}" \
--user_password="$(cat ${cfg.userPasswordFile})" \
--configdir="${stateDir}" \
--configdirname="${homeDirName}"
'';
serviceConfig = {
Type = "exec";
DynamicUser = true;
User = "jigasi";
Group = "jitsi-meet";
CapabilityBoundingSet = "";
NoNewPrivileges = true;
ProtectSystem = "strict";
ProtectHome = true;
PrivateTmp = true;
PrivateDevices = true;
ProtectHostname = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectControlGroups = true;
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
RestrictNamespaces = true;
LockPersonality = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
StateDirectory = baseNameOf stateDir;
EnvironmentFile = cfg.environmentFile;
};
};
environment.etc."jitsi/jigasi/sip-communicator.properties".source =
lib.mkDefault "${sipCommunicatorPropertiesFile}";
environment.etc."jitsi/jigasi/sip-communicator.properties".source = lib.mkDefault "${
sipCommunicatorPropertiesFile
}";
environment.etc."jitsi/jigasi/logging.properties".source =
lib.mkDefault "${stateDir}/logging.properties-journal";
};