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

Make nix-shell evaluation faster #2300

Merged
merged 8 commits into from
Nov 6, 2020
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
13 changes: 12 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
eval "$(lorri direnv)"
if [ -e .envrc-local ]; then
# Source a user-specific config in ./.envrc-local
source .envrc-local
elif type lorri &>/dev/null; then
eval "$(lorri direnv)"
else
# Fall back to using direnv's builtin nix support
# to prevent bootstrapping problems.
# It's definitely better to use lorri, because direnv won't
# be fast like this.
use nix
fi
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# - influences how files are shown in the GitHub diff view

# Hide stuff that is generated by nix-tools stack-to-nix
nix/.stack.nix/*.nix linguist-generated=true merge=union
nix/.stack.nix/*.nix linguist-generated=true merge=binary
nix/materialized/*/*.nix linguist-generated=true merge=binary
nix/materialized/*/.plan.nix/*.nix linguist-generated=true merge=binary

# Hide niv boilerplate
nix/sources.nix linguist-generated=true
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ cabal.sandbox.config
result*
.stack-to-nix.cache

### Direnv ###
.envrc-local

### auto-generated faulty JSON golden tests ###
*.faulty.json
11 changes: 9 additions & 2 deletions cabal-nix.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
--
-- The Haskell package set is automatically generated from stack.yaml.
--
-- To build, run "nix-shell", then:
-- To build, start "nix-shell", then run Cabal inside:
-- nix-shell
-- cabal build --project-file=cabal-nix.project all
--
-- cabal build --project-file=cabal-nix.project --enable-tests --enable-benchmarks all
-- To build with profiling enabled, use:
-- nix-shell --arg profiling true
-- cabal build --project-file=cabal-nix.project all --enable-profiling
--
--------------------------------------------------------------------------------

packages:
lib/*/*.cabal

tests: True
benchmarks: True
55 changes: 2 additions & 53 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,57 +73,6 @@ let

getPackageChecks = mapAttrs (_: package: package.checks);

# Creates a development environment for Cabal builds or ghci
# sessions, with various build tools included.
mkShell = name: hp: hp.shellFor {
inherit name;
packages = ps: attrValues (selectProjectPackages ps);
buildInputs = (with self; [
jormungandr
jormungandr-cli
cardano-node
cardano-cli
cardano-address
cardano-tx
bech32
]) ++ (with pkgs; [
niv
pkgconfig
python3Packages.openapi-spec-validator
ruby
sqlite-interactive
yq
]);
tools = {
cabal = "3.2.0.0";
ghcid = "0.8.7";
hlint = "3.2";
lentil = "1.3.2.0";
stylish-haskell = "0.11.0.3";
weeder = "1.0.9";
};
CARDANO_NODE_CONFIGS = cardano-node.deployments;
meta.platforms = lib.platforms.unix;
shellHook = ''
setup_completion() {
local p
for p in $buildInputs; do
if [ -d "$p/share/bash-completion" ]; then
addToSearchPath XDG_DATA_DIRS "$p/share"
fi
done
}
setup_completion
'';
};

# FIXME: This is causing issue in CI, as described here: https://github.com/input-output-hk/haskell.nix/issues/884
#
# # Build latest release of haskell-language-server from github
# hls = pkgs.callPackages ./nix/hls.nix {
# compiler-nix-name = haskellPackages._config.compiler.nix-name;
# };

self = {
inherit pkgs commonLib src haskellPackages profiledHaskellPackages coveredHaskellPackages;
# Jormungandr
Expand Down Expand Up @@ -168,8 +117,8 @@ let
shelley = self.cardano-wallet;
});

shell = mkShell "cardano-wallet-shell" haskellPackages;
shell-prof = mkShell "cardano-wallet-shell-profiled" profiledHaskellPackages;
shell = import ./shell.nix { inherit pkgs; walletPackages = self; };
shell-prof = import ./shell.nix { inherit pkgs; walletPackages = self; profiling = true; };
cabalShell = import ./nix/cabal-shell.nix { inherit pkgs; walletPackages = self; };
stackShell = import ./nix/stack-shell.nix { inherit pkgs; walletPackages = self; };

Expand Down
8 changes: 8 additions & 0 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ let
doHaddock = false;
}))

# Silence some warnings about "cleaning component source not
# supported for hpack package" which appear in nix-shell
{
packages.cardano-addresses.cabal-generator = lib.mkForce null;
packages.cardano-addresses-cli.cabal-generator = lib.mkForce null;
packages.cardano-transactions.cabal-generator = lib.mkForce null;
}

# Allow installation of a newer version of Win32 than what is
# included with GHC. The packages in this list are all those
# installed with GHC, except for Win32.
Expand Down
32 changes: 0 additions & 32 deletions nix/hls.nix

This file was deleted.

Loading