2009-08-23 23:10:08 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
[ -n "$2" ] && NIXPKGS_ALL="$2";
|
2012-07-07 17:11:06 +01:00
|
|
|
[ -z "$NIXPKGS_ALL" ] && [ -d "/etc/nixos/nixpkgs" ] && NIXPKGS_ALL="/etc/nixos/nixpkgs";
|
|
|
|
[ -z "$NIXPKGS_ALL" ] && [ -d "$HOME/nixpkgs" ] && NIXPKGS_ALL="$HOME/nixpkgs";
|
2009-08-23 23:10:08 +01:00
|
|
|
[ -z "$NIXPKGS_ALL" ] && {
|
|
|
|
echo "Cannot find Nixpkgs source. Please specify it via NIXPKGS_ALL or second command line argument"
|
|
|
|
exit 1
|
|
|
|
};
|
|
|
|
|
|
|
|
derivation="$(nix-instantiate --show-trace - << EOF
|
|
|
|
let
|
|
|
|
pkgs = import "${NIXPKGS_ALL}" {};
|
|
|
|
attrSet = import "${1}";
|
|
|
|
in
|
|
|
|
pkgs.attrSetToDir attrSet
|
|
|
|
EOF
|
|
|
|
)"
|
|
|
|
echo "Derivation is: $derivation" >&2
|
|
|
|
output="$(nix-store -r "$derivation")"
|
|
|
|
echo "$output/attributes"
|