Skip to content

Instantly share code, notes, and snippets.

@matejc matejc/sloc.nix
Created Aug 26, 2014

Embed
What would you like to do?
{ pkgs ? import /home/matej/workarea/nixpkgs {} }:
let
# When upgrading node.nix / node packages:
# fetch package.json from package's repository
# run `npm2nix package.json node.nix`
# and replace node.nix with new one
nodePackages = import /home/matej/workarea/nixpkgs/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 = ./node_modules.nix;
};
node_env = pkgs.buildEnv {
name = "node_env";
paths = [ nodePackages.commander nodePackages.async nodePackages.readdirp
nodePackages."cli-table" ];
pathsToLink = [ "/lib" ];
};
in pkgs.stdenv.mkDerivation rec {
name = "sloc-${version}";
version = "0.1.4";
src = pkgs.fetchgit {
url = "https://github.com/flosse/sloc";
rev = "refs/tags/v${version}";
sha256 = "163qpabzs8hjw2fhz7y493n04l4v5spmb37383kl0l12fk16jkg3";
};
buildInputs = [ pkgs.makeWrapper pkgs.nodePackages.coffee-script ];
dontBuild = true;
installPhase = ''
ensureDir $out
cp -r ./bin $out/bin
cp -r ./package.json $out/package.json
coffee -c -o $out/lib ./src
wrapProgram $out/bin/sloc \
--prefix NODE_PATH : ${node_env}/lib/node_modules
'';
postFixup = ''
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.