Unverified Commit ca92730e authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

appimageupdate: init at 2.0.0-alpha-1-20230526; zsync2: init at 2.0.0-alpha-1-20230304 (#329104)

parents dfffb2e7 5ab59cff
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  qt5,
  zsync2,
  libcpr,
  libgcrypt,
  libappimage,
  argagg,
  nlohmann_json,
  gpgme,
  appimageupdate-qt,
  withQtUI ? false,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "appimageupdate";
  version = "2.0.0-alpha-1-20230526";

  src = fetchFromGitHub {
    owner = "AppImageCommunity";
    repo = "AppImageUpdate";
    rev = finalAttrs.version;
    hash = "sha256-b2RqSw0Ksn9OLxQV9+3reBiqrty+Kx9OwV93jlvuPnY=";
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail 'VERSION 1-alpha' 'VERSION ${finalAttrs.version}' \
      --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"' \
      --replace-fail 'git rev-parse --short HEAD' 'bash -c "echo unknown"' \
      --replace-fail '<local dev build>' '<nixpkgs build>'
  '';

  nativeBuildInputs =
    [
      cmake
      pkg-config
    ]
    ++ lib.optionals withQtUI [
      qt5.wrapQtAppsHook
    ];

  buildInputs =
    [
      zsync2
      libcpr
      libgcrypt
      libappimage
      argagg
      nlohmann_json
      gpgme
    ]
    ++ lib.optionals withQtUI [
      qt5.qtbase
    ];

  cmakeFlags = [
    (lib.cmakeBool "USE_SYSTEM_ZSYNC2" true)
    (lib.cmakeBool "USE_SYSTEM_LIBAPPIMAGE" true)
    (lib.cmakeBool "BUILD_QT_UI" withQtUI)
  ];

  dontWrapQtApps = true;

  preFixup = lib.optionalString withQtUI ''
    wrapQtApp "$out/bin/AppImageUpdate"
  '';

  passthru.tests = {
    inherit appimageupdate-qt;
  };

  meta = {
    description = "Update AppImages using information embedded in the AppImage itself";
    homepage = "https://github.com/AppImageCommunity/AppImageUpdate";
    license = lib.licenses.mit;
    mainProgram = if withQtUI then "AppImageUpdate" else "appimageupdatetool";
    maintainers = with lib.maintainers; [ aleksana ];
    platforms = lib.platforms.linux;
  };
})
+66 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  libgcrypt,
  libcpr,
  libargs,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "zsync2";
  version = "2.0.0-alpha-1-20230304";

  src = fetchFromGitHub {
    owner = "AppImageCommunity";
    repo = "zsync2";
    rev = finalAttrs.version;
    hash = "sha256-OCeMEXQmbc34MZ1NyOfAASdrUyeSQqqfvWqAszJN4x0=";
  };

  patches = [
    # Add missing cstdint includes
    (fetchpatch {
      url = "https://github.com/AppImageCommunity/zsync2/commit/e57e1fce68194fa920542fd334488de5123e4832.patch";
      hash = "sha256-iLXxD6v+pSwFKmwAEyzbYUJ3DmtpvV/DYr8kcD+t5Cg=";
    })
  ];

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail 'VERSION "2.0.0-alpha-1"' 'VERSION "${finalAttrs.version}"' \
      --replace-fail 'git rev-parse --short HEAD' 'bash -c "echo unknown"' \
      --replace-fail '<local dev build>' '<nixpkgs build>' \
      --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"'
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    libgcrypt
    libcpr
    libargs
  ];

  cmakeFlags = [
    (lib.cmakeBool "USE_SYSTEM_CPR" true)
    (lib.cmakeBool "USE_SYSTEM_ARGS" true)
  ];

  meta = {
    description = "Rewrite of the advanced file download/sync tool zsync";
    homepage = "https://github.com/AppImageCommunity/zsync2";
    license = lib.licenses.artistic2;
    mainProgram = "zsync2";
    maintainers = with lib.maintainers; [ aleksana ];
    # macro only supports linux as of now
    # src/zsclient.cpp#L460
    platforms = lib.platforms.linux;
  };
})
+2 −0
Original line number Diff line number Diff line
@@ -196,6 +196,8 @@ with pkgs;
  appimageTools = callPackage ../build-support/appimage { };
  appimageupdate-qt = appimageupdate.override { withQtUI = true; };
  appindicator-sharp = callPackage ../development/libraries/appindicator-sharp { };
  bindle = callPackage ../servers/bindle {