From 732fe5d0fa1b62de0bbca08f9e2a9a25827f2172 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 6 Mar 2025 15:59:11 -0300 Subject: [PATCH 1/4] cosmic-term: refactor --- pkgs/by-name/co/cosmic-term/package.nix | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/pkgs/by-name/co/cosmic-term/package.nix b/pkgs/by-name/co/cosmic-term/package.nix index 6c420ec15c02..6191dd292e86 100644 --- a/pkgs/by-name/co/cosmic-term/package.nix +++ b/pkgs/by-name/co/cosmic-term/package.nix @@ -1,30 +1,30 @@ { lib, - cosmic-icons, + stdenv, + rustPlatform, fetchFromGitHub, + pkg-config, + just, fontconfig, freetype, - just, libglvnd, libinput, libxkbcommon, makeBinaryWrapper, - pkg-config, - rustPlatform, - stdenv, vulkan-loader, wayland, + cosmic-icons, xorg, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "cosmic-term"; version = "1.0.0-alpha.6"; src = fetchFromGitHub { owner = "pop-os"; repo = "cosmic-term"; - rev = "epoch-${version}"; + tag = "epoch-${finalAttrs.version}"; hash = "sha256-sdeRkT6UcyBKIFnJZn3aGf8LZQimqVPqtXo7RtwUs5M="; }; @@ -33,12 +33,10 @@ rustPlatform.buildRustPackage rec { # COSMIC applications now uses vergen for the About page # Update the COMMIT_DATE to match when the commit was made - env.VERGEN_GIT_COMMIT_DATE = "2025-02-21"; - env.VERGEN_GIT_SHA = src.rev; - - postPatch = '' - substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)" - ''; + env = { + VERGEN_GIT_COMMIT_DATE = "2025-02-21"; + VERGEN_GIT_SHA = finalAttrs.src.tag; + }; nativeBuildInputs = [ just @@ -58,6 +56,7 @@ rustPlatform.buildRustPackage rec { ]; dontUseJustBuild = true; + dontUseJustCheck = true; justFlags = [ "--set" @@ -83,15 +82,15 @@ rustPlatform.buildRustPackage rec { --suffix XDG_DATA_DIRS : "${cosmic-icons}/share" ''; - meta = with lib; { + meta = { homepage = "https://github.com/pop-os/cosmic-term"; description = "Terminal for the COSMIC Desktop Environment"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ ahoneybun nyabinary ]; - platforms = platforms.linux; + platforms = lib.platforms.linux; mainProgram = "cosmic-term"; }; -} +}) From ab6978130dd319b8dfa3bc36a143dd8ec8a94c92 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 6 Mar 2025 16:00:19 -0300 Subject: [PATCH 2/4] cosmic-term: use libcosmicAppHook --- pkgs/by-name/co/cosmic-term/package.nix | 30 ++----------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/pkgs/by-name/co/cosmic-term/package.nix b/pkgs/by-name/co/cosmic-term/package.nix index 6191dd292e86..18008e7a3012 100644 --- a/pkgs/by-name/co/cosmic-term/package.nix +++ b/pkgs/by-name/co/cosmic-term/package.nix @@ -5,16 +5,10 @@ fetchFromGitHub, pkg-config, just, + libcosmicAppHook, fontconfig, freetype, - libglvnd, libinput, - libxkbcommon, - makeBinaryWrapper, - vulkan-loader, - wayland, - cosmic-icons, - xorg, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -41,18 +35,13 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ just pkg-config - makeBinaryWrapper + libcosmicAppHook ]; buildInputs = [ fontconfig freetype - libglvnd libinput - libxkbcommon - vulkan-loader - wayland - xorg.libX11 ]; dontUseJustBuild = true; @@ -67,21 +56,6 @@ rustPlatform.buildRustPackage (finalAttrs: { "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-term" ]; - # 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" - ]; - - postInstall = '' - wrapProgram "$out/bin/cosmic-term" \ - --suffix XDG_DATA_DIRS : "${cosmic-icons}/share" - ''; - meta = { homepage = "https://github.com/pop-os/cosmic-term"; description = "Terminal for the COSMIC Desktop Environment"; From 528437b27bd425e023b451ad822463ebc05c53db Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 6 Mar 2025 16:01:58 -0300 Subject: [PATCH 3/4] cosmic-term: add updateScript --- pkgs/by-name/co/cosmic-term/package.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/by-name/co/cosmic-term/package.nix b/pkgs/by-name/co/cosmic-term/package.nix index 18008e7a3012..f39da322fdaa 100644 --- a/pkgs/by-name/co/cosmic-term/package.nix +++ b/pkgs/by-name/co/cosmic-term/package.nix @@ -9,6 +9,7 @@ fontconfig, freetype, libinput, + nix-update-script, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -56,6 +57,15 @@ rustPlatform.buildRustPackage (finalAttrs: { "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-term" ]; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; + meta = { homepage = "https://github.com/pop-os/cosmic-term"; description = "Terminal for the COSMIC Desktop Environment"; From 554d5379aab6808086ad5c2311e735d3f4887609 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Thu, 6 Mar 2025 16:02:10 -0300 Subject: [PATCH 4/4] cosmic-term: add HeitorAugustoLN as a maintainer --- pkgs/by-name/co/cosmic-term/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/co/cosmic-term/package.nix b/pkgs/by-name/co/cosmic-term/package.nix index f39da322fdaa..f8efd682d3a4 100644 --- a/pkgs/by-name/co/cosmic-term/package.nix +++ b/pkgs/by-name/co/cosmic-term/package.nix @@ -73,6 +73,7 @@ rustPlatform.buildRustPackage (finalAttrs: { maintainers = with lib.maintainers; [ ahoneybun nyabinary + HeitorAugustoLN ]; platforms = lib.platforms.linux; mainProgram = "cosmic-term";