1 # Use exportReferencesGraph to capture the possible dependencies of the
2 # drivers (e.g. libc linked through DT_RUNPATH) and ensure they are mounted
3 # in the sandbox as well. In practice, things seemed to have worked without
4 # this as well, but we go with the safe option until we understand why.
12 runCommand "allowed-patterns.json"
14 nativeBuildInputs = [ python3Packages.python ];
15 exportReferencesGraph = builtins.concatMap (
20 prefix = "${builtins.storeDir}/";
21 # Has to start with a letter: https://github.com/NixOS/nix/blob/516e7ddc41f39ff939b5d5b5dc71e590f24890d4/src/libstore/build/local-derivation-goal.cc#L568
22 exportName = ''references-${lib.strings.removePrefix prefix "${path}"}'';
23 isStorePath = lib.isStorePath path && (lib.hasPrefix prefix "${path}");
25 lib.optionals isStorePath [
29 ) allowedPatterns.${name}.paths
30 ) (builtins.attrNames allowedPatterns);
31 env.storeDir = "${builtins.storeDir}/";
32 shallowConfig = builtins.toJSON allowedPatterns;
33 passAsFile = [ "shallowConfig" ];
36 python ${./scripts/nix_required_mounts_closure.py}