From b4a4a6bca37052c7dd2af1ff6997a89d0fc103b1 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Sat, 12 Mar 2022 18:39:23 -0500 Subject: [PATCH] Initial commit --- .envrc | 3 +++ .gitignore | 31 +++++++++++++++++++++++++++++++ Main.hs | 4 ++++ flake.lock | 37 +++++++++++++++++++++++++++++++++++++ flake.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ snake.cabal | 12 ++++++++++++ 6 files changed, 135 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 Main.hs create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 snake.cabal diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..b9238c3 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b7f4a2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# standard haskell gitignore +dist +dist-* +cabal-dev +*.o +*.hi +*.hie +*.chi +*.chs.h +*.dyn_o +*.dyn_hi +.hpc +.hsenv +.cabal-sandbox/ +cabal.sandbox.config +*.prof +*.aux +*.hp +*.eventlog +.stack-work/ +cabal.project.local +cabal.project.local~ +.HTF/ +.ghc.environment.* + +# ignore vscodium's local config +.vscode/ + +# ignore nix build system +result* +.direnv diff --git a/Main.hs b/Main.hs new file mode 100644 index 0000000..c2e4af9 --- /dev/null +++ b/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = undefined diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..76f1930 --- /dev/null +++ b/flake.lock @@ -0,0 +1,37 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "narHash": "sha256-4va4MvJ076XyPp5h8sm5eMQvCrJ6yZAbBmyw95dGyw4=", + "path": "/nix/store/d9wpzgyjlpw1424kw2lyilah6690fnk3-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..df28e48 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "A snake game in Haskell using Yampa"; + + 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 = "snake"; + 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; + }); +} diff --git a/snake.cabal b/snake.cabal new file mode 100644 index 0000000..6029e57 --- /dev/null +++ b/snake.cabal @@ -0,0 +1,12 @@ +cabal-version: 2.4 +name: snake +version: 0.0 +synopsis: A snake game using Yampa +author: Kiana Sheibani +license: MIT +build-type: Simple + +executable snake + main-is: Main.hs + other-modules: + build-depends: