Skip to content

cabalProject has no way to specify a branch name #1663

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

Closed
parsonsmatt opened this issue Sep 13, 2022 · 3 comments
Closed

cabalProject has no way to specify a branch name #1663

parsonsmatt opened this issue Sep 13, 2022 · 3 comments
Labels
enhancement New feature or request wontfix

Comments

@parsonsmatt
Copy link
Contributor

The branchMap configuration option was added to stackProject, but this was not ported to cabalProject.

@parsonsmatt
Copy link
Contributor Author

Huh. The parser is converting tag in the cabal.project to ref. Presumably because tag can be either a git commit (aka rev) or a branch/tag (aka ref). This breaks the ability to use source-repo-override:

    source-repo-override = {
      "https://github.com/TeofilC/servant.git" =
        orig: orig // {
          ref = "ghc-9.4";
          rev = orig.rev;
        };
    };

since the fetchgit call does an override here:

              then fetchgit { inherit (repoData) url sha256; rev = repoData.ref; }

If the parser can disambiguate a ref and a rev, then we could set it appropriately from the outset.

  extractSourceRepoPackageData = cabalProjectFileName: sha256map: repo: {
    url = repo.location;
    ref = repo.tag;
    sha256 = repo."--sha256" or (
      if sha256map != null
        then sha256map."${repo.location}"."${repo.tag}"
        else null);
    subdirs = if repo ? subdir
      then pkgs.lib.filter (x: x != "") (pkgs.lib.splitString " " repo.subdir)
      else ["."];
  };

@yvan-sraka yvan-sraka added the enhancement New feature or request label Sep 20, 2022
@fumieval
Copy link

fumieval commented Dec 6, 2022

Apparently this breaks the ability to specify cabalProject by an arbitrary string; I get the following error when I pass cabalProject = builtins.readFile "${args.src}/cabal.project"; to haskell-nix.cabalProject

trace: WARNING: No sha256 found for source-repository-package https://github.com/herp-inc/raven-haskell.git ref=(unspecified) rev=e9d89ecb3499c29f56a67da00bddbed53e37aeca download may fail in restricted mode (hydra)
error: fetchTree argument 'ref' is null while a string, Boolean or integer is expected

@stale
Copy link

stale bot commented Apr 5, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 5, 2023
@stale stale bot closed this as completed Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix
Projects
None yet
Development

No branches or pull requests

3 participants