# inherit keyword

In Nix, the inherit keyword is shorthand for setting an attribute to whatever value of the same name is in scope. In we have inherit perl, which sets the derivations perl attribute to the value of the perl parameter passed to our function. That is, inherit perl is equivalent to perl = perl, where the left-hand side is the attribute passed into mkDerivation and the right-hand side is the perl passed in as an argument.

## Scoped inherit

inherit (somePackage) value


is equivalent to

value = somePackage.value


That is, the value in the parentheses specifies which the value should be inherited from.