diff --git a/pkgs/by-name/cb/cbconvert/gui.nix b/pkgs/by-name/cb/cbconvert/gui.nix new file mode 100644 index 000000000000..a5721401d31e --- /dev/null +++ b/pkgs/by-name/cb/cbconvert/gui.nix @@ -0,0 +1,48 @@ +{ + 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"; + }; +} diff --git a/pkgs/by-name/cb/cbconvert/package.nix b/pkgs/by-name/cb/cbconvert/package.nix new file mode 100644 index 000000000000..9ab25d493c07 --- /dev/null +++ b/pkgs/by-name/cb/cbconvert/package.nix @@ -0,0 +1,87 @@ +{ + 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"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 50cce1a1625e..7a36e8f118bb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; };