From 1e688997ce4fea6d3e62260ec9d415592146aed3 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Sun, 13 Apr 2025 14:43:10 +0530 Subject: [PATCH 1/2] cosmic-bg: substitute default background path The directory `/usr/share/backgrounds/cosmic/` is not accessible on NixOS because the directory `/usr` does not exist on NixOS. But the wallpaper image that upstream uses as the default wallpapers is packaged in the `cosmic-wallpapers` package. So substitute the FHS path with the path of the wallpaper image from the Nix store, making this work on NixOS _and_ non-NixOS operating systems. --- pkgs/by-name/co/cosmic-bg/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/co/cosmic-bg/package.nix b/pkgs/by-name/co/cosmic-bg/package.nix index f81daf1fc9fb..962dd5d91f1b 100644 --- a/pkgs/by-name/co/cosmic-bg/package.nix +++ b/pkgs/by-name/co/cosmic-bg/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, rustPlatform, + cosmic-wallpapers, libcosmicAppHook, just, nasm, @@ -21,6 +22,12 @@ rustPlatform.buildRustPackage (finalAttrs: { hash = "sha256-4b4laUXTnAbdngLVh8/dD144m9QrGReSEjRZoNR6Iks="; }; + postPatch = '' + substituteInPlace config/src/lib.rs data/v1/all \ + --replace-fail '/usr/share/backgrounds/cosmic/orion_nebula_nasa_heic0601a.jpg' \ + "${cosmic-wallpapers}/share/backgrounds/cosmic/orion_nebula_nasa_heic0601a.jpg" + ''; + useFetchCargoVendor = true; cargoHash = "sha256-GLXooTjcGq4MsBNnlpHBBUJGNs5UjKMQJGJuj9UO2wk="; From 4a116543a3deea4e05a81bb84ae480e76f819642 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Sun, 13 Apr 2025 14:49:05 +0530 Subject: [PATCH 2/2] cosmic-bg: add upstream patch to lookup wallpapers in $XDG_DATA_DIRS Usually, I prefer waiting for a release from upstream that includes the commit but there appears that the next release is a few months away. So add the patch for the time being. Once we have a new release, the patch won't apply cleanly and we can remove it then. --- pkgs/by-name/co/cosmic-bg/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/co/cosmic-bg/package.nix b/pkgs/by-name/co/cosmic-bg/package.nix index 962dd5d91f1b..e244f19b7251 100644 --- a/pkgs/by-name/co/cosmic-bg/package.nix +++ b/pkgs/by-name/co/cosmic-bg/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, rustPlatform, + fetchpatch, cosmic-wallpapers, libcosmicAppHook, just, @@ -22,6 +23,14 @@ rustPlatform.buildRustPackage (finalAttrs: { hash = "sha256-4b4laUXTnAbdngLVh8/dD144m9QrGReSEjRZoNR6Iks="; }; + patches = [ + # TOOD: This is merged and will be included in the 7th Alpha release, remove it then. + (fetchpatch { + url = "https://github.com/pop-os/cosmic-bg/commit/6a824a7902d7cc72b5a3117b6486603a1795a1d6.patch"; + hash = "sha256-jL0az87BlJU99lDF3jnE74I4m/NV6NViyYXTfZoBDM4="; + }) + ]; + postPatch = '' substituteInPlace config/src/lib.rs data/v1/all \ --replace-fail '/usr/share/backgrounds/cosmic/orion_nebula_nasa_heic0601a.jpg' \