Skip to content

Commit

Permalink
Amend to postBuild and passthru in buildEnv rather than replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
hacker1024 authored and lopsided98 committed Aug 2, 2023
1 parent 14ace52 commit fa63ec0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions distros/build-env/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# By default, all binaries in the environment are wrapped, setting the relevant
# ROS environment variables, allowing use outside of nix-shell.
{ lib, stdenv, buildPackages, writeText, buildEnv, makeWrapper, python }:
{ paths ? [], wrapPrograms ? true, ... }@args:
{ paths ? [], wrapPrograms ? true, postBuild ? "", passthru ? { }, ... }@args:

with lib;

Expand Down Expand Up @@ -46,6 +46,7 @@ let
nativeBuildInputs = optional wrapPrograms makeWrapper;

postBuild = ''
${postBuild}
"${buildPackages.perl}/bin/perl" "${./setup-hook-builder.pl}"
'' + optionalString wrapPrograms ''
if [ -d "$out/bin" ]; then
Expand All @@ -67,17 +68,19 @@ let
fi
'';

passthru.env = stdenv.mkDerivation {
name = "interactive-ros-env";
passthru = passthru // {
env = stdenv.mkDerivation {
name = "interactive-ros-env";

buildInputs = [ env ];
buildInputs = [ env ];

buildCommand = ''
echo >&2 ""
echo >&2 "*** ROS 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
echo >&2 ""
exit 1
'';
buildCommand = ''
echo >&2 ""
echo >&2 "*** ROS 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
echo >&2 ""
exit 1
'';
};
};
})).overrideAttrs ({ buildCommand, passAsFile ? [], ...}: {
# Hack to allow buildEnv to use propagatedBuildInputs
Expand Down

0 comments on commit fa63ec0

Please sign in to comment.