Skip to content

Commit

Permalink
Update tools for ghc 9.6
Browse files Browse the repository at this point in the history
Also improve find
  • Loading branch information
tbidne committed Sep 15, 2023
1 parent 1fb62ee commit 9ee3c1e
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- ghc-9.6

pull_request:
branches:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## [0.9] -- 2023-09-16
### Changed
* Updated tools:
* `cabal-fmt: 0.1.6 -> 0.1.7`
* `fourmolu: 0.10.1.0 -> 0.13.1.0`
* `hlint: 3.5 -> 3.6.1`
* `implcit-hie: 0.1.2.7 -> 0.1.4.0`
* `ormolu: 0.5.3.0 -> 0.7.1.0`
* `stylish: 0.14.3.0 -> 0.14.5.0`

## [0.8] -- 2023-02-20
### Changed
* Updated tools:
Expand Down Expand Up @@ -94,6 +104,7 @@ and this project adheres to the

* First version. Released on an unsuspecting world.

[0.9]: https://github.com/tbidne/nix-hs-tools/compare/0.8...0.9
[0.8]: https://github.com/tbidne/nix-hs-tools/compare/0.7...0.8
[0.7]: https://github.com/tbidne/nix-hs-tools/compare/0.6.1...0.7
[0.6.1]: https://github.com/tbidne/nix-hs-tools/compare/0.6...0.6.1
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# nix-hs-tools

