From 705c4d7b49a7a824be70b6ead4799dfe328df783 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 9 May 2015 00:50:39 +0000 Subject: [PATCH 1/7] agda: Remove unnecessary env-var export Derivation attributes are automatically exported as environment variables already. --- pkgs/build-support/agda/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index cb6059e00cd2..a137704a30c7 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -70,7 +70,6 @@ in # configurePhase is idempotent configurePhase = '' eval "$preConfigure" - export AGDA_PACKAGE_PATH=${self.AGDA_PACKAGE_PATH}; export PATH="${self.agdaWrapper}/bin:$PATH" eval "$postConfigure" ''; From 45052c02a8b27f76a0a4ad9d43a37f7e23d637eb Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 9 May 2015 00:58:18 +0000 Subject: [PATCH 2/7] agda: Replace `eval` with `runHook` This is what haskell-ng does, so I figure it is the right thing to do. --- pkgs/build-support/agda/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index a137704a30c7..03a417a37847 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -69,22 +69,22 @@ in # configurePhase is idempotent configurePhase = '' - eval "$preConfigure" + runHook preConfigure export PATH="${self.agdaWrapper}/bin:$PATH" - eval "$postConfigure" + runHook postConfigure ''; buildPhase = '' - eval "$preBuild" + runHook preBuild ${Agda}/bin/agda ${self.buildFlags} ${self.everythingFile} - eval "$postBuild" + runHook postBuild ''; installPhase = '' - eval "$preInstall" + runHook preInstall mkdir -p $out/share/agda cp -pR ${unwords self.sourceDirectories} ${mapInside self.topSourceDirectories} $out/share/agda - eval "$postInstall" + runHook postInstall ''; }; in stdenv.mkDerivation From 95c1c686a371954751003c8108f9b6bd49a5338b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 May 2015 04:02:31 +0000 Subject: [PATCH 3/7] agda: Remove buildTools, it is unused --- pkgs/build-support/agda/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index 03a417a37847..d268bc3b122a 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -37,7 +37,7 @@ in everythingFile = "Everything.agda"; - propagatedBuildInputs = self.buildDepends ++ self.buildTools; + propagatedBuildInputs = self.buildDepends; propagatedUserEnvPkgs = self.buildDepends; # Immediate source directories under which modules can be found. @@ -50,8 +50,6 @@ in # would make a direct copy of the whole thing. topSourceDirectories = [ "src" ]; - buildTools = []; - # Extra stuff to pass to the Agda binary. extraBuildFlags = [ "-i ." ]; buildFlags = let r = map (x: "-i " + x + "/share/agda") self.buildDepends; From ae444ea4c4e12853e9791d6c567964e345fea922 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 May 2015 04:21:50 +0000 Subject: [PATCH 4/7] agda: Remove `extraBuildFlags` This is unused, future users can just use override `buildFlags` and extend/replace as needed. `includeDirs` is provided for this purpose. We should add `dirOf self.everythingFile` rather than `.`, but `dirOf` breaks on relative paths so that is not an option. --- pkgs/build-support/agda/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index d268bc3b122a..a513d50d04c7 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -21,7 +21,6 @@ in sourceDirectories = filter (y: !(y == null)) x.sourceDirectories; propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs; propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs; - extraBuildFlags = filter (y : ! (y == null)) x.extraBuildFlags; everythingFile = if x.everythingFile == "" then "Everything.agda" else x.everythingFile; }; @@ -50,11 +49,11 @@ in # would make a direct copy of the whole thing. topSourceDirectories = [ "src" ]; - # Extra stuff to pass to the Agda binary. - extraBuildFlags = [ "-i ." ]; - buildFlags = let r = map (x: "-i " + x + "/share/agda") self.buildDepends; - d = map (x : "-i " + x) (self.sourceDirectories ++ self.topSourceDirectories); - in unwords (r ++ d ++ self.extraBuildFlags); + # FIXME: `dirOf self.everythingFile` is what we really want, not hardcoded "./" + includeDirs = let r = map (x: x + "/share/agda") self.buildDepends; + d = self.sourceDirectories ++ self.topSourceDirectories; + in r ++ d ++ [ "." ]; + 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.buildDepends; From 33c28bdc833effbf4cd31971e782eeb925f88877 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 May 2015 04:46:48 +0000 Subject: [PATCH 5/7] agda: Agda dependencies are treated seperately - Only they are added to the optional build path (share/agda) - Only they are are passed as an include dir (share/agda) - Only they are propigatedBuildInputs --- pkgs/build-support/agda/default.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index a513d50d04c7..6e9aef5499aa 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -28,16 +28,24 @@ in # There is no Hackage for Agda so we require src. inherit (self) src name; + isAgdaPackage = true; + buildInputs = [ Agda ] ++ self.buildDepends; buildDepends = []; + + buildDependsAgda = filter + (dep: dep ? isAgdaPackage && dep.isAgdaPackage) + self.buildDepends; + buildDependsAgdaShareAgda = map (x: x + "/share/agda") self.buildDependsAgda; + # Not much choice here ;) LANG = "en_US.UTF-8"; LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; everythingFile = "Everything.agda"; - propagatedBuildInputs = self.buildDepends; - propagatedUserEnvPkgs = self.buildDepends; + propagatedBuildInputs = self.buildDependsAgda; + propagatedUserEnvPkgs = self.buildDependsAgda; # Immediate source directories under which modules can be found. sourceDirectories = [ ]; @@ -50,13 +58,13 @@ in topSourceDirectories = [ "src" ]; # FIXME: `dirOf self.everythingFile` is what we really want, not hardcoded "./" - includeDirs = let r = map (x: x + "/share/agda") self.buildDepends; - d = self.sourceDirectories ++ self.topSourceDirectories; - in r ++ d ++ [ "." ]; + includeDirs = self.buildDependsAgdaShareAgda + ++ self.sourceDirectories ++ self.topSourceDirectories + ++ [ "." ]; 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.buildDepends; + 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. From 91ab6c9e899605be047e0e96af1144b964e6b64e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 May 2015 04:50:37 +0000 Subject: [PATCH 6/7] 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`. --- pkgs/build-support/agda/default.nix | 39 +++++++++++++++++------------ 1 file 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; From 52a6589559ea424857b30b531f766c3c783b60a8 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 May 2015 01:49:19 -0400 Subject: [PATCH 7/7] agda: the Iowa stdlib seems to be behind a private SVN now --- pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix b/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix index 2c76c2f43508..cda2cd9bb05d 100644 --- a/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix +++ b/pkgs/development/libraries/agda/agda-iowa-stdlib/default.nix @@ -22,5 +22,7 @@ agda.mkDerivation (self: rec { license = stdenv.lib.licenses.free; platforms = stdenv.lib.platforms.unix; maintainers = with stdenv.lib.maintainers; [ fuuzetsu ]; + + broken = true; }; })