Skip to content

Instantly share code, notes, and snippets.

@haitlahcen
Created November 27, 2018 20:10
Show Gist options
  • Select an option

  • Save haitlahcen/a9d8cd810255292e9053a6e13d4c4928 to your computer and use it in GitHub Desktop.

Select an option

Save haitlahcen/a9d8cd810255292e9053a6e13d4c4928 to your computer and use it in GitHub Desktop.
On the fly node package inside nix-shell
{ pkgs ? import <nixpkgs> {} }: with pkgs;
let
node2nix = nodePackages.node2nix;
emmet = stdenv.mkDerivation rec {
name = "emmet-cli-${version}";
version = "1.2.0";
phases = [ "installPhase" ];
src = builtins.fetchurl {
url = "https://github.com/Delapouite/emmet-cli/archive/v${version}.tar.gz";
sha256 = "1vq3c0i5cid2zs5j53v778wj0wdka57nny1jvsaa8adj26mjnw6f";
};
installPhase = ''
mkdir $out;
tar -xzf $src;
mv emmet-cli-${version}/* $out;
'';
};
in
mkShell {
shellHook = ''
mkdir /tmp/emmet;
cp -r ${emmet}/* /tmp/emmet;
pushd /tmp/emmet;
${node2nix}/bin/node2nix;
nix-build -A package
export PATH=$(pwd)/result/bin:$PATH;
popd;
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment