Skip to content

Instantly share code, notes, and snippets.

@fghibellini
Created September 19, 2019 07:28
Show Gist options
  • Save fghibellini/f592d439eeff8f569df02016a00c4cad to your computer and use it in GitHub Desktop.
Save fghibellini/f592d439eeff8f569df02016a00c4cad to your computer and use it in GitHub Desktop.
shell.nix file that sets up a valid `bower_components` folder to build the project and deletes it when the shell is left
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
bowerComponents = pkgs.buildBowerComponents {
name = "bower-test";
generated = ./bower-generated.nix;
src = ./.;
};
shellHook = ''
function _nix_shell_cleanup {
rm -rf bower_components
}
trap _nix_shell_cleanup EXIT
rm -rf bower_components
ln -s "$bowerComponents/bower_components" bower_components
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment