Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active June 22, 2019 05:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/a962f47501ab581a5925a44d192f1c78 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/a962f47501ab581a5925a44d192f1c78 to your computer and use it in GitHub Desktop.
Nix Store Queries #nix
#!/usr/bin/env sh
# show the output paths of a derivation
nix-store --query --outputs $(nix-instantiate)
# show the immediate dependencies of a derivation
nix-store --query --references $(nix-instantiate)
# show the transitive dependencies of a derivation
nix-store --query --requisites $(nix-instantiate)
# show the dependers of a store-path
nix-store --query --referrers $(nix-instantiate)
# show the transitive dependers of store-path (includes itself)
nix-store --query --referrers-closure $(nix-instantiate)
# show the derivation of the non-derivation store-path
nix-store --query --deriver $(nix-build)
# note this bidirectional relationship:
# this is probably made possible via the nix database
# DRV -> OUTPUT
nix-store --query --outputs $(nix-instantiate)
# OUTPUT -> DRV
nix-store --query --deriver $(nix-build)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment