Skip to content

Commit

Permalink
Merge pull request #39 from cdepillabout/update
Browse files Browse the repository at this point in the history
Nix clone full repo for git repos
  • Loading branch information
cdepillabout authored Nov 22, 2023
2 parents 10d5316 + 909a362 commit 84694f4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
## 4.0.0

* Make sure the `psqueues` Haskell package gets the `fingertree-psqueue` dep
depending on what version of `psqueues` you're compiling.

Added in [#39](https://github.com/cdepillabout/stacklock2nix/pull/39).

* Change stacklock2nix's handling of Stack's `git` dependencies.

A `git` dependency looks like the following in `stack.yaml`:

```yaml
extra-deps:
- git: "https://github.com/haskell-servant/servant-cassava"
commit: "f76308b42b9f93a6641c70847cec8ecafbad3abc"
```
Up until now, stacklock2nix would download Stack's `git` dependencies using
Nix's `builtins.fetchGit` function.

By default, this function doesn't clone the full repository, but only the
history of the default branch. This is a problem if you try to specify a
commit that is not a parent of the default branch. This may happen if
you're developing new functionality in a feature branch that hasn't yet
been merged into `master`.

stacklock2nix has been changed to additionally specify the `allRefs = true`
argument to `builtins.fetchGit`. This causes the full Git repository to be
downloaded, even commits that aren't ancestors of the default branch.

Added in [#39](https://github.com/cdepillabout/stacklock2nix/pull/39).
Thanks to [@isomorpheme](https://github.com/isomorpheme) for reporting this
and coming up with the fix.

It is possible this causes increased download times, especially for repos
that are very big.

You may be able to work around this by using Stack's functionality for
downloading given URLs, in order to download a tarball of a repository
(without any of the Git history).:

```yaml
extra-deps:
- url: "https://github.com/haskell-servant/servant-cassava/archive/f76308b42b9f93a6641c70847cec8ecafbad3abc.tar.gz"
```

## 3.0.5

* Make sure the `digest` Haskell package gets the system `zlib` as an argument.
Expand Down
9 changes: 7 additions & 2 deletions nix/build-support/stacklock2nix/cabal2nixArgsForPkg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ cabal2nixArgsOverrides {

"pango" = ver: { pango = pkgs.pango; };

# The PSQueue and fingertree-psqueue packages are used in benchmarks, but they are not on Stackage.
"psqueues" = ver: { fingertree-psqueue = null; PSQueue = null; };
"psqueues" = ver:
if pkgs.lib.versionAtLeast ver "0.2.8.0" then
# The PSQueue package is used in benchmarks, but it is not on Stackage.
{ PSQueue = null; }
else
# The PSQueue and fingertree-psqueue packages are used in benchmarks, but they are not on Stackage.
{ fingertree-psqueue = null; PSQueue = null; };

"saltine" = ver: { libsodium = pkgs.libsodium; };

Expand Down
1 change: 1 addition & 0 deletions nix/build-support/stacklock2nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ let
url = haskPkgLock.git;
name = srcName;
rev = haskPkgLock.commit;
allRefs = true;
};
src =
if haskPkgLock ? "subdir" then
Expand Down

0 comments on commit 84694f4

Please sign in to comment.