Hey everyone,
I am trying to build a modified version of libimobiledevice
(source), in Nix, to get the option wifi <on/off> enable/disable wifi connections
in the command idevicepair
.
I am currently able to build the software corrected using a Dockerfile, which I found here and changed the repo libimobiledevice/libimobiledevice
to tihmstar/libimobiledevice
.
Content of Dockerfile
FROM debian:11-slim
RUN apt-get update # && apt-get upgrade -y
RUN apt-get install -y build-essential pkg-config checkinstall git autoconf automake
RUN apt-get install -y libtool-bin libssl-dev libcurl4-openssl-dev
RUN apt-get install -y libusb-1.0.0-dev libavahi-client-dev avahi-daemon avahi-utils
ENV INSTALL_PATH /src
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
RUN git clone https://github.com/libimobiledevice/libplist.git \
&& cd /src/libplist \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git \
&& cd /src/libimobiledevice-glue \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/libimobiledevice/libtatsu.git \
&& cd /src/libtatsu \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/libimobiledevice/libusbmuxd.git \
&& cd /src/libusbmuxd \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/tihmstar/libimobiledevice.git \
&& cd /src/libimobiledevice \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/tihmstar/libgeneral.git \
&& cd /src/libgeneral \
&& ./autogen.sh \
&& make \
&& make install
RUN git clone https://github.com/fosple/usbmuxd2.git \
&& cd /src/usbmuxd2 \
&& apt-get install -y clang \
&& ./autogen.sh \
&& ./configure CC=clang CXX=clang++ \
&& make \
&& make install
Help menu from idevicepair, when build with Dockerfile
root@e69221d8b4b9:/src# idevicepair --help
Usage: idevicepair [OPTIONS] COMMAND
Manage host pairings with devices and usbmuxd.
Where COMMAND is one of:
systembuid print the system buid of the usbmuxd host
hostid print the host id for target device
pair pair device with this host
validate validate if device is paired with this host
unpair unpair device with this host
list list devices paired with this host
wifi <on/off> enable/disable wifi connections
The following OPTIONS are accepted:
-u, --udid UDID target specific device by UDID
-w, --wireless perform wireless pairing (see NOTE)
-n, --network connect to network device (see NOTE)
-d, --debug enable communication debugging
-h, --help prints usage information
-v, --version prints version information
NOTE: Pairing over network (wireless pairing) is only supported by Apple TV
devices. To perform a wireless pairing, you need to use the -w command line
switch. Make sure to put the device into pairing mode first by opening
Settings > Remotes and Devices > Remote App and Devices.
Homepage: <https://libimobiledevice.org>
Bug Reports: <https://github.com/libimobiledevice/libimobiledevice/issues>
I thought I could just take the nix package and modify the src =
to point to a different repo and build it, but for some reason the wifi <on/off>
option is missing from idevicepair
command,
I have also tried to build with including patches =
to no include something from the original repo, but the wifi <on/off>
option is still missing.
Are there someone who are familiar with package C/C++ and can help me figure out what I do wrong?
Link to nixpkgs for libimobiledevice: nixpkgs/pkgs/development/libraries/libimobiledevice/default.nix at d02d88f8de5b882ccdde0465d8fa2db3aa1169f7 · NixOS/nixpkgs · GitHub
and my modified package.nix
file
My package.nix file for building libimobiledevice
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
autoreconfHook,
pkg-config,
openssl,
libgcrypt,
libplist,
libtasn1,
libusbmuxd,
libimobiledevice-glue,
SystemConfiguration,
CoreFoundation,
unstableGitUpdater,
}:
stdenv.mkDerivation rec {
pname = "libimobiledevice";
version = "1.3.0-unstable-2024-08-01";
src = fetchFromGitHub {
owner = "tihmstar";
repo = pname;
rev = "1eba0b23cac7d9bdfaa271fadff6bcccd8aadb3f";
hash = "sha256-pNvtDGUlifp10V59Kah4q87TvLrcptrCJURHo+Y+hs4=";
};
# patches = [
# # Fix gcc-14 and clang-16 build:
# # https://github.com/libimobiledevice/libimobiledevice/pull/1569
# (fetchpatch {
# name = "fime.h.patch";
# url = "https://github.com/libimobiledevice/libimobiledevice/commit/92256c2ae2422dac45d8648a63517598bdd89883.patch";
# hash = "sha256-sB+wEFuXFoQnuf7ntWfvYuCgWfYbmlPL7EjW0L0F74o=";
# })
# ];
preAutoreconf = ''
export RELEASE_VERSION=${version}
'';
configureFlags = [ "--without-cython" ];
nativeBuildInputs = [
autoreconfHook
pkg-config
];
propagatedBuildInputs =
[
openssl
libgcrypt
libplist
libtasn1
libusbmuxd
libimobiledevice-glue
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
SystemConfiguration
CoreFoundation
];
outputs = [
"out"
"dev"
];
enableParallelBuilding = true;
passthru.updateScript = unstableGitUpdater { };
meta = with lib; {
homepage = "https://github.com/libimobiledevice/libimobiledevice";
description = "Software library that talks the protocols to support iPhone®, iPod Touch® and iPad® devices on Linux";
longDescription = ''
libimobiledevice is a software library that talks the protocols to support
iPhone®, iPod Touch® and iPad® devices on Linux. Unlike other projects, it
does not depend on using any existing proprietary libraries and does not
require jailbreaking. It allows other software to easily access the
device's filesystem, retrieve information about the device and it's
internals, backup/restore the device, manage SpringBoard® icons, manage
installed applications, retrieve addressbook/calendars/notes and bookmarks
and synchronize music and video to the device. The library is in
development since August 2007 with the goal to bring support for these
devices to the Linux Desktop.
'';
license = licenses.lgpl21Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ RossComputerGuy ];
};
}