[![GitHub release (latest SemVer)](https://img.shields.io/github/v/tag/tbidne/nix-hs-tools?include_prereleases&sort=semver)](https://github.com/tbidne/nix-hs-tools/releases/)
![haskell](https://img.shields.io/static/v1?label=&message=9.4&logo=haskell&logoColor=655889&labelColor=2f353e&color=655889)
![haskell](https://img.shields.io/static/v1?label=&message=9.6&logo=haskell&logoColor=655889&labelColor=2f353e&color=655889)
[![ci](http://img.shields.io/github/actions/workflow/status/tbidne/nix-hs-tools/ci.yaml?branch=main&logoColor=85c5e7&labelColor=2f353c)](https://github.com/tbidne/nix-hs-tools/actions/workflows/ci.yaml)
[![MIT](https://img.shields.io/github/license/tbidne/nix-hs-tools?color=blue)](https://opensource.org/licenses/MIT)

Expand Down Expand Up @@ -74,7 +74,7 @@ nix run github:tbidne/nix-hs-tools/0.4.0.1#<tool> -- <args>

**Source:** https://github.com/phadej/cabal-fmt

**Version:** 0.1.6
**Version:** 0.1.7

**Description:** The `cabal-fmt` formatter for `cabal` files. By default, searches the current directory for `*.cabal` files. Otherwise the search directory can be specified with `--dir DIR`.

Expand All @@ -94,7 +94,7 @@ nix run github:tbidne/nix-hs-tools#cabal-fmt -- --dir ../foo --check

**Source:** https://github.com/fourmolu/fourmolu

**Version:** 0.10.1.0
**Version:** 0.13.1.0

**Description:** The `fourmolu` code formatter for haskell source files. Runs `fourmolu` recursively on all `hs` files in the specified directory, ignoring `dist-newstyle` and `.stack-work`. By default runs on the current directory, though it can be specified with `--dir`.

Expand All @@ -117,7 +117,7 @@ nix run github:tbidne/nix-hs-tools#fourmolu -- --no-cabal --ghc-opt -XImportQual

**Source:** https://github.com/tweag/ormolu

**Version:** 0.5.3.0
**Version:** 0.7.1.0

**Description:** The `ormolu` code formatter for haskell source files. Runs `ormolu` recursively on all `hs` files in the specified directory, ignoring `dist-newstyle` and `.stack-work`. By default runs on the current directory, though it can be specified with `--dir`.

Expand All @@ -140,7 +140,7 @@ nix run github:tbidne/nix-hs-tools#ormolu -- --no-cabal --ghc-opt -XImportQualif

**Source:** https://github.com/haskell/stylish-haskell

**Version:** 0.14.3.0
**Version:** 0.14.5.0

**Description:** The `stylish-haskell` code formatter for haskell source files. Runs `stylish-haskell` recursively on all `hs` files in the specified directory, ignoring `dist-newstyle` and `.stack-work`. By default runs on the current directory, though it can be specified with `--dir`.

Expand All @@ -159,7 +159,7 @@ nix run github:tbidne/nix-hs-tools#stylish -- --inplace

**Source:** https://github.com/ndmitchell/hlint

**Version:** 3.5
**Version:** 3.6.1

**Description:** The `hlint` linter. Runs recursively on the current directory, though this can be overridden with `--dir`. Ignores `dist-newstyle` and `stack-work`.

Expand Down
30 changes: 24 additions & 6 deletions flake.lock

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

22 changes: 9 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@
let
haskell-overlay = final: prev:
let
hp = final.pkgs.haskell.packages.ghc944;
hp = final.pkgs.haskell.packages.ghc962;
in
{
# overrides
apply-refact = hp.apply-refact_0_11_0_0;
# TODO: Update
fourmolu = hp.fourmolu;
ormolu = hp.ormolu_0_5_3_0;
hlint = hp.hlint_3_5;

# adding to pkgs so we can easily access versions.
# Need these overrides so we use ghc962 over the defaults.
cabal-fmt = hp.cabal-fmt;
implicit-hie = hp.implicit-hie;
fourmolu = hp.fourmolu;
hlint = hp.hlint;
implicit-hie = hp.implicit-hie_0_1_4_0;
ormolu = hp.ormolu;
stylish-haskell = hp.stylish-haskell;

# disable all tests
mkDerivation = args: prev.mkDerivation (args // {
Expand All @@ -39,8 +36,7 @@
};

# convenient aliases used in multiple tools
excluded-dirs = "! -path \"./.*\" ! -path \"./*dist-newstyle/*\" ! -path \"./*stack-work/*\"";
find-hs-non-build = "${pkgs.findutils}/bin/find $dir -type f -name \"*.hs\" ${excluded-dirs}";
find-hs-non-build = "${pkgs.fd}/bin/fd $dir -e hs";

# misc
title = "nix-hs-tools";
Expand Down Expand Up @@ -80,7 +76,7 @@
version = "0.8";

# tools
cabal-fmt = import ./tools/cabal-fmt.nix { inherit pkgs excluded-dirs; };
cabal-fmt = import ./tools/cabal-fmt.nix { inherit pkgs; };
fourmolu = import ./tools/fourmolu.nix { inherit pkgs find-hs-non-build; };
hie = import ./tools/hie.nix { inherit pkgs; };
hlint = import ./tools/hlint.nix { inherit find-hs-non-build pkgs; };
Expand Down
9 changes: 3 additions & 6 deletions tools/cabal-fmt.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{ excluded-dirs
, pkgs
}:
{ pkgs }:

let
find-cabal-non-build = "${pkgs.findutils}/bin/find $dir -type f -name \"*.cabal\" ${excluded-dirs}";
find-cabal-non-build = "${pkgs.fd}/bin/fd $dir -e .cabal";
in
pkgs.writeShellScript "cabal-fmt.sh" ''
set -e
Expand All @@ -22,6 +20,5 @@ pkgs.writeShellScript "cabal-fmt.sh" ''
shift
done
${find-cabal-non-build} | ${pkgs.findutils}/bin/xargs \
${pkgs.haskellPackages.cabal-fmt}/bin/cabal-fmt ''${args[@]}
${pkgs.haskellPackages.cabal-fmt}/bin/cabal-fmt ''${args[@]} $(${find-cabal-non-build})
''
3 changes: 1 addition & 2 deletions tools/fourmolu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ pkgs.writeShellScript "fourmolu.sh" ''
shift
done
${find-hs-non-build} | ${pkgs.findutils}/bin/xargs \
${pkgs.fourmolu}/bin/fourmolu ''${args[@]}
${pkgs.fourmolu}/bin/fourmolu ''${args[@]} $(${find-hs-non-build})
''
3 changes: 1 addition & 2 deletions tools/ormolu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ pkgs.writeShellScript "ormolu.sh" ''
shift
done
${find-hs-non-build} | ${pkgs.findutils}/bin/xargs \
${pkgs.ormolu}/bin/ormolu ''${args[@]}
${pkgs.ormolu}/bin/ormolu ''${args[@]} $(${find-hs-non-build})
''
3 changes: 1 addition & 2 deletions tools/stylish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ pkgs.writeShellScript "stylish.sh" ''
shift
done
${find-hs-non-build} | ${pkgs.findutils}/bin/xargs \
${pkgs.stylish-haskell}/bin/stylish-haskell ''${args[@]}
${pkgs.stylish-haskell}/bin/stylish-haskell ''${args[@]} $(${find-hs-non-build})
''

0 comments on commit 9ee3c1e

Please sign in to comment.