Add Haskell package

This commit is contained in:
Robert Hensing 2019-06-14 16:10:37 +02:00
parent 221bccd7f1
commit 9443fe8410
12 changed files with 132 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
result
result-*
dist/
dist-newstyle/

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
# Revision history for arion-compose
## 0.1.0.0 -- YYYY-mm-dd
* First version. Released on an unsuspecting world.

2
Setup.hs Normal file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

54
arion-compose.cabal Normal file
View File

@ -0,0 +1,54 @@
cabal-version: 2.2
name: arion-compose
version: 0.1.0.0
synopsis: Run docker-compose with help from Nix/NixOS
-- description:
homepage: https://github.com/hercules-ci/arion#readme
-- bug-reports:
license: Apache-2.0
license-file: LICENSE
author: Robert Hensing
maintainer: robert@hercules-ci.com
-- copyright:
-- category:
extra-source-files: CHANGELOG.md, README.asciidoc
write-ghc-enviroment-files:
never
common deps
build-depends: base ^>=4.12.0.0
, aeson
, protolude
library
import: deps
-- exposed-modules:
-- other-modules:
-- other-extensions:
build-depends: process
hs-source-dirs: src/haskell/lib
default-language: Haskell2010
executable arion
import: deps
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: optparse-applicative
, process
hs-source-dirs: src/haskell/exe
default-language: Haskell2010
test-suite arion-unit-tests
import: deps
type: exitcode-stdio-1.0
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: arion-compose
, hspec
, QuickCheck
hs-source-dirs: src/haskell/test
default-language: Haskell2010

13
live-unit-tests Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env nix-shell
#!nix-shell ./shell.nix
#!nix-shell -i bash
set -eux -o pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
ghcid \
--command 'ghci -isrc/haskell/exe -isrc/haskell/lib -isrc/haskell/test src/haskell/test/TestMain.hs' \
--test=Main.main \
--restart=hercules-ci-api.cabal \
--restart=../stack.yaml \
;

3
nix/haskell-overlay.nix Normal file
View File

@ -0,0 +1,3 @@
self: super: hself: hsuper: {
arion-compose = hself.callCabal2nix "arion-compose" ./.. {};
}

View File

@ -1,5 +1,20 @@
self: super: {
self: super:
let
inherit (self.arion-project) haskellPkgs;
in
{
arion = super.callPackage ../arion.nix {};
tests = super.callPackage ../tests {};
doc = super.callPackage ../doc {};
arion-project = super.recurseIntoAttrs {
haskellPkgs = super.haskellPackages.extend (import ./haskell-overlay.nix self super);
shell = haskellPkgs.shellFor {
packages = p: [p.arion-compose];
buildInputs = [
haskellPkgs.cabal-install
haskellPkgs.ghcid
];
};
};
}

1
shell.nix Normal file
View File

@ -0,0 +1 @@
(import ./nix {}).arion-project.shell

4
src/haskell/exe/Main.hs Normal file
View File

@ -0,0 +1,4 @@
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"

View File

@ -0,0 +1,11 @@
module Arion.FooSpec
( spec
)
where
import Test.Hspec
import Test.QuickCheck
spec :: Spec
spec = do
it "foo" $ property True

11
src/haskell/test/Spec.hs Normal file
View File

@ -0,0 +1,11 @@
module Spec
( spec
)
where
import Test.Hspec
import qualified Arion.FooSpec
spec :: Spec
spec = do
describe "Arion.Foo" Arion.FooSpec.spec

View File

@ -0,0 +1,9 @@
module Main where
import Protolude
import Test.Hspec.Runner
import qualified Spec
main :: IO ()
main = hspecWith config Spec.spec
where config = defaultConfig { configColorMode = ColorAlways }