1{ stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }:
3{ component, package, name, src, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
4, preUnpack ? component.preUnpack, postUnpack ? component.postUnpack
5, prePatch ? null, postPatch ? null
6, preBuild ? component.preBuild , postBuild ? component.postBuild
7, preInstall ? component.preInstall , postInstall ? component.postInstall
8, cleanSrc ? haskellLib.cleanCabalComponent package component src
12 fullName = "${name}-setup";
14 includeGhcPackage = lib.any (p: p.identifier.name == "ghc") component.depends;
16 configFiles = makeSetupConfigFiles {
17 inherit (package) identifier;
18 inherit fullName flags component;
20 hooks = haskellLib.optionalHooks {
25 preInstall postInstall
29 executableToolDepends =
30 (lib.concatMap (c: if c.isHaskell or false
31 then builtins.attrValues (c.components.exes or {})
32 else [c]) component.build-tools) ++
33 lib.optional (component.pkgconfig != []) pkgconfig;
36 stdenv.mkDerivation ({
37 name = "${ghc.targetPrefix}${fullName}";
39 buildInputs = component.libs
40 ++ component.frameworks
41 ++ builtins.concatLists component.pkgconfig;
42 nativeBuildInputs = [ghc] ++ executableToolDepends;
45 inherit (package) identifier;
47 inherit configFiles cleanSrc;
51 homepage = package.homepage or "";
52 description = package.synopsis or "";
55 license-map = import ../lib/cabal-licenses.nix lib;
56 in license-map.${package.license} or
57 (builtins.trace "WARNING: license \"${package.license}\" not found" license-map.LicenseRef-OtherLicense);
58 platforms = if component.platforms == null then stdenv.lib.platforms.all else component.platforms;
61 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
64 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
65 cat ${defaultSetupSrc} > Setup.hs
67 for f in Setup.hs Setup.lhs; do
69 echo Compiling package $f
70 ghc $f -threaded '' + (if includeGhcPackage then "-package ghc " else "")
71 + ''-package-db ${configFiles}/${configFiles.packageCfgDir} --make -o ./Setup
75 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
82 install ./Setup $out/bin/Setup
86 // (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; })
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list