1# This function takes the output of `callCabalProjectToNix` or
2# `callStackToNix`. It imports the projectNix that was produced
3# and combines it with the original source.
5{ projectNix, sourceRepos, src }:
7 # Full source including possible relative paths form the
10 if haskellLib.canCleanSource src
11 then haskellLib.cleanSourceWith {
12 name = if src ? name then "${src.name}-root" else "source-root";
13 src = src.origSrc or src;
14 filter = src.filter or (_: _: true);
16 else src.origSrc or src;
17 # The sub directory containing the cabal.project or stack.yaml file
18 projectSubDir' = src.origSubDir or ""; # With leading /
19 projectSubDir = pkgs.lib.strings.removePrefix "/" projectSubDir'; # Without /
20 projectSubDir'' = if projectSubDir == "" then "" else projectSubDir + "/"; # With trailing /
21 project = import "${projectNix}${projectSubDir'}";
23 extras = hackage: let old = (project.extras hackage).packages; in {
24 packages = pkgs.lib.attrsets.mapAttrs (name: value:
25 if builtins.isFunction value
28 let oldPkg = import value args;
29 packageSrc = if !pkgs.lib.strings.hasPrefix (toString projectNix) (toString oldPkg.src.content)
30 then toString oldPkg.src.content
32 subDir = pkgs.lib.strings.removePrefix "/" (
33 pkgs.lib.strings.removePrefix (toString projectNix)
34 (toString oldPkg.src.content));
35 srcRepoPrefix = projectSubDir'' + ".source-repository-packages/";
36 in if pkgs.lib.strings.hasPrefix srcRepoPrefix subDir
38 pkgs.lib.lists.elemAt sourceRepos (
39 pkgs.lib.strings.toInt (pkgs.lib.strings.removePrefix srcRepoPrefix subDir))
40 else if haskellLib.canCleanSource srcRoot
41 then haskellLib.cleanSourceWith { src = srcRoot; inherit subDir; }
42 else srcRoot + (if subDir == "" then "" else "/" + subDir);
44 src = (pkgs.lib).mkDefault packageSrc;
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