add options for build idris package (#65666)
add options for build idris package
This commit is contained in:
commit
dd7de2d096
|
@ -124,3 +124,21 @@ in another file (say `default.nix`) to be able to build it with
|
||||||
```
|
```
|
||||||
$ nix-build -A yaml
|
$ nix-build -A yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Passing options to `idris` commands
|
||||||
|
|
||||||
|
The `build-idris-package` function provides also optional input values to set additional options for the used `idris` commands.
|
||||||
|
|
||||||
|
Specifically, you can set `idrisBuildOptions`, `idrisTestOptions`, `idrisInstallOptions` and `idrisDocOptions` to provide additional options to the `idris` command respectively when building, testing, installing and generating docs for your package.
|
||||||
|
|
||||||
|
For example you could set
|
||||||
|
|
||||||
|
```
|
||||||
|
build-idris-package {
|
||||||
|
idrisBuildOptions = [ "--log" "1" "--verbose" ]
|
||||||
|
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
to require verbose output during `idris` build phase.
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
, version
|
, version
|
||||||
, ipkgName ? name
|
, ipkgName ? name
|
||||||
, extraBuildInputs ? []
|
, extraBuildInputs ? []
|
||||||
|
, idrisBuildOptions ? []
|
||||||
|
, idrisTestOptions ? []
|
||||||
|
, idrisInstallOptions ? []
|
||||||
|
, idrisDocOptions ? []
|
||||||
, ...
|
, ...
|
||||||
}@attrs:
|
}@attrs:
|
||||||
let
|
let
|
||||||
|
@ -39,14 +43,14 @@ stdenv.mkDerivation ({
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
idris --build ${ipkgName}.ipkg
|
idris --build ${ipkgName}.ipkg ${lib.escapeShellArgs idrisBuildOptions}
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
if grep -q tests ${ipkgName}.ipkg; then
|
if grep -q tests ${ipkgName}.ipkg; then
|
||||||
idris --testpkg ${ipkgName}.ipkg
|
idris --testpkg ${ipkgName}.ipkg ${lib.escapeShellArgs idrisTestOptions}
|
||||||
fi
|
fi
|
||||||
runHook postCheck
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
|
@ -54,9 +58,9 @@ stdenv.mkDerivation ({
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
idris --install ${ipkgName}.ipkg --ibcsubdir $out/libs
|
idris --install ${ipkgName}.ipkg --ibcsubdir $out/libs ${lib.escapeShellArgs idrisInstallOptions}
|
||||||
|
|
||||||
IDRIS_DOC_PATH=$out/doc idris --installdoc ${ipkgName}.ipkg || true
|
IDRIS_DOC_PATH=$out/doc idris --installdoc ${ipkgName}.ipkg ${lib.escapeShellArgs idrisDocOptions} || true
|
||||||
|
|
||||||
# If the ipkg file defines an executable, install that
|
# If the ipkg file defines an executable, install that
|
||||||
executable=$(grep -Po '^executable = \K.*' ${ipkgName}.ipkg || true)
|
executable=$(grep -Po '^executable = \K.*' ${ipkgName}.ipkg || true)
|
||||||
|
|
Loading…
Reference in a new issue