feat: Create desktop item for appimage-run
Thanks @jtotnar for help with the tests <https://discourse.nixos.org/t/how-to-test-desktop-item-mime-types/24510>!
This commit is contained in:
parent
0acc6df742
commit
73981dd9c2
@ -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;
|
||||
})
|
||||
|
@ -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,7 +11,7 @@ let
|
||||
};
|
||||
in
|
||||
runCommand "appimage-run-tests" {
|
||||
buildInputs = [ appimage-run glibcLocales file ];
|
||||
buildInputs = [ appimage-run glibcLocales file xdg-utils ];
|
||||
meta.platforms = [ "x86_64-linux" ];
|
||||
}
|
||||
''
|
||||
@ -28,7 +28,10 @@ in
|
||||
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
|
||||
''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user