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
This commit is contained in:
John Ericson 2015-05-18 04:46:48 +00:00
parent ae444ea4c4
commit 33c28bdc83

View file

@ -28,16 +28,24 @@ in
# There is no Hackage for Agda so we require src. # There is no Hackage for Agda so we require src.
inherit (self) src name; inherit (self) src name;
isAgdaPackage = true;
buildInputs = [ Agda ] ++ self.buildDepends; buildInputs = [ Agda ] ++ self.buildDepends;
buildDepends = []; buildDepends = [];
buildDependsAgda = filter
(dep: dep ? isAgdaPackage && dep.isAgdaPackage)
self.buildDepends;
buildDependsAgdaShareAgda = map (x: x + "/share/agda") self.buildDependsAgda;
# Not much choice here ;) # Not much choice here ;)
LANG = "en_US.UTF-8"; LANG = "en_US.UTF-8";
LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
everythingFile = "Everything.agda"; everythingFile = "Everything.agda";
propagatedBuildInputs = self.buildDepends; propagatedBuildInputs = self.buildDependsAgda;
propagatedUserEnvPkgs = self.buildDepends; propagatedUserEnvPkgs = self.buildDependsAgda;
# Immediate source directories under which modules can be found. # Immediate source directories under which modules can be found.
sourceDirectories = [ ]; sourceDirectories = [ ];
@ -50,13 +58,13 @@ in
topSourceDirectories = [ "src" ]; topSourceDirectories = [ "src" ];
# FIXME: `dirOf self.everythingFile` is what we really want, not hardcoded "./" # FIXME: `dirOf self.everythingFile` is what we really want, not hardcoded "./"
includeDirs = let r = map (x: x + "/share/agda") self.buildDepends; includeDirs = self.buildDependsAgdaShareAgda
d = self.sourceDirectories ++ self.topSourceDirectories; ++ self.sourceDirectories ++ self.topSourceDirectories
in r ++ d ++ [ "." ]; ++ [ "." ];
buildFlags = unwords (map (x: "-i " + x) self.includeDirs); buildFlags = unwords (map (x: "-i " + x) self.includeDirs);
# We expose this as a mere convenience for any tools. # 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 # Makes a wrapper available to the user. Very useful in
# nix-shell where all dependencies are -i'd. # nix-shell where all dependencies are -i'd.