about summary refs log tree commit diff
path: root/nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-02-14 23:36:38 +0900
committersefidel <contact@sefidel.net>2023-02-14 23:38:29 +0900
commit748adbac7ca3452d0a1250c37ff4168d6ccf5ae0 (patch)
tree7be36fd9da46399b3a98bc1b3e9309bd3ce64fb3 /nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix
parentadf6baa00e038e49cf477160eeddc886efced2b4 (diff)
downloadnixrc-748adbac7ca3452d0a1250c37ff4168d6ccf5ae0.tar.gz
nixrc-748adbac7ca3452d0a1250c37ff4168d6ccf5ae0.zip
feat(nixos): init kompakt
Diffstat (limited to 'nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix')
-rwxr-xr-xnixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix b/nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix
new file mode 100755
index 0000000..992d250
--- /dev/null
+++ b/nixos/modules/apple-silicon-support/packages/asahi-fwextract/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, python3
+, fetchFromGitHub
+, gzip
+, gnutar
+, lzfse
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "asahi-fwextract";
+  version = "0.5pre2";
+
+  # tracking version: https://github.com/AsahiLinux/PKGBUILDs/blob/main/asahi-fwextract/PKGBUILD
+  src = fetchFromGitHub {
+    owner = "AsahiLinux";
+    repo = "asahi-installer";
+    rev = "v${version}";
+    hash = "sha256-p34eN2iE1s8rupdysjyf6GN8kHkVG9NDw31YKPDNXbk=";
+  };
+
+  patches = [
+    ./add_entry_point.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace asahi_firmware/img4.py \
+      --replace 'liblzfse.so' '${lzfse}/lib/liblzfse.so'
+    substituteInPlace asahi_firmware/update.py \
+      --replace '"tar"' '"${gnutar}/bin/tar"' \
+      --replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"'
+  '';
+
+  nativeBuildInputs = [ python3.pkgs.setuptools ];
+
+  doCheck = false;
+}