-
Notifications
You must be signed in to change notification settings - Fork 1
Features
Karim Vergnes edited this page Mar 6, 2023
·
5 revisions
The nix script generated by nixie comes with a few handy features, for a smooth user experience.
You can save or symlink your nix script as nix-shell, which will make it behave exactly like the normal nix-shell command. You can even use it as a script shebang, using the exact same format!
Example:
#!./nix-shell
#!nix-shell -i python -p python3 python3Packages.scipy
import scipy
...If your project contains a shell.nix or flake.nix at its root, you can invoke the same nix script as the name of any command provided by your development environment, and it will launch that command!
Example shell.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "cowsay";
nativeBuildInputs = with pkgs; [ cowsay ];
}which gives us...
$ cowsay "hello"
bash: cowsay: command not found
$ ln -s ./nix ./cowsay
$ ./cowsay "hello"
_______
< hello >
-------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||