Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkgs/tools/misc/rmlint/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ stdenv.mkDerivation rec {
sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
};

patches = [
# pass through NIX_* environment variables to scons.
./scons-nix-env.patch
];

nativeBuildInputs = [
pkg-config
sphinx
Expand All @@ -56,9 +61,6 @@ stdenv.mkDerivation rec {
];

prePatch = ''
export CFLAGS="$NIX_CFLAGS_COMPILE"
export LDFLAGS="''${NIX_LDFLAGS//-rpath /-Wl,-rpath=}"

# remove sources of nondeterminism
substituteInPlace lib/cmdline.c \
--replace "__DATE__" "\"Jan 1 1970\"" \
Expand All @@ -67,6 +69,7 @@ stdenv.mkDerivation rec {
--replace "gzip -c " "gzip -cn "
'';

# Otherwise tries to access /usr.
prefixKey = "--prefix=";

sconsFlags = lib.optionals (!withGui) [ "--without-gui" ];
Expand Down
19 changes: 19 additions & 0 deletions pkgs/tools/misc/rmlint/scons-nix-env.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
scons does not use os environment by default:
https://scons.org/doc/2.1.0/HTML/scons-user/x1750.html

nixpkgs' cc-wrapper on the other hand relies on various NIX_* variables
to be passed through like NIX_CFLAGS_COMPILE_BEFORE.
--- a/SConstruct
+++ b/SConstruct
@@ -559,10 +559,7 @@ options = dict(
SHLINKCOMSTR=link_shared_library_message,
LINKCOMSTR=link_program_message,
PREFIX=GetOption('prefix'),
- ENV = dict([ (key, os.environ[key])
- for key in os.environ
- if key in ['PATH', 'TERM', 'HOME', 'PKG_CONFIG_PATH']
- ])
+ ENV = os.environ,
)

if ARGUMENTS.get('VERBOSE') == "1":