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 a08b3a4d19.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
parent b32a094368
commit 4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions

View File

@@ -1,4 +1,5 @@
import ../make-test-python.nix ({ pkgs, ... }:
import ../make-test-python.nix (
{ pkgs, ... }:
let
homeserverDomain = "server";
homeserverUrl = "http://server:8008";
@@ -13,145 +14,158 @@ import ../make-test-python.nix ({ pkgs, ... }:
meta.maintainers = pkgs.mautrix-meta.meta.maintainers;
nodes = {
server = { config, pkgs, ... }: {
services.postgresql = {
enable = true;
server =
{ config, pkgs, ... }:
{
services.postgresql = {
enable = true;
ensureUsers = [
{
name = "mautrix-meta-instagram";
ensureDBOwnership = true;
}
];
ensureUsers = [
{
name = "mautrix-meta-instagram";
ensureDBOwnership = true;
}
];
ensureDatabases = [
"mautrix-meta-instagram"
];
};
systemd.services.mautrix-meta-instagram = {
wants = [ "postgres.service" ];
after = [ "postgres.service" ];
};
services.matrix-synapse = {
enable = true;
settings = {
database.name = "sqlite3";
enable_registration = true;
# don't use this in production, always use some form of verification
enable_registration_without_verification = true;
listeners = [ {
# The default but tls=false
bind_addresses = [
"0.0.0.0"
];
port = 8008;
resources = [ {
"compress" = true;
"names" = [ "client" ];
} {
"compress" = false;
"names" = [ "federation" ];
} ];
tls = false;
type = "http";
} ];
ensureDatabases = [
"mautrix-meta-instagram"
];
};
};
services.mautrix-meta.instances.instagram = {
enable = true;
systemd.services.mautrix-meta-instagram = {
wants = [ "postgres.service" ];
after = [ "postgres.service" ];
};
environmentFile = pkgs.writeText ''my-secrets'' ''
AS_TOKEN=${asToken}
HS_TOKEN=${hsToken}
'';
services.matrix-synapse = {
enable = true;
settings = {
database.name = "sqlite3";
settings = {
homeserver = {
address = homeserverUrl;
domain = homeserverDomain;
enable_registration = true;
# don't use this in production, always use some form of verification
enable_registration_without_verification = true;
listeners = [
{
# The default but tls=false
bind_addresses = [
"0.0.0.0"
];
port = 8008;
resources = [
{
"compress" = true;
"names" = [ "client" ];
}
{
"compress" = false;
"names" = [ "federation" ];
}
];
tls = false;
type = "http";
}
];
};
};
appservice = {
port = 8009;
services.mautrix-meta.instances.instagram = {
enable = true;
as_token = "$AS_TOKEN";
hs_token = "$HS_TOKEN";
environmentFile = pkgs.writeText ''my-secrets'' ''
AS_TOKEN=${asToken}
HS_TOKEN=${hsToken}
'';
database = {
type = "postgres";
uri = "postgres:///mautrix-meta-instagram?host=/var/run/postgresql";
settings = {
homeserver = {
address = homeserverUrl;
domain = homeserverDomain;
};
bot.username = botUserName;
};
appservice = {
port = 8009;
bridge.permissions."@${userName}:server" = "user";
as_token = "$AS_TOKEN";
hs_token = "$HS_TOKEN";
database = {
type = "postgres";
uri = "postgres:///mautrix-meta-instagram?host=/var/run/postgresql";
};
bot.username = botUserName;
};
bridge.permissions."@${userName}:server" = "user";
};
};
networking.firewall.allowedTCPPorts = [
8008
8009
];
};
networking.firewall.allowedTCPPorts = [ 8008 8009 ];
};
client =
{ pkgs, ... }:
{
environment.systemPackages = [
(pkgs.writers.writePython3Bin "do_test"
{
libraries = [ pkgs.python3Packages.matrix-nio ];
flakeIgnore = [
# We don't live in the dark ages anymore.
# Languages like Python that are whitespace heavy will overrun
# 79 characters..
"E501"
];
}
''
import sys
import functools
import asyncio
client = { pkgs, ... }: {
environment.systemPackages = [
(pkgs.writers.writePython3Bin "do_test"
{
libraries = [ pkgs.python3Packages.matrix-nio ];
flakeIgnore = [
# We don't live in the dark ages anymore.
# Languages like Python that are whitespace heavy will overrun
# 79 characters..
"E501"
];
} ''
import sys
import functools
import asyncio
from nio import AsyncClient, RoomMessageNotice, RoomCreateResponse, RoomInviteResponse
from nio import AsyncClient, RoomMessageNotice, RoomCreateResponse, RoomInviteResponse
async def message_callback(matrix: AsyncClient, msg: str, _r, e):
print("Received matrix text message: ", e)
assert msg in e.body
exit(0) # Success!
async def message_callback(matrix: AsyncClient, msg: str, _r, e):
print("Received matrix text message: ", e)
assert msg in e.body
exit(0) # Success!
async def run(homeserver: str):
matrix = AsyncClient(homeserver)
response = await matrix.register("${userName}", "foobar")
print("Matrix register response: ", response)
async def run(homeserver: str):
matrix = AsyncClient(homeserver)
response = await matrix.register("${userName}", "foobar")
print("Matrix register response: ", response)
# Open a DM with the bridge bot
response = await matrix.room_create()
print("Matrix create room response:", response)
assert isinstance(response, RoomCreateResponse)
room_id = response.room_id
# Open a DM with the bridge bot
response = await matrix.room_create()
print("Matrix create room response:", response)
assert isinstance(response, RoomCreateResponse)
room_id = response.room_id
response = await matrix.room_invite(room_id, "@${botUserName}:${homeserverDomain}")
assert isinstance(response, RoomInviteResponse)
response = await matrix.room_invite(room_id, "@${botUserName}:${homeserverDomain}")
assert isinstance(response, RoomInviteResponse)
callback = functools.partial(
message_callback, matrix, "Hello, I'm an Instagram bridge bot."
)
matrix.add_event_callback(callback, RoomMessageNotice)
callback = functools.partial(
message_callback, matrix, "Hello, I'm an Instagram bridge bot."
)
matrix.add_event_callback(callback, RoomMessageNotice)
print("Waiting for matrix message...")
await matrix.sync_forever(timeout=30000)
print("Waiting for matrix message...")
await matrix.sync_forever(timeout=30000)
if __name__ == "__main__":
asyncio.run(run(sys.argv[1]))
''
)
];
};
if __name__ == "__main__":
asyncio.run(run(sys.argv[1]))
''
)
];
};
};
testScript = ''
@@ -218,4 +232,5 @@ import ../make-test-python.nix ({ pkgs, ... }:
assert as_token_registration == expected_as_token, f"as_token in registration should match the one specified (is: {as_token_registration}, expected: {expected_as_token})"
assert hs_token_registration == expected_hs_token, f"hs_token in registration should match the one specified (is: {hs_token_registration}, expected: {expected_hs_token})"
'';
})
}
)