Initial commit
This commit is contained in:
commit
dd882e1ebc
13
flake.nix
Normal file
13
flake.nix
Normal 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
4
template/Main.hs
Normal file
|
@ -0,0 +1,4 @@
|
|||
module Main where
|
||||
|
||||
main :: IO ()
|
||||
main = undefined
|
48
template/flake.nix
Normal file
48
template/flake.nix
Normal 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
16
template/project.cabal
Normal 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:
|
Loading…
Reference in a new issue