From a0a00bc73be9673984396b15d29729dc6ded4781 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sat, 14 Dec 2024 16:33:25 -0600 Subject: [PATCH] migrated simple packages --- pkgs/aviator.nix | 62 +++++++++++++ pkgs/polymc.nix | 187 +++++++++++++++++++++++++++++++++++++++ pkgs/super-mario-127.nix | 69 +++++++++++++++ pkgs/talk.nix | 89 +++++++++++++++++++ 4 files changed, 407 insertions(+) create mode 100644 pkgs/aviator.nix create mode 100644 pkgs/polymc.nix create mode 100644 pkgs/super-mario-127.nix create mode 100644 pkgs/talk.nix diff --git a/pkgs/aviator.nix b/pkgs/aviator.nix new file mode 100644 index 0000000..4578a8a --- /dev/null +++ b/pkgs/aviator.nix @@ -0,0 +1,62 @@ +{ + stdenv, + lib, + python3, + python3Packages, + fetchFromGitHub, + meson, + appstream-glib, + pkg-config, + glib, + libadwaita, + wrapGAppsHook4, + desktop-file-utils, + ninja, + gobject-introspection, + gtk4, +}: + +stdenv.mkDerivation (finaAttrs: rec { + pname = "aviator"; + version = "0.6.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "gianni-rosato"; + repo = "aviator"; + rev = version; + hash = "sha256-5PjQgCapI9WU4kR0k0uYWnFERYEZxCuTnTbD1oN+Zms="; + }; + + nativeBuildInputs = [ + appstream-glib + meson + wrapGAppsHook4 + pkg-config + desktop-file-utils + ninja + python3Packages.pygobject3 + gobject-introspection + ]; + + buildInputs = [ + gtk4 + glib + libadwaita + (python3.withPackages ( + ps: with ps; [ + pygobject3 + ffmpeg-progress-yield + ffmpeg-python + ] + )) + ]; + + meta = { + description = "A lightweight, Flatpak-first, easy-to-use GUI utility for encoding with SVT-AV1 & Opus"; + homepage = "https://github.com/gianni-rosato/aviator"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ CaptainJawZ ]; + mainProgram = "aviator"; + }; +}) diff --git a/pkgs/polymc.nix b/pkgs/polymc.nix new file mode 100644 index 0000000..880344b --- /dev/null +++ b/pkgs/polymc.nix @@ -0,0 +1,187 @@ +{ + stdenv, + lib, + fetchFromGitHub, + cmake, + ninja, + jdk17, + ghc_filesystem, + zlib, + file, + xorg, + libpulseaudio, + openal, + qt6, + glfw, + pciutils, + udev, + glxinfo, + qt6Packages, + libGL, + flite, + addDriverRunpath, + vulkan-loader, + msaClientID ? null, + extra-cmake-modules, + makeWrapper, + gamemode, + mangohud, + glfw-wayland-minecraft, + writeShellScript, +}: + +let + polymc = + let + binpath = lib.makeBinPath [ + xorg.xrandr + glxinfo + pciutils + ]; + + libpath = lib.makeLibraryPath [ + xorg.libX11 + xorg.libXext + xorg.libXcursor + xorg.libXrandr + xorg.libXxf86vm + libpulseaudio + libGL + vulkan-loader + glfw + openal + udev + flite + stdenv.cc.cc.lib + ]; + + gameLibraryPath = libpath + ":${addDriverRunpath.driverLink}/lib"; + + in + stdenv.mkDerivation ( + let + version = "6.1"; + in + { + pname = "polymc" + (lib.optionalString ((lib.versions.major qt6.qtbase.version) == "5") "-qt5"); + inherit version; + + src = fetchFromGitHub { + owner = "PolyMC"; + repo = "PolyMC"; + rev = version; + sha256 = "sha256-AOy13zAWQ0CtsX9z1M+fxH7Sh/QSFy7EdQ/fD9yUYc8="; + fetchSubmodules = true; + }; + dontWrapQtApps = true; + nativeBuildInputs = [ + cmake + extra-cmake-modules + ninja + jdk17 + qt6.wrapQtAppsHook + file + ghc_filesystem + ]; + buildInputs = [ + qt6.qtbase + qt6.qtsvg + qt6.qtcharts + qt6.qtwayland + qt6Packages.quazip + zlib + ]; + + cmakeFlags = [ + "-GNinja" + "-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qt6.qtbase.version}" + ] ++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; + + postPatch = '' + # hardcode jdk paths + substituteInPlace launcher/java/JavaUtils.cpp \ + --replace 'scanJavaDir("/usr/lib/jvm")' 'javas.append("${jdk17}/lib/openjdk/bin/java")' + ''; + + postFixup = '' + # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 + wrapQtApp $out/bin/polymc \ + --suffix LD_LIBRARY_PATH : "${gameLibraryPath}" \ + --suffix PATH : "${binpath}" \ + --set-default ALSOFT_DRIVERS "pulse" + ''; + passthru = { + + wrap = + { + extraJDKs ? [ ], + extraPaths ? [ ], + extraLibs ? [ ], + withWaylandGLFW ? false, + withMangohud ? true, + withGamemode ? true, + }: + stdenv.mkDerivation ( + let + libsPath = + (lib.makeLibraryPath (extraLibs ++ lib.optional withGamemode gamemode.lib)) + + lib.optionalString withMangohud "${mangohud + "/lib/mangohud"}"; + binsPath = lib.makeBinPath (extraPaths ++ lib.optional withMangohud mangohud); + waylandPreExec = writeShellScript "waylandGLFW" '' + if [ -n "$WAYLAND_DISPLAY" ]; then + export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH" + fi + ''; + in + { + pname = "${polymc.pname}-wrapped"; + inherit (polymc) version; + inherit libsPath binsPath waylandPreExec; + + src = polymc; + nativeBuildInputs = [ makeWrapper ]; + phases = [ + "installPhase" + "fixupPhase" + ]; + installPhase = '' + mkdir -p $out/bin + ln -s $src/bin/polymc $out/bin/polymc + ln -s $src/share $out/share + ''; + + postFixup = + let + javaPaths = lib.makeSearchPath "bin/java" extraJDKs; + in + '' + wrapProgram $out/bin/polymc \ + --suffix LD_LIBRARY_PATH : "${libsPath}" \ + --suffix POLYMC_JAVA_PATHS : "${javaPaths}" \ + --suffix PATH : "${binsPath}" ${lib.optionalString withWaylandGLFW "--run ${waylandPreExec}"} + + ''; + + preferLocalBuild = true; + inherit (polymc) meta; + + } + ); + }; + meta = { + homepage = "https://polymc.org/"; + downloadPage = "https://polymc.org/download/"; + changelog = "https://github.com/PolyMC/PolyMC/releases"; + description = "A free, open source launcher for Minecraft"; + longDescription = '' + Allows you to have multiple, separate instances of Minecraft (each with + their own mods, texture packs, saves, etc) and helps you manage them and + their associated options with a simple interface. + ''; + platforms = [ "x86_64-linux" ]; + license = lib.licenses.gpl3Only; + }; + } + ); +in +polymc diff --git a/pkgs/super-mario-127.nix b/pkgs/super-mario-127.nix new file mode 100644 index 0000000..ca5b872 --- /dev/null +++ b/pkgs/super-mario-127.nix @@ -0,0 +1,69 @@ +{ + lib, + stdenvNoCC, + requireFile, + buildFHSEnv, + unzip, +}: + +let + version = "0.8.0"; + + super-mario-127 = stdenvNoCC.mkDerivation (finalAttrs: { + pname = "super-mario-127"; + inherit version; + + src = requireFile { + name = "SuperMario127v${finalAttrs.version}Linux.zip"; + url = "https://charpurrr.itch.io/super-mario-127"; + hash = "sha256-l713xdEvwnOV8OMyDQ4/qU7VMj/uDViAJR5gl+R/vCU="; + }; + + nativeBuildInputs = [ unzip ]; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out/{bin,opt/super-mario-127} + unzip $src -d $out/opt/super-mario-127 + chmod +x $out/opt/super-mario-127/Super_Mario_127v${finalAttrs.version}.x86_64 + ln -s $out/opt/super-mario-127/Super_Mario_127v${finalAttrs.version}.x86_64 $out/bin/super-mario-127 + ''; + }); +in + +buildFHSEnv { + pname = "super-mario-127"; + inherit version; + + targetPkgs = + pkgs: + [ super-mario-127 ] + ++ builtins.attrValues { + inherit (pkgs) + alsa-lib + libGL + pulseaudio + udev + ; + inherit (pkgs.xorg) + libX11 + libXcursor + libXext + libXi + libXinerama + libXrandr + libXrender + ; + }; + + runScript = "super-mario-127"; + + meta = { + description = "Fan sequel to Super Mario 63"; + homepage = "https://charpurrr.itch.io/super-mario-127"; + license = lib.licenses.unfree; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ federicoschonborn ]; + }; +} diff --git a/pkgs/talk.nix b/pkgs/talk.nix new file mode 100644 index 0000000..bead727 --- /dev/null +++ b/pkgs/talk.nix @@ -0,0 +1,89 @@ +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + nss, + cairo, + xorg, + libxkbcommon, + alsa-lib, + at-spi2-core, + mesa, + pango, + libdrm, + vivaldi-ffmpeg-codecs, + gtk3, + libGL, + libglvnd, + systemd, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "nextcloud-talk-desktop"; + version = "1.0.0"; + + # Building from source would require building also building Server and Talk components + # See https://github.com/nextcloud/talk-desktop?tab=readme-ov-file#%EF%B8%8F-prerequisites + src = fetchzip { + url = "https://github.com/nextcloud-releases/talk-desktop/releases/download/v${finalAttrs.version}/Nextcloud.Talk-linux-x64.zip"; + hash = "sha256-XQa4Fa9eEaFlYrWa00S9aMWKJOPPFGSo4NAlRqE23jM="; + stripRoot = false; + }; + + nativeBuildInputs = [ autoPatchelfHook ]; + + buildInputs = + [ + nss + cairo + alsa-lib + at-spi2-core + pango + libdrm + libxkbcommon + gtk3 + vivaldi-ffmpeg-codecs + mesa + libGL + libglvnd + ] + ++ (with xorg; [ + libX11 + libXcomposite + libXdamage + libXrandr + libXfixes + libXcursor + ]); + + # Required to launch the application and proceed past the zygote_linux fork() process + # Fixes `Zygote could not fork` + runtimeDependencies = [ systemd ]; + + preInstall = '' + mkdir -p $out/bin + mkdir -p $out/opt + + cp -r $src/* $out/opt/ + ''; + + installPhase = '' + runHook preInstall + + # Link the application in $out/bin away from contents of `preInstall` + ln -s "$out/opt/Nextcloud Talk-linux-x64/Nextcloud Talk" $out/bin/nextcloud-talk-desktop + + runHook postInstall + ''; + + meta = with lib; { + description = "Nextcloud Talk Desktop Client"; + homepage = "https://github.com/nextcloud/talk-desktop"; + changelog = "https://github.com/nextcloud/talk-desktop/blob/${finalAttrs.version}/CHANGELOG.md"; + license = licenses.agpl3Only; + maintainers = with maintainers; [ kashw2 ]; + mainProgram = "nextcloud-talk-desktop"; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +})