Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

idevicerestore: Add darwin build support. #105722

Merged
merged 5 commits into from Dec 2, 2020

Conversation

rb2k
Copy link
Contributor

@rb2k rb2k commented Dec 2, 2020

Motivation for this change

I saw that in the original derivation the comment mentioned darwin should be theoretically supported but it wasn't tested.
I tested it and it compiles fine and can run a few basic CLI commands.

I had to add the darwin flag to a few of the dependencies as well. Not sure if that needs to go into a separate PR?

(This is my first nixpkg contribution, so a sanity check would be appreciated 馃槂 )

Things done
  1. I cloned the nixpkgs repo
  2. I made my changes
  3. I built it using:
$ nix-build default.nix -A idevicerestore
  1. Ran the resulting binary on macOS 10.15.7:
% /nix/store/zscw4bcgqrgaypjl1r0z7zh13rbl2fk5-idevicerestore-2019-12-26/bin/idevicerestore 
Usage: idevicerestore [OPTIONS] PATH
Restore IPSW firmware at PATH to an iOS device.

PATH can be a compressed .ipsw file or a directory containing all files
extracted from an IPSW.

Options:
 -i, --ecid ECID  Target specific device by its ECID
                  e.g. 0xaabb123456 (hex) or 1234567890 (decimal)
 -u, --udid UDID  Target specific device by its device UDID
                  NOTE: only works with devices in normal mode.
 -l, --latest     Use latest available firmware (with download on demand).
                  Before performing any action it will interactively ask to
                  select one of the currently signed firmware versions,
                  unless -y has been given too.
                  The PATH argument is ignored when using this option.
                  DO NOT USE if you need to preserve the baseband (unlock)!
                  USE WITH CARE if you want to keep a jailbreakable firmware!
 -e, --erase      Perform a full restore, erasing all data (defaults to update)
                  DO NOT USE if you want to preserve user data on the device!
 -y, --no-input   Non-interactive mode, do not ask for any input.
                  WARNING: This will disable certain checks/prompts that are
                  supposed to prevent DATA LOSS. Use with caution.
 -n, --no-action  Do not perform any restore action. If combined with -l option
                  the on-demand ipsw download is performed before exiting.
 -h, --help       Prints this usage information
 -C, --cache-path DIR  Use specified directory for caching extracted or other
                  reused files.
 -d, --debug      Enable communication debugging

Advanced/experimental options:
 -c, --custom     Restore with a custom firmware
 -s, --cydia      Use Cydia's signature service instead of Apple's
 -x, --exclude    Exclude nor/baseband upgrade
 -t, --shsh       Fetch TSS record and save to .shsh file, then exit
 -k, --keep-pers  Write personalized components to files for debugging
 -p, --pwn        Put device in pwned DFU mode and exit (limera1n devices only)

Homepage: <http://libimobiledevice.org>
mseeger@mseeger-mbp ~ % 
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • [Not Applicable] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • [Nothing depends on it] Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@rb2k
Copy link
Contributor Author

rb2k commented Dec 2, 2020

@SuperSandro2000 thanks for the quick review!
I just noticed that I needed to whitelist a few libraries as well so I don't need the env var.
I'll incorporate your changes and I'll try to do some reading if that has to go into a separate PR.

@SuperSandro2000
Copy link
Member

I just noticed that I needed to whitelist a few libraries as well so I don't need the env var.
I'll incorporate your changes and I'll try to do some reading if that has to go into a separate PR.

One PR for this fine but please put each package change into a separate commit so it could be easily backported.

@rb2k
Copy link
Contributor Author

rb2k commented Dec 2, 2020

Ok cool. I'll turn this into a few commits then :)

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 105722 run on x86_64-darwin 1

5 packages built:
  • idevicerestore
  • libimobiledevice
  • libirecovery
  • libplist
  • libusbmuxd

@makefu
Copy link
Contributor

makefu commented Dec 2, 2020

@rb2k welcome to the club!

@infinisil infinisil merged commit 96f34a8 into NixOS:master Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants