I have a personal source project I created a shell.nix file for. However, in the project I have also scripts I want to execute periodically non-interactively. Could I use the nix-shell shebang pointing to shell.nix file in order to have the same programs when I use nix-shell interactively and when I launch the scripts?

  • chayleaf@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago
    #!/usr/bin/env -S nix-shell shell.nix --run
    echo "Hello, World!"
    

    should work

    or alternatively

    #!/usr/bin/env nix-shell
    #!nix-shell -i bash shell.nix
    echo "Hello, World!"
    

    haven’t tested either