Commit 1ec311590d
Unregistered key
Layout: unified · split
.github/workflows/ci.yml +22
| @@ -45,3 +45,25 @@ jobs: | |||
| 45 | reporter: 'github-check' | 45 | reporter: 'github-check' |
| 46 | - name: Run tests | 46 | - name: Run tests |
| 47 | run: cargo test --locked | 47 | run: cargo test --locked |
| 48 | |||
| 49 | nix-flake-test: | ||
| 50 | name: Flake checks ❄️ | ||
| 51 | strategy: | ||
| 52 | matrix: | ||
| 53 | platform: [ubuntu-latest, macos-latest] | ||
| 54 | runs-on: ${{ matrix.platform }} | ||
| 55 | steps: | ||
| 56 | - name: Checkout Code | ||
| 57 | uses: actions/checkout@v4 | ||
| 58 | - uses: cachix/install-nix-action@v31 | ||
| 59 | with: | ||
| 60 | github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
| 61 | - uses: cachix/cachix-action@v15 | ||
| 62 | with: | ||
| 63 | name: iamb-prs | ||
| 64 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
| 65 | - name: Flake check | ||
| 66 | run: | | ||
| 67 | nix flake show | ||
| 68 | nix flake check --print-build-logs | ||
| 69 | |||
flake.lock +52 −32
| @@ -1,5 +1,41 @@ | |||
| 1 | { | 1 | { |
| 2 | "nodes": { | 2 | "nodes": { |
| 3 | "crane": { | ||
| 4 | "locked": { | ||
| 5 | "lastModified": 1759893430, | ||
| 6 | "narHash": "sha256-yAy4otLYm9iZ+NtQwTMEbqHwswSFUbhn7x826RR6djw=", | ||
| 7 | "owner": "ipetkov", | ||
| 8 | "repo": "crane", | ||
| 9 | "rev": "1979a2524cb8c801520bd94c38bb3d5692419d93", | ||
| 10 | "type": "github" | ||
| 11 | }, | ||
| 12 | "original": { | ||
| 13 | "owner": "ipetkov", | ||
| 14 | "repo": "crane", | ||
| 15 | "type": "github" | ||
| 16 | } | ||
| 17 | }, | ||
| 18 | "fenix": { | ||
| 19 | "inputs": { | ||
| 20 | "nixpkgs": [ | ||
| 21 | "nixpkgs" | ||
| 22 | ], | ||
| 23 | "rust-analyzer-src": "rust-analyzer-src" | ||
| 24 | }, | ||
| 25 | "locked": { | ||
| 26 | "lastModified": 1760510549, | ||
| 27 | "narHash": "sha256-NP+kmLMm7zSyv4Fufv+eSJXyqjLMUhUfPT6lXRlg/bU=", | ||
| 28 | "owner": "nix-community", | ||
| 29 | "repo": "fenix", | ||
| 30 | "rev": "ef7178cf086f267113b5c48fdeb6e510729c8214", | ||
| 31 | "type": "github" | ||
| 32 | }, | ||
| 33 | "original": { | ||
| 34 | "owner": "nix-community", | ||
| 35 | "repo": "fenix", | ||
| 36 | "type": "github" | ||
| 37 | } | ||
| 38 | }, | ||
| 3 | "flake-utils": { | 39 | "flake-utils": { |
| 4 | "inputs": { | 40 | "inputs": { |
| 5 | "systems": "systems" | 41 | "systems": "systems" |
| @@ -20,11 +56,11 @@ | |||
| 20 | }, | 56 | }, |
| 21 | "nixpkgs": { | 57 | "nixpkgs": { |
| 22 | "locked": { | 58 | "locked": { |
| 23 | "lastModified": 1756542300, | 59 | "lastModified": 1760284886, |
| 24 | "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=", | 60 | "narHash": "sha256-TK9Kr0BYBQ/1P5kAsnNQhmWWKgmZXwUQr4ZMjCzWf2c=", |
| 25 | "owner": "nixos", | 61 | "owner": "nixos", |
| 26 | "repo": "nixpkgs", | 62 | "repo": "nixpkgs", |
| 27 | "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa", | 63 | "rev": "cf3f5c4def3c7b5f1fc012b3d839575dbe552d43", |
| 28 | "type": "github" | 64 | "type": "github" |
| 29 | }, | 65 | }, |
| 30 | "original": { | 66 | "original": { |
| @@ -34,44 +70,28 @@ | |||
| 34 | "type": "github" | 70 | "type": "github" |
| 35 | } | 71 | } |
| 36 | }, | 72 | }, |
| 37 | "nixpkgs_2": { | ||
| 38 | "locked": { | ||
| 39 | "lastModified": 1744536153, | ||
| 40 | "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", | ||
| 41 | "owner": "NixOS", | ||
| 42 | "repo": "nixpkgs", | ||
| 43 | "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", | ||
| 44 | "type": "github" | ||
| 45 | }, | ||
| 46 | "original": { | ||
| 47 | "owner": "NixOS", | ||
| 48 | "ref": "nixpkgs-unstable", | ||
| 49 | "repo": "nixpkgs", | ||
| 50 | "type": "github" | ||
| 51 | } | ||
| 52 | }, | ||
| 53 | "root": { | 73 | "root": { |
| 54 | "inputs": { | 74 | "inputs": { |
| 75 | "crane": "crane", | ||
| 76 | "fenix": "fenix", | ||
| 55 | "flake-utils": "flake-utils", | 77 | "flake-utils": "flake-utils", |
| 56 | "nixpkgs": "nixpkgs", | 78 | "nixpkgs": "nixpkgs" |
| 57 | "rust-overlay": "rust-overlay" | ||
| 58 | } | 79 | } |
| 59 | }, | 80 | }, |
| 60 | "rust-overlay": { | 81 | "rust-analyzer-src": { |
| 61 | "inputs": { | 82 | "flake": false, |
| 62 | "nixpkgs": "nixpkgs_2" | ||
| 63 | }, | ||
| 64 | "locked": { | 83 | "locked": { |
| 65 | "lastModified": 1756694554, | 84 | "lastModified": 1760457219, |
| 66 | "narHash": "sha256-z/Iy4qvcMqzhA2IAAg71Sw4BrMwbBHvCS90ZoPLsnIk=", | 85 | "narHash": "sha256-WJOUGx42hrhmvvYcGkwea+BcJuQJLcns849OnewQqX4=", |
| 67 | "owner": "oxalica", | 86 | "owner": "rust-lang", |
| 68 | "repo": "rust-overlay", | 87 | "repo": "rust-analyzer", |
| 69 | "rev": "b29e5365120f344fe7161f14fc9e272fcc41ee56", | 88 | "rev": "8747cf81540bd1bbbab9ee2702f12c33aa887b46", |
| 70 | "type": "github" | 89 | "type": "github" |
| 71 | }, | 90 | }, |
| 72 | "original": { | 91 | "original": { |
| 73 | "owner": "oxalica", | 92 | "owner": "rust-lang", |
| 74 | "repo": "rust-overlay", | 93 | "ref": "nightly", |
| 94 | "repo": "rust-analyzer", | ||
| 75 | "type": "github" | 95 | "type": "github" |
| 76 | } | 96 | } |
| 77 | }, | 97 | }, |
flake.nix +76 −26
| @@ -5,49 +5,99 @@ | |||
| 5 | inputs = { | 5 | inputs = { |
| 6 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | 6 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; |
| 7 | flake-utils.url = "github:numtide/flake-utils"; | 7 | flake-utils.url = "github:numtide/flake-utils"; |
| 8 | rust-overlay.url = "github:oxalica/rust-overlay"; | 8 | crane.url = "github:ipetkov/crane"; |
| 9 | fenix = { | ||
| 10 | url = "github:nix-community/fenix"; | ||
| 11 | inputs.nixpkgs.follows = "nixpkgs"; | ||
| 12 | }; | ||
| 9 | }; | 13 | }; |
| 10 | 14 | ||
| 11 | outputs = | 15 | outputs = |
| 12 | { | 16 | { |
| 13 | self, | 17 | self, |
| 14 | nixpkgs, | 18 | nixpkgs, |
| 19 | crane, | ||
| 15 | flake-utils, | 20 | flake-utils, |
| 16 | rust-overlay, | 21 | fenix, |
| 17 | ... | 22 | ... |
| 18 | }: | 23 | }: |
| 19 | flake-utils.lib.eachDefaultSystem ( | 24 | flake-utils.lib.eachDefaultSystem ( |
| 20 | system: | 25 | system: |
| 21 | let | 26 | let |
| 22 | # We only need the nightly overlay in the devShell because .rs files are formatted with nightly. | 27 | pkgs = nixpkgs.legacyPackages.${system}; |
| 23 | overlays = [ (import rust-overlay) ]; | 28 | inherit (pkgs) lib; |
| 24 | pkgs = import nixpkgs { inherit system overlays; }; | 29 | |
| 25 | rustNightly = pkgs.rust-bin.nightly."2025-08-31".default; | 30 | rustToolchain = fenix.packages.${system}.fromToolchainFile { |
| 26 | in | 31 | file = ./rust-toolchain.toml; |
| 27 | with pkgs; | 32 | # When the file changes, this hash must be updated. |
| 28 | { | 33 | sha256 = "sha256-Hn2uaQzRLidAWpfmRwSRdImifGUCAb9HeAqTYFXWeQk="; |
| 29 | packages.default = rustPlatform.buildRustPackage { | 34 | }; |
| 35 | |||
| 36 | # Nightly toolchain for rustfmt (pinned to current flake lock) | ||
| 37 | # Note that the github CI uses "current nightly" for formatting, it 's not pinned. | ||
| 38 | rustNightly = fenix.packages.${system}.latest.toolchain; | ||
| 39 | rustNightlyFmt = fenix.packages.${system}.latest.rustfmt; | ||
| 40 | |||
| 41 | craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; | ||
| 42 | craneLibNightly = (crane.mkLib pkgs).overrideToolchain rustNightly; | ||
| 43 | |||
| 44 | src = lib.fileset.toSource { | ||
| 45 | root = ./.; | ||
| 46 | fileset = lib.fileset.unions [ | ||
| 47 | (craneLib.fileset.commonCargoSources ./.) | ||
| 48 | ./src/windows/welcome.md | ||
| 49 | ]; | ||
| 50 | }; | ||
| 51 | |||
| 52 | commonArgs = { | ||
| 53 | inherit src; | ||
| 54 | strictDeps = true; | ||
| 30 | pname = "iamb"; | 55 | pname = "iamb"; |
| 31 | version = self.shortRev or self.dirtyShortRev; | 56 | version = self.shortRev or self.dirtyShortRev; |
| 32 | src = ./.; | 57 | }; |
| 33 | cargoLock = { | 58 | |
| 34 | lockFile = ./Cargo.lock; | 59 | # Build *just* the cargo dependencies, so we can reuse |
| 60 | # all of that work (e.g. via cachix) when running in CI | ||
| 61 | cargoArtifacts = craneLib.buildDepsOnly commonArgs; | ||
| 62 | |||
| 63 | # Build the actual crate | ||
| 64 | iamb = craneLib.buildPackage (commonArgs // { | ||
| 65 | inherit cargoArtifacts; | ||
| 66 | }); | ||
| 67 | in | ||
| 68 | { | ||
| 69 | checks = { | ||
| 70 | # Build the crate as part of `nix flake check` | ||
| 71 | inherit iamb; | ||
| 72 | |||
| 73 | iamb-clippy = craneLib.cargoClippy (commonArgs // { | ||
| 74 | inherit cargoArtifacts; | ||
| 75 | cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | ||
| 76 | }); | ||
| 77 | |||
| 78 | iamb-fmt = craneLibNightly.cargoFmt { | ||
| 79 | inherit src; | ||
| 35 | }; | 80 | }; |
| 36 | nativeBuildInputs = [ pkg-config ]; | 81 | |
| 37 | buildInputs = [ openssl ]; | 82 | iamb-nextest = craneLib.cargoNextest (commonArgs // { |
| 83 | inherit cargoArtifacts; | ||
| 84 | partitions = 1; | ||
| 85 | partitionType = "count"; | ||
| 86 | }); | ||
| 38 | }; | 87 | }; |
| 39 | 88 | ||
| 40 | devShell = mkShell { | 89 | packages.default = iamb; |
| 41 | buildInputs = [ | 90 | |
| 42 | (rustNightly.override { | 91 | apps.default = flake-utils.lib.mkApp { |
| 43 | extensions = [ | 92 | drv = iamb; |
| 44 | "rust-src" | 93 | }; |
| 45 | "rust-analyzer-preview" | 94 | |
| 46 | "rustfmt" | 95 | devShells.default = craneLib.devShell { |
| 47 | "clippy" | 96 | # Inherit inputs from checks |
| 48 | ]; | 97 | checks = self.checks.${system}; |
| 49 | }) | 98 | |
| 50 | pkg-config | 99 | packages = with pkgs; [ |
| 100 | rustNightlyFmt | ||
| 51 | cargo-tarpaulin | 101 | cargo-tarpaulin |
| 52 | cargo-watch | 102 | cargo-watch |
| 53 | sqlite | 103 | sqlite |
src/notifications.rs +1
| @@ -139,6 +139,7 @@ async fn send_notification_bell(store: &AsyncProgramStore) { | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | #[cfg(feature = "desktop")] | 141 | #[cfg(feature = "desktop")] |
| 142 | #[cfg_attr(target_os = "macos", allow(unused_variables))] | ||
| 142 | async fn send_notification_desktop( | 143 | async fn send_notification_desktop( |
| 143 | summary: &str, | 144 | summary: &str, |
| 144 | body: Option<&str>, | 145 | body: Option<&str>, |