Unverified Commit 3431d204 authored by Grimmauld's avatar Grimmauld
Browse files

upscaler: init at 1.4.0

parent 6da00ff0
Loading
Loading
Loading
Loading
+92 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitLab,
  glib,
  gtk4,
  meson,
  ninja,
  gitUpdater,
  desktop-file-utils,
  appstream,
  blueprint-compiler,
  python3Packages,
  pkg-config,
  libadwaita,
  wrapGAppsHook4,
  upscayl-ncnn,
}:

python3Packages.buildPythonApplication rec {
  pname = "upscaler";
  version = "1.4.0";

  pyproject = false; # meson instead of pyproject

  src = fetchFromGitLab {
    domain = "gitlab.gnome.org";
    owner = "World";
    repo = "Upscaler";
    rev = version;
    hash = "sha256-Dy8tykIbK5o0XulurG+TxORZZSxfRe5Kjh6aGpsh+0Y=";
  };

  passthru.updateScript = gitUpdater { };

  postPatch = ''
    substituteInPlace upscaler/window.py \
      --replace-fail '"upscayl-bin",' '"${lib.getExe upscayl-ncnn}",'
  '';

  strictDeps = true;

  nativeBuildInputs = [
    wrapGAppsHook4
    meson
    ninja
    desktop-file-utils
    appstream
    blueprint-compiler
    pkg-config
    gtk4
    glib
  ];

  dependencies = with python3Packages; [
    pygobject3
    pillow
    vulkan
  ];

  buildInputs = [
    libadwaita
    upscayl-ncnn
  ];

  mesonFlags = [
    (lib.mesonBool "network_tests" false)
  ];

  # NOTE: `postCheck` is intentionally not used here, as the entire checkPhase
  # is skipped by `buildPythonApplication`
  # https://github.com/NixOS/nixpkgs/blob/9d4343b7b27a3e6f08fc22ead568233ff24bbbde/pkgs/development/interpreters/python/mk-python-derivation.nix#L296
  postInstallCheck = ''
    mesonCheckPhase
  '';

  dontWrapGApps = true;

  makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];

  meta = {
    description = "Upscale and enhance images";
    homepage = "https://tesk.page/upscaler";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [
      grimmauld
      getchoo
      aleksana
    ];
    mainProgram = "upscaler";
    platforms = lib.platforms.linux;
  };
}