diff --git a/source/recipes/haskell-nixpkg/shell/Main.hs b/source/recipes/devshell/haskell-pkg/Main.hs similarity index 100% rename from source/recipes/haskell-nixpkg/shell/Main.hs rename to source/recipes/devshell/haskell-pkg/Main.hs diff --git a/source/recipes/devshell/haskell-pkg/main.adoc0 b/source/recipes/devshell/haskell-pkg/main.adoc0 new file mode 100644 index 0000000..523920a --- /dev/null +++ b/source/recipes/devshell/haskell-pkg/main.adoc0 @@ -0,0 +1,38 @@ += A Haskell library package in the nixpkgs repo (without a `.cabal` file) + +//// +$ mkdir tempwork +$ cd tempwork +$ cp ../flake.nix Main.hs . +$ git add flake.nix +$ nix develop +$ git add flake.lock +$ git commit -a -m temp +//// + +Occasionally you might want to run a short Haskell program that depends on a Haskell library, +but you don't want to bother writing a cabal file. + +Example: Access the `containers` package from the `haskellPackages` set in the nixpkgs repo. + +[source,nix,linenums] +.flake.nix +.... +include::flake.nix[] +.... + +Here's a short Haskell program that uses it. + +[source,haskell,linenums] +.Main.hs +.... +include::Main.hs[] +.... + +Here's a demonstration using the program. + +.... +$# ../../../../../start-shell nix develop <> -where defined a development shell in <> -with a dependency on `cowsay` , -and tested the shell. - -= In `shell.nix` - -[source,nix,linenums] -.shell.nix -.... -include::shell.nix[] -.... - -Here's a demonstration using the shell. - -.... -$# echo '$ nix-shell' -$# nix-shell --run bash < {}); -let - hello-nix = import (builtins.fetchGit { - url = "https://codeberg.org/mhwombat/hello-nix"; - rev = "aa2c87f8b89578b069b09fdb2be30a0c9d8a77d8"; - }); -in -mkShell { - buildInputs = [ hello-nix ]; -}