agda: Remove unused/uneeded abstractions, including postprocess

This commit is contained in:
John Ericson 2015-05-30 19:33:20 +00:00
parent 9b31a07b0d
commit be2cba690c

View File

@ -10,11 +10,6 @@
with stdenv.lib.strings; with stdenv.lib.strings;
let let
optionalString = stdenv.lib.optionalString;
filter = stdenv.lib.filter;
unwords = concatStringsSep " ";
mapInside = xs: unwords (map (x: x + "/*") xs);
defaults = self : { defaults = self : {
# 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;
@ -24,14 +19,16 @@ let
buildInputs = [ Agda ] ++ self.buildDepends; buildInputs = [ Agda ] ++ self.buildDepends;
buildDepends = []; buildDepends = [];
buildDependsAgda = filter buildDependsAgda = stdenv.lib.filter
(dep: dep ? isAgdaPackage && dep.isAgdaPackage) (dep: dep ? isAgdaPackage && dep.isAgdaPackage)
self.buildDepends; self.buildDepends;
buildDependsAgdaShareAgda = map (x: x + "/share/agda") self.buildDependsAgda; 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 = stdenv.lib.optionalString
stdenv.isLinux
"${glibcLocales}/lib/locale/locale-archive";
everythingFile = "Everything.agda"; everythingFile = "Everything.agda";
@ -52,7 +49,7 @@ let
includeDirs = self.buildDependsAgdaShareAgda includeDirs = self.buildDependsAgdaShareAgda
++ self.sourceDirectories ++ self.topSourceDirectories ++ self.sourceDirectories ++ self.topSourceDirectories
++ [ "." ]; ++ [ "." ];
buildFlags = unwords (map (x: "-i " + x) self.includeDirs); buildFlags = concatStringsSep " " (map (x: "-i " + x) self.includeDirs);
agdaWithArgs = "${Agda}/bin/agda ${self.buildFlags}"; agdaWithArgs = "${Agda}/bin/agda ${self.buildFlags}";
@ -62,10 +59,13 @@ let
runHook postBuild runHook postBuild
''; '';
installPhase = '' installPhase = let
srcFiles = self.sourceDirectories
++ map (x: x + "/*") self.topSourceDirectories;
in ''
runHook preInstall runHook preInstall
mkdir -p $out/share/agda mkdir -p $out/share/agda
cp -pR ${unwords self.sourceDirectories} ${mapInside self.topSourceDirectories} $out/share/agda cp -pR ${concatStringsSep " " srcFiles} $out/share/agda
runHook postInstall runHook postInstall
''; '';
@ -84,16 +84,9 @@ let
}; };
}; };
}; };
postprocess = x: x // {
sourceDirectories = filter (y: !(y == null)) x.sourceDirectories;
propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
everythingFile = if x.everythingFile == "" then "Everything.agda" else x.everythingFile;
};
in in
{ mkDerivation = args: let { mkDerivation = args: let
super = defaults self // args self; super = defaults self // args self;
self = super // extension self super; self = super // extension self super;
in stdenv.mkDerivation (postprocess self); in stdenv.mkDerivation self;
} }