podman-desktop: derive .desktop entry from upstream .flatpak.desktop

Install the upstream .flatpak.desktop directly instead of hand-maintaining
a makeDesktopItem, rewriting only the launcher command and icon name and
dropping the X-Flatpak key. This keeps Categories and Keywords aligned with
upstream and prevents them from regressing. The --replace-fail patterns
fail the build if upstream renames those lines.

Signed-off-by: kaynetik <aleksandar@nesovic.dev>
This commit is contained in:
kaynetik 2026-05-31 07:24:41 +02:00
commit 7a77089c8f
No known key found for this signature in database
GPG key ID: FC04210D2782C032

View file

@ -3,13 +3,11 @@
stdenv,
fetchFromGitHub,
makeBinaryWrapper,
copyDesktopItems,
electron_41,
nodejs-slim_24,
pnpm_10,
fetchPnpmDeps,
pnpmConfigHook,
makeDesktopItem,
darwin,
nix-update-script,
_experimental-update-script-combinators,
@ -96,9 +94,6 @@ stdenv.mkDerivation (finalAttrs: {
pnpm
pnpmConfigHook
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
copyDesktopItems
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.autoSignDarwinBinariesHook
];
@ -147,6 +142,13 @@ stdenv.mkDerivation (finalAttrs: {
install -Dm644 buildResources/icon.svg "$out/share/icons/hicolor/scalable/apps/podman-desktop.svg"
# Derive the .desktop entry from upstream to keep it aligned and avoid regressions.
install -Dm644 .flatpak.desktop "$out/share/applications/podman-desktop.desktop"
substituteInPlace "$out/share/applications/podman-desktop.desktop" \
--replace-fail 'Exec=run.sh %U' 'Exec=podman-desktop %U' \
--replace-fail 'Icon=io.podman_desktop.PodmanDesktop' 'Icon=podman-desktop'
sed -i '/^X-Flatpak=/d' "$out/share/applications/podman-desktop.desktop"
makeWrapper '${electron}/bin/electron' "$out/bin/podman-desktop" \
--add-flags "$out/share/lib/podman-desktop/resources/app.asar" \
--set XDG_SESSION_TYPE 'x11' \
@ -159,20 +161,6 @@ stdenv.mkDerivation (finalAttrs: {
''
);
# see: https://github.com/podman-desktop/podman-desktop/blob/main/.flatpak.desktop
desktopItems = [
(makeDesktopItem {
name = "podman-desktop";
exec = "podman-desktop %U";
icon = "podman-desktop";
desktopName = appName;
genericName = "Desktop client for podman";
comment = finalAttrs.meta.description;
categories = [ "Utility" ];
startupWMClass = appName;
})
];
meta = {
description = "Graphical tool for developing on containers and Kubernetes";
homepage = "https://podman-desktop.io";