diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2015-05-18 04:50:37 +0000 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2015-05-20 16:01:40 +0000 |
commit | 91ab6c9e899605be047e0e96af1144b964e6b64e (patch) | |
tree | 5a15166d9a47c81c123110bdfd549c4d1f988917 /pkgs/build-support | |
parent | 33c28bdc833effbf4cd31971e782eeb925f88877 (diff) | |
download | nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar.gz nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar.bz2 nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar.lz nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar.xz nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.tar.zst nixlib-91ab6c9e899605be047e0e96af1144b964e6b64e.zip |
agda: Wrapper is no longer built by default
Instead it is provided to the user who can choose whether or not to include it in the final derivati. Example of including would be: ```nix callPackage ... (self: { inherit (self.extras) extraThing; }) ``` These extras are also available downstream without being built by default. This is achieved with `passthru`.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/agda/default.nix | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index 6e9aef5499aa..69c4897d1a4b 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -22,6 +22,9 @@ in propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs; propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs; everythingFile = if x.everythingFile == "" then "Everything.agda" else x.everythingFile; + + passthru = { inherit (x) extras; }; + extras = null; }; defaults = self : { @@ -63,25 +66,11 @@ in ++ [ "." ]; buildFlags = unwords (map (x: "-i " + x) self.includeDirs); - # We expose this as a mere convenience for any tools. - AGDA_PACKAGE_PATH = concatMapStrings (x: x + ":") self.buildDependsAgdaShareAgda; - - # Makes a wrapper available to the user. Very useful in - # nix-shell where all dependencies are -i'd. - agdaWrapper = writeScriptBin "agda" '' - ${Agda}/bin/agda ${self.buildFlags} "$@" - ''; - - # configurePhase is idempotent - configurePhase = '' - runHook preConfigure - export PATH="${self.agdaWrapper}/bin:$PATH" - runHook postConfigure - ''; + agdaWithArgs = "${Agda}/bin/agda ${self.buildFlags}"; buildPhase = '' runHook preBuild - ${Agda}/bin/agda ${self.buildFlags} ${self.everythingFile} + ${self.agdaWithArgs} ${self.everythingFile} runHook postBuild ''; @@ -91,6 +80,24 @@ in cp -pR ${unwords self.sourceDirectories} ${mapInside self.topSourceDirectories} $out/share/agda runHook postInstall ''; + + # Optionally-built conveniences + extras = { + # Makes a wrapper available to the user. Very useful in + # nix-shell where all dependencies are -i'd. + agdaWrapper = writeScriptBin "agda" '' + ${self.agdaWithArgs} "$@" + ''; + + # Use this to stick `agdaWrapper` at the front of the PATH: + # + # agda.mkDerivation (self: { PATH = self.extras.agdaWrapperPATH; }) + # + # Not sure this is the best way to handle conflicts.... + agdaWrapperPATH = "${self.extras.agdaWrapper}/bin:$PATH"; + + AGDA_PACKAGE_PATH = concatMapStrings (x: x + ":") self.buildDependsAgdaShareAgda; + }; }; in stdenv.mkDerivation (postprocess (let super = defaults self // args self; |