summary refs log tree commit diff
path: root/pkgs/tools/package-management
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-03-09 11:18:21 +0000
committerGitHub <noreply@github.com>2020-03-09 11:18:21 +0000
commit115a8e8d1492722bbdc3b82ace93db707e43d949 (patch)
tree9b917f770f49dc75f05a439fd26af5f6d6e1e412 /pkgs/tools/package-management
parent92b7df1c19715b24560017085bd6292eabad2c95 (diff)
parenta3df64c8a7bd5e3e26c1cf469680d563c42103be (diff)
downloadnixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar.gz
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar.bz2
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar.lz
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar.xz
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.tar.zst
nixpkgs-115a8e8d1492722bbdc3b82ace93db707e43d949.zip
Merge pull request #81833 from bignaux/appimage-run
appimage-run: unify appimageTools and appimage-run
Diffstat (limited to 'pkgs/tools/package-management')
-rw-r--r--pkgs/tools/package-management/appimage-run/default.nix53
1 files changed, 4 insertions, 49 deletions
diff --git a/pkgs/tools/package-management/appimage-run/default.nix b/pkgs/tools/package-management/appimage-run/default.nix
index 426cc7943e5..3bc59f2ad14 100644
--- a/pkgs/tools/package-management/appimage-run/default.nix
+++ b/pkgs/tools/package-management/appimage-run/default.nix
@@ -1,56 +1,11 @@
-{ writeScript, buildFHSUserEnv, coreutils, file, libarchive, runtimeShell
-, extraPkgs ? pkgs: [], appimageTools }:
+{ appimageTools, buildFHSUserEnv, extraPkgs ? pkgs: [] }:
 
 let
   fhsArgs = appimageTools.defaultFhsEnvArgs;
 in buildFHSUserEnv (fhsArgs // {
   name = "appimage-run";
 
-  targetPkgs = pkgs: fhsArgs.targetPkgs pkgs ++ extraPkgs pkgs;
-
-  runScript = writeScript "appimage-exec" ''
-    #!${runtimeShell}
-    if [ $# -eq 0 ]; then 
-      echo "Usage: $0 FILE [OPTION...]"
-      echo
-      echo 'Options are passed on to the appimage.'
-      echo "If you want to execute a custom command in the appimage's environment, set the APPIMAGE_DEBUG_EXEC environment variable."
-      exit 1
-    fi
-    APPIMAGE="$(realpath "$1")"
-    shift
-
-    if [ ! -x "$APPIMAGE" ]; then
-      echo "fatal: $APPIMAGE is not executable"
-      exit 1
-    fi
-
-    SHA256="$(${coreutils}/bin/sha256sum "$APPIMAGE" | cut -d ' ' -f 1)"
-    SQUASHFS_ROOT="''${XDG_CACHE_HOME:-$HOME/.cache}/appimage-run/$SHA256/"
-    mkdir -p "$SQUASHFS_ROOT"
-
-    export APPDIR="$SQUASHFS_ROOT/squashfs-root"
-    if [ ! -x "$APPDIR" ]; then
-      cd "$SQUASHFS_ROOT"
-
-      if ${file}/bin/file --mime-type --brief --keep-going "$APPIMAGE" | grep -q iso; then
-        # is type-1 appimage
-        mkdir "$APPDIR"
-        ${libarchive}/bin/bsdtar -x -C "$APPDIR" -f "$APPIMAGE"
-      else
-        # is type-2 appimage
-        "$APPIMAGE" --appimage-extract 2>/dev/null
-      fi
-    fi
-
-    cd "$APPDIR"
-    export PATH="$PATH:$PWD/usr/bin"
-    export APPIMAGE_SILENT_INSTALL=1
-
-    if [ -n "$APPIMAGE_DEBUG_EXEC" ]; then
-      exec "$APPIMAGE_DEBUG_EXEC"
-    fi
-
-    exec ./AppRun "$@"
-  '';
+  targetPkgs = pkgs: [ appimageTools.appimage-exec ]
+    ++ fhsArgs.targetPkgs pkgs ++ extraPkgs pkgs;
+  runScript = "appimage-exec.sh";
 })