55 lines
1.5 KiB
Nix

{
# Compares a generic dev shell with a Haskell-specific `shellFor` shell
# while building the same local package in both cases.
description = "Compare mkShell and shellFor";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
haskellPackages = pkgs.haskellPackages.override {
overrides = final: _: {
mini-shell-choice = final.callCabal2nix "mini-shell-choice" ./. { };
};
};
project = haskellPackages.mini-shell-choice;
checkedProject = pkgs.haskell.lib.doCheck project;
genericShell = pkgs.mkShell {
packages = [
haskellPackages.ghc
pkgs.cabal-install
pkgs.haskell-language-server
];
};
shellForShell = haskellPackages.shellFor {
packages = hp: [ hp.mini-shell-choice ];
nativeBuildInputs = [
pkgs.cabal-install
pkgs.haskell-language-server
];
};
in
{
packages.${system}.default = project;
apps.${system}.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/mini-shell-choice";
meta.description = "Run the package used by both shell styles.";
};
devShells.${system} = {
default = genericShell;
generic = genericShell;
shellFor = shellForShell;
};
checks.${system}.test-suite = checkedProject;
};
}