Initial commit

This commit is contained in:
Kiana Sheibani 2022-03-12 18:13:25 -05:00
commit dd882e1ebc
4 changed files with 81 additions and 0 deletions

13
flake.nix Normal file
View file

@ -0,0 +1,13 @@
{
description = "A simple haskell template";
outputs = { self }: {
templates.haskell = {
description = "A haskell executable";
path = ./template;
};
defaultTemplate = self.templates.haskell;
};
}

4
template/Main.hs Normal file
View file

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = undefined

48
template/flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
description = "A haskell executable";
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [];
pkgs = import nixpkgs { inherit system overlays; config.allowBroken = true; };
# 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
# cf. https://tek.brick.do/K3VXJd8mEKO7
# Example:
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
# Assumes that you have the 'NanoID' flake input defined.
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; [
# Specify your build/dev dependencies here.
]);
};
in
{
# Used by `nix build` & `nix run` (prod exe)
defaultPackage = project false;
defaultApp = {
type = "app";
program = "${self.defaultPackage.${system}}/bin/${execName}";
};
# Used by `nix develop` (dev shell)
devShell = project true;
});
}

16
template/project.cabal Normal file
View file

@ -0,0 +1,16 @@
cabal-version: 2.4
name:
version: 0.0
synopsis:
author:
license:
build-type: Simple
library
build-depends:
exposed-modules:
executable
main-is: Main.hs
other-modules:
build-depends: