Skip to content

Instantly share code, notes, and snippets.

@colemickens
Last active August 6, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colemickens/790aa973b2249a383f38a297a91ac294 to your computer and use it in GitHub Desktop.
Save colemickens/790aa973b2249a383f38a297a91ac294 to your computer and use it in GitHub Desktop.
function instantiate() {
machine="${1}"; shift
# do it
true
#drv="$(nix eval --pure-eval ".#nixosConfigurations.${machine}.config.system.build.toplevel")" # TODO: why????
set -e
drv="$(set -eu; nix --experimental-features 'nix-command flakes' --pure-eval \
eval \
--raw ".#machines.${machine}")"
drv="$(set -euo pipefail; nix --experimental-features 'nix-command flakes' --pure-eval \
show-derivation "${drv}" | jq -r 'to_entries[].key')"
echo -e "${drv}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment