Widen the accepted pimsync range to the 0.6 series; stream sync output and bound the Google HTTP calls
The version work and the sync-output work landed in one change; they can be split apart if the history wants them separate.
This commit is contained in:
parent
3d701361da
commit
d03748472a
8 changed files with 250 additions and 94 deletions
78
flake.nix
78
flake.nix
|
|
@ -3,8 +3,26 @@
|
|||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# pimsync is built from source rather than taken from nixpkgs, which trails
|
||||
# the releases calcalist has been read against. Being an input rather than a
|
||||
# `fetchFromSourcehut` call makes it substitutable: a fork or a working tree
|
||||
# can be swapped in at install time with
|
||||
# `--override-input pimsync-src git+file:///path/to/pimsync`, without the
|
||||
# committed flake naming anything that exists on one machine only.
|
||||
#
|
||||
# The rev is the commit v0.6.0 points at: nix cannot peel an annotated tag,
|
||||
# and resolving the ref alone fails.
|
||||
inputs.pimsync-src = {
|
||||
url = "git+https://git.sr.ht/~whynothugo/pimsync?ref=refs/tags/v0.6.0&rev=a111a44cd9e65c031ce9801fdced912057e4a4a0";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
pimsync-src,
|
||||
}:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
|
|
@ -19,30 +37,48 @@
|
|||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
# nixpkgs currently ships pimsync 0.5.9, but `discover`'s output
|
||||
# format is undocumented and changed between 0.5.9 and 0.5.11 —
|
||||
# calcalist's parser only understands the newer shape (see
|
||||
# SUPPORTED_PATCH_MIN in src/pimsync.rs). Build the exact version
|
||||
# rather than trust whatever nixpkgs happens to carry.
|
||||
pimsync0_5_11 = pkgs.rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "pimsync";
|
||||
version = "0.5.11";
|
||||
src = pkgs.fetchFromSourcehut {
|
||||
owner = "~whynothugo";
|
||||
repo = "pimsync";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-iMdBqSSguViF+54e47IGV8hH3qvTxcNkWkmND1QAAxw=";
|
||||
};
|
||||
cargoHash = "sha256-dvkZ047eJnvYvyH1iW1NJo3Uv0L2T7waPYKN12bi+dA=";
|
||||
# pimsync's Cargo.toml carries no version — the binary learns its own
|
||||
# from `git describe`, which has nothing to describe inside the
|
||||
# store. So it is assembled: the newest changelog heading for the
|
||||
# release, and the input's revision for the tree it came from. That
|
||||
# second half is what distinguishes an overridden fork from the
|
||||
# upstream release it descends from, and a suffixed version is
|
||||
# pimsync's own convention for a build off a tag.
|
||||
pimsyncVersion =
|
||||
let
|
||||
lines = pkgs.lib.splitString "\n" (builtins.readFile "${pimsync-src}/CHANGELOG.rst");
|
||||
isRelease = line: builtins.match "v[0-9]+\\.[0-9]+\\.[0-9]+" line != null;
|
||||
newest =
|
||||
pkgs.lib.findFirst isRelease (throw "no release heading found in pimsync's CHANGELOG.rst")
|
||||
lines;
|
||||
release = pkgs.lib.removePrefix "v" newest;
|
||||
in
|
||||
"${release}-${pimsync-src.dirtyShortRev or pimsync-src.shortRev}";
|
||||
|
||||
# Skips build.rs's `git describe` call, which has nothing to
|
||||
# describe once fetched as a plain source tarball.
|
||||
env.PIMSYNC_VERSION = finalAttrs.version;
|
||||
pimsync = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "pimsync";
|
||||
version = pimsyncVersion;
|
||||
src = pimsync-src;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = "${pimsync-src}/Cargo.lock";
|
||||
|
||||
# pimsync pins a few dependencies to git revisions, and vstorage
|
||||
# — which the fork swaps in — keeps libdav and libjmap as
|
||||
# submodules of its own. Naming those revisions in
|
||||
# `outputHashes` fetches them without submodules and vendors
|
||||
# two empty directories; the builtin fetcher recurses properly.
|
||||
# The revisions come from the lock file, so evaluation stays
|
||||
# pure, and there is no hash here to go stale when a fork moves.
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
|
||||
env.PIMSYNC_VERSION = pimsyncVersion;
|
||||
|
||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||
buildInputs = [ pkgs.sqlite ];
|
||||
doCheck = false;
|
||||
});
|
||||
};
|
||||
in
|
||||
rec {
|
||||
calcalist = pkgs.rustPlatform.buildRustPackage {
|
||||
|
|
@ -62,7 +98,7 @@
|
|||
# against, regardless of what else is on the user's PATH.
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/calcalist \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath [ pimsync0_5_11 ]}
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath [ pimsync ]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue