@@ -10,11 +10,6 @@
1010with stdenv.lib.strings;
1111
1212let
13− optionalString = stdenv.lib.optionalString;
14− filter = stdenv.lib.filter;
15− unwords = concatStringsSep " ";
16− mapInside = xs: unwords (map (x: x + "/*") xs);
17−
1813 defaults = self : {
1914 # There is no Hackage for Agda so we require src.
2015 inherit (self) src name;
@@ -24,14 +19,16 @@ let
2419 buildInputs = [ Agda ] ++ self.buildDepends;
2520 buildDepends = [];
2621
27− buildDependsAgda = filter
22+ buildDependsAgda = stdenv.lib.filter
2823 (dep: dep ? isAgdaPackage && dep.isAgdaPackage)
2924 self.buildDepends;
3025 buildDependsAgdaShareAgda = map (x: x + "/share/agda") self.buildDependsAgda;
3126
3227 # Not much choice here ;)
3328 LANG = "en_US.UTF-8";
34− LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
29+ LOCALE_ARCHIVE = stdenv.lib.optionalString
30+ stdenv.isLinux
31+ "${glibcLocales}/lib/locale/locale-archive";
3532
3633 everythingFile = "Everything.agda";
3734
@@ -52,7 +49,7 @@ let
5249 includeDirs = self.buildDependsAgdaShareAgda
5350 ++ self.sourceDirectories ++ self.topSourceDirectories
5451 ++ [ "." ];
55− buildFlags = unwords (map (x: "-i " + x) self.includeDirs);
52+ buildFlags = concatStringsSep " " (map (x: "-i " + x) self.includeDirs);
5653
5754 agdaWithArgs = "${Agda}/bin/agda ${self.buildFlags}";
5855
@@ -62,10 +59,13 @@ let
6259 runHook postBuild
6360 '';
6461
65− installPhase = ''
62+ installPhase = let
63+ srcFiles = self.sourceDirectories
64+ ++ map (x: x + "/*") self.topSourceDirectories;
65+ in ''
6666 runHook preInstall
6767 mkdir -p $out/share/agda
68− cp -pR ${unwords self.sourceDirectories} ${mapInside self.topSourceDirectories} $out/share/agda
68+ cp -pR ${concatStringsSep " " srcFiles} $out/share/agda
6969 runHook postInstall
7070 '';
7171
@@ -84,16 +84,9 @@ let
8484 };
8585 };
8686 };
87−
88− postprocess = x: x // {
89− sourceDirectories = filter (y: !(y == null)) x.sourceDirectories;
90− propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
91− propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
92− everythingFile = if x.everythingFile == "" then "Everything.agda" else x.everythingFile;
93− };
9487in
9588{ mkDerivation = args: let
9689 super = defaults self // args self;
9790 self = super // extension self super;
98− in stdenv.mkDerivation (postprocess self);
91+ in stdenv.mkDerivation self;
9992}