From 060aa4bd74fdeb066a9e565078a8aec7afde684a Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Tue, 3 Dec 2024 14:37:20 -0800 Subject: [PATCH] sandwich-contexts: more docs --- sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs | 2 +- sandwich-site/docs/context-libraries/sandwich-contexts.md | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs b/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs index ab01aa2a..8fd06a6d 100644 --- a/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs +++ b/sandwich-contexts/lib/Test/Sandwich/Contexts/Nix.hs @@ -209,7 +209,7 @@ introduceNixContext'' nodeOptions nixpkgsDerivation = introduce' nodeOptions "In -- | Introduce a Nix environment containing the given list of packages, using the current 'NixContext'. -- These packages are mashed together using the Nix @symlinkJoin@ function. Their binaries will generally --- be found in "\\/bin". +-- be found in @\\/bin@. introduceNixEnvironment :: ( HasBaseContext context, HasNixContext context , MonadUnliftIO m diff --git a/sandwich-site/docs/context-libraries/sandwich-contexts.md b/sandwich-site/docs/context-libraries/sandwich-contexts.md index 69d414cc..0fecc7a2 100644 --- a/sandwich-site/docs/context-libraries/sandwich-contexts.md +++ b/sandwich-site/docs/context-libraries/sandwich-contexts.md @@ -9,9 +9,9 @@ The [sandwich-contexts](https://hackage.haskell.org/package/sandwich-contexts) p The [Test.Sandwich.Contexts.Nix](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Nix.html) module allows you to introduce a `NixContext`. A `NixContext` essentially represents a snapshot of the [Nixpkgs](https://github.com/NixOS/nixpkgs) package collection, plus some auxiliary stuff like a build cache to keep things speedy. -You can introduce any version of Nixpkgs that you [want](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Nix.html#t:NixpkgsDerivation). Some are provided in the library, such as [nixpkgsRelease2405](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Nix.html#v:nixpkgsRelease2405). A basic usage example is as follows: +You can introduce any version of Nixpkgs that you [want](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Nix.html#t:NixpkgsDerivation). Some are provided in the library, such as [nixpkgsRelease2405](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Nix.html#v:nixpkgsRelease2405). Once you introduce a `NixContext`, you can use it to build Nix artifacts. For example, the [introduceNixEnvironment](https://hackage.haskell.org/package/sandwich-contexts-0.3.0.1/docs/Test-Sandwich-Contexts-Nix.html#v:introduceNixEnvironment) function will allow you to build an environment with a given list of packages. -```haskell title="https://github.com/codedownio/sandwich/blob/master/demos/demo-nix/app/Main.hs" +```haskell title="https://github.com/codedownio/sandwich/blob/master/demos/demo-nix/app/Main.hs"p nixDemo :: TopSpec nixDemo = introduceNixContext nixpkgsRelease2405 $ @@ -22,6 +22,8 @@ nixDemo = info [i|Found binaries in environment: #{binaries}|] ``` +This test will log the various binaries that are available, such as `emacs`, `emacsclient`, and `firefox`. You can now use these artifacts in tests. + ## File contexts The [Test.Sandwich.Contexts.Files](https://hackage.haskell.org/package/sandwich-contexts/docs/Test-Sandwich-Contexts-Files.html) module allows you to introduce named files as contexts.