Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set haddock URLs to hackage #735

Closed
GuillaumeDesforges opened this issue Jun 30, 2020 · 3 comments
Closed

Set haddock URLs to hackage #735

GuillaumeDesforges opened this issue Jun 30, 2020 · 3 comments

Comments

@GuillaumeDesforges
Copy link
Contributor

I'm building documentation with nix-build -A mypackage.components.library.doc

However that give me html pages with links to other packages like: file:///nix/store/94lvmc6196dp2blza38jh21sqbm4dzzs-basement-lib-basement-0.0.11-haddock-doc/share/doc/basement/html/Basement-Compat-Base.html#t:IO

Could I set to use some other URLs like described here?
https://stackoverflow.com/questions/57916341/how-to-instruct-haddock-to-link-to-hackage-documentation-for-hackage-packages

@TravisWhitaker
Copy link
Contributor

I think the current behavior is definitely the correct default; I actually really like that I can get my own local universe of packages complete with Hoogle, all accessible locally. You can even do hoogle server --local and serve your whole project's closure to an internal network.

@GuillaumeDesforges
Copy link
Contributor Author

Sorry if I was not clear. It is good that we can access the doc locally, but I believe that being able to export the doc is also necessary.
If I have to use haddock outside of haskell.nix, then I loose all the benefits of the haskell.nix infrastructure.

So I suggest adding such a feature.

@GuillaumeDesforges
Copy link
Contributor Author

GuillaumeDesforges commented Jul 1, 2020

In the end I wrote a doc.nix

let
    pkgs = import ./nixpkgs.nix {};

    base = import ./default.nix;
    base-doc = base.mypackage.components.library.doc;
in
    pkgs.runCommand
        "${base-doc.name}-url-corrected"
        { }
        ''
            cp -R ${base-doc}/* $out
            find $out -exec chmod 755 {} \;
            find $out -type f \
                -exec sed -i -e \
                    "s/file:\/\/\/nix\/store\/[a-z0-9]\+.\+-lib-\(.\+\)-\([0-9\.-]\+\)-haddock-doc\/share\/doc\/\(.\+\)\/html\//https:\/\/hackage.haskell.org\/package\/\1-\2\/docs\//g" \
                    {} \;
        ''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants