diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 4685fe0..fd7baa1 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -50,6 +50,30 @@ 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
+ 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/Cargo.lock b/Cargo.lock
index 648d62f..a06e2f8 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 6bc5502..a83d771 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"
diff --git a/appinfo/info.xml b/appinfo/info.xml
index b4a581f..120793f 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -11,7 +11,7 @@
- 1.3.4
+ 1.3.5
agpl
Robin Appelman
NotifyPush
diff --git a/flake.nix b/flake.nix
index 4bafd83..b87bade 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 0000000..71f2e6d
--- /dev/null
+++ b/nix/overlay.nix
@@ -0,0 +1,17 @@
+/*
+* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
+* SPDX-License-Identifier: AGPL-3.0-or-later
+*/
+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;};
+ });
+}