Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<description><![CDATA[Push update support for desktop app.
Once the app is installed, the push binary needs to be setup. You can either use the setup wizard with `occ notify_push:setup` or see the [README](http://github.com/nextcloud/notify_push) for detailed setup instructions]]></description>
<version>1.3.4</version>
<version>1.3.5</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<namespace>NotifyPush</namespace>
Expand Down
107 changes: 59 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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
];
Expand Down
17 changes: 17 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -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;};
});
}
Loading