Skip to content

Commit

Permalink
Refactor dev shells
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed May 26, 2024
1 parent 9ada2a8 commit f69c765
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
nix develop --command bash -c "cabal build"
- name: Test
# NOTE: The onlyCabal shell does not contain cardano-node
# NOTE: The ci shell does not contain cardano-node
run: |
nix develop .#onlyCabal --command bash -c "cabal test"
nix develop .#ci --command bash -c "cabal test"
64 changes: 34 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

hsPkgs = pkgs.haskellPackages;

ghcWithPackages = pkgs.haskell.packages.ghc98.ghcWithPackages (ps: with ps; [
ghcWithPackages = pkgs.haskell.packages.ghc96.ghcWithPackages (ps: with ps; [
# Nix-provided libraries (no need to rebuild)
# XXX: Annoying to keep updated with .cabal build-depends
# library
Expand All @@ -43,39 +43,43 @@
hspec
HUnit
]);

mkShell = { isCI ? false }:
pkgs.mkShell {
packages =
let
libs = [
pkgs.pkg-config
pkgs.libsodium-vrf
pkgs.blst
pkgs.secp256k1
pkgs.zlib
];
tools = [
pkgs.cabal-install
ghcWithPackages
];
devTools = [
hsPkgs.haskell-language-server
hsPkgs.fourmolu
hsPkgs.cabal-fmt
hsPkgs.hoogle
];
in
libs ++ tools ++
pkgs.lib.optionals (isCI == false) devTools ++
# Cardano-node to build against
pkgs.lib.optional (isCI == false) inputs.cardano-node.packages.${system}.cardano-node
;
};

in
{
legacyPackages = pkgs;

devShells.default = pkgs.mkShell {
packages =
let
libs = [
pkgs.pkg-config
pkgs.libsodium-vrf
pkgs.blst
pkgs.secp256k1
pkgs.zlib
];
tools = [
pkgs.cabal-install
hsPkgs.haskell-language-server
hsPkgs.fourmolu
hsPkgs.cabal-fmt
];
in
libs ++ tools ++ [
# Cardano-node to build against
inputs.cardano-node.packages.${system}.cardano-node
];
};

# Only cabal and no cardano-node to run integration tests
devShells.onlyCabal = pkgs.mkShell {
packages = [
pkgs.cabal-install
];
};
devShells.default = mkShell { };
# No dev tools and without cardano-node to run integration tests
devShells.ci = mkShell { isCI = true; };
});

nixConfig = {
Expand Down

0 comments on commit f69c765

Please sign in to comment.