hoverbear: I think you can get rid of most of the code. the wrapper should look like stdenv.mkDerviation { preferLocalBuild = true; buildInputs = [makeWrapper]; buildCommand = ''makeWrapper ...''; }