Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WeissP committed Jan 21, 2024
0 parents commit 6fa93ca
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on:
- push
- pull_request

jobs:

nix-build:
name: Nix build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v16
- name: Build dependencies
run: nix develop --command ghc --version
- name: Build weiss-xmonad
run: nix build -L
- name: Build weiss-xmonad shell
run: nix build -L '.#devShells.x86_64-linux.default'

stack-build:
name: Stack ${{ matrix.resolver }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
resolver: [ nightly, lts-19, lts-18, lts-17, lts-16, lts-15, lts-14 ]
os: [ macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
enable-stack: true
## For some reason, stack caching seems to be very brittle, and cause a lot of build failures.
## I haven't investigated very thoroughly what to best do about this, but for now, I'm just not caching stack builds.
- run: stack init --resolver ${{ matrix.resolver }}
- run: stack build --resolver ${{ matrix.resolver }} --only-dependencies
- run: stack build --resolver ${{ matrix.resolver }}
- run: stack build --resolver ${{ matrix.resolver }} --haddock --test --bench --no-run-benchmarks

cabal-build:
name: Cabal with GHC ${{ matrix.ghc }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: [ '8.6.5', '8.8.3', '8.10.7', '9.0.2', '9.2.2' ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
- uses: actions/cache@v2
with:
path: |
~/.cabal
dist-newstyle
key: cabal-cache-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}
- run: cabal new-build --only-dependencies
- run: cabal new-build
- run: cabal new-test --test-show-details=direct
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Nix ###
result

### Haskell ###
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.*
15 changes: 15 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# template-haskell example hlint file

# Generalise map to fmap, ++ to <>. Off by default
- group:
name: generalise
enabled: true

- ignore:
name: Use section

- ignore:
name: Use infix

- ignore:
name: Avoid lambda using `infix`
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## 0

### [Added]
### [Removed]
### [Changed]
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2024, weiss
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# weiss-xmonad
[![weiss-xmonad on hackage](https://img.shields.io/hackage/v/weiss-xmonad)](http://hackage.haskell.org/package/weiss-xmonad)
[![weiss-xmonad on Stackage Nightly](https://stackage.org/package/weiss-xmonad/badge/nightly)](https://stackage.org/nightly/package/weiss-xmonad)

Generated with [template-haskell](https://github.com/jonascarpay/template-haskell)
4 changes: 4 additions & 0 deletions app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Lib

main :: IO ()
main = putStrLn "heyyyyyy"
4 changes: 4 additions & 0 deletions bench/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Lib

main :: IO ()
main = putStrLn "heyyyyyyyyyyyyyyyyyyyy"
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages:
./

package weiss-xmonad
tests: True
43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "weiss-xmonad";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = inputs:
let
overlay = final: prev: {
haskell = prev.haskell // {
packageOverrides = hfinal: hprev:
prev.haskell.packageOverrides hfinal hprev // {
weiss-xmonad = hfinal.callCabal2nix "weiss-xmonad" ./. { };
};
};
weiss-xmonad = final.haskell.lib.compose.justStaticExecutables final.haskellPackages.weiss-xmonad;
};
perSystem = system:
let
pkgs = import inputs.nixpkgs { inherit system; overlays = [ overlay ]; };
hspkgs = pkgs.haskellPackages;
in
{
devShells = rec {
default = weiss-xmonad-shell;
weiss-xmonad-shell = hspkgs.shellFor {
withHoogle = true;
packages = p: [ p.weiss-xmonad ];
buildInputs = [
hspkgs.cabal-install
hspkgs.haskell-language-server
hspkgs.hlint
hspkgs.ormolu
pkgs.bashInteractive
];
};
};
packages = rec {
default = weiss-xmonad;
weiss-xmonad = pkgs.weiss-xmonad;
};
};
in
{ inherit overlay; } // inputs.flake-utils.lib.eachDefaultSystem perSystem;
}
16 changes: 16 additions & 0 deletions hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cradle:
multi:
# - path: "ignore/"
# config: {cradle: {none: }}

- path: "src"
config: {cradle: {cabal: {component: "lib:weiss-xmonad"}}}

- path: "app"
config: {cradle: {cabal: {component: "weiss-xmonad:weiss-xmonad-exe"}}}

- path: "test"
config: {cradle: {cabal: {component: "weiss-xmonad:weiss-xmonad-test"}}}

- path: "bench"
config: {cradle: {cabal: {component: "weiss-xmonad:weiss-xmonad-bench"}}}
7 changes: 7 additions & 0 deletions src/Lib.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Lib
( someFunc,
)
where

someFunc :: IO ()
someFunc = putStrLn "hey"
8 changes: 8 additions & 0 deletions test/Spec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Test.Hspec

main :: IO ()
main =
hspec $
describe "weiss-xmonad-test" $
it "works" $
2 + 2 `shouldBe` (4 :: Int)
68 changes: 68 additions & 0 deletions weiss-xmonad.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cabal-version: 2.4
name: weiss-xmonad
version: 0
license: BSD-3-Clause
build-type: Simple
license-file: LICENSE
author: weiss
maintainer: weiss <[email protected]>
copyright: 2024 weiss
tested-with: GHC ==8.6.5 || ==8.8.3 || ==8.10.7 || ==9.0.2 || ==9.2.2
extra-doc-files:
CHANGELOG.md
README.md

-- category:
-- description: description
-- synopsis: one-line synopsis
-- homepage: https://github.com/FIXME/weiss-xmonad#readme
-- source-repository head
-- type: git
-- location: git://github.com/FIXME/weiss-xmonad.git

common common-options
build-depends: base >=4.9 && <5
default-language: Haskell2010
ghc-options:
-Wall -Wcompat -Widentities -Wincomplete-uni-patterns
-Wincomplete-record-updates -Wredundant-constraints
-fhide-source-paths -Wpartial-fields

library
import: common-options
hs-source-dirs: src
exposed-modules: Lib
build-depends:
, containers
, mtl

executable weiss-xmonad-exe
import: common-options
hs-source-dirs: app
main-is: Main.hs
build-depends: weiss-xmonad
ghc-options: -threaded -rtsopts -with-rtsopts=-N

test-suite weiss-xmonad-test
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends:
, hspec
, HUnit
, weiss-xmonad
, QuickCheck

ghc-options: -threaded -rtsopts -with-rtsopts=-N

benchmark weiss-xmonad-bench
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: bench
main-is: Main.hs
build-depends:
, criterion
, weiss-xmonad

ghc-options: -threaded -rtsopts -with-rtsopts=-N

0 comments on commit 6fa93ca

Please sign in to comment.