Skip to content

Add haskell.nix shell #1386

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
wants to merge 7 commits into from
Closed

Conversation

hamishmack
Copy link

No description provided.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

Do you think both nix-ways should be supported or only one of them?

hamishmack and others added 3 commits February 17, 2021 11:51
Co-authored-by: fendor <fendor@users.noreply.github.com>
Co-authored-by: fendor <fendor@users.noreply.github.com>
Co-authored-by: fendor <fendor@users.noreply.github.com>
@pepeiborra
Copy link
Collaborator

IIUC correctly, this will track changes to the cabal.project file and never break, therefore no need to set up a CI job for it?

@hamishmack
Copy link
Author

IIUC correctly, this will track changes to the cabal.project file and never break, therefore no need to set up a CI job for it?

Never say never. Is there a test for shell.nix that we could run on this as well?

@pepeiborra
Copy link
Collaborator

IIUC correctly, this will track changes to the cabal.project file and never break, therefore no need to set up a CI job for it?

Never say never. Is there a test for shell.nix that we could run on this as well?

There is a GitHub action

@michaelpj
Copy link
Collaborator

FWIW, I'm not sure I'd recommend merging this unless some of the contributors to the project are actually keen on maintaining it! Maintaining other people's Nix code is never fun...

Comment on lines +23 to +24
name: haskell-language-server
authToken: ${{ secrets.HLS_CACHIX_AUTH_TOKEN }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The haskell-language-server Cachix account is limited to 5GB, so this won't work. I recommend using a different Cachix account for the haskell.nix artifacts, I can set up the token if you share it via email (pepeiborra@gmail.com).

To test it, you will have to open the PR from a GitHub.com/haskell/haskell-language-server branch, otherwise the GitHub action cannot see the token. I've given you push access

Copy link
Collaborator

@pepeiborra pepeiborra Feb 20, 2021

Choose a reason for hiding this comment

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

I've set up the public Cachix account haskell-nix-language-server and the secret HLS_NIX_CACHIX_AUTH_TOKEN

Copy link
Author

Choose a reason for hiding this comment

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

I can set up the token if you share it via email

Sorry, I just saw this. Do you still need me to do this?

I've given you push access

I tried pushing the hkm/haskell-nix branch to haskell/haskell-language-server, but got:

ERROR: Permission to haskell/haskell-language-server.git denied to hamishmack.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

It used quite a lot of github minutes building GHC.  Is it possible (and would it make sense) to use the IOHK cache instead of cachix (or better yet as an upstream cache if that is possible)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Github says that it is awaiting your response:
image

It makes sense to use the IOHK cache, as long as it freely accessible and also provides Mac OS builds?

Copy link
Member

Choose a reason for hiding this comment

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

@hamishmack hi, some update on this?

@pepeiborra
Copy link
Collaborator

I am happy to switch from shell.nix to this one if we set it up with Cachix properly. Otherwise it will be not viable for me (Mac OS here)

@berberman
Copy link
Collaborator

Moreover, do we have any plan to use Flakes? It's an experimental feature, providing functionality similar to niv but more powerful and concise. And there is a flake-compat to help us keep it backward compatible (default.nix and shell.nix will still be available for non-flake users).

@jneira jneira added the status: needs info Not actionable, because there's missing information label Apr 13, 2021
@jneira
Copy link
Member

jneira commented Jul 14, 2021

@hamishmack do you still have plans to continue this?

@hamishmack
Copy link
Author

hamishmack commented Jul 14, 2021

My use case for this is now covered by Hix.

I can check a project builds with haskell.nix by installing or updating Hix as per the getting started guide, then cloning the project:

git clone https://github.com/haskell/haskell-language-server.git
cd haskell-language-server

Add configuration to nix/hix.nix or $HOME/.config/hix/hix.conf:

{ projectFileName = "cabal.project";
  shell.tools.cabal = {};
  sha256map."https://github.com/hsyl20/ghc-api-compat"."8fee87eac97a538dbe81ff1ab18cff10f2f9fa15" = "sha256-byehvdxQxhNk5ZQUXeFHjAZpAze4Ct9261ro4c5acZk=";
}

To build a project component:

hix-build -A hsPkgs.haskell-language-server.components.exes.haskell-language-server

or

hix build hsPkgs.haskell-language-server.components.exes.haskell-language-server

To build with cabal in a haskell.nix nix shell:

hix-shell --run 'cabal build all'

The getting started guide has example default.nix, shell.nix and flake.nix that use a nix/hix.nix configuration file if anyone else wants to migrate to haskell.nix (that way the regular Nix tools work the way the Hix ones do).

@hamishmack hamishmack closed this Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs info Not actionable, because there's missing information
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants