Unverified Commit 1e688997 authored by Pratham Patel's avatar Pratham Patel
Browse files

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.
parent f9445fde
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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=";