Add mise tasks, desktop entry, and app icon

mise run install builds a release binary and installs it into ~/.local with
a desktop entry and a hicolor icon.

Two wrinkles specific to a Nix-built GTK app installed outside the dev shell:
the launcher is a generated script rather than a symlink, because a desktop
launcher provides a minimal environment and GTK still needs to be pointed at
its GSettings schemas and icon themes; and install registers Nix GC roots for
every store path in the binary's RPATH, so nix-collect-garbage cannot delete
GTK out from under the installed app.

The runtime paths are exported from the flake's shellHook and read back at
install time, so they cannot drift from what the binary was built against.
This commit is contained in:
Greyson Parrelli
2026-08-11 10:03:41 -04:00
parent 7af5cf72e6
commit 74bc9e8fd3
5 changed files with 218 additions and 6 deletions
+14 -4
View File
@@ -84,10 +84,20 @@
];
shellHook = ''
# GTK needs to find icon themes and schemas at runtime when the app
# is launched straight out of the dev shell rather than installed.
export XDG_DATA_DIRS="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}:${pkgs.adwaita-icon-theme}/share:${pkgs.hicolor-icon-theme}/share:$XDG_DATA_DIRS"
export GSETTINGS_SCHEMA_DIR="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}/glib-2.0/schemas"
# The runtime data GTK needs to find at startup: its own GSettings
# schemas and the icon themes our widgets pull symbolic icons from.
#
# These are exported under their own names, rather than only folded
# into XDG_DATA_DIRS, because `mise run install` reads them back out
# to bake into the installed launcher. The built binary already has
# an RPATH into the Nix store and runs fine outside this shell, but
# it still has to be pointed at this data or GTK aborts on a missing
# schema and falls back to broken-image icons.
export VTABS_GSETTINGS_SCHEMA_DIR="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}/glib-2.0/schemas"
export VTABS_RUNTIME_DATA_DIRS="${pkgs.gtk4}/share/gsettings-schemas/${pkgs.gtk4.name}:${pkgs.adwaita-icon-theme}/share:${pkgs.hicolor-icon-theme}/share"
export GSETTINGS_SCHEMA_DIR="$VTABS_GSETTINGS_SCHEMA_DIR"
export XDG_DATA_DIRS="$VTABS_RUNTIME_DATA_DIRS:$XDG_DATA_DIRS"
'';
};
});