From fa58667f93ac8784d675618123b5d919ac0d0886 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Mon, 4 Nov 2024 14:14:01 +0100 Subject: [PATCH] openmolcas: fix shebangs in python scripts patchShebangs replaces the shebang with the bare python interpreter, but not with our defined environment. This patch fixes the shebang manually and restores function of all python scripts in $out/bin --- pkgs/applications/science/chemistry/openmolcas/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/science/chemistry/openmolcas/default.nix b/pkgs/applications/science/chemistry/openmolcas/default.nix index f3687a64d599..ed3f74e7656a 100644 --- a/pkgs/applications/science/chemistry/openmolcas/default.nix +++ b/pkgs/applications/science/chemistry/openmolcas/default.nix @@ -159,9 +159,10 @@ stdenv.mkDerivation rec { noAuditTmpdir = true; postFixup = '' - # Wrong store path in shebang (no Python pkgs), force re-patching - sed -i "1s:/.*:/usr/bin/env python:" $out/bin/pymolcas - patchShebangs $out/bin + # Wrong store path in shebang (bare Python, no Python pkgs), force manual re-patching + for exe in $(find $out/bin/ -type f -name "*.py"); do + sed -i "1s:.*:#!${python}/bin/python:" "$exe" + done wrapProgram $out/bin/pymolcas --set MOLCAS $out '';