Add support for "nix run"

This commit is contained in:
Kiana Sheibani 2021-12-28 22:55:42 -05:00
parent d323ca2988
commit 3cdb121ed3
2 changed files with 10 additions and 2 deletions

View file

@ -6,7 +6,7 @@ license: MIT
build-type: Simple build-type: Simple
cabal-version: >= 1.8 cabal-version: >= 1.8
executable main executable gol
main-is: Main.hs main-is: Main.hs
other-modules: GOL.Rule, other-modules: GOL.Rule,
GOL.Space, GOL.Space,

View file

@ -23,8 +23,9 @@
jailbreakUnbreak = pkg: jailbreakUnbreak = pkg:
pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; })); pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; }));
# DON'T FORGET TO PUT YOUR PACKAGE NAME HERE, REMOVING `throw`
packageName = "conways-game-of-life"; packageName = "conways-game-of-life";
execName = "gol";
in { in {
packages.${packageName} = packages.${packageName} =
haskellPackages.callCabal2nix packageName self rec { haskellPackages.callCabal2nix packageName self rec {
@ -33,6 +34,13 @@
defaultPackage = self.packages.${system}.${packageName}; defaultPackage = self.packages.${system}.${packageName};
apps.${execName} = {
type = "app";
program = "${self.packages.${system}.${packageName}}/bin/${execName}";
};
defaultApp = self.apps.${system}.${execName};
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
buildInputs = with haskellPackages; [ buildInputs = with haskellPackages; [
ghcid ghcid