BSD-3-Clause licensed by Domen Kozar
This version can be pinned in stack with:elm2nix-0.5.0@sha256:80b4a8683c0cdfef290c1ea3b314cec528546e469f87e0e562d70b3414305034,1705
Module documentation for 0.5.0
Depends on 14 packages
(full list with versions):
aeson,
async,
base,
binary,
bytestring,
containers,
elm2nix,
here,
optparse-applicative,
prettyprinter,
process,
text,
transformers,
unordered-containers elm2nix

Convert an Elm project into
Nix expressions.
It consists of multiple commands:
elm2nix convert
: Given elm.json
in current directory, all dependencies are
parsed and their sha256sum calculated
elm2nix snapshot
: Reads packages from elm.json
and writes them to binary cache file registry.dat
used by elm-compiler.
elm2nix init
: Generates default.nix
that glues everything together
Assumptions
Supports Elm 0.19.1
Installation
It’s already included in devenv when using Elm:
{
langauges.elm.enable = true;
tasks = {
"frontend:elm2nix" = {
exec = "cd frontend && elm2nix convert > elm-srcs.nix && elm2nix snapshot";
execIfModified = [ "frontend/elm.json" ];
before = [ "devenv:enterShell" ];
};
};
}
Running tests (as per CI)
$ ./scripts/tests.sh
FAQ
Why is mkDerivation inlined into default.nix
?
As it’s considered experimental, it’s generated for now. Might change in the future.
How do I use elm2nix with ParcelJS and Yarn?
Instead of running elm2nix init
, create a default.nix
with the following derivation:
https://github.com/cachix/elm2nix/issues/49#issuecomment-1696082884
Changelog for elm2nix
Unreleased
0.5.0 (2025-09-09)
- Fix inconsistent indentation in generated elm-srcs.nix, now compatible with nixfmt-rfc-style (@sander)
- Format the
default.nix
generated by elm2nix init
, now compatible with nixfmt-rfc-style (@sander)
0.4.0 (2024-09-23)
- snapshot creates a minimal registry.dat from elm.json without network access (@bmillwood)
0.3.0 (2022-09-06)
- Prevent duplicates between src and test dependencies (@gpampara)
- #48 Aeson 2 support (@gpampara)
0.2.1 (2020-11-22)
- #40 Fix compatibility with newer versions of uglify.js (@turboMaCk)
- #39 Switch to unversioned collection
nodePackages
for npm dependencies in default.nix (@ShrykeWindgrace)
0.2 (2019-12-28)
- #35 Elm 0.19.1 support (@gpampara)
0.1.2 (2019-10-29)
- #33 Minification of JS output (@turboMaCk)
- #32 Make it possible to target JS output (@turboMaCk)
- #31 Fetch test-dependencies (@prasmussen)
0.1.1 (2019-02-19)
Changes
- #22 Support req-0.1.0.0 (@domenkozar)
0.1.0 (2018-12-28)
- Initial release (@domenkozar)