mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Without this, it is easy to accidentally generate, e.g., a config file referencing a store path without recording proper dependency information.
20 lines
416 B
Nix
20 lines
416 B
Nix
let
|
|
|
|
s = "${builtins.derivation {
|
|
name = "test";
|
|
builder = "/bin/sh";
|
|
system = "x86_64-linux";
|
|
}}";
|
|
|
|
c = builtins.getContext s;
|
|
|
|
matchRes = builtins.match ".*(-).*" s;
|
|
|
|
splitRes = builtins.split "(-)" s;
|
|
|
|
in
|
|
[
|
|
(c == builtins.getContext (builtins.head matchRes))
|
|
(c == builtins.getContext (builtins.head splitRes))
|
|
(c == builtins.getContext (builtins.head (builtins.elemAt splitRes 1)))
|
|
]
|