From af844471b3cbc3d1b77a2fbf41a9dbdd052144e9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Jul 2026 16:28:58 +0200 Subject: [PATCH 1/4] test: reuse nixos' notify_push test as extra integration test Signed-off-by: Robin Appelman --- .github/workflows/rust.yml | 12 +++++ flake.nix | 107 ++++++++++++++++++++----------------- nix/overlay.nix | 13 +++++ 3 files changed, 84 insertions(+), 48 deletions(-) create mode 100644 nix/overlay.nix diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4685fe09..b3eae371 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,6 +50,18 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix build .#test + nixos-tests: + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 + - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 + with: + name: notify-push + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: nix build .#checks.x86_64-linux.nixosTest + matrix: runs-on: ubuntu-latest-low outputs: diff --git a/flake.nix b/flake.nix index 4bafd836..b87bade2 100644 --- a/flake.nix +++ b/flake.nix @@ -11,19 +11,20 @@ cross-naersk.inputs.naersk.follows = "naersk"; }; - outputs = - { - self, - nixpkgs, - utils, - naersk, - rust-overlay, - cross-naersk, - }: + outputs = inputs @ { + self, + nixpkgs, + utils, + naersk, + rust-overlay, + cross-naersk, + }: utils.lib.eachDefaultSystem ( - system: - let - overlays = [ (import rust-overlay) ]; + system: let + overlays = [ + (import rust-overlay) + (import ./nix/overlay.nix) + ]; pkgs = import nixpkgs { inherit system overlays; }; @@ -68,15 +69,16 @@ pname = "notify_push"; inherit src; }; - testClientOpts = nearskOpt // { - cargoBuildOptions = - x: - x - ++ [ - "-p" - "test_client" - ]; - }; + testClientOpts = + nearskOpt + // { + cargoBuildOptions = x: + x + ++ [ + "-p" + "test_client" + ]; + }; buildServer = target: (cross-naersk'.buildPackage target) nearskOpt; buildTestClient = target: (cross-naersk'.buildPackage target) testClientOpts; hostNaersk = cross-naersk'.hostNaersk; @@ -89,39 +91,37 @@ msrv = (fromTOML (readFile ./Cargo.toml)).package.rust-version; msrvToolchain = pkgs.rust-bin.stable."${msrv}".default; - naerskMsrv = - let - toolchain = msrvToolchain; - in + naerskMsrv = let + toolchain = msrvToolchain; + in pkgs.callPackage naersk { cargo = toolchain; rustc = toolchain; }; testClientArtifactForTarget = target: "test_client${execSufficForTarget target}"; - - in - rec { + in { # `nix build` packages = # cross compile notify_push for all targets (genAttrs targets buildServer) // - # cross compile build test_client for all test_client-targets - (listToAttrs ( - map (target: nameValuePair "test_client-${target}" (buildTestClient target)) clientTargets - )) + # cross compile build test_client for all test_client-targets + (listToAttrs ( + map (target: nameValuePair "test_client-${target}" (buildTestClient target)) clientTargets + )) // - # check,test,clippy for notify_push - (genAttrs checks (mode: hostNaersk.buildPackage (nearskOpt // { inherit mode; }))) + # check,test,clippy for notify_push + (genAttrs checks (mode: hostNaersk.buildPackage (nearskOpt // {inherit mode;}))) // - # check,test,clippy for test_client - (listToAttrs ( - map ( - mode: - nameValuePair "test_client-${mode}" (hostNaersk.buildPackage (testClientOpts // { inherit mode; })) - ) checks - )) + # check,test,clippy for test_client + (listToAttrs ( + map ( + mode: + nameValuePair "test_client-${mode}" (hostNaersk.buildPackage (testClientOpts // {inherit mode;})) + ) + checks + )) // rec { notify_push = hostNaersk.buildPackage nearskOpt; test_client = hostNaersk.buildPackage testClientOpts; @@ -132,20 +132,31 @@ } ); default = notify_push; + nixPkgs = pkgs.nextcloud-notify_push; }; inherit targets clientTargets; testClientMatrix = { - include = map (target: { - inherit target; - extension = execSufficForTarget target; - }) clientTargets; + include = + map (target: { + inherit target; + extension = execSufficForTarget target; + }) + clientTargets; + }; + + checks = { + nixosTest = pkgs.nextcloud-notify_push.tests.with-postgresql-and-redis34.extendNixOS { + module = { + services.nextcloud.notify_push.package = hostNaersk.buildPackage nearskOpt; + }; + }; }; devShells = { - default = cross-naersk'.mkShell [ "x86_64-unknown-linux-gnu" ] { + default = cross-naersk'.mkShell ["x86_64-unknown-linux-gnu"] { nativeBuildInputs = with pkgs; [ - (rust-bin.stable.latest.default.override { targets = targets ++ [ hostTarget ]; }) + (rust-bin.stable.latest.default.override {targets = targets ++ [hostTarget];}) krankerl cargo-edit cargo-outdated @@ -155,7 +166,7 @@ phpPackages.composer ]; }; - msrv = cross-naersk'.mkShell [ "x86_64-unknown-linux-gnu" ] { + msrv = cross-naersk'.mkShell ["x86_64-unknown-linux-gnu"] { nativeBuildInputs = [ msrvToolchain ]; diff --git a/nix/overlay.nix b/nix/overlay.nix new file mode 100644 index 00000000..7aa9ca90 --- /dev/null +++ b/nix/overlay.nix @@ -0,0 +1,13 @@ +final: prev: let + inherit (prev) lib; +in { + nextcloud-notify_push = prev.nextcloud-notify_push.overrideAttrs (finalAttrs: previousAttrs: { + version = "develop"; + src = lib.sources.sourceByRegex (lib.cleanSource ../.) [ + "Cargo.*" + "(src|tests|test_client|build.rs|appinfo)(/.*)?" + ]; + + cargoDeps = prev.rustPlatform.importCargoLock {lockFile = ../Cargo.lock;}; + }); +} From cfe3134a4e49077d2c19e8cd724557b40e66dae0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Jul 2026 16:34:47 +0200 Subject: [PATCH 2/4] fix: workaround upstream socket regression Signed-off-by: Robin Appelman --- Cargo.lock | 34 ++++++++++++++++++++++++++++++++++ Cargo.toml | 2 ++ 2 files changed, 36 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 648d62f0..a06e2f8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1492,6 +1492,15 @@ version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +[[package]] +name = "libredox" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" +dependencies = [ + "libc", +] + [[package]] name = "libsqlite3-sys" version = "0.30.1" @@ -1757,6 +1766,7 @@ dependencies = [ "warp", "warp-real-ip", "webpki-root-certs", + "whoami", ] [[package]] @@ -1777,6 +1787,24 @@ dependencies = [ "autocfg", ] +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.0", +] + +[[package]] +name = "objc2-system-configuration" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" +dependencies = [ + "objc2-core-foundation", +] + [[package]] name = "object" version = "0.37.3" @@ -3837,6 +3865,12 @@ name = "whoami" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "998767ef88740d1f5b0682a9c53c24431453923962269c2db68ee43788c5a40d" +dependencies = [ + "libc", + "libredox", + "objc2-system-configuration", + "web-sys", +] [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index 6bc5502b..a83d771e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,8 @@ url = "2.5.8" clap = { version = "4.6.1", features = ["derive"] } sd-notify = { version = "0.5.0", optional = true } webpki-root-certs = "1.0.8" +# https://github.com/transact-rs/sqlx/pull/4303 should be safe to remove after the next sqlx release +whoami = { version = "2.0.2", features = ["std"], default-features = false } [dev-dependencies] mini-redis = "0.4.1" From 9c6ecbd2bf2636990c4182daefac3de7301ef52b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Jul 2026 16:35:04 +0200 Subject: [PATCH 3/4] chore: 1.3.5 Signed-off-by: Robin Appelman --- appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index b4a581f2..120793f1 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -11,7 +11,7 @@ - 1.3.4 + 1.3.5 agpl Robin Appelman NotifyPush From e54198fcd60544012137cc2ac74d67832566fe5d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 24 Jul 2026 16:43:22 +0200 Subject: [PATCH 4/4] test: build nixos package in testing Signed-off-by: Robin Appelman --- .github/workflows/rust.yml | 12 ++++++++++++ nix/overlay.nix | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b3eae371..fd7baa12 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,6 +50,18 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: nix build .#test + nixos-build: + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 + - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 + with: + name: notify-push + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: nix build .#nixPkgs + nixos-tests: runs-on: ubuntu-latest needs: check diff --git a/nix/overlay.nix b/nix/overlay.nix index 7aa9ca90..71f2e6d6 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,3 +1,7 @@ +/* +* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +* SPDX-License-Identifier: AGPL-3.0-or-later +*/ final: prev: let inherit (prev) lib; in {