#! /nix/store/gik3rh1vz2jlgnifb9dh6vc6sxwwz9jj-bash-5.3p9/bin/bash -e

if [ -x "/run/wrappers/bin/__chromium-suid-sandbox" ]
then
  export CHROME_DEVEL_SANDBOX="/run/wrappers/bin/__chromium-suid-sandbox"
else
  export CHROME_DEVEL_SANDBOX="/nix/store/q4iz4hyg64qadncbkvwzskssvk6yxghv-chromium-148.0.7778.215-sandbox/bin/__chromium-suid-sandbox"
fi

# Make generated desktop shortcuts have a valid executable name.
export CHROME_WRAPPER='chromium'

# To avoid loading .so files from cwd, LD_LIBRARY_PATH here must not
# contain an empty section before or after a colon.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}/nix/store/19ird1a31plmgjhppsqww9xs8z4wzlqr-libva-2.23.0/lib:/nix/store/m2kqwy3rb25dy5zi5sjl4f6raryb67y9-pipewire-1.6.5/lib:/nix/store/b89rbd2k8k3a8va6xkmh4nizgrpwv0y4-wayland-1.25.0/lib:/nix/store/v7fvwaf6j1hwvb9dmwfa97nzmrlshqai-gtk+3-3.24.52/lib:/nix/store/hkg2i77ydzyym51dql6q375lnf29f17a-gtk4-4.22.4/lib:/nix/store/5cbjxz04crbjnawysjx5q717gvbsx7k8-krb5-1.22.1-lib/lib"

# libredirect causes chromium to deadlock on startup
export LD_PRELOAD="$(echo -n "$LD_PRELOAD" | /nix/store/9ypz3flqsrl5xl495mm8h645gadjsxi1-coreutils-9.11/bin/tr ':' '\n' | /nix/store/gn94gpcp5q08x4v6g8mvw8v4r65rcjzk-gnugrep-3.12/bin/grep -v /lib/libredirect\\.so$ | /nix/store/9ypz3flqsrl5xl495mm8h645gadjsxi1-coreutils-9.11/bin/tr '\n' ':')"

export XDG_DATA_DIRS=/nix/store/79yg09y5lg8bg6cin5rpj36p1d5n0c0p-cups-2.4.19/share:/nix/store/v7fvwaf6j1hwvb9dmwfa97nzmrlshqai-gtk+3-3.24.52/share:/nix/store/hkg2i77ydzyym51dql6q375lnf29f17a-gtk4-4.22.4/share:/nix/store/w0h810i9z541ign43w8hbzld6p37b6n9-adwaita-icon-theme-50.0/share:/nix/store/mbylkr3lfv6ai591npydil4xp468z2xs-hicolor-icon-theme-0.18/share:/nix/store/k8a44404day9i86sxkjm0gq5ymlvyh06-gsettings-desktop-schemas-50.1/share/gsettings-schemas/gsettings-desktop-schemas-50.1:/nix/store/v7fvwaf6j1hwvb9dmwfa97nzmrlshqai-gtk+3-3.24.52/share/gsettings-schemas/gtk+3-3.24.52:/nix/store/hkg2i77ydzyym51dql6q375lnf29f17a-gtk4-4.22.4/share/gsettings-schemas/gtk4-4.22.4${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS

# Mainly for xdg-open but also other xdg-* tools (this is only a fallback; $PATH is suffixed so that other implementations can be used):
export PATH="$PATH${PATH:+:}/nix/store/0vk8rbf3l0j5qrihizh85kyplycw5kdv-xdg-utils-1.2.1/bin"

exec "/nix/store/6qqg0rn1fg6gr3bw7gwbp32hp86y221v-chromium-unwrapped-148.0.7778.215/libexec/chromium/chromium"  ${NIXOS_OZONE_WL:+${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}  "$@" 
