How to expose all installed packages' directories to my package/derivation?

I’m trying to make an app launcher, but I’m having problems both loading icons, and now that i tried installing it as a system app, also loading its own stylesheet file. (it does load the .desktop files correctly tho)
I’m using Gtk+Glib, in Vala, and looking through the system data directories using a library function instead of a hardcoded string. Is it a gtk problem or is there a way to expose ALL the derivations to mine.

This is my launcher’s .nix build file:

{
  pkgs ? import <nixpkgs> {},
  stdenv ? pkgs.stdenv,
}: stdenv.mkDerivation rec {
  name = "equlauncher";
  APPLICATION_ID = "one.zagura.equshell.equlauncher";
  src = ./src/.;
  nativeBuildInputs = with pkgs; [ vala pkg-config ];
  buildInputs = with pkgs; [
    libgee
    gtk4
    gtk4-layer-shell
  ];
  buildPhase = ''
    valac shared/util.vala \
      launcher/main.vala launcher/window.vala launcher/desktop_entry.vala launcher/fuzzy.vala \
      shared/config.vapi -X -w -o ${name} \
      -X -DAPPLICATION_ID=\"$APPLICATION_ID\" \
      --pkg=gee-0.8 \
      --pkg=gio-unix-2.0 \
      --pkg=gtk4 \
      --pkg=gtk4-layer-shell-0
  '';
  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/share/$APPLICATION_ID
    cp ${name} $out/bin/${name}
    cp launcher/style.css $out/share/$APPLICATION_ID/style.css
  	echo "[Theme]" >> $out/share/$APPLICATION_ID/config
  	echo "Icon=nix-snowflake-white" >> $out/share/$APPLICATION_ID/config
  '';

  meta = {
  	description = "Pretty app launcher";
  	mainProgram = name;
  };
}

I then add it to my system packages using the callPackage function.

When running it in a nix-shell it does load its own stylesheet, when installing it on the system and running from the command line, it doesnt, cause its own store directory is missing from the data dirs list.

Installing and running xdg-user-dirs-update doesnt fix it

it’s worth adding that the normal (not other apps) icons that do load are very blurry/lowres (even tho Adwaita icons are all svgs)
image

another strange behavior: if i replace all occurrences of $APPLICATION_ID with ${name} it stops loading its own stylesheet even when running it with nix-shell

UPDATE: it does load its own stylesheet when installed, if i do it using the home manager
So now the only issue is still the other apps’ icons not loading

OMG!! I figured it out!!!
I had to use makeWrapper with librsvg, i just stole this from some other package’s nix file, so I’m not entirely sure why it works. I guess im setting a different, patched backend… idk why this is not the default… Anyone feel free to explain it further, but I’m happy, my icons are fixed, and I’m marking this as solved

{
  pkgs ? import <nixpkgs> {},
  stdenv ? pkgs.stdenv,
}: stdenv.mkDerivation rec {
  name = "equlauncher";
  version = "1.0.0";
  APPLICATION_ID = "one.zagura.equshell.equlauncher";
  src = ./src/.;
  nativeBuildInputs = with pkgs; [
    vala
    pkg-config
    makeWrapper
  ];
  buildInputs = with pkgs; [
    librsvg
    gtk4
    gtk4-layer-shell
    libgee
  ];
  propagatedBuildInputs = with pkgs; [
    hicolor-icon-theme
    adwaita-icon-theme
  ];
  
  buildPhase = ''
    valac shared/util.vala \
      launcher/main.vala \
      launcher/window.vala launcher/desktop-entry.vala \
      launcher/smart-answer.vala \
      launcher/math/lexer.vala launcher/math/parser.vala \
      launcher/fuzzy.vala \
      shared/config.vapi -X -w -o ${name} \
      -X -DAPPLICATION_ID=\"$APPLICATION_ID\" \
      -X -lm \
      --pkg=gee-0.8 \
      --pkg=gio-unix-2.0 \
      --pkg=gtk4 \
      --pkg=gtk4-layer-shell-0
  '';
  installPhase = ''
    runHook preInstall
    
    mkdir -p $out/bin
    mkdir -p $out/share/${APPLICATION_ID}
    cp ${name} $out/bin/${name}
    cp launcher/style.css $out/share/${APPLICATION_ID}/style.css
  	echo "[Theme]" >> $out/share/${APPLICATION_ID}/config
  	echo "Icon=nix-snowflake-white" >> $out/share/${APPLICATION_ID}/config
  	
    runHook postInstall
  '';
  
  postInstall = ''
    wrapProgram $out/bin/${name} \
      --set GDK_PIXBUF_MODULE_FILE "$(echo ${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)"
  '';

  meta = {
  	description = "Pretty app launcher";
  	mainProgram = name;
  };
}