diff --git a/pkgs/by-name/up/upscaler/package.nix b/pkgs/by-name/up/upscaler/package.nix new file mode 100644 index 000000000000..c8ce29d532a3 --- /dev/null +++ b/pkgs/by-name/up/upscaler/package.nix @@ -0,0 +1,92 @@ +{ + 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; + }; +}