Created
September 12, 2018 20:24
-
-
Save LnL7/59d26191a5f313a2ffdb4475b03df164 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if ! test -e /tmp/nix-nixpkgs-cache; then | |
nix-env -f '<nixpkgs>' -qaP --no-name --out-path \* > /tmp/nix-nixpkgs-cache | |
fi | |
exprs="with import <nixpkgs> {}; (pkgs.runCommandCC or pkgs.runCommand) \"instantiate\" { buildInputs = [ $* ]; } \"\"" | |
exprsDrv=$(nix-instantiate -E "$exprs" 2> /dev/null) | |
for drv in $(nix-store -qR "$exprsDrv"); do | |
out="$(nix-store -q --binding out "$drv" 2> /dev/null)" | |
if test -n "$out"; then | |
grep "$out" /tmp/nix-nixpkgs-cache | awk '{print $1}' | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment