Skip to content
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

Shell nix further steps #240

Merged
merged 4 commits into from
Jul 26, 2020
Merged

Shell nix further steps #240

merged 4 commits into from
Jul 26, 2020

Conversation

pepeiborra
Copy link
Collaborator

@pepeiborra pepeiborra commented Jul 26, 2020

I've done a bit more work on this, fixing compatibility with all supported ghc versions and adding some comments on the rationale behind the approach.

pepeiborra@devvm370 ~/s/ide (shell-nix)> nix-shell -run "cabal build --dry-run"
Resolving dependencies...
Build profile: -w ghc-8.8.3 -O1
In order, the following would be built (use -v for more details):
 - ghcide-0.2.0 (exe:ghcide-test-preprocessor) (first run)
 - lsp-test-0.11.0.2 (lib) (requires build)
 - streaming-commons-0.2.1.2 (lib) (requires download & build)
 - conduit-extra-1.3.5 (lib) (requires build)
 - hie-bios-0.6.1 (lib) (requires build)
 - ghcide-0.2.0 (lib) (first run)
 - haskell-language-server-0.2.2.0 (lib) (first run)
 - haskell-language-server-0.2.2.0 (exe:haskell-language-server-wrapper) (first run)
 - haskell-language-server-0.2.2.0 (exe:haskell-language-server) (first run)
 - haskell-language-server-0.2.2.0 (test:wrapper-test) (first run)
 - haskell-language-server-0.2.2.0 (test:func-test) (first run)

- Removing packages that fail to build with ghc8101 (haskell-lsp due to statistics)
- Adding more prebuilt packages to further leverage the Nix cache
@fendor
Copy link
Collaborator

fendor commented Jul 26, 2020

What do we need to update all this? Is niv update enough?
Will the build-plan be identical to non-nix builds?

@pepeiborra
Copy link
Collaborator Author

niv update only moves the version of Nixpkgs, but it doesn't change the set of Haskell packages used to create the environment.

The list of packages in the shell.nix does need to be maintained manually, and it's ok if it gets out of sync. The penalty in the latter case is less Nix cache reuse, or unnecessary packages in the environment, both of which are minor issues. There exist options to automate this, e.g. cabal2nix or haskell.nix, but the approach in this PR is imho the simplest and least opinionated one. To recap, the goal is not to replace Cabal with Nix, but to leverage the Nix cache.

I believe the Cabal build plan is identical to non-nix builds: Cabal first solves the build plan and then reuses whatever is available in the package database and builds everything else.

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.

LGTM.
Thanks!

@fendor fendor merged commit 4e6082f into haskell:master Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants