From 195c2e4d1c70f6e9b36f134097beddeedd2dd8d0 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Tue, 19 Dec 2023 06:21:29 +0000 Subject: [PATCH] ipsw: init at 3.1.437 --- flake.lock | 12 ++++++------ flake.nix | 1 + packages/ipsw/default.nix | 36 +++++++++++++++++++++++++++++++++++ packages/ipsw/fix-build.patch | 13 +++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 packages/ipsw/default.nix create mode 100644 packages/ipsw/fix-build.patch diff --git a/flake.lock b/flake.lock index 1d0a4a5..a70d186 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1701336116, - "narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=", + "lastModified": 1702900294, + "narHash": "sha256-pt7sSoJYNw3n8YtXw0Z/Nnr6/PfY2YrjDvqboErXnRM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f5c27c6136db4d76c30e533c20517df6864c46ee", + "rev": "886c9aee6ca9324e127f9c2c4e6f68c2641c8256", "type": "github" }, "original": { @@ -42,11 +42,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2745d52..b978953 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,7 @@ }) // { overlays.default = final: prev: { jlink = final.callPackage ./packages/jlink { }; + ipsw = final.callPackage ./packages/ipsw { }; kernelPatches = prev.kernelPatches // final.callPackage ./packages/kernelPatches { }; zephyrPackages = final.callPackage ./packages/zephyr { }; diff --git a/packages/ipsw/default.nix b/packages/ipsw/default.nix new file mode 100644 index 0000000..3fba14d --- /dev/null +++ b/packages/ipsw/default.nix @@ -0,0 +1,36 @@ +{ lib, buildGoModule, fetchFromGitHub, unicorn, libusb, pkg-config }: + +buildGoModule rec { + pname = "ipsw"; + version = "3.1.437"; + + src = fetchFromGitHub { + owner = "blacktop"; + repo = "ipsw"; + rev = "v${version}"; + hash = "sha256-dYT6mmof7ip3X27UKixVhiofAOqJI5botmk6/mB8DgA="; + }; + vendorHash = "sha256-+LnakMHn2dIBJtyZ3JlS+mQkHeO0Q5sSDc4+Fzau7PE="; + patches = [ ./fix-build.patch ]; + postPatch = '' + rm cmd/ipsw/cmd/sb/sb_cmpl.go + ''; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ unicorn libusb ]; + ldflags = [ + "-s" + "-w" + "-X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion=${version}" + "-X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildTime=19700101" + ]; + tags = [ "unicorn" "libusb" ]; + doCheck = false; + + meta = with lib; { + description = "iOS/macOS Research Swiss Army Knife"; + hompage = "https://blacktop.github.io/ipsw/"; + license = licenses.mit; + maintainers = with maintainers; [ artemist ]; + }; +} diff --git a/packages/ipsw/fix-build.patch b/packages/ipsw/fix-build.patch new file mode 100644 index 0000000..bf93820 --- /dev/null +++ b/packages/ipsw/fix-build.patch @@ -0,0 +1,13 @@ +diff --git a/pkg/onthedl/file/preallocate_unix.go b/pkg/onthedl/file/preallocate_unix.go +index 78305e05c..610387b6a 100644 +--- a/pkg/onthedl/file/preallocate_unix.go ++++ b/pkg/onthedl/file/preallocate_unix.go +@@ -49,7 +49,7 @@ func PreAllocate(size int64, out *os.File) (err error) { + // Try the next flags combination + index++ + fallocFlagsIndex.Store(index) +- log.Debugf(nil, "preAllocate: got error on fallocate, trying combination %d/%d: %v", index, len(fallocFlags), err) ++ log.Debugf("preAllocate: got error on fallocate, trying combination %d/%d: %v", index, len(fallocFlags), err) + goto again + + }