Nix/OS keeps impressing me - TIL that you can write a script in arbitrary languages and then add a nix-shell shebang to set up the environment using the standard Nix repo biz

so, you can do:

#! /usr/bin/env nix-shell

#! nix-shell -i python3 -p python3Packages.beautifulsoup4 python3Packages.prettytable

from bs4 import BeautifulSoup

from prettytable import PrettyTable

..more Python code..

no need to create / understand language-specific virtual environments

super cool!

#linux #nix #nixos

Reply to this note

Please Login to reply.

Discussion

nostr:npub1wl0tzswcyamc27vm2c77lltf5l3kqq443tmp8gws2qmy3vdw8ljqlzpv54 this feature has even advanced property like you can do --pure to have self contained pure Bash scripts that removes external environment variables

I use it to create "pure environment" for testing etc.