I’m reading this section from the Nix Manual. I’m trying to run some turtle scripts, but I’m having a hard time making them work. Also I have neither cabal
nor stack
installed globally, which would probably made this a lot easier.
Here’s some minimally broken examples I’ve come with:
#! /usr/bin/env nix-shell
#! nix-shell -p stack
-- stack --resolver lts-14.00 script --package turtle --no-nix-pure
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main :: IO()
main = sh $ do
echo "Hello World"
this one does not break, but gives me a nix-shell instead of trying to run the script.
This second example is taken from the docs, it tries to run the script but fails:
#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p haskellPackages.ghc haskellPackages.turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main :: IO()
main = sh $ do
echo "Hello World"
giving the following error:
Could not find module ‘Turtle’
Use -v to see a list of the files searched for.
|
6 | import Turtle
| ^^^^^^^^^^^^^^^^^^^^^^^
Any hints on how I could made some or both of these scripts works with the nix-shell
shebang?