nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 libgcrypt,
8 libcpr,
9 libargs,
10 zlib,
11}:
12stdenv.mkDerivation (finalAttrs: {
13 pname = "zsync2";
14 version = "2.0.0-alpha-1-20250926";
15
16 src = fetchFromGitHub {
17 owner = "AppImageCommunity";
18 repo = "zsync2";
19 rev = finalAttrs.version;
20 hash = "sha256-dbIe47cDaQJAOiHcLRwEbLgvrDUHOnPkYqDbkX74gZk=";
21 };
22
23 postPatch = ''
24 substituteInPlace CMakeLists.txt \
25 --replace-fail 'VERSION "2.0.0-alpha-1"' 'VERSION "${finalAttrs.version}"' \
26 --replace-fail 'git rev-parse --short HEAD' 'bash -c "echo unknown"' \
27 --replace-fail '<local dev build>' '<nixpkgs build>' \
28 --replace-fail 'env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"' 'bash -c "echo 1970-01-01 00:00:01 UTC"'
29 '';
30
31 nativeBuildInputs = [
32 cmake
33 pkg-config
34 ];
35
36 buildInputs = [
37 libgcrypt
38 libcpr
39 libargs
40 zlib
41 ];
42
43 cmakeFlags = [
44 (lib.cmakeBool "USE_SYSTEM_CPR" true)
45 (lib.cmakeBool "USE_SYSTEM_ARGS" true)
46 ];
47
48 env.NIX_CFLAGS_COMPILE = "-lz -Wno-error=incompatible-pointer-types";
49
50 meta = {
51 description = "Rewrite of the advanced file download/sync tool zsync";
52 homepage = "https://github.com/AppImageCommunity/zsync2";
53 license = lib.licenses.artistic2;
54 mainProgram = "zsync2";
55 maintainers = with lib.maintainers; [ aleksana ];
56 # macro only supports linux as of now
57 # src/zsclient.cpp#L460
58 platforms = lib.platforms.linux;
59 };
60})