Skip to content

Commit

Permalink
Simplify down to just a cabal package
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Mackie committed Jun 8, 2020
1 parent 8a1f286 commit 86faddc
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 487 deletions.
2 changes: 0 additions & 2 deletions .hlint.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: nix
nix: 2.2.2
script: nix build -f default.nix kesha
script: ci.sh
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 Jordan Mackie
Copyright (c) 2020 Jordan Mackie

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,7 @@

[![Build Status](https://travis-ci.org/jmackie/kesha.svg?branch=master)](https://travis-ci.org/jmackie/kesha)

A Haskell library and executable for computing the cryptographic hash of any path.
A Haskell library for computing the cryptographic hash of any path.

The implementation is an almost verbatim port of `nix-hash`, which is the
standard tool used by the [Nix](https://nixos.org/nix/) package manager.

# Installation

With [`cabal`](https://cabal.readthedocs.io/en/latest/)

```bash
cabal new-install
```

with [`stack`](https://docs.haskellstack.org/en/latest/)

```bash
stack install
```

with [Nix](https://nixos.org/nix/)

```bash
nix build -f https://github.com/jmackie/kesha/archive/master.tar.gz kesha -o ./kesha
nix-env -i ./kesha
```
1 change: 1 addition & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
98 changes: 0 additions & 98 deletions app/Main.hs

This file was deleted.

41 changes: 41 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash

set -euo pipefail
shopt -s inherit_errexit

print_versions() { (
set -x
ghc --version
cabal --version
hlint --version
ormolu --version
); }

build_and_test() {
cabal new-update
cabal new-build
cabal new-test --test-show-details=streaming
}

lint() {
hlint --git

local exit=0
for f in $(git ls-files | grep -e '\.hs'); do
if ! ormolu --mode check "$f"; then
echo 2>&1 "$f isn't formatted"
exit=1
fi
done

return $exit
}

main() {
print_versions
build_and_test
lint
}

main "$@"
52 changes: 0 additions & 52 deletions default.nix

This file was deleted.

35 changes: 13 additions & 22 deletions kesha.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license: MIT
license-file: LICENSE
author: Jordan Mackie
maintainer: [email protected]
copyright: (c) 2019 Jordan Mackie
copyright: (c) 2020 Jordan Mackie
category: System
extra-source-files:
README.md
Expand All @@ -28,52 +28,43 @@ source-repository head
library
default-language: Haskell2010
hs-source-dirs: src
ghc-options: -Wall
ghc-options: -Wall
exposed-modules:
Kesha
Kesha.NAR
build-depends:
-- https://wiki.haskell.org/Base_package
-- >= 8.2.2 && < 8.9
base >= 4.10.1 && < 4.14,

-- boot libraries
binary,
bytestring,
containers,
cryptohash-sha256,
-- 1.3.1.0 introduced `getSymbolicLinkTarget`
directory >= 1.3.1,
filepath,
text
text,

executable kesha
default-language: Haskell2010
hs-source-dirs: app
ghc-options: -Wall -threaded -O2 -rtsopts -with-rtsopts=-N
main-is: Main.hs
other-modules: Paths_kesha
build-depends:
base >= 4.10.1 && < 4.14,

bytestring,

kesha
cryptohash-sha256

test-suite test
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: test
ghc-options: -Wall -threaded -rtsopts
build-depends:
kesha,

base >= 4.10.1 && < 4.14,

QuickCheck,
bytestring,
containers,
directory >= 1.3.1,
filepath,
hspec,
process,
temporary,

kesha
other-modules:
default-language: Haskell2010
hspec,
QuickCheck,
temporary
20 changes: 19 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
(import ./.).env
let
pinnedPkgs =
# 2020-05-17T11:55:13+02:00
let rev = "85d6f3bcd9cbcc52c4a307d2ef5116dab4b41641";
in import (builtins.fetchTarball {
name = "nixpkgs-${rev}";
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
sha256 = "10jxpwq47clbj047jh5zn20hqmwpc821ac8zljgpayk0sk5p0mwv";
}) { };
in { pkgs ? pinnedPkgs, compiler ? "ghc865" }:
pkgs.mkShell {
buildInputs = [
pkgs.haskell.packages."${compiler}".ghc
pkgs.cabal-install
pkgs.ormolu
pkgs.hlint
];
}

Loading

0 comments on commit 86faddc

Please sign in to comment.