nix-haskell-template/template/flake.nix

51 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2022-03-12 18:13:25 -05:00
{
description = "A haskell executable";
2023-01-18 13:57:35 -05:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
2022-03-12 18:13:25 -05:00
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
2022-03-14 08:22:34 -04:00
pkgs = nixpkgs.legacyPackages.${system};
2022-03-12 18:13:25 -05:00
# package/executable name
packageName = "";
execName = packageName;
# version of ghc used
hp = pkgs.haskellPackages;
project = returnShellEnv:
hp.developPackage {
inherit returnShellEnv;
name = packageName;
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# Use callCabal2nix to override Haskell dependencies here
# Example:
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; [
# Specify your build/dev dependencies here.
]);
};
in
{
# Used by `nix build` & `nix run` (prod exe)
2023-01-24 13:21:58 -05:00
packages.default = project false;
2022-03-12 18:13:25 -05:00
2023-01-24 13:21:58 -05:00
apps.default = {
2022-03-12 18:13:25 -05:00
type = "app";
2023-01-24 13:21:58 -05:00
program = "${self.packages.${system}.default}/bin/${execName}";
2022-03-12 18:13:25 -05:00
};
# Used by `nix develop` (dev shell)
devShell = project true;
});
}