Last active
November 2, 2024 22:01
-
-
Save mitchellh/450cecda9477fa0d7bb2c72f1b672928 to your computer and use it in GitHub Desktop.
Revisions
-
mitchellh revised this gist
Oct 11, 2022 . 2 changed files with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,11 @@ in final: prev: rec { inherit pkgsIntel; # This always outputs x86_64 binaries. I setup binfmt_misc in my # system config to run x86_64 binaries on aarch64 via qemu. This # package properly patches all the binaries so they have the right # x86_64 libs and linker cross-compiled so they'll just work if # you have binfmt_misc setup. playdate-sdk = prev.callPackage ./playdate-sdk.nix {}; # Playdate requires gcc-arm-embedded v11. I haven't tested with later This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ pkgsIntel, }: let # TODO: eventually, I want to do a check here if we're natively # on x86_64 to not cross-compile these and just use the built-ins. # Build inputs for `pdc` pdcInputs = with pkgsIntel; [ -
mitchellh revised this gist
Oct 11, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,8 @@ in playdate-sdk = prev.callPackage ./playdate-sdk.nix {}; # Playdate requires gcc-arm-embedded v11. I haven't tested with later # versions but earlier versions do NOT work. At the time of gisting, # stable is 22.05 and only has gcc-arm-embedded v10. I overlay # nixpkgs-unstable to get v11. gcc-arm-embedded = final.pkgs-unstable.gcc-arm-embedded-11; } -
mitchellh revised this gist
Oct 11, 2022 . No changes.There are no files selected for viewing
-
mitchellh created this gist
Oct 11, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ let # Playdate distributes their SDK as precompiled x86_64 binaries # currently so we have to import cross-compiled packages for it # if we're not on an x86_64 system. pkgsIntel = import <nixpkgs> { crossSystem = { config = "x86_64-unknown-linux-gnu"; }; }; in final: prev: rec { inherit pkgsIntel; playdate-sdk = prev.callPackage ./playdate-sdk.nix {}; # Playdate requires gcc-arm-embedded v11. I haven't tested with later # versions but earlier versions do NOT work. gcc-arm-embedded = final.pkgs-unstable.gcc-arm-embedded-11; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ { stdenv, lib, fetchurl, pkgsIntel, }: let # TODO: eventually, I want to do a check here if we're natively # on x86_64 to not cross-compile these. # Build inputs for `pdc` pdcInputs = with pkgsIntel; [ libpng zlib ]; # Build inputs for the simulator (excluding those from pdc) pdsInputs = with pkgsIntel; [ udev ]; # For native, if and when we support that: # "$(cat $NIX_CC/nix-support/dynamic-linker)" dynamicLinker = "${pkgsIntel.glibc}/lib/ld-linux-x86-64.so.2"; in stdenv.mkDerivation rec { pname = "playdate_sdk"; version = "1.12.3"; src = fetchurl { url = "https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-${version}.tar.gz"; sha256 = "6QZb7Ie6LaSAa5fK8qjDGSWt4AzgCimFo2IGp685XWo="; }; buildInputs = pdcInputs; dontFixup = true; installPhase = '' runHook preInstall # Get our new root root=$out/opt/playdate-sdk-${version} # Everything else mkdir -p $out/opt/playdate-sdk-${version} cp -r ./ $out/opt/playdate-sdk-${version} ln -s $root $out/opt/playdate-sdk # Setup dependencies and interpreter patchelf \ --set-interpreter "${dynamicLinker}" \ --set-rpath "${lib.makeLibraryPath pdcInputs}" \ $root/bin/pdc patchelf \ --set-interpreter "${dynamicLinker}" \ $root/bin/pdutil patchelf \ --set-interpreter "${dynamicLinker}" \ $root/bin/PlaydateSimulator # Binaries mkdir -p $out/bin cp $root/bin/pdc $out/bin/pdc cp $root/bin/pdutil $out/bin/pdutil cp $root/bin/PlaydateSimulator $out/bin/PlaydateSimulator runHook postInstall ''; }