Skip to content

Commit

Permalink
trace overrides when used
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Theil <[email protected]>
  • Loading branch information
thillux committed Sep 16, 2024
1 parent 82adb1a commit 8ece9ce
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ let
mayOverride =
name: path:
let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NPINS_OVERRIDE_${saneName}";
ersatz = builtins.getEnv envVarName;
in
if ersatz == "" then
path
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then
/. + ersatz
else
/. + builtins.getEnv "PWD" + "/${ersatz}";
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/" then
/. + ersatz
else
/. + builtins.getEnv "PWD" + "/${ersatz}"
);

mkSource =
name: spec:
Expand Down

0 comments on commit 8ece9ce

Please sign in to comment.