Skip to content

Instantly share code, notes, and snippets.

@benley
Created August 24, 2015 03:48
Show Gist options
  • Save benley/3f1586e3a8dc71897891 to your computer and use it in GitHub Desktop.
Save benley/3f1586e3a8dc71897891 to your computer and use it in GitHub Desktop.
npm2nix nix nix nix
{ npm2nix ? { outPath = ./.; name = "npm2nix"; }
, pkgs ? import <nixpkgs> {}
}:
let
nodePackages = import "${pkgs.path}/pkgs/top-level/node-packages.nix" {
inherit pkgs;
inherit (pkgs) stdenv nodejs fetchurl fetchgit;
neededNatives = [ pkgs.python ] ++ pkgs.lib.optional pkgs.stdenv.isLinux pkgs.utillinux;
self = nodePackages;
generated = ./package.nix;
};
in rec {
tarball = pkgs.runCommand "npm2nix-5.12.0.tgz" { buildInputs = [ pkgs.nodejs ]; } ''
mv `HOME=$PWD npm pack ${npm2nix}` $out
'';
build = nodePackages.buildNodePackage {
name = "npm2nix-5.12.0";
src = [ tarball ];
buildInputs = nodePackages.nativeDeps."npm2nix" or [];
deps = [ nodePackages.by-spec."semver"."~4.2.0" nodePackages.by-spec."argparse"."0.1.15" nodePackages.by-spec."npm-registry-client"."0.2.27" nodePackages.by-spec."npmconf"."0.1.1" nodePackages.by-spec."tar"."0.1.17" nodePackages.by-spec."temp"."0.6.0" nodePackages.by-spec."fs.extra".">=1.2.0 <2.0.0" nodePackages.by-spec."findit".">=1.1.0 <2.0.0" ];
peerDependencies = [];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment