From eabae3d7c7d7c8f648715826e5533f3fb4f523de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amy=20de=20Buitl=C3=A9ir?= Date: Thu, 4 Sep 2025 20:21:18 +0100 Subject: [PATCH] temp --- .../shell => devshell/haskell-pkg}/Main.hs | 0 .../recipes/devshell/haskell-pkg/main.adoc0 | 38 ++++++++++++ .../tempwork/flake.nix | 6 +- .../devshell/nixpkg/tempwork/flake.lock | 60 ------------------- .../recipes/haskell-nixpkg/shell/main.adoc0 | 25 -------- source/recipes/main.adoc | 26 ++------ .../shell => nix-shell}/shell.nix | 0 source/recipes/nixpkgs-pkg/main.adoc | 10 ---- source/recipes/nixpkgs-pkg/shebang/main.adoc0 | 25 -------- source/recipes/nixpkgs-pkg/shell/main.adoc0 | 24 -------- source/recipes/remote-git-flake/main.adoc | 10 ---- .../recipes/remote-git-flake/shell/main.adoc0 | 17 ------ source/recipes/remote-git/shell/main.adoc0 | 16 ----- source/recipes/remote-git/shell/shell.nix | 10 ---- 14 files changed, 48 insertions(+), 219 deletions(-) rename source/recipes/{haskell-nixpkg/shell => devshell/haskell-pkg}/Main.hs (100%) create mode 100644 source/recipes/devshell/haskell-pkg/main.adoc0 rename source/recipes/devshell/{nixpkg => haskell-pkg}/tempwork/flake.nix (57%) delete mode 100644 source/recipes/devshell/nixpkg/tempwork/flake.lock delete mode 100644 source/recipes/haskell-nixpkg/shell/main.adoc0 rename source/recipes/{remote-git-flake/shell => nix-shell}/shell.nix (100%) delete mode 100644 source/recipes/nixpkgs-pkg/main.adoc delete mode 100644 source/recipes/nixpkgs-pkg/shebang/main.adoc0 delete mode 100644 source/recipes/nixpkgs-pkg/shell/main.adoc0 delete mode 100644 source/recipes/remote-git-flake/main.adoc delete mode 100644 source/recipes/remote-git-flake/shell/main.adoc0 delete mode 100644 source/recipes/remote-git/shell/main.adoc0 delete mode 100644 source/recipes/remote-git/shell/shell.nix 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 ]; -}