agda: Remove unused/uneeded abstractions, including `postprocess`

+11 -18
+11 -18
pkgs/build-support/agda/default.nix
··· 10 10 with stdenv.lib.strings; 11 11 12 12 let 13 - optionalString = stdenv.lib.optionalString; 14 - filter = stdenv.lib.filter; 15 - unwords = concatStringsSep " "; 16 - mapInside = xs: unwords (map (x: x + "/*") xs); 17 - 18 13 defaults = self : { 19 14 # There is no Hackage for Agda so we require src. 20 15 inherit (self) src name; ··· 24 19 buildInputs = [ Agda ] ++ self.buildDepends; 25 20 buildDepends = []; 26 21 27 - buildDependsAgda = filter 22 + buildDependsAgda = stdenv.lib.filter 28 23 (dep: dep ? isAgdaPackage && dep.isAgdaPackage) 29 24 self.buildDepends; 30 25 buildDependsAgdaShareAgda = map (x: x + "/share/agda") self.buildDependsAgda; 31 26 32 27 # Not much choice here ;) 33 28 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"; 35 32 36 33 everythingFile = "Everything.agda"; 37 34 ··· 52 49 includeDirs = self.buildDependsAgdaShareAgda 53 50 ++ self.sourceDirectories ++ self.topSourceDirectories 54 51 ++ [ "." ]; 55 - buildFlags = unwords (map (x: "-i " + x) self.includeDirs); 52 + buildFlags = concatStringsSep " " (map (x: "-i " + x) self.includeDirs); 56 53 57 54 agdaWithArgs = "${Agda}/bin/agda ${self.buildFlags}"; 58 55 ··· 62 59 runHook postBuild 63 60 ''; 64 61 65 - installPhase = '' 62 + installPhase = let 63 + srcFiles = self.sourceDirectories 64 + ++ map (x: x + "/*") self.topSourceDirectories; 65 + in '' 66 66 runHook preInstall 67 67 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 69 69 runHook postInstall 70 70 ''; 71 71 ··· 84 84 }; 85 85 }; 86 86 }; 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 - }; 94 87 in 95 88 { mkDerivation = args: let 96 89 super = defaults self // args self; 97 90 self = super // extension self super; 98 - in stdenv.mkDerivation (postprocess self); 91 + in stdenv.mkDerivation self; 99 92 }