Skip to content

Fix nix flake by explicit version for lsp-xxx packages #2557

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

Merged
merged 1 commit into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 70 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,22 @@
url = "github:hercules-ci/gitignore.nix";
flake = false;
};

lsp-source = {
url = "https://hackage.haskell.org/package/lsp-1.4.0.0/lsp-1.4.0.0.tar.gz";
flake = false;
};
lsp-types-source = {
url = "https://hackage.haskell.org/package/lsp-types-1.4.0.0/lsp-types-1.4.0.0.tar.gz";
flake = false;
};
lsp-test-source = {
url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz";
flake = false;
};
};
outputs =
{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore }:
{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, lsp-source, lsp-types-source, lsp-test-source }:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cute. In the past we've just used an explicit fetchurl for this sort of thing, but this is nicer, I think. That said, it might be simpler to update if the flake input pointed to the corresponding tag in the github repository instead of hackage?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No obligation, I'll merge this in a day or so regardless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I tried to load it from github directly.. However I had problem finding the tags in the git repository. For example, there is no 1.4.0.0 tag (or any other variation, unless I'm wrong) in the https://github.com/haskell/lsp repository.

Then I realized that the source of truth is hackage. The cabal file for Haskell language server is actually using bounds based on hackage version and hence fetching the revision as it is on hackage seems more robust from my point of view.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tags are confusing indeed, they're prefixed by the package. And it's no wonder you weren't able to find them... I forgot to push the tags (done now) 😅 anyway, not a big deal.

{
overlay = final: prev:
with prev;
Expand Down Expand Up @@ -75,6 +88,10 @@
# We need an older version
hiedb = hself.hiedb_0_4_1_0;

lsp = hsuper.callCabal2nix "lsp" lsp-source {};
lsp-types = hsuper.callCabal2nix "lsp-types" lsp-types-source {};
lsp-test = hsuper.callCabal2nix "lsp-test" lsp-test-source {};

implicit-hie-cradle = hself.callCabal2nix "implicit-hie-cradle"
(builtins.fetchTarball {
url = "https://hackage.haskell.org/package/implicit-hie-cradle-0.3.0.5/implicit-hie-cradle-0.3.0.5.tar.gz";
Expand Down