cosmic: sort and refactor package attrs, fix libcosmicAppHook wrapping (#534694)

This commit is contained in:
Gaétan Lepage 2026-07-06 13:01:33 +00:00 committed by GitHub
commit 36c0ecd764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 123 additions and 87 deletions

View file

@ -20,7 +20,7 @@ let
with pkgs; with pkgs;
[ [
cosmic-applets cosmic-applets
cosmic-applibrary cosmic-app-library
cosmic-bg cosmic-bg
cosmic-comp cosmic-comp
cosmic-files cosmic-files

View file

@ -10,7 +10,7 @@
}: }:
rustPlatform.buildRustPackage (finalAttrs: { rustPlatform.buildRustPackage (finalAttrs: {
pname = "cosmic-applibrary"; pname = "cosmic-app-library";
version = "1.1.0"; version = "1.1.0";
# nixpkgs-update: no auto update # nixpkgs-update: no auto update

View file

@ -32,8 +32,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-ki+unf58rXBCpj5PCpBcg/6FWo16+MdPQWae+w1YkJ8="; cargoHash = "sha256-ki+unf58rXBCpj5PCpBcg/6FWo16+MdPQWae+w1YkJ8=";
separateDebugInfo = true; # Only default feature is systemd
buildNoDefaultFeatures = !useSystemd;
separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
nativeBuildInputs = [ nativeBuildInputs = [
@ -51,9 +53,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
] ]
++ lib.optional useSystemd systemd; ++ lib.optional useSystemd systemd;
# Only default feature is systemd
buildNoDefaultFeatures = !useSystemd;
makeFlags = [ makeFlags = [
"prefix=${placeholder "out"}" "prefix=${placeholder "out"}"
"CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}" "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"

View file

@ -26,16 +26,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-5DsnhaiJgmTakn+q9o2Q7IeuakAC/j0Ck3F3pfFx/EA="; hash = "sha256-5DsnhaiJgmTakn+q9o2Q7IeuakAC/j0Ck3F3pfFx/EA=";
}; };
cargoHash = "sha256-2E+98uWtahyQufoZTzdUtkwbuISsUHwlqOmMSpyi1O8=";
separateDebugInfo = true;
postPatch = '' postPatch = ''
substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)" substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)"
''; '';
cargoHash = "sha256-2E+98uWtahyQufoZTzdUtkwbuISsUHwlqOmMSpyi1O8=";
separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
just just
pkg-config pkg-config

View file

@ -26,6 +26,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-mC19GLLHrjqYXl052HoNFscz9zzQWVBBm0OxzXoUd8U="; cargoHash = "sha256-mC19GLLHrjqYXl052HoNFscz9zzQWVBBm0OxzXoUd8U=";
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
libcosmicAppHook libcosmicAppHook

View file

@ -27,6 +27,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
just just
libcosmicAppHook libcosmicAppHook

View file

@ -29,16 +29,20 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-oxXCAvBISkZu76VpvQ9AliFRJ8r5Ay7mjWf4sEwV0Xs="; hash = "sha256-oxXCAvBISkZu76VpvQ9AliFRJ8r5Ay7mjWf4sEwV0Xs=";
}; };
postPatch = ''
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/orca' '${lib.getExe orca}'
'';
cargoHash = "sha256-mfY2hsMxBooRjmTB2jgUIKyKHBpGfZ9Qslwv+2aEQyg="; cargoHash = "sha256-mfY2hsMxBooRjmTB2jgUIKyKHBpGfZ9Qslwv+2aEQyg=";
separateDebugInfo = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
cargoBuildFlags = [ "--all" ]; cargoBuildFlags = [ "--all" ];
separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
rustPlatform.bindgenHook rustPlatform.bindgenHook
cmake cmake
@ -66,11 +70,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
postPatch = ''
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/orca' '${lib.getExe orca}'
'';
preFixup = '' preFixup = ''
libcosmicAppWrapperArgs+=( libcosmicAppWrapperArgs+=(
--prefix PATH : ${lib.makeBinPath [ cosmic-randr ]} --prefix PATH : ${lib.makeBinPath [ cosmic-randr ]}

View file

@ -24,17 +24,17 @@ stdenvNoCC.mkDerivation (finalAttrs: {
nativeBuildInputs = [ just ]; nativeBuildInputs = [ just ];
propagatedBuildInputs = [
pop-icon-theme
hicolor-icon-theme
];
justFlags = [ justFlags = [
"--set" "--set"
"prefix" "prefix"
(placeholder "out") (placeholder "out")
]; ];
propagatedBuildInputs = [
pop-icon-theme
hicolor-icon-theme
];
dontDropIconThemeCache = true; dontDropIconThemeCache = true;
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {

View file

@ -26,6 +26,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-0tcrOfVT5b57ev3b5F2U78F2QPGFwp94bqFVNyKH0Yk="; hash = "sha256-0tcrOfVT5b57ev3b5F2U78F2QPGFwp94bqFVNyKH0Yk=";
}; };
postPatch = ''
substituteInPlace src/main.rs --replace-fail '"/bin/sh"' '"${lib.getExe' bash "sh"}"'
'';
cargoHash = "sha256-wAjFC6qAC3nllbnZf0KVaZTEztNYo6GTvwcp5FYmXLw="; cargoHash = "sha256-wAjFC6qAC3nllbnZf0KVaZTEztNYo6GTvwcp5FYmXLw=";
separateDebugInfo = true; separateDebugInfo = true;
@ -48,10 +52,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
postPatch = ''
substituteInPlace src/main.rs --replace-fail '"/bin/sh"' '"${lib.getExe' bash "sh"}"'
'';
passthru = { passthru = {
tests = { tests = {
inherit (nixosTests) inherit (nixosTests)

View file

@ -24,9 +24,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-UABqbmbwW2ZBOO7mq16/h0s55VCWRF2yyf/1TaubC88="; hash = "sha256-UABqbmbwW2ZBOO7mq16/h0s55VCWRF2yyf/1TaubC88=";
}; };
cargoHash = "sha256-DESnl5NjakU4++Ep6CHxDZzHn+o0Gi0eREpXk5BN5iY="; postPatch = ''
# Installs in $out/etc/xdg/autostart instead of /etc/xdg/autostart
substituteInPlace justfile \
--replace-fail \
"autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry" \
"autostart-dst := prefix / 'etc' / 'xdg' / 'autostart' / desktop-entry"
'';
separateDebugInfo = true; cargoHash = "sha256-DESnl5NjakU4++Ep6CHxDZzHn+o0Gi0eREpXk5BN5iY=";
buildFeatures = [ "nixos" ]; buildFeatures = [ "nixos" ];
@ -38,8 +44,14 @@ rustPlatform.buildRustPackage (finalAttrs: {
# https://github.com/rust-secure-code/cargo-auditable/issues/225 # https://github.com/rust-secure-code/cargo-auditable/issues/225
auditable = false; auditable = false;
separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env = {
VERGEN_GIT_SHA = finalAttrs.src.tag;
DISABLE_IF_EXISTS = "/iso/nix-store.squashfs";
};
nativeBuildInputs = [ nativeBuildInputs = [
libcosmicAppHook libcosmicAppHook
just just
@ -52,18 +64,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
udev udev
]; ];
postPatch = ''
# Installs in $out/etc/xdg/autostart instead of /etc/xdg/autostart
substituteInPlace justfile \
--replace-fail \
"autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry" \
"autostart-dst := prefix / 'etc' / 'xdg' / 'autostart' / desktop-entry"
'';
preFixup = ''
libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ killall ]})
'';
dontUseJustBuild = true; dontUseJustBuild = true;
dontUseJustCheck = true; dontUseJustCheck = true;
@ -76,7 +76,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
env.DISABLE_IF_EXISTS = "/iso/nix-store.squashfs"; preFixup = ''
libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ killall ]})
'';
passthru = { passthru = {
tests = { tests = {

View file

@ -26,6 +26,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = "--cfg tokio_unstable";
nativeBuildInputs = [ nativeBuildInputs = [
just just
libcosmicAppHook libcosmicAppHook
@ -43,8 +45,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = "--cfg tokio_unstable";
passthru = { passthru = {
tests = { tests = {
inherit (nixosTests) inherit (nixosTests)

View file

@ -30,6 +30,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.POLKIT_AGENT_HELPER_1 = "/run/wrappers/bin/polkit-agent-helper-1";
nativeBuildInputs = [ nativeBuildInputs = [
just just
libcosmicAppHook libcosmicAppHook
@ -55,8 +57,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
env.POLKIT_AGENT_HELPER_1 = "/run/wrappers/bin/polkit-agent-helper-1";
passthru = { passthru = {
tests = { tests = {
inherit (nixosTests) inherit (nixosTests)

View file

@ -1,3 +1,7 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Lily Foster <lily@lily.flowers>
# Portions of this code are adapted from nixos-cosmic
# https://github.com/lilyinstarlight/nixos-cosmic
{ {
lib, lib,
stdenv, stdenv,
@ -33,6 +37,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
just just
pkg-config pkg-config
@ -40,9 +46,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
rustPlatform.bindgenHook rustPlatform.bindgenHook
]; ];
# Largely based on lilyinstarlight's work linked below
# https://github.com/lilyinstarlight/nixos-cosmic/blob/main/pkgs/cosmic-player/package.nix
buildInputs = [ buildInputs = [
alsa-lib alsa-lib
ffmpeg ffmpeg
@ -67,7 +70,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
postInstall = '' preFixup = ''
libcosmicAppWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") libcosmicAppWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0")
''; '';

View file

@ -21,9 +21,10 @@ stdenv.mkDerivation {
__structuredAttrs = true; __structuredAttrs = true;
strictDeps = true; strictDeps = true;
makeFlags = [ "PREFIX=${placeholder "out"}" ];
nativeBuildInputs = [ wayland-scanner ]; nativeBuildInputs = [ wayland-scanner ];
makeFlags = [ "PREFIX=${placeholder "out"}" ];
passthru = { passthru = {
tests = { tests = {
inherit (nixosTests) inherit (nixosTests)

View file

@ -33,6 +33,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.rev;
nativeBuildInputs = [ nativeBuildInputs = [
just just
libcosmicAppHook libcosmicAppHook
@ -64,8 +66,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
env.VERGEN_GIT_SHA = finalAttrs.src.rev;
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
extraArgs = [ extraArgs = [
"--version" "--version"

View file

@ -22,23 +22,25 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-FphY53MaOUUR2oQfZak3HbT+kvysUnw2AIc4L9O+TcU="; hash = "sha256-FphY53MaOUUR2oQfZak3HbT+kvysUnw2AIc4L9O+TcU=";
}; };
postPatch = ''
substituteInPlace data/start-cosmic \
--replace-fail '/usr/bin/cosmic-session' "$out/bin/cosmic-session" \
--replace-fail '/usr/bin/dbus-run-session' "${lib.getBin dbus}/bin/dbus-run-session"
substituteInPlace data/cosmic.desktop \
--replace-fail '/usr/bin/start-cosmic' "$out/bin/start-cosmic"
'';
cargoHash = "sha256-5dLG40X+yxJo566guyHqOCLNp+uNSE+HONS8GIDm58A="; cargoHash = "sha256-5dLG40X+yxJo566guyHqOCLNp+uNSE+HONS8GIDm58A=";
separateDebugInfo = true; separateDebugInfo = true;
postPatch = ''
substituteInPlace data/start-cosmic \
--replace-fail '/usr/bin/cosmic-session' "${placeholder "out"}/bin/cosmic-session" \
--replace-fail '/usr/bin/dbus-run-session' "${lib.getBin dbus}/bin/dbus-run-session"
substituteInPlace data/cosmic.desktop \
--replace-fail '/usr/bin/start-cosmic' "${placeholder "out"}/bin/start-cosmic"
'';
__structuredAttrs = true; __structuredAttrs = true;
buildInputs = [ bash ]; env.ORCA = "orca"; # get orca from $PATH
nativeBuildInputs = [ just ]; nativeBuildInputs = [ just ];
buildInputs = [ bash ];
dontUseJustBuild = true; dontUseJustBuild = true;
justFlags = [ justFlags = [
@ -53,8 +55,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}" "target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
env.ORCA = "orca"; # get orca from $PATH
passthru = { passthru = {
providedSessions = [ "cosmic" ]; providedSessions = [ "cosmic" ];
tests = { tests = {

View file

@ -30,6 +30,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
just just
pkg-config pkg-config

View file

@ -30,6 +30,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [ nativeBuildInputs = [
just just
pkg-config pkg-config

View file

@ -19,11 +19,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
hash = "sha256-m2cYppfitpBDKK8CC9i/lUrC9rfSYTuqUSZSyIKKGyg="; hash = "sha256-m2cYppfitpBDKK8CC9i/lUrC9rfSYTuqUSZSyIKKGyg=";
}; };
makeFlags = [ "prefix=${placeholder "out"}" ];
__structuredAttrs = true; __structuredAttrs = true;
strictDeps = true; strictDeps = true;
makeFlags = [ "prefix=${placeholder "out"}" ];
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
extraArgs = [ extraArgs = [
"--version-regex" "--version-regex"

View file

@ -27,7 +27,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-Z5dC3W8QoDBZWBjHwRj9MC8EScDjQwUiUcOPTRDToDA="; cargoHash = "sha256-Z5dC3W8QoDBZWBjHwRj9MC8EScDjQwUiUcOPTRDToDA=";
separateDebugInfo = true; separateDebugInfo = true;
__structuredAttrs = true; __structuredAttrs = true;
nativeBuildInputs = [ nativeBuildInputs = [
@ -41,13 +40,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
udev udev
]; ];
dontCargoInstall = true;
makeFlags = [ makeFlags = [
"prefix=${placeholder "out"}" "prefix=${placeholder "out"}"
"CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}" "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
]; ];
dontCargoInstall = true;
passthru = { passthru = {
tests = { tests = {
inherit (nixosTests) inherit (nixosTests)

View file

@ -5,24 +5,25 @@
# shellcheck shell=bash # shellcheck shell=bash
libcosmicAppWrapperArgs=() libcosmicAppWrapperArgs=()
libcosmicAppWrapHookRanFor=()
libcosmicAppVergenHook() { libcosmicAppVergenHook() {
if [ -z "${VERGEN_GIT_COMMIT_DATE-}" ]; then if [ -z "${VERGEN_GIT_COMMIT_DATE-}" ]; then
# shellcheck disable=SC2155 # shellcheck disable=SC2155
export VERGEN_GIT_COMMIT_DATE="$(date --utc --date=@"$SOURCE_DATE_EPOCH" '+%Y-%m-%d')" export VERGEN_GIT_COMMIT_DATE="$(date --utc --date=@"$SOURCE_DATE_EPOCH" '+%Y-%m-%d')"
fi fi
} }
libcosmicAppLinkerArgsHook() { libcosmicAppLinkerArgsHook() {
# Force linking to certain libraries like libEGL, which are always dlopen()ed # Force linking to certain libraries like libEGL, which are always dlopen()ed
local flags="CARGO_TARGET_@cargoLinkerVar@_RUSTFLAGS" local flags="CARGO_TARGET_@cargoLinkerVar@_RUSTFLAGS"
export "$flags"="${!flags-} -C link-arg=-Wl,--push-state,--no-as-needed" export "$flags"="${!flags-} -C link-arg=-Wl,--push-state,--no-as-needed"
# shellcheck disable=SC2043 # shellcheck disable=SC2043
for lib in @cargoLinkLibs@; do for lib in @cargoLinkLibs@; do
export "$flags"="${!flags} -C link-arg=-l${lib}" export "$flags"="${!flags} -C link-arg=-l${lib}"
done done
export "$flags"="${!flags} -C link-arg=-Wl,--pop-state" export "$flags"="${!flags} -C link-arg=-Wl,--pop-state"
} }
preConfigurePhases+=" libcosmicAppVergenHook libcosmicAppLinkerArgsHook" preConfigurePhases+=" libcosmicAppVergenHook libcosmicAppLinkerArgsHook"
@ -51,9 +52,18 @@ wrapLibcosmicApp() {
# Note: $libcosmicAppWrapperArgs still gets defined even if ${dontWrapLibcosmicApp-} is set # Note: $libcosmicAppWrapperArgs still gets defined even if ${dontWrapLibcosmicApp-} is set
libcosmicAppWrapHook() { libcosmicAppWrapHook() {
# guard against running multiple times (e.g. due to propagation) # guard against running multiple times for the same prefix (e.g. due to propagation)
[ -z "$libcosmicAppWrapHookHasRun" ] || return 0 for _ranFor in "${libcosmicAppWrapHookRanFor[@]}"; do
libcosmicAppWrapHookHasRun=1 if [[ "$_ranFor" == "$prefix" ]]; then
echo "[libcosmicAppWrapHook] already ran for prefix='${prefix}', returning early"
return 0
fi
done
libcosmicAppWrapHookRanFor+=("$prefix")
echo "[libcosmicAppWrapHook] prefix='${prefix}'"
echo "[libcosmicAppWrapHook] dontWrapLibcosmicApp='${dontWrapLibcosmicApp:-}'"
echo "[libcosmicAppWrapHook] libcosmicAppWrapperArgs=(${libcosmicAppWrapperArgs[*]})"
if [[ -z "${dontWrapLibcosmicApp:-}" ]]; then if [[ -z "${dontWrapLibcosmicApp:-}" ]]; then
targetDirsThatExist=() targetDirsThatExist=()
@ -61,35 +71,47 @@ libcosmicAppWrapHook() {
# wrap binaries # wrap binaries
targetDirs=("${prefix}/bin" "${prefix}/libexec") targetDirs=("${prefix}/bin" "${prefix}/libexec")
echo "[libcosmicAppWrapHook] checking targetDirs: ${targetDirs[*]}"
for targetDir in "${targetDirs[@]}"; do for targetDir in "${targetDirs[@]}"; do
echo "[libcosmicAppWrapHook] checking targetDir='${targetDir}' exists=$([ -d "${targetDir}" ] && echo yes || echo no)"
if [[ -d "${targetDir}" ]]; then if [[ -d "${targetDir}" ]]; then
targetDirsThatExist+=("${targetDir}") targetDirsThatExist+=("${targetDir}")
targetDirsRealPath+=("$(realpath "${targetDir}")/") targetDirsRealPath+=("$(realpath "${targetDir}")/")
echo "[libcosmicAppWrapHook] finding executables in '${targetDir}'"
find "${targetDir}" -type f -executable -print0 | find "${targetDir}" -type f -executable -print0 |
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
echo "Wrapping program '${file}'" echo "[libcosmicAppWrapHook] wrapping program '${file}'"
wrapLibcosmicApp "${file}" wrapLibcosmicApp "${file}"
done done
fi fi
done done
echo "[libcosmicAppWrapHook] targetDirsThatExist=(${targetDirsThatExist[*]})"
echo "[libcosmicAppWrapHook] targetDirsRealPath=(${targetDirsRealPath[*]})"
# wrap links to binaries that point outside targetDirs # wrap links to binaries that point outside targetDirs
# Note: links to binaries within targetDirs do not need # Note: links to binaries within targetDirs do not need
# to be wrapped as the binaries have already been wrapped # to be wrapped as the binaries have already been wrapped
if [[ ${#targetDirsThatExist[@]} -ne 0 ]]; then if [[ ${#targetDirsThatExist[@]} -ne 0 ]]; then
echo "[libcosmicAppWrapHook] finding symlinks in targetDirs"
find "${targetDirsThatExist[@]}" -type l -xtype f -executable -print0 | find "${targetDirsThatExist[@]}" -type l -xtype f -executable -print0 |
while IFS= read -r -d '' linkPath; do while IFS= read -r -d '' linkPath; do
linkPathReal=$(realpath "${linkPath}") linkPathReal=$(realpath "${linkPath}")
echo "[libcosmicAppWrapHook] checking link '${linkPath}' -> '${linkPathReal}'"
for targetPath in "${targetDirsRealPath[@]}"; do for targetPath in "${targetDirsRealPath[@]}"; do
if [[ "$linkPathReal" == "$targetPath"* ]]; then if [[ "$linkPathReal" == "$targetPath"* ]]; then
echo "Not wrapping link: '$linkPath' (already wrapped)" echo "[libcosmicAppWrapHook] not wrapping link: '$linkPath' (already wrapped)"
continue 2 continue 2
fi fi
done done
echo "Wrapping link: '$linkPath'" echo "[libcosmicAppWrapHook] wrapping link: '$linkPath'"
wrapLibcosmicApp "${linkPath}" wrapLibcosmicApp "${linkPath}"
done done
else
echo "[libcosmicAppWrapHook] no targetDirs exist, skipping symlink wrapping"
fi fi
else
echo "[libcosmicAppWrapHook] dontWrapLibcosmicApp is set, skipping all wrapping"
fi fi
} }

View file

@ -576,6 +576,7 @@ mapAliases {
cordless = throw "'cordless' has been removed due to being archived upstream. Consider using 'discordo' instead."; # Added 2025-06-07 cordless = throw "'cordless' has been removed due to being archived upstream. Consider using 'discordo' instead."; # Added 2025-06-07
corepack_latest = throw "'corepack_latest' has been removed, use 'corepack.override { nodejs-slim = pkgs.nodejs-slim_latest; }' instead"; # Added 2025-10-25 corepack_latest = throw "'corepack_latest' has been removed, use 'corepack.override { nodejs-slim = pkgs.nodejs-slim_latest; }' instead"; # Added 2025-10-25
coreth = throw "'coreth' has been moved to 'avalanchego' by upstream"; # Added 2026-01-15 coreth = throw "'coreth' has been moved to 'avalanchego' by upstream"; # Added 2026-01-15
cosmic-applibrary = warnAlias "'cosmic-applibrary' has been renamed to 'cosmic-app-library'" cosmic-app-library; # Added 2026-07-01
cosmic-tasks = throw "'cosmic-tasks' has been renamed to/replaced by 'tasks'"; # Converted to throw 2025-10-27 cosmic-tasks = throw "'cosmic-tasks' has been renamed to/replaced by 'tasks'"; # Converted to throw 2025-10-27
cotton = throw "'cotton' has been removed since it is vulnerable to CVE-2025-62518 and upstream is unmaintained"; # Added 2025-10-26 cotton = throw "'cotton' has been removed since it is vulnerable to CVE-2025-62518 and upstream is unmaintained"; # Added 2025-10-26
cpp-ipfs-api = throw "'cpp-ipfs-api' has been renamed to/replaced by 'cpp-ipfs-http-client'"; # Converted to throw 2025-10-27 cpp-ipfs-api = throw "'cpp-ipfs-api' has been renamed to/replaced by 'cpp-ipfs-http-client'"; # Converted to throw 2025-10-27