Skip to content

Instantly share code, notes, and snippets.

@DavHau
Last active September 20, 2022 10:48
Show Gist options
  • Save DavHau/ea4db887a0779d04d3382d44ad6bb084 to your computer and use it in GitHub Desktop.
Save DavHau/ea4db887a0779d04d3382d44ad6bb084 to your computer and use it in GitHub Desktop.
End user tests for dream2nix stack integration

Build a haskell project containing a stack.yaml.lock

Interactions

build a project

Acceptance Criteria

If the project builds with stack, it also builds with dream2nix

Implementation details

During evaluation time:

  • Data about the given project is collected by parsing stack.yaml, stack.yaml.lock, {project}.cabal
  • Hackage dependency hashes and metadata are retrieved from all-cabal-json
  • URLs, hashes, metadata are represented via the dream-lock structure (see specification).
  • generate nix derivations, represented via flake outputs schema

Test descriptions

Have a dummy hello-world project, run stack build, initialize the dream2nix basic flake, run nix build. Run the resulting executables of both project and ensure the output is the same.2


Cheap listing of outputs

Interaction

List the available packages and dev-shells of a given project

Acceptance Criteria

The output list should be computed in less than 5 seconds

Implementation Details

Parse basic metadata like the name of the package directly via nix without using IFD.

Test Description

Take a stack lock based project, initialize the dream2nix default flake and execute nix flake show while measuring the duration until complete.


Non invasiveness

Interaction

Switch back and forth between using stack and nix to build (or to enter dev shells)

Acceptance Criteria

Switching between different package managers should not require changing to the contents of existing files.

Implementation Details

Dream2nix will only read from and not write to stack or cabal related files. Individual fix-ups can be done via overrides, not requiring the user to change the existing code

Test Description

Enter the dev shell via dream2nix and build the project via stack, then build the project via nix. Do not edit any files while doing that and ensure that both builds work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment