From 892ab8d49b3b2d5add2f338e3f57a61ae447f35e Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 14 Nov 2025 09:13:59 +0100 Subject: [PATCH 1/4] nix: update flake lock, disable diff by default for flake.lock Signed-off-by: Rory& --- .gitattributes | 1 + flake.lock | 58 +++++++++++++++++--------------------------------- 2 files changed, 21 insertions(+), 38 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..b44acd74c23 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +flake.lock -diff diff --git a/flake.lock b/flake.lock index a6a2aea3285..7d4e420edd2 100644 --- a/flake.lock +++ b/flake.lock @@ -39,15 +39,12 @@ } }, "flake-utils": { - "inputs": { - "systems": "systems" - }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -152,27 +149,27 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1729265718, - "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", + "lastModified": 1762943920, + "narHash": "sha256-ITeH8GBpQTw9457ICZBddQEBjlXMmilML067q0e6vqY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ccc0c2126893dd20963580b6478d1a10a4512185", + "rev": "91c9a64ce2a84e648d0cf9671274bb9c2fb9ba60", "type": "github" }, "original": { @@ -184,11 +181,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1728538411, - "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", "type": "github" }, "original": { @@ -213,11 +210,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1688056373, - "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "lastModified": 1686050334, + "narHash": "sha256-R0mczWjDzBpIvM3XXhO908X5e2CQqjyh/gFbwZk/7/Q=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "rev": "6881eb2ae5d8a3516e34714e7a90d9d95914c4dc", "type": "github" }, "original": { @@ -231,7 +228,7 @@ "devenv": "devenv", "nixpkgs": "nixpkgs_2", "rust-overlay": "rust-overlay", - "systems": "systems_2" + "systems": "systems" } }, "rust-overlay": { @@ -239,11 +236,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1731897198, - "narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=", + "lastModified": 1763087910, + "narHash": "sha256-eB9Z1mWd1U6N61+F8qwDggX0ihM55s4E0CluwNukJRU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "0be641045af6d8666c11c2c40e45ffc9667839b5", + "rev": "cf4a68749733d45c0420726596367acd708eb2e8", "type": "github" }, "original": { @@ -266,21 +263,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", From fe0ce7289f5e7dcff089cb8eecff361e645a1798 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 14 Nov 2025 14:39:06 +0100 Subject: [PATCH 2/4] Update devenv from 0.6.3 to 1.10 Signed-off-by: Rory& --- flake.lock | 228 +++++++++++++++++++++++++++-------------------------- flake.nix | 19 ++++- 2 files changed, 133 insertions(+), 114 deletions(-) diff --git a/flake.lock b/flake.lock index 7d4e420edd2..600b802d058 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,57 @@ { "nodes": { + "cachix": { + "inputs": { + "devenv": [ + "devenv" + ], + "flake-compat": [ + "devenv" + ], + "git-hooks": [ + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752264895, + "narHash": "sha256-1zBPE/PNAkPNUsOWFET4J0cjlvziH8DOekesDmjND+w=", + "owner": "cachix", + "repo": "cachix", + "rev": "47053aef762f452e816e44eb9a23fbc3827b241a", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, "devenv": { "inputs": { + "cachix": "cachix", "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", "nix": "nix", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1688058187, - "narHash": "sha256-ipDcc7qrucpJ0+0eYNlwnE+ISTcq4m03qW+CWUshRXI=", + "lastModified": 1759795821, + "narHash": "sha256-rsb+6Wca43guzLL4Czoc89L394ZW9JZF2MShxaz2Sx4=", "owner": "cachix", "repo": "devenv", - "rev": "c8778e3dc30eb9043e218aaa3861d42d4992de77", + "rev": "6880d8946d4a02b1fd2c74f2b6a342f45034b483", "type": "github" }, "original": { "owner": "cachix", - "ref": "v0.6.3", + "ref": "v1.10", "repo": "devenv", "type": "github" } @@ -25,11 +59,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -38,128 +72,128 @@ "type": "github" } }, - "flake-utils": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "gitignore": { + "git-hooks": { "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "gitignore": "gitignore", "nixpkgs": [ "devenv", - "pre-commit-hooks", "nixpkgs" ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "lastModified": 1758108966, + "narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, - "lowdown-src": { - "flake": false, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "git-hooks", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { - "owner": "kristapsdz", - "repo": "lowdown", + "owner": "hercules-ci", + "repo": "gitignore.nix", "type": "github" } }, "nix": { "inputs": { - "lowdown-src": "lowdown-src", + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-parts": [ + "devenv", + "flake-parts" + ], + "git-hooks-nix": [ + "devenv", + "git-hooks" + ], "nixpkgs": [ "devenv", "nixpkgs" ], - "nixpkgs-regression": "nixpkgs-regression" + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ] }, "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", - "owner": "domenkozar", + "lastModified": 1758763079, + "narHash": "sha256-Bx1A+lShhOWwMuy3uDzZQvYiBKBFcKwy6G6NEohhv6A=", + "owner": "cachix", "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "rev": "6f0140527c2b0346df4afad7497baa08decb929f", "type": "github" }, "original": { - "owner": "domenkozar", - "ref": "relaxed-flakes", + "owner": "cachix", + "ref": "devenv-2.30.5", "repo": "nix", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1678875422, - "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "lastModified": 1758532697, + "narHash": "sha256-bhop0bR3u7DCw9/PtLCwr7GwEWDlBSxHp+eVQhCW9t4=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "207a4cb0e1253c7658c6736becc6eb9cace1f25f", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", "type": "github" } }, @@ -195,34 +229,6 @@ "type": "github" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "devenv", - "flake-compat" - ], - "flake-utils": "flake-utils", - "gitignore": "gitignore", - "nixpkgs": [ - "devenv", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1686050334, - "narHash": "sha256-R0mczWjDzBpIvM3XXhO908X5e2CQqjyh/gFbwZk/7/Q=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "6881eb2ae5d8a3516e34714e7a90d9d95914c4dc", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "devenv": "devenv", diff --git a/flake.nix b/flake.nix index 4ff6518aed7..bb6d7a54ba5 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,7 @@ # Output a development shell for x86_64/aarch64 Linux/Darwin (MacOS). systems.url = "github:nix-systems/default"; # A development environment manager built on Nix. See https://devenv.sh. - devenv.url = "github:cachix/devenv/v0.6.3"; + devenv.url = "github:cachix/devenv/v1.10"; # Rust toolchain. rust-overlay.url = "github:oxalica/rust-overlay"; }; @@ -82,7 +82,7 @@ # # NOTE: We currently need to set the Rust version unnecessarily high # in order to work around https://github.com/matrix-org/synapse/issues/15939 - (rust-bin.stable."1.82.0".default.override { + (rust-bin.stable."1.88.0".default.override { # Additionally install the "rust-src" extension to allow diving into the # Rust source code in an IDE (rust-analyzer will also make use of it). extensions = [ "rust-src" ]; @@ -117,6 +117,9 @@ # For releasing Synapse debian-devscripts # (`dch` for manipulating the Debian changelog) libnotify # (the release script uses `notify-send` to tell you when CI jobs are done) + + # For building psychopg2 from source, if needed + postgresql.pg_config ]; # Install Python and manage a virtualenv with Poetry. @@ -139,6 +142,9 @@ # force compiling those binaries locally instead. env.POETRY_INSTALLER_NO_BINARY = "ruff"; + # Workaround to make cargo fetch git repositories with the git CLI + env.CARGO_NET_GIT_FETCH_WITH_CLI = "true"; + # Install dependencies for the additional programming languages # involved with Synapse development. # @@ -152,6 +158,8 @@ # Postgres is needed to run Synapse with postgres support and # to run certain unit tests that require postgres. services.postgres.enable = true; + services.postgres.port = 28743; # Use a non-standard port to avoid conflicts + services.postgres.package = pkgs.postgresql_17; # The default in nixpkgs stable # On the first invocation of `devenv up`, create a database for # Synapse to store data in. @@ -174,7 +182,9 @@ # * ensures a directory containing two additional homeserver config files exists; # one to configure using the development environment's PostgreSQL as the # database backend and another for enabling Redis support. - process.before = '' + process.manager.before = '' + # Ensure the venv is activated explicitly, in order not to confuse poetry + . .venv/bin/activate python -m synapse.app.homeserver -c homeserver.yaml --generate-config --server-name=synapse.dev --report-stats=no mkdir -p homeserver-config-overrides.d cat > homeserver-config-overrides.d/database.yaml << EOF @@ -250,7 +260,10 @@ # When LD_LIBRARY_PATH is set, system tools will attempt to use the development environment's # libraries. Which, when built against a different glibc version lead, to "version 'GLIBC_X.YY' # not found" errors. + # + # Additionally, activate the python venv explicitly in order to avoid poetry getting confused enterShell = '' + . .venv/bin/activate unset LD_LIBRARY_PATH ''; } From ead471569b9e22e6847fcf9233380e17b5dea4ea Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 14 Nov 2025 14:41:19 +0100 Subject: [PATCH 3/4] Add shortcut script to run tests Signed-off-by: Rory& --- scripts-dev/test.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 scripts-dev/test.sh diff --git a/scripts-dev/test.sh b/scripts-dev/test.sh new file mode 100755 index 00000000000..1ac82801b2e --- /dev/null +++ b/scripts-dev/test.sh @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +poetry run trial -j`nproc` tests From 584701ec7a3e29efa83f897f6e3876b7d16f74d9 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 14 Nov 2025 14:48:46 +0100 Subject: [PATCH 4/4] Add changelog Signed-off-by: Rory& --- changelog.d/19185.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/19185.misc diff --git a/changelog.d/19185.misc b/changelog.d/19185.misc new file mode 100644 index 00000000000..afd7de2dd9f --- /dev/null +++ b/changelog.d/19185.misc @@ -0,0 +1 @@ +Update in-tree nix flake to make it work again, bump required dependencies and remove conflicts with pre-existing postgres on host (fixes developing under NixOS). Contributed by Emma [it/its] @ Rory&.