Previously, the script was created in buildPhase by Nix interpolating the code into a heredoc string and being written to a file by cat there. But the script contained a comment that included backticks, which were interpreted by bash as command substitution inside the heredoc because, unlike dollar signs, they were not escaped. This resulted in an execution of generic builder setup script, as well as an attempt to execute the $stdenv directory. Warning from the latter is how this mess was discovered.
Since no variable other than $stdenv was used, and that one is also readily available as a Nix variable ${pkgs.stdenv}, this commit delegates the creation of the script to the appropriate trivial builder from Nixpkgs, allowing us to get rid of the nasty escaping.
cc @Mazurel who introduced this in #38 (the inappropriate execution comes specifically from 915bcc39b18c39fd4cd8765a396053db9947e0c7).
Previously, the script was created in
buildPhase
by Nix interpolating the code into a heredoc string and being written to a file bycat
there. But the script contained a comment that included backticks, which were interpreted by bash as command substitution inside the heredoc because, unlike dollar signs, they were not escaped. This resulted in an execution of generic builder setup script, as well as an attempt to execute the$stdenv
directory. Warning from the latter is how this mess was discovered.Since no variable other than
$stdenv
was used, and that one is also readily available as a Nix variable${pkgs.stdenv}
, this commit delegates the creation of the script to the appropriate trivial builder from Nixpkgs, allowing us to get rid of the nasty escaping.cc @Mazurel who introduced this in #38 (the inappropriate execution comes specifically from 915bcc39b18c39fd4cd8765a396053db9947e0c7).