Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 1.69 KB

README.md

File metadata and controls

67 lines (53 loc) · 1.69 KB

NPM NixOS

Noxide

Caution

Noxide should be considered unstable.

Support for building npm package in Nix. More information to coming soon ...

How does Noxide work ?

  1. Noxide loads the package-lock.json file and parses it. Then it fetches all specified packages into the Nix Store.
  2. Noxide uses npm cache on the stored packages to allow install to work.
  3. Noxide calls all the npm commands.
  4. Noxide installs everything automatically or based on what was specified in installPhase.

Documentation

noxide.lib.buildNpmPackage

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  inputs.noxide.url = "github:dominicegginton/noxide";
  inputs.noxide.inputs.nixpkgs.follows = "nixpkgs"; # optional but recommended

  outputs = { self, nixpkgs, noxide }:

  {
    packages = {
      my-package = noxide.lib.buildNpmPackage {
        name = "my-package";
        src = ./.;
      };
    };
  };
}

noxide.overlays.default

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  inputs.noxide.url = "github:dominicegginton/noxide";
  inputs.noxide.inputs.nixpkgs.follows = "nixpkgs"; # optional but recommended

  outputs = { self, nixpkgs, noxide }:

  let
    pkgs = import nixpkgs {
        system = "x86_64-linux";
        overlays = [ noxide.overlays.default ];
    };
  in
  {
      packages = {
        my-package = pkgs.lib.buildNpmPackage {
            name = "my-package";
            src = ./.;
        };
      };
  };
}