node2nix

Deploy NPM Package Manager (NPM) packages with the Nix package manager.

***

Generates a set of Nix expressions from a NPM package's package.json configuration or a collection.json configuration containing a set of NPM dependency specifiers so that the packages can be deployed with Nix instead of NPM.

node2nix github repo was mentioned in Wiki Dev/User Video Chat Dec 12. Here we learn how to deploy Federated Wiki (Node.js server version) on NixOS.

# Installation ```shell nix-env -f '<nixpkgs>' -iA nodePackages.node2nix ```

# Usage See github , fork ```shell $ node2nix ```

The above command generates three files: `node-packages.nix` capturing the packages that can be deployed including all its required dependencies, `node-env.nix` contains the build logic and `default.nix` is a composition expression allowing users to deploy the package.

By running the following Nix command with these expressions, the project can be built: ```shell $ nix-build -A package ``` The above instruction places a `result` symlink in the current working directory, e.g., `~/wiki` pointing to the build result. An executable (that is part of the project) can be started as follows:

```shell $ ~/wiki/result/bin/wiki --security_legacy ```

**Note**: The above working directory `~/wiki` is a git clone https://github.com/fedwiki/wiki.git .

-l option

WARNING: A lock file exists in the repository, yet it is not used in the generation process! As a result, the deployment of the project may fail. You probably want to run node2nix with the -l option to use the lock file!

node2nix 1.9.0

~