1{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }@defaults:
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
10, nonReinstallablePkgs ? defaults.nonReinstallablePkgs
11, smallAddressSpace ? false
15 ghc = (if enableDWARF then (x: x.dwarf) else (x: x)) (
16 (if smallAddressSpace then (x: x.smallAddressSpace) else (x: x)) defaults.ghc);
18 cleanSrc' = haskellLib.rootAndSubDir cleanSrc;
20 fullName = "${name}-setup";
22 includeGhcPackage = lib.any (p: p.identifier.name == "ghc") component.depends;
24 configFiles = makeSetupConfigFiles {
25 inherit (package) identifier;
26 inherit fullName flags component enableDWARF nonReinstallablePkgs;
28 hooks = haskellLib.optionalHooks {
33 preInstall postInstall
37 executableToolDepends =
38 (lib.concatMap (c: if c.isHaskell or false
39 then builtins.attrValues (c.components.exes or {})
40 else [c]) component.build-tools) ++
41 lib.optional (component.pkgconfig != []) pkgconfig;
44 stdenv.mkDerivation ({
45 name = "${ghc.targetPrefix}${fullName}";
47 buildInputs = component.libs
48 ++ component.frameworks
49 ++ builtins.concatLists component.pkgconfig;
50 nativeBuildInputs = [ghc] ++ executableToolDepends;
53 inherit (package) identifier;
55 srcSubDir = cleanSrc'.subDir;
56 srcSubDirPath = cleanSrc'.root + cleanSrc'.subDir;
59 dwarf = self (drvArgs // { enableDWARF = true; });
60 smallAddressSpace = self (drvArgs // { smallAddressSpace = true; });
64 homepage = package.homepage or "";
65 description = package.synopsis or "";
66 license = haskellLib.cabalToNixpkgsLicense package.license;
67 platforms = if component.platforms == null then lib.platforms.all else component.platforms;
70 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
73 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
74 cat ${defaultSetupSrc} > Setup.hs
76 for f in Setup.hs Setup.lhs; do
78 echo Compiling package $f
79 ghc $f -threaded '' + (if includeGhcPackage then "-package ghc " else "")
80 + ''-package-db ${configFiles}/${configFiles.packageCfgDir} --make -o ./Setup
84 [ -f ./Setup ] || (echo Failed to build Setup && exit 1)
91 install ./Setup $out/bin/Setup
95 // (lib.optionalAttrs (cleanSrc'.subDir != "") {
97 # If the package is in a sub directory `cd` there first
99 cd ${lib.removePrefix "/" cleanSrc'.subDir}
102 // (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