Merge pull request #209832 from l0b0/feat/create-appimage-run-desktop-entry

appimage-run: Create desktop entry
This commit is contained in:
Guillaume Girol 2023-03-12 13:44:26 +00:00 committed by GitHub
commit ddc56938e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 6 deletions

View file

@ -1,13 +1,29 @@
{ appimageTools, buildFHSUserEnv, extraPkgs ? pkgs: [], appimage-run-tests ? null }:
{ appimageTools, buildFHSUserEnv, makeDesktopItem, extraPkgs ? pkgs: [], appimage-run-tests ? null }:
let
fhsArgs = appimageTools.defaultFhsEnvArgs;
in buildFHSUserEnv (fhsArgs // {
name = "appimage-run";
fhsArgs = appimageTools.defaultFhsEnvArgs;
desktopItem = makeDesktopItem {
inherit name;
exec = name;
desktopName = name;
genericName = "AppImage runner";
noDisplay = true;
mimeTypes = ["application/vnd.appimage" "application/x-iso9660-appimage"];
categories = ["PackageManager" "Utility"];
};
in buildFHSUserEnv (fhsArgs // {
inherit name;
targetPkgs = pkgs: [ appimageTools.appimage-exec ]
++ fhsArgs.targetPkgs pkgs ++ extraPkgs pkgs;
runScript = "appimage-exec.sh";
extraInstallCommands = ''
cp --recursive "${desktopItem}/share" "$out/"
'';
passthru.tests.appimage-run = appimage-run-tests;
})

View file

@ -1,4 +1,4 @@
{ runCommand, fetchurl, appimage-run, glibcLocales, file }:
{ runCommand, fetchurl, appimage-run, glibcLocales, file, xdg-utils }:
let
# any AppImage usable on cli, really
sample-appImage = fetchurl {
@ -11,21 +11,27 @@ let
};
in
runCommand "appimage-run-tests" {
buildInputs = [ appimage-run glibcLocales file ];
buildInputs = [ appimage-run glibcLocales file xdg-utils ];
meta.platforms = [ "x86_64-linux" ];
}
''
export HOME=$(mktemp -d)
set -x
# regression test for #101137, must come first
LANG=fr_FR appimage-run ${sample-appImage} --list ${sample-appImage}
# regression test for #108426
cp ${sample-appImage} foo.appImage
LANG=fr_FR appimage-run ${sample-appImage} --list foo.appImage
cp ${owdtest} owdtest.AppImage.gz
gunzip owdtest.AppImage.gz
appimage-run owdtest.AppImage
# Verify desktop entry
XDG_DATA_DIRS="${appimage-run}/share"
[[ "$(xdg-mime query default application/vnd.appimage)" == '${appimage-run.name}.desktop' ]]
set +x
touch $out
''