1 { lib, stdenv, fetchFromGitHub
2 , pkg-config, cmake, autoconf, automake, libtool, makeWrapper
3 , wget, xxd, desktop-file-utils, file
4 , gnupg, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
11 appimagekit_src = fetchFromGitHub {
14 rev = "8bbf694455d00f48d835f56afaa1dabcd9178ba6";
15 hash = "sha256-pqg+joomC5CI9WdKP/h/XKPsruMgZEaIOjPLOqnNPZw=";
16 fetchSubmodules = true;
19 # squashfuse adapted to nix from cmake experession in "${appimagekit_src}/lib/libappimage/cmake/dependencies.cmake"
20 appimagekit_squashfuse = squashfuse.overrideAttrs rec {
22 version = "unstable-2016-10-09";
24 src = fetchFromGitHub {
27 rev = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92";
28 sha256 = "sha256-BZd1+7sRYZHthULKk3RlgMIy4uCUei45GbSEiZxLPFM=";
32 "${appimagekit_src}/lib/libappimage/src/patches/squashfuse.patch"
33 "${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.patch"
37 cp -v ${appimagekit_src}/lib/libappimage/src/patches/squashfuse_dlopen.[hc] .
40 # Workaround build failure on -fno-common toolchains:
41 # ld: libsquashfuse_ll.a(libfuseprivate_la-fuseprivate.o):(.bss+0x8):
42 # multiple definition of `have_libloaded'; runtime.4.o:(.bss.have_libloaded+0x0): first defined here
43 env.NIX_CFLAGS_COMPILE = "-fcommon";
46 sed -i "/PKG_CHECK_MODULES.*/,/,:./d" configure
47 sed -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h
51 "--disable-demo" "--disable-high-level" "--without-lzo" "--without-lz4"
55 sed -i "s|XZ_LIBS = -llzma |XZ_LIBS = -Bstatic -llzma/|g" Makefile
58 # only static libs and header files
60 mkdir -p $out/lib $out/include
61 cp -v ./.libs/*.a $out/lib
62 cp -v ./*.h $out/include
66 in stdenv.mkDerivation rec {
67 pname = "appimagekit";
68 version = "unstable-2020-12-31";
70 src = appimagekit_src;
72 patches = [ ./nix.patch ];
75 patchShebangs src/embed-magic-bytes-in-file.sh
79 pkg-config cmake autoconf automake libtool wget xxd
80 desktop-file-utils makeWrapper
84 glib zlib cairo openssl fuse xz inotify-tools
85 libarchive squashfsTools appimagekit_squashfuse
94 "-DUSE_SYSTEM_SQUASHFUSE=ON"
95 "-DSQUASHFUSE=${appimagekit_squashfuse}"
96 "-DUSE_SYSTEM_LIBARCHIVE=ON"
97 "-DUSE_SYSTEM_GTEST=ON"
98 "-DUSE_SYSTEM_MKSQUASHFS=ON"
99 "-DTOOLS_PREFIX=${stdenv.cc.targetPrefix}"
103 mkdir -p $out/lib/appimagekit
104 cp "${squashfsTools}/bin/mksquashfs" "$out/lib/appimagekit/"
105 cp "${desktop-file-utils}/bin/desktop-file-validate" "$out/bin"
107 wrapProgram "$out/bin/appimagetool" \
108 --prefix PATH : "${lib.makeBinPath [ file gnupg ]}" \
109 --unset SOURCE_DATE_EPOCH
112 nativeCheckInputs = [ gtest ];
116 squashfuse = appimagekit_squashfuse;
120 description = "Tool to package desktop applications as AppImages";
122 AppImageKit is an implementation of the AppImage format that
123 provides tools such as appimagetool and appimaged for handling
126 license = licenses.mit;
127 maintainers = with maintainers; [ taeer ];
128 homepage = src.meta.homepage;
129 platforms = platforms.linux;