diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index e7bfe38..f886cd6 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -38,6 +38,13 @@ jobs: - uses: cachix/install-nix-action@v31 + # Pulls from the project's binary cache, and pushes what this run built + # when the token is there; a fork's pull request has none and only pulls. + - uses: cachix/cachix-action@v17 + with: + name: proton-drive-linux + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - name: Check the flake run: nix flake check --print-build-logs --no-build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c032f4..9f9b766 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -240,6 +240,13 @@ jobs: - uses: cachix/install-nix-action@v31 + # Pulls from the project's binary cache, and pushes what this run built + # when the token is there; a fork's pull request has none and only pulls. + - uses: cachix/cachix-action@v17 + with: + name: proton-drive-linux + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - name: Build the flake run: nix build --print-build-logs .#proton-drive-linux diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 52b3c14..c279442 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,12 @@ scratch (user data in `staging/` and `recovery/` is never touched by this). ## [Unreleased] +### Added +- **A binary cache for the Nix flake.** Every release and every build of `main` is uploaded to + `proton-drive-linux.cachix.org`, so NixOS installs download the client instead of compiling + it. See [Install → Binary cache](INSTALL.md#binary-cache). + ([#37](https://github.com/narrrl/proton-drive-linux/issues/37)) + ## [3.3.0] — 2026-10-11 Schema: **42**, unchanged. diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 39aeb83..61a1244 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -154,7 +154,8 @@ Releases are cut from `main` by pushing a `v*` tag. `.github/workflows/release.y `packaging/PKGBUILD` agree; 2. runs the quality gates; 3. builds the release binaries and packages a `.tar.gz`, a `.deb` and a GPG-signed `.rpm`, and - builds the Nix flake at the tag, which is what a flake input pinned to `vX.Y.Z` gets; + builds the Nix flake at the tag, which is what a flake input pinned to `vX.Y.Z` gets, and + pushes it to the `proton-drive-linux` Cachix cache (secret `CACHIX_AUTH_TOKEN`); 4. publishes them as a GitHub release, with the version's section of `docs/CHANGELOG.md` as the notes; 5. calls `.github/workflows/aur.yml`, which updates and pushes the AUR recipes and commits them diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 6821073..23a5f01 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -112,6 +112,26 @@ inputs.proton-drive-linux.url = "github:narrrl/proton-drive-linux/v3.3.0"; Each release tag is built with Nix before the release is published. +#### Binary cache + +CI uploads every build of `main` and of each release tag to a Cachix binary cache, so Nix can +download the client instead of compiling it. A system build does not read a flake input's cache +settings, so add the cache to your NixOS configuration once: + +```nix +nix.settings = { + substituters = [ "https://proton-drive-linux.cachix.org" ]; + trusted-public-keys = [ + "proton-drive-linux.cachix.org-1:w1+3pXVXyTlqkFGn3dWpUhlaJtyGhSm3X0mFwfa++AA=" + ]; +}; +``` + +The cache holds the build against the `nixpkgs` this flake locks. Setting +`inputs.proton-drive-linux.inputs.nixpkgs.follows = "nixpkgs"` builds against yours instead, which +the cache does not have, so Nix compiles it. `nix run` and `nix shell` ask whether to use the +cache the first time; answer yes, or run `cachix use proton-drive-linux`. + To try it without changing your system, run the app straight from the flake: ```bash diff --git a/flake.nix b/flake.nix index 10afe56..b2c69e9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,16 @@ { description = "Unofficial Proton Drive client for Linux: files-on-demand FUSE mount, CLI, GTK4 app and tray"; + # CI pushes every build of `main` and of each release tag here, so installing + # downloads the client instead of compiling it. Nix asks before it uses a + # flake's caches unless the user trusts them (docs/INSTALL.md). + nixConfig = { + extra-substituters = [ "https://proton-drive-linux.cachix.org" ]; + extra-trusted-public-keys = [ + "proton-drive-linux.cachix.org-1:w1+3pXVXyTlqkFGn3dWpUhlaJtyGhSm3X0mFwfa++AA=" + ]; + }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs =