@@ -0,0 +1,55 @@
1+{ stdenv, fetchurl, perl, pathsFromGraph }:
5+ url = "https://github.com/probonopd/AppImageKit/releases/download/6/AppRun_6-x86_64";
6+ sha256 = "1i0hr4ag6jz3h27c80ir2rswq91khw0cq9fqylg23l6pmjgwbf98";
11+ { target, name }: stdenv.mkDerivation {
12+ name = "${name}.AppDir";
13+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) [ target ];
14+ nativeBuildInputs = [ perl ];
16+ # TODO use symlinks to shrink output size
18+ if [ ! -d ${target}/share/applications ]; then
19+ echo "--------------------------------------------------"
20+ echo "| /share/applications does not exist. |"
21+ echo "| AppImage only works with 'applications'. |"
22+ echo "| Try using nix-bundle.sh for command-line apps. |"
23+ echo "--------------------------------------------------"
27+ storePaths=$(${perl}/bin/perl ${pathsFromGraph} ./closure-*)
28+ mkdir -p $out/nix/store
29+ cp -r $storePaths $out/nix/store
33+ ln -s .${target} $out/usr
36+ if [ -d ${target}/share/applications ]; then
37+ desktop=$(find ${target}/share/applications -name "*.desktop" | head -n1)
38+ if ! [ -z "$desktop" ]; then
44+ if [ -d ${target}/share/icons ]; then
45+ icon=$(find ${target}/share/icons -name "${name}.png" | head -n1)
46+ if ! [ -z "$icon" ]; then
48+ ln -s .$icon .DirIcon