-
Notifications
You must be signed in to change notification settings - Fork 725
Description
Describe the bug
Similar to #5346
cabal.project source-repository-package is cloned from GitHub, regardless of the --offline flag or active-repositories: https://cabal.readthedocs.io/en/stable/cabal-project.html#cfg-field-active-repositories
To Reproduce
example project: https://github.com/peterbecich/cabal2nix-project-issue
This example clones the haskell/text repository as a source-repository-package.
The nix files are irrelevant to this issue.
git clone https://github.com/peterbecich/cabal2nix-project-issue.gitcabal build --enable-tests --offline
Cabal will clone the source-repository-package:
Cloning into '/home/peterbecich/nix/cabal2nix-project-issue/dist-newstyle/src/text-8e814f5854032da8'...
remote: Enumerating objects: 11518, done.
remote: Counting objects: 100% (11518/11518), done.
remote: Compressing objects: 100% (4352/4352), done.
.
.
I have tested
active-repositories: none
and
active-repositories: :none
To re-test,
rm -rf dist-newstyle
Expected behavior
The --offline flag and/or active-repositories work perfectly to block access to Hackage. Can the same be done for source-repository-package?
System information
- Operating system: Debian
cabal3.10.2.1ghc9.6.4
Additional context
This may help to solve a different issue with Nix. Example Nix build from a different repository:
> Writing default configuration to
> /build/source-halogen-chess/.config/cabal/config
> Error: cabal: The program 'git' is required but it could not be found.
>
In this Nix build, Cabal is attempting to clone the source-repository-package but Nix is correctly not providing Git.
One way to solve this may be to have Nix invoke Cabal with the --offline flag.
I think that may go somewhere in make-package-set.nix: https://github.com/NixOS/nixpkgs/blob/46d10fdfe87d34e1641d627c31dbedd719024c91/pkgs/development/haskell-modules/make-package-set.nix#L4