about summary refs log tree commit diff
path: root/pkgs/misc/uboot
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2024-02-08 21:28:04 -0500
committerGitHub <noreply@github.com>2024-02-08 21:28:04 -0500
commit9b5d456802b2322b36b69dca65b04095877495ad (patch)
treea66a18aa58163805272a324ddb895082bdaffc62 /pkgs/misc/uboot
parent0d23229e11e1d0bb42a7bb316958a83e50f63c08 (diff)
parent32104c2fec1299dcd2e1253dfcfc1894b1096469 (diff)
Merge pull request #255403 from RaitoBezarius/uboot
buildUBoot: supports Python scripts with their own environment
Diffstat (limited to 'pkgs/misc/uboot')
-rw-r--r--pkgs/misc/uboot/default.nix16
1 files changed, 13 insertions, 3 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 5d661140d7438..9d4e04d1c18ab 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -15,6 +15,7 @@
 , openssl
 , swig
 , which
+, python3
 , armTrustedFirmwareAllwinner
 , armTrustedFirmwareAllwinnerH6
 , armTrustedFirmwareAllwinnerH616
@@ -44,6 +45,7 @@ let
     version ? null
   , src ? null
   , filesToInstall
+  , pythonScriptsToInstall ? { }
   , installDir ? "$out"
   , defconfig
   , extraConfig ? ""
@@ -63,6 +65,10 @@ let
     ] ++ extraPatches;
 
     postPatch = ''
+      ${lib.concatMapStrings (script: ''
+        substituteInPlace ${script} \
+        --replace "#!/usr/bin/env python3" "#!${pythonScriptsToInstall.${script}}/bin/python3"
+      '') (builtins.attrNames pythonScriptsToInstall)}
       patchShebangs tools
       patchShebangs scripts
     '';
@@ -110,12 +116,12 @@ let
       runHook preInstall
 
       mkdir -p ${installDir}
-      cp ${lib.concatStringsSep " " filesToInstall} ${installDir}
+      cp ${lib.concatStringsSep " " (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)} ${installDir}
 
       mkdir -p "$out/nix-support"
       ${lib.concatMapStrings (file: ''
         echo "file binary-dist ${installDir}/${builtins.baseNameOf file}" >> "$out/nix-support/hydra-build-products"
-      '') filesToInstall}
+      '') (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)}
 
       runHook postInstall
     '';
@@ -128,7 +134,7 @@ let
       license = licenses.gpl2;
       maintainers = with maintainers; [ bartsch dezgeg samueldr lopsided98 ];
     } // extraMeta;
-  } // removeAttrs args [ "extraMeta" ]));
+  } // removeAttrs args [ "extraMeta" "pythonScriptsToInstall" ]));
 in {
   inherit buildUBoot;
 
@@ -154,6 +160,10 @@ in {
       "tools/mkenvimage"
       "tools/mkimage"
     ];
+
+    pythonScriptsToInstall = {
+      "tools/efivar.py" = (python3.withPackages (ps: [ ps.pyopenssl ]));
+    };
   };
 
   ubootA20OlinuxinoLime = buildUBoot {