Am I correct that if multiple dependencies have a store path in
propagatedBuildInputs that /nix-support/setup-hook will be sourced
multiple times?

Do we want this? I mean if you have PYTHONPATH=PATH1:PATH1:PATH1 it will
only make everything slightly slower but I can't see any benefits?

Does someone mind me adding code to prevent this?


Marc

An implementation could look like this:
If you know a better way than using arrays let me know.

#!/bin/sh

contains(){
  # $1 var name containing array
  # $2 value checked for membership
  for i in "${!1}"; do
    [ "$i" == "$2" ] && return 0
  done
  return 1
}

sourceOnce(){
  # $1 path to source (may contain spaces)
  if contains sourced "$1"; then
    echo "$1 already sourced"
  else
    echo sourcing "$1"
    sourced=("[EMAIL PROTECTED]" "$1")
  fi
}

sourceOnce "/foo/ bar"
sourceOnce "/foo/ bar2"
sourceOnce "/foo/ bar"
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to