mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
doc: use writableTmpDirAsHomeHook
This commit is contained in:
parent
11a695488e
commit
540ddbcf2f
5 changed files with 13 additions and 6 deletions
|
@ -105,9 +105,12 @@ pkgs.stdenv.mkDerivation {
|
||||||
src = myWebApp;
|
src = myWebApp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
writableTmpDirAsHomeHook # note 3
|
||||||
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
cp --reflink=auto --no-preserve=mode -R $bowerComponents/bower_components . # note 2
|
cp --reflink=auto --no-preserve=mode -R $bowerComponents/bower_components . # note 2
|
||||||
export HOME=$PWD # note 3
|
|
||||||
${pkgs.nodePackages.gulp}/bin/gulp build # note 4
|
${pkgs.nodePackages.gulp}/bin/gulp build # note 4
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ pkgs.buildEmscriptenPackage rec {
|
||||||
];
|
];
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config
|
pkg-config
|
||||||
|
writableTmpDirAsHomeHook
|
||||||
zlib
|
zlib
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -140,7 +141,6 @@ pkgs.buildEmscriptenPackage rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
HOME=$TMPDIR
|
|
||||||
make -f Makefile.emEnv
|
make -f Makefile.emEnv
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -646,8 +646,11 @@ It's important to use the `--offline` flag. For example if you script is `"build
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
writableTmpDirAsHomeHook
|
||||||
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
export HOME=$(mktemp -d)
|
|
||||||
yarn --offline build
|
yarn --offline build
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2135,8 +2135,9 @@ Occasionally packages don't make use of a common test framework, which may then
|
||||||
|
|
||||||
#### Common issues {#common-issues}
|
#### Common issues {#common-issues}
|
||||||
|
|
||||||
* Tests that attempt to access `$HOME` can be fixed by using the following
|
* Tests that attempt to access `$HOME` can be fixed by using `writableTmpDirAsHomeHook` in
|
||||||
work-around before running tests (e.g. `preCheck`): `export HOME=$(mktemp -d)`
|
`nativeCheckInputs`, which sets up a writable temporary directory as the home directory. Alternatively,
|
||||||
|
you can achieve the same effect manually (e.g. in `preCheck`) with: `export HOME=$(mktemp -d)`.
|
||||||
* Compiling with Cython causes tests to fail with a `ModuleNotLoadedError`.
|
* Compiling with Cython causes tests to fail with a `ModuleNotLoadedError`.
|
||||||
This can be fixed with two changes in the derivation: 1) replacing `pytest` with
|
This can be fixed with two changes in the derivation: 1) replacing `pytest` with
|
||||||
`pytestCheckHook` and 2) adding a `preCheck` containing `cd $out` to run
|
`pytestCheckHook` and 2) adding a `preCheck` containing `cd $out` to run
|
||||||
|
|
|
@ -173,6 +173,7 @@ let
|
||||||
(writeShellScript "force-tex-output.sh" ''
|
(writeShellScript "force-tex-output.sh" ''
|
||||||
out="''${tex-}"
|
out="''${tex-}"
|
||||||
'')
|
'')
|
||||||
|
writableTmpDirAsHomeHook # Need a writable $HOME for latexmk
|
||||||
];
|
];
|
||||||
|
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
|
@ -184,7 +185,6 @@ let
|
||||||
latex foiltex.ins
|
latex foiltex.ins
|
||||||
|
|
||||||
# Generate the documentation
|
# Generate the documentation
|
||||||
export HOME=.
|
|
||||||
latexmk -pdf foiltex.dtx
|
latexmk -pdf foiltex.dtx
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue