1{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }:
4{ component, package, name, src, enableDWARF ? false, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
5, preUnpack ? component.preUnpack, postUnpack ? component.postUnpack
6, prePatch ? null, postPatch ? null
7, preBuild ? component.preBuild , postBuild ? component.postBuild
8, preInstall ? component.preInstall , postInstall ? component.postInstall
9, cleanSrc ? haskellLib.cleanCabalComponent package component "setup" src
13 cleanSrc' = haskellLib.rootAndSubDir cleanSrc;
15 fullName = "${name}-setup";
17 includeGhcPackage = lib.any (p: p.identifier.name == "ghc") component.depends;
19 configFiles = makeSetupConfigFiles {
20 inherit (package) identifier;
21 inherit fullName flags component enableDWARF;
23 hooks = haskellLib.optionalHooks {
28 preInstall postInstall
32 executableToolDepends =
33 (lib.concatMap (c: if c.isHaskell or false
34 then builtins.attrValues (c.components.exes or {})
35 else [c]) component.build-tools) ++
36 lib.optional (component.pkgconfig != []) pkgconfig;
39 stdenv.mkDerivation ({
40 name = "${ghc.targetPrefix}${fullName}";
42 buildInputs = component.libs
43 ++ component.frameworks
44 ++ builtins.concatLists component.pkgconfig;
45 nativeBuildInputs = [ghc] ++ executableToolDepends;
48 inherit (package) identifier;
50 srcSubDir = cleanSrc'.subDir;
51 srcSubDirPath = cleanSrc'.root + cleanSrc'.subDir;
54 dwarf = self (drvArgs // { enableDWARF = true; });
58 homepage = package.homepage or "";
59 description = package.synopsis or "";
60 license = haskellLib.cabalToNixpkgsLicense package.license;
61 platforms = if component.platforms == null then lib.platforms.all else component.platforms;
64 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
67 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
68 cat ${defaultSetupSrc} > Setup.hs
70 for f in Setup.hs Setup.lhs; do
72 echo Compiling package $f
73 ghc $f -threaded '' + (if includeGhcPackage then "-package ghc " else "")
74 + ''-package-db ${configFiles}/${configFiles.packageCfgDir} --make -o ./Setup
78 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
85 install ./Setup $out/bin/Setup
89 // (lib.optionalAttrs (cleanSrc'.subDir != "") {
91 # If the package is in a sub directory `cd` there first
93 cd ${lib.removePrefix "/" cleanSrc'.subDir}
96 // (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