Unverified Commit b56dce17 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

cbconvert: init at 1.0.4 (#350741)

parents f218f8ff e7e66352
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
{
  buildGoModule,
  cbconvert,
  gtk3,
  wrapGAppsHook3,
}:

buildGoModule rec {
  pname = "cbconvert-gui";

  inherit (cbconvert)
    patches
    proxyVendor
    src
    tags
    version
    ;

  nativeBuildInputs = cbconvert.nativeBuildInputs ++ [
    wrapGAppsHook3
  ];
  buildInputs = cbconvert.buildInputs ++ [ gtk3 ];

  vendorHash = "sha256-vvCvKecPszhNCQdgm3mQMb5+486BGZ9sz3R0b70eLeQ=";
  modRoot = "cmd/cbconvert-gui";

  ldflags = [
    "-s"
    "-w"
    "-X main.appVersion=${version}"
  ];

  postInstall = ''
    install -D --mode=0644 --target-directory=$out/share/applications/ dist/linux/cbconvert.desktop
    install -D --mode=0644 --target-directory=$out/icons/hicolor/256x256/apps dist/linux/cbconvert.png
    install -D --mode=0644 --target-directory=$out/share/thumbnailers dist/linux/cbconvert.thumbnailer
    install -D --mode=0644 dist/linux/flatpak/io.github.gen2brain.cbconvert.metainfo.xml $out/share/metainfo/cbconvert.metainfo.xml
  '';

  postFixup = ''
    substituteInPlace $out/share/metainfo/cbconvert.metainfo.xml \
      --replace-fail "io.github.gen2brain.cbconvert" "cbconvert"
  '';

  meta = cbconvert.meta // {
    mainProgram = "cbconvert-gui";
  };
}
+87 −0
Original line number Diff line number Diff line
{
  buildGoModule,
  bzip2,
  callPackage,
  cbconvert,
  fetchFromGitHub,
  fetchpatch2,
  imagemagick,
  lib,
  libunarr,
  mupdf-headless,
  nix-update-script,
  pkg-config,
  testers,
  zlib,
}:

buildGoModule rec {
  pname = "cbconvert";
  version = "1.0.4";

  src = fetchFromGitHub {
    owner = "gen2brain";
    repo = "cbconvert";
    rev = "v${version}";
    hash = "sha256-9x7RXyiQoV2nIVFnG1XHcYfTQiMZ88Ck7uuY7NLK8CA=";
  };

  # Update dependencies in order to use the extlib tag.
  patches = [
    (fetchpatch2 {
      name = "update-dependencies-1.patch";
      url = "https://github.com/gen2brain/cbconvert/commit/1a36ec17b2c012f278492d60d469b8e8457a6110.patch";
      hash = "sha256-E+HWYPz9FtU3JAktzIRflF/pHdLfoaciBmjb7UOQYLo=";
    })
    (fetchpatch2 {
      name = "update-dependencies-2.patch";
      url = "https://github.com/gen2brain/cbconvert/commit/74c5de699413e95133f97666b64a1866f88fedd5.patch";
      hash = "sha256-rrJsYJHcfNWF90vwUAT3J/gqg22e1gk6I48LsTrYbmU=";
    })
  ];

  vendorHash = "sha256-aVInsWvygNH+/h7uQs4hAPOO2gsSkBx+tI+TK77M/hg=";
  modRoot = "cmd/cbconvert";

  proxyVendor = true;

  # The extlib tag forces the github.com/gen2brain/go-unarr module to use external libraries instead of bundled ones.
  tags = [ "extlib" ];

  ldflags = [
    "-s"
    "-w"
    "-X main.appVersion=${version}"
  ];

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    bzip2
    imagemagick
    libunarr
    mupdf-headless
    zlib
  ];

  passthru = {
    gui = callPackage ./gui.nix { };
    updateScript = nix-update-script { };
    tests.version = testers.testVersion {
      package = cbconvert;
      command = "cbconvert version";
    };
  };

  meta = {
    description = "Comic Book converter";
    homepage = "https://github.com/gen2brain/cbconvert";
    changelog = "https://github.com/gen2brain/cbconvert/releases/tag/v${version}";
    license = with lib.licenses; [ gpl3Only ];
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ jwillikers ];
    mainProgram = "cbconvert";
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -28254,6 +28254,8 @@ with pkgs;
  cbc = callPackage ../applications/science/math/cbc { };
  cbconvert-gui = cbconvert.gui;
  cddiscid = callPackage ../applications/audio/cd-discid {
    inherit (darwin) IOKit;
  };