ralismark/nix-appimage

Fully Conform to the AppImage format by including `.desktop` & `icons`

Opened this issue · 0 comments

Hi, we have started to use nix-appimage to create portable AppImages over at: https://github.com/Azathothas/Toolpacks
Unfortunately, currently we have to extract the AppImage (created by nix-appimage ) and then use some bash kung-fu to place the relevant .desktop & icon files.
For an example to create an mpv AppImage: https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/x86_64_Linux/bins/mpv.sh

#Media
cd "${APPIMAGE_EXTRACT}"
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo"
SHARE_DIR="$(find "." -path '*share/*mpv*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}"

#usr/{applications,bash-completion,icons,metainfo,mpv,zsh}
 rsync -av --copy-links \
                      --include="*/" \
                      --include="*.desktop" \
                      --include="*.png" \
                      --include="*.svg" \
                      --include="*.xml" \
                      --exclude="*" \
                     "${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/"
                     
#Icon
find "." -path '*128x128/apps/*.png' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp "{}" ./mpv.png'
find "." -maxdepth 1 -type f -name '*.svg' -exec sh -c 'convert "$0" "${0%.svg}.png"' {} \; 2>/dev/null
cp "./mpv.png" "./.DirIcon"

##Desktop
find "." -path '*mpv*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./mpv.desktop"'
sed 's/Icon=[^ ]*/Icon=mpv/' -i "./mpv.desktop" 2>/dev/null

As per the readme:

Additionally, the produced file isn't a fully conforming AppImage. For example, it's missing the relevant .desktop file and icons -- this doesn't affect the running of bundled apps in any way, but might cause issues with showing up correctly in application launchers (e.g. rofi). Please open an issue if this is something you want.

It would be nice to have nix-appimage include the .desktop & icons too.
Thanks!