hasStorePathPrefix
lib.path.hasStorePathPrefix
Docs pulled from | This Revision | 22 minutes ago
Whether a path has a store path as a prefix.
As with all functions of this lib.path
library, it does not work on paths in strings,
which is how you'd typically get store paths.
Instead, this function only handles path values themselves, which occur when Nix files in the store use relative path expressions.
Inputs
path
-
1. Function argument
Type
hasStorePathPrefix :: Path -> Bool
Examples
hasStorePathPrefix
usage example
# Subpaths of derivation outputs have a store path as a prefix
hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo/bar/baz
=> true
# The store directory itself is not a store path
hasStorePathPrefix /nix/store
=> false
# Derivation outputs are store paths themselves
hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo
=> true
# Paths outside the Nix store don't have a store path prefix
hasStorePathPrefix /home/user
=> false
# Not all paths under the Nix store are store paths
hasStorePathPrefix /nix/store/.links/10gg8k3rmbw8p7gszarbk7qyd9jwxhcfq9i6s5i0qikx8alkk4hq
=> false
# Store derivations are also store paths themselves
hasStorePathPrefix /nix/store/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo.drv
=> true