Skip to content

buildEnv: improvements - #10308

Closed
jraygauthier wants to merge 1 commit into
NixOS:masterfrom
jraygauthier:jrg/improve_buildenv
Closed

jraygauthier wants to merge 1 commit into
NixOS:masterfrom
jraygauthier:jrg/improve_buildenv

Conversation

@jraygauthier

Copy link
Copy Markdown
Member

Add the possibility to specify arbitrary arguments
(same as with other derivation helpers).

This allows one to use a buildEnv helper to define a
package.

Tests:

  • Using fixed attribute throws an error.
  • Using an arbitrary attribute such as nativeBuildInputs,
    meta, dontPatchELF or dontStrip work fine.

Add the possibility to specify arbitrary arguments
(same as with other derivation helpers).

This allows one to use a buildEnv helper to define a
package.

Tests:

 -  Using fixed attribute throws an error.
 -  Using an arbitrary attribute such as `nativeBuildInputs`,
    `meta`, `dontPatchELF` or `dontStrip` work fine.
@jraygauthier

Copy link
Copy Markdown
Member Author

An example of improvement it could bring:

was:

runCommand name {
  inherit build;
  inherit meta;

  nativeBuildInputs = [ makeWrapper lndir ];

  dontPatchELF = true;
  dontStrip = true;

} 
(let
  buildWithPlugins = buildEnv {
    name = "thunar-build-with-plugins";
    paths = [ build ] ++ thunarPlugins;
  };

in ''
  mkdir -p $out
  pushd ${buildWithPlugins} > /dev/null
  for d in `find . -maxdepth 1 -name "*" -printf "%f\n" | tail -n+2`; do
    ln -s "${buildWithPlugins}/$d" "$out/$d"
  done
  popd > /dev/null

  ${replaceLnExeListWithWrapped "$out/bin" [ "thunar" "thunar-settings" ] [
    "--set THUNARX_MODULE_DIR \"${buildWithPlugins}/lib/thunarx-2\""
  ]}
'')

now could be:

buildEnv {
  inherit name;
  inherit build;
  inherit meta;

  paths = [ build ] ++ thunarPlugins;

  nativeBuildInputs = [ makeWrapper lndir ];

  dontPatchELF = true;
  dontStrip = true;

  postBuild = ''
    ${replaceLnExeListWithWrapped "$out/bin" [ "thunar" "thunar-settings" ] [
      "--set THUNARX_MODULE_DIR \"$out/lib/thunarx-2\""
    ]}
  '';
}

This was referenced Oct 10, 2015
@jagajaga

Copy link
Copy Markdown
Member

cc @edolstra @vcunat

@zimbatm

zimbatm commented Feb 22, 2016

Copy link
Copy Markdown
Member

ping

@joachifm joachifm added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 8, 2016
@jraygauthier
jraygauthier deleted the jrg/improve_buildenv branch March 12, 2017 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants