yarn2nix: Convert yarn.lock files to nix expressions

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Convert yarn.lock files to nix expressions. See yarn2nix executable. Contains a nix library to call the generated nix files in nix-lib/. Library functions and module names might be restructured in the future.


[Skip to Readme]

Properties

Versions 0.5.0, 0.5.0, 0.7.0, 0.8.0, 0.10.1
Change log None available
Dependencies aeson (>=1.0 && <1.3), ansi-wl-pprint (>=0.6 && <0.7), async-pool (>=0.9 && <0.10), base (>=4 && <5), bytestring (>=0.10 && <0.11), containers (>=0.5 && <0.7), data-fix (>=0.0.7 && <0.1), directory (>=1.3 && <1.4), either (>=4.4 && <4.5), filepath (>=1.4 && <1.5), hnix (>=0.3 && <0.4), mtl (>=2.2 && <2.3), optparse-applicative (>=0.13 && <0.14), process (>=1.4 && <1.5), protolude (>=0.1 && <0.2), regex-tdfa (>=1.2 && <1.3), regex-tdfa-text (>=1.0.0 && <1.0.1), stm (>=2.4 && <2.5), text (>=1.2 && <1.3), unix (>=2.7 && <2.8), unordered-containers (>=0.2 && <0.3), yarn-lock (>=0.4 && <0.5), yarn2nix [details]
License MIT
Author Profpatsch
Maintainer mail@profpatsch.de
Category Distribution, Nix
Home page https://github.com/Profpatsch/yarn2nix#readme
Bug tracker https://github.com/Profpatsch/yarn2nix/issues
Source repo head: git clone https://github.com/Profpatsch/yarn2nix
Uploaded by Profpatsch at 2017-12-16T03:48:02Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for yarn2nix-0.5.0

[back to package description]

yarn2nix

yarn2nix [path/to/yarn.lock]
yarn2nix --template [path/to/package.json]

Convert a `yarn.lock` into a synonymous nix expression.
If no path is given, search for `./yarn.lock`.
In the second invocation generate a template for your `package.json`.

Features

Probably a few more.

Example Output

The HackMD project is an elaborate npm package with hundreds of dependencies. yarn2nix flawlessly parses the current (2017-12) yarn.lock file distributed with the project, including resolving their manual git forks of multiple npm packages:

dist/build/yarn2nix/yarn2nix ~/tmp/hackmd/yarn.lock | wc
   5306   17068  280246
cat ~/tmp/hackmd/yarn.lock | wc
   7667   11307  266652

The output of this conversion can be seen here. Also note that git dependencies are resolved correctly.

Pushing it through the provided library of nix functions, we get a complete build of HackMD dependencies, using the project template (generated with --template), we also build HackMD. Included executables will be in node_modules/.bin as expected and correctly link to their respective library paths in the nix store, for example:

 ls /nix/store/2jc8b4q9i2cvx7pamv5r8md45prrvx4f-hackmd-0.5.1-0.5.1/node_modules/.bin/markdown-it --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).

Building

$ nix-build
$ result/bin/yarn2nix

Development

$ nix-shell
nix-shell> hpack
nix-shell> cabal build