From e4fe9710287960438856fa78b697ccae64b7e2eb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 2 Jun 2016 15:19:14 +0200 Subject: Build framework --- LICENSE | 20 ++++++++++++++++++++ Setup.hs | 2 ++ default.nix | 8 ++++++++ sequence.cabal | 24 ++++++++++++++++++++++++ sequence.nix | 10 ++++++++++ shell.nix | 17 +++++++++++++++++ src/Main.hs | 2 ++ 7 files changed, 83 insertions(+) create mode 100644 LICENSE create mode 100644 Setup.hs create mode 100644 default.nix create mode 100644 sequence.cabal create mode 100644 sequence.nix create mode 100644 shell.nix create mode 100644 src/Main.hs diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bef535c --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2016 Gregor Kleen + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..ac19354 --- /dev/null +++ b/default.nix @@ -0,0 +1,8 @@ +{ pkgs ? (import {}) +, compilerName ? "ghc7103" +}: + +rec { + haskellPackages = pkgs.haskell.packages."${compilerName}"; + sequence = haskellPackages.callPackage ./sequence.nix {}; +} diff --git a/sequence.cabal b/sequence.cabal new file mode 100644 index 0000000..0cea160 --- /dev/null +++ b/sequence.cabal @@ -0,0 +1,24 @@ +-- Initial sequence.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +name: sequence +version: 0.0.0 +-- synopsis: +-- description: +license: MIT +license-file: LICENSE +author: Gregor Kleen +maintainer: gkleen@yggdrasil.li +-- copyright: +category: Game +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +executable sequence + main-is: Main.hs + -- other-modules: + -- other-extensions: + build-depends: base >=4.8 && <4.9 + hs-source-dirs: src + default-language: Haskell2010 \ No newline at end of file diff --git a/sequence.nix b/sequence.nix new file mode 100644 index 0000000..612eb30 --- /dev/null +++ b/sequence.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, stdenv }: +mkDerivation { + pname = "sequence"; + version = "0.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ base ]; + license = stdenv.lib.licenses.mit; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..294fea0 --- /dev/null +++ b/shell.nix @@ -0,0 +1,17 @@ +{ pkgs ? (import {}) +, haskellPackages ? (import ./default.nix { inherit pkgs; }).haskellPackages +}: + +let + ghc = (haskellPackages.ghcWithPackages (ps: (payload ++ depends ++ (with ps; [ hlint cabal2nix cabal-install ])))).override { ignoreCollisions = true; }; + payload = builtins.attrValues (import ./default.nix {}); + depends = builtins.concatLists (builtins.map (x: if builtins.hasAttr "nativeBuildInputs" x then x.nativeBuildInputs else []) (builtins.attrValues (import ./default.nix {}))); +in pkgs.stdenv.mkDerivation rec { + bareName = "sequence"; + name = "${bareName}-env"; + buildInputs = [ ghc ]; + shellHook = '' + eval $(egrep ^export ${ghc}/bin/ghc) + export PROMPT_INFO="${name}" + ''; +} diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..e9e1deb --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,2 @@ +main :: IO () +main = undefined -- cgit v1.2.3