mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
8bc5104a6e
When specifying the `builder` attribute in `stdenv.mkDerivation`, this will be effectively transformed into builtins.derivation { builder = stdenv.shell; args = [ "-e" builder ]; } This also means that `default-builder.sh` is never sourced and as a result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct location[1]. Also, we need to source `.attrs.sh` to source `$stdenv`. So, the following is done now: * If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it. Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage (see previous commit for more context), so prefer the environment variable if possible. * Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this can happen. * If neither applies, it can be assumed that `__structuredAttrs` is turned off and thus nothing needs to be done. [1] It's possible that it doesn't exist at all - in case of Nix 2.3 or it can point to a wrong location on older Nix versions with a bug in `__structuredAttrs`.
27 lines
776 B
Bash
27 lines
776 B
Bash
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
|
|
source $stdenv/setup
|
|
|
|
(echo "#!$SHELL"; \
|
|
echo 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"') > ssh
|
|
chmod +x ssh
|
|
export CVS_RSH=$PWD/ssh
|
|
|
|
# creating the export drictory and checking out there only to be able to
|
|
# move the content without the root directory into $out ...
|
|
# cvs -f -d "$url" export $tag -d "$out" "$module"
|
|
# should work (but didn't - got no response on #cvs)
|
|
# See als man Page for those options
|
|
|
|
mkdir -p export
|
|
if [ -n "$tag" ]; then
|
|
tag="-r $tag"
|
|
else
|
|
if [ -n "$date" ]; then
|
|
tag="-D $date"
|
|
else
|
|
tag="-D NOW"
|
|
fi
|
|
fi
|
|
(cd export && cvs -f -z0 -d "$cvsRoot" export $tag "$module")
|
|
mv export/* $out
|