From f622612445a7dc79e96ec3d98b21299f585ccdd7 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Wed, 26 Feb 2025 16:38:10 -0300 Subject: [PATCH 1/4] cosmic-player: refactor --- pkgs/by-name/co/cosmic-player/package.nix | 51 ++++------------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/pkgs/by-name/co/cosmic-player/package.nix b/pkgs/by-name/co/cosmic-player/package.nix index 4a5994200067..f620b113b84c 100644 --- a/pkgs/by-name/co/cosmic-player/package.nix +++ b/pkgs/by-name/co/cosmic-player/package.nix @@ -1,22 +1,17 @@ { lib, + stdenv, fetchFromGitHub, rustPlatform, + libcosmicAppHook, + just, + pkg-config, alsa-lib, ffmpeg, glib, gst_all_1, - just, - pkg-config, - libxkbcommon, - stdenv, - cosmic-icons, libglvnd, libgbm, - wayland, - xorg, - vulkan-loader, - makeBinaryWrapper, }: rustPlatform.buildRustPackage rec { @@ -25,8 +20,8 @@ rustPlatform.buildRustPackage rec { src = fetchFromGitHub { owner = "pop-os"; - repo = pname; - rev = "epoch-${version}"; + repo = "cosmic-player"; + tag = "epoch-${version}"; hash = "sha256-Ebjj+C+yLCRomZy2W8mYDig1pv7aQcD3A9V2M53RM5U="; }; @@ -40,7 +35,8 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ just pkg-config - makeBinaryWrapper + libcosmicAppHook + rustPlatform.bindgenHook ]; # Largely based on lilyinstarlight's work linked below @@ -54,15 +50,12 @@ rustPlatform.buildRustPackage rec { gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad - libxkbcommon libgbm - wayland - vulkan-loader - xorg.libX11 libglvnd ]; dontUseJustBuild = true; + dontUseJustCheck = true; justFlags = [ "--set" @@ -73,32 +66,6 @@ rustPlatform.buildRustPackage rec { "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-player" ]; - # Force linking to libEGL, which is always dlopen()ed, and to - # libwayland-client, which is always dlopen()ed except by the - # obscure winit backend. - RUSTFLAGS = map (a: "-C link-arg=${a}") [ - "-Wl,--push-state,--no-as-needed" - "-lEGL" - "-lwayland-client" - "-Wl,--pop-state" - ]; - - # LD_LIBRARY_PATH can be removed once tiny-xlib is bumped above 0.2.2 - postInstall = '' - wrapProgram "$out/bin/cosmic-player" \ - --suffix XDG_DATA_DIRS : "${cosmic-icons}/share" \ - --prefix LD_LIBRARY_PATH : ${ - lib.makeLibraryPath [ - xorg.libX11 - xorg.libXcursor - xorg.libXi - vulkan-loader - libxkbcommon - wayland - ] - } - ''; - meta = { homepage = "https://github.com/pop-os/cosmic-player"; description = "Media player for the COSMIC Desktop Environment"; From 1b3898d06e470b163240263eed852076d3be6752 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Wed, 26 Feb 2025 16:44:42 -0300 Subject: [PATCH 2/4] cosmic-player: wrap with `GST_PLUGIN_SYSTEM_PATH_1_0` gst_all_1.gstreamer populates GST_PLUGIN_SYSTEM_PATH_1_0, but it is not automatically wrapped with the binary of the package --- pkgs/by-name/co/cosmic-player/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/co/cosmic-player/package.nix b/pkgs/by-name/co/cosmic-player/package.nix index f620b113b84c..d2e854a9dd19 100644 --- a/pkgs/by-name/co/cosmic-player/package.nix +++ b/pkgs/by-name/co/cosmic-player/package.nix @@ -66,6 +66,10 @@ rustPlatform.buildRustPackage rec { "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-player" ]; + postInstall = '' + libcosmicAppWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") + ''; + meta = { homepage = "https://github.com/pop-os/cosmic-player"; description = "Media player for the COSMIC Desktop Environment"; From f38861be6280d0279ffeaeb81f1cea19fd4e220f Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Wed, 26 Feb 2025 16:46:51 -0300 Subject: [PATCH 3/4] cosmic-player: add HeitorAugustoLN as a maintainer --- pkgs/by-name/co/cosmic-player/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/co/cosmic-player/package.nix b/pkgs/by-name/co/cosmic-player/package.nix index d2e854a9dd19..e70f66141d77 100644 --- a/pkgs/by-name/co/cosmic-player/package.nix +++ b/pkgs/by-name/co/cosmic-player/package.nix @@ -74,7 +74,10 @@ rustPlatform.buildRustPackage rec { homepage = "https://github.com/pop-os/cosmic-player"; description = "Media player for the COSMIC Desktop Environment"; license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ ahoneybun ]; + maintainers = with lib.maintainers; [ + ahoneybun + HeitorAugustoLN + ]; platforms = lib.platforms.linux; mainProgram = "cosmic-player"; }; From f50cace56b93f4beaae79e7d52f85286ed7c0200 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Wed, 26 Feb 2025 16:48:41 -0300 Subject: [PATCH 4/4] cosmic-player: add updateScript --- pkgs/by-name/co/cosmic-player/package.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/by-name/co/cosmic-player/package.nix b/pkgs/by-name/co/cosmic-player/package.nix index e70f66141d77..ad93070244b0 100644 --- a/pkgs/by-name/co/cosmic-player/package.nix +++ b/pkgs/by-name/co/cosmic-player/package.nix @@ -12,6 +12,7 @@ gst_all_1, libglvnd, libgbm, + nix-update-script, }: rustPlatform.buildRustPackage rec { @@ -70,6 +71,15 @@ rustPlatform.buildRustPackage rec { libcosmicAppWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") ''; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; + meta = { homepage = "https://github.com/pop-os/cosmic-player"; description = "Media player for the COSMIC Desktop Environment";