A simple helper that makes it easy to package Nu scripts with Nix, including inline dependency declarations for external commands and other packaged scripts.
flake nu nushell nix
1

Configure Feed

Select the types of activity you want to include in your feed.

just use patchShebangs

didnt know that existed lmao

cswimr (Jul 13, 2026, 12:24 PM EDT) 8544660c 100ce58e

+2 -17
+2 -17
mkNuScript.nix
··· 57 57 src = script; 58 58 dontUnpack = true; 59 59 60 - nativeBuildInputs = with pkgs; [ 61 - makeWrapper 62 - gnugrep 63 - gnused 64 - ]; 60 + nativeBuildInputs = [ pkgs.makeWrapper ]; 61 + buildInputs = [ nushell ]; 65 62 66 63 installPhase = '' 67 64 runHook preInstall 68 65 69 66 install -Dm755 $src $out/bin/${name} 70 - 71 - # support shebangs that contain options (such as --stdin) 72 - if grep -q '^#!/usr/bin/env nu$' $out/bin/${name}; then 73 - substituteInPlace $out/bin/${name} \ 74 - --replace-fail "#!/usr/bin/env nu" "#!${lib.getExe nushell}" 75 - elif grep -q '^#!/usr/bin/env -S nu$' $out/bin/${name}; then 76 - substituteInPlace $out/bin/${name} \ 77 - --replace-fail "#!/usr/bin/env -S nu" "#!${lib.getExe nushell}" 78 - else 79 - echo "No supported Nushell shebang found" 80 - exit 1 81 - fi 82 67 83 68 wrapProgram $out/bin/${name} \ 84 69 --set PATH ${lib.makeBinPath deps}