Docs, and rebuild dist

This commit is contained in:
Stéphan Kochen
2020-08-25 22:37:48 +02:00
parent fcba68fd6f
commit ccfc83af5d
3 changed files with 19 additions and 7 deletions
+17 -6
View File
@@ -2,20 +2,30 @@
**WORK IN PROGRESS**
Generates a Nix expression to build a Yarn v2 package.
Generates a Nix expression to build a Yarn v2 project (not using zero-install).
## Usage
```sh
yarn plugin import https://raw.githubusercontent.com/stephank/yarn-plugin-nixify/main/dist/yarn-plugin-nixify.js
yarn
yarn nixify
nix-build
```
The `yarn nixify` command always updates `yarn-project.nix`, but only writes a
(minimal) `default.nix` if it doesn't exist yet. The `default.nix` is intended
to be customized, for example:
Running `yarn` with this plugin enabled will generate two files:
- `yarn-project.nix`: This file is always overwritten, and contains a basic
derivation for your project.
- `default.nix`: Only generated if it does not exist yet. This file is intended
to be customized with any project-specific logic you need.
When building the basic derivation without any customization, it'll run `yarn`
inside your project, copy your project to `$out/libexec/<name>`, and setup
wrappers in `$out/bin` for any executables declared in the `bin` field of your
top-level `package.json`.
Some examples of how to customize your build from within `default.nix`:
```nix
{ pkgs ? import <nixpkgs> { } }:
@@ -62,4 +72,5 @@ yarn build-dev
yarn plugin import /path/to/yarn-plugin-nixify/dist/yarn-plugin-nixify.dev.js
```
(Alternatively, add a direct reference in `.yarnrc.yml`.)
(Alternatively, add a direct reference in `.yarnrc.yml`. This will likely only
work if the Nix sandbox is disabled.)