~kaction/flake-dhall

Alternative Nix build system for Dhall projects
13c9f5ec — Dmitry Bogatov 8 months ago
json-schema: v1.0 -> v1.1
2b29fb37 — Dmitry Bogatov 8 months ago
Add CI configuration
ac22d296 — Dmitry Bogatov 8 months ago
Make release tarball default package

clone

read-only
https://git.sr.ht/~kaction/flake-dhall
read/write
git@git.sr.ht:~kaction/flake-dhall

You can also use your local clone with git send-email.

#flake-dhall -- alternative Nix build system for Dhall

#Past

Nixpkgs provides function buildDhallPackage that allows managing Dhall dependencies with Nix. It is designed to work with projects that are not Nix-aware and use native Dhall HTTP support to fetch dependencies. This is natural approach of distribution maintainer.

From point of view of developer, who writes Dhall expression and wants Nix to manage dependencies, buildDhallPackage requires specifying dependencies twice: once in source, like

https://prelude.dhall-lang.org/v13.0.0/package.dhall sha256:4aa8581954f7734d09b7b21fddbf5d8df901a44b54b4ef26ea71db92de0b1a12

and second time in Nix expression, like

dependencies = [ Prelude ]

Also, hash of dependency provided by Nix and one requested by frozed import must match, which adds extra bookkeeping work.

#Present

This repository provides alternative buildDhallPackage function that implements workflow where Nix expression is the single source of truth. During build and in shellHook file deps.dhall is auto-generated with content like:

{
  Prelude = [... snip ...],
  another-dependency = [... snip ...]
}

and package is supposed to import deps.dhall to access functionality of dependency, e.g:

let Prelude = (./deps.dhall).Prelude

For convenience of non-Nix users one can build package with Nix and publish resulting source.dhall.

#Available modules

In addition to buildDhallPackage, following Dhall modules are provided:

  • Prelude -- list of utilities, maintained by Dhall author himself.

  • bhat -- implementation of Functor, Applicative and other things familiar for Haskell programmers.