1
1
mirror of https://github.com/srid/ema.git synced 2024-12-01 15:13:36 +03:00
ema/flake.nix
2022-03-17 13:26:18 -04:00

59 lines
1.8 KiB
Nix

{
description = "Ema project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/3eb07eeafb52bcbf02ce800f032f18d666a9498d";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
name = "ema";
pkgs = nixpkgs.legacyPackages.${system};
emaProject = returnShellEnv:
pkgs.haskellPackages.developPackage {
inherit name returnShellEnv;
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# lvar = self.callCabal2nix "lvar" inputs.lvar { };
# url-slug = inputs.url-slug.defaultPackage.${system};
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv
(with pkgs.haskellPackages; pkgs.lib.lists.optionals returnShellEnv [
# Specify your build/dev dependencies here.
cabal-fmt
cabal-install
ghcid
haskell-language-server
ormolu
pkgs.nixpkgs-fmt
]);
};
in
rec {
# Used by `nix build`
defaultPackage = emaProject false;
checks = {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
hlint.enable = true;
nixpkgs-fmt.enable = true;
ormolu.enable = true;
};
};
};
# Used by `nix develop`
devShell = emaProject true;
});
}