Last active
July 11, 2024 07:53
-
-
Save luochen1990/bdfb49a630d865afa5a41af7adcc3980 to your computer and use it in GitHub Desktop.
Demo for Nix as Shebang
This file contains 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 characters
#!/usr/bin/env nix-shell | |
#! nix-shell -p 'python3.withPackages (ps: with ps; [ msgspec ])' -i python3 | |
import msgspec | |
print('hello') |
This file contains 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 characters
#!/usr/bin/env nix | |
#! nix shell nixpkgs#bash --command bash -e | |
#Doc: https://nix.dev/manual/nix/2.22/command-ref/new-cli/nix3-shell#use-as-a--interpreter | |
echo Hello, $NAME | |
echo $@ | |
# Usage: | |
# $ NAME=Nix ./hello.sh today is a good day! | |
# Hello, Nix | |
# today is a good day! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment