Skip to content

Instantly share code, notes, and snippets.

@gilligan
Created July 7, 2017 09:56
Show Gist options
  • Save gilligan/7c93640a5d640bc053fc78f4b4ab4ef5 to your computer and use it in GitHub Desktop.
Save gilligan/7c93640a5d640bc053fc78f4b4ab4ef5 to your computer and use it in GitHub Desktop.
rather primitive (for now) shell script to get a default.nix with some packages
read -r -d '' TEMPLATE << EOM
with (import <nixpkgs> {});
stdenv.mkDerivation {
name = "dev-shell";
src = null;
buildInputs = [ __PKGS__ ];
}
EOM
usage() {
echo -e "Usage:\n\t $0 pkg1 pkg2 ... \n"
}
if [[ $# -ne 1 ]]; then
echo -e "Error: No packages given!\n"
usage
exit 1
fi
PKGS="$*"
echo -e "$TEMPLATE" | sed -e "s/__PKGS__/${PKGS}/"
@gilligan
Copy link
Author

gilligan commented Jul 7, 2017

Can be used as follows:

$ ./nixify nodejs-8_x > shell.nix
$ nix-shell

@wolframkriesing
Copy link

sweet, it does not tie itself to a certain commit (yet), right? Which means it always depends on the local system, did I understand that correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment