Skip to content

Commit

Permalink
Release 0.3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisCardwell committed Jun 25, 2021
2 parents 25b635b + 5852e23 commit c7b3eca
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 47 deletions.
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# project
/build/

# cabal
cabal.project.local
cabal.project.local~
/dist-newstyle/

# nix
result*

# stack
.stack-work
*.yaml.lock
Expand All @@ -9,10 +17,5 @@ stack-nix*
# stan
/.hie/

# cabal
cabal.project.local
cabal.project.local~
/dist-newstyle/

# vi
.*.swp
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ following conventions:

[KaC]: <https://keepachangelog.com/en/1.0.0/>

## 0.3.0.0 (2021-06-25)

### Breaking

* Fix `--help` when using `optparse-applicative` `0.16`

### Non-Breaking

* Refactor Nix configuration

## 0.2.0.1 (2021-05-27)

### Non-Breaking
Expand Down
9 changes: 8 additions & 1 deletion LibOA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-- projects as required. If the library grows to a substantial size or others
-- with to use it, I will reconsider.
--
-- Revision: 2021-04-04
-- Revision: 2021-06-24
------------------------------------------------------------------------------

{-# LANGUAGE CPP #-}
Expand Down Expand Up @@ -42,6 +42,9 @@ import Data.Monoid ((<>))

-- https://hackage.haskell.org/package/optparse-applicative
import qualified Options.Applicative as OA
#if MIN_VERSION_optparse_applicative (0,16,0)
import qualified Options.Applicative.Builder.Internal as OABI
#endif
import qualified Options.Applicative.Common as OAC
import qualified Options.Applicative.Types as OAT

Expand All @@ -59,6 +62,10 @@ helper :: OA.Parser (a -> a)
helper = OA.option helpReader $ mconcat
[ OA.short 'h'
, OA.long "help"
, OA.value id
, OA.metavar ""
, OABI.noGlobal
, OA.noArgError (OA.ShowHelpText Nothing)
, OA.help "show this help text"
, OA.hidden
]
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ clean-all: clean # clean package and remove artifacts
> @rm -rf dist-newstyle
> @rm -f *.yaml.lock
> @rm -f cabal.project.local
> @rm -f result*
.PHONY: clean-all

deb: # build .deb package for VERSION in a Debian container
Expand Down
93 changes: 68 additions & 25 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,78 @@
let
# Nix configuration for redact
#
# Usage:
#
# * Build redact with the default compiler:
#
# $ nix-build
#
# * Build redact with a specific compiler version:
#
# $ nix-build --argstr compiler ghc901

nixpkgsRev = "c92ca95afb5043bc6faa0d526460584eccff2277";
compilerVersion = "ghc8104";
{ # This string argument specifies the compiler (example: "ghc8104"). When
# not specified, the default compiler (configured below) is used.
compiler ? null
# This path argument specifies the packages to use. When not specified, a
# working revision for the selected compiler is used. When a working
# revision for the selected compiler is not defined (below), the packages
# configured on the filesystem are used.
, nixpkgs ? null
# This boolean argument is used by `shell.nix`. When `True`, build tools
# are added to the derivation.
, isShell ? false
}:

githubTarball = owner: repo: rev:
builtins.fetchTarball { url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; };
let

gitIgnore = pkgs.nix-gitignore.gitignoreSourcePure;
# This string defines the default compiler version.
defaultCompiler = "ghc8104";

config = {
packageOverrides = super: let self = super.pkgs; in rec {
haskell = super.haskell // {
packageOverrides = self: super: {
haskell-nix = super.callCabal2nix "haskell-nix" (gitIgnore [./.gitignore] ./.) {};
};
};
};
# This set defines working revisions for supported compiler versions.
nixpkgsRevs = {
ghc901 = "4d4fdc329285e0d0c1c1a2b65947d651b8ba6b29";
ghc8104 = "c92ca95afb5043bc6faa0d526460584eccff2277";
ghc884 = "c92ca95afb5043bc6faa0d526460584eccff2277";
ghc865 = "2d9888f61c80f28b09d64f5e39d0ba02e3923057";
ghc844 = "6a80140fdf2157d1a5500a04c87033c0dcd6bf9b";
ghc822 = "6a80140fdf2157d1a5500a04c87033c0dcd6bf9b";
};

pkgs = import (githubTarball "NixOS" "nixpkgs" nixpkgsRev) { inherit config; };
compilerSet = pkgs.haskell.packages."${compilerVersion}";
# This function fetches the specified nixpkgs revision.
nixpkgsTarball = rev:
builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
};

in {
# The compiler is explicitly specified or the default.
compiler' = if isNull compiler then defaultCompiler else compiler;

inherit pkgs;
# Packages are explicitly specified, those for the revision defined for the
# selected compiler, or those configured on the filesystem.
pkgs = if isNull nixpkgs
then if nixpkgsRevs ? ${compiler'}
then import (nixpkgsTarball nixpkgsRevs.${compiler'}) {}
else import <nixpkgs> {}
else nixpkgs;

shell = compilerSet.shellFor {
packages = p: [p.haskell-nix];
buildInputs = with pkgs; [
compilerSet.cabal-install
];
};
# Git ignore functionality from a fixed `nixpkgs` revision is used. Old
# revisions do not work, proably due to an API change. The `ghc901` build
# fails if that revision is not used.
gitIgnore = (
import (nixpkgsTarball nixpkgsRevs.ghc901) {}
).nix-gitignore.gitignoreSourcePure;

in

}
# Configure the development environment for the package using the selected
# packages and compiler.
pkgs.haskell.packages.${compiler'}.developPackage {
root = gitIgnore [./.gitignore] ./.;
name = "redact";
modifier = drv:
if isShell
then pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
[ cabal-install
])
else drv;
}
4 changes: 2 additions & 2 deletions doc/redact.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.9.1.1
.\" Automatically generated by Pandoc 2.11.4
.\"
.TH "REDACT" "1" "" "redact-haskell 0.2.0.1 (2021-05-27)" "redact Manual"
.TH "REDACT" "1" "" "redact-haskell 0.3.0.0 (2021-06-25)" "redact Manual"
.nh
.SH NAME
.PP
Expand Down
29 changes: 29 additions & 0 deletions project/release/redact-haskell-0.3.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# `redact-haskell` `0.3.0.0` Release Notes

Date
: 2021-06-25

## Overview

This release of `redact` fixes a bug and makes changes to the [Nix][]
configuration. There are no changes to the `redact` CLI.

[Nix]: <https://nixos.org/>

### Big Fix

This release includes a fix for a bug that broke `--help` output. The issue
only affected builds using `optparse-applicative` `0.16`, so none of the
published builds were affected.

### Nix Configuration

The Nix configuration now supports testing against the following GHC versions
using known working `nixpkgs` revisions:

* GHC 8.2.2
* GHC 8.4.4
* GHC 8.6.5
* GHC 8.8.4
* GHC 8.10.4
* GHC 9.0.1
2 changes: 1 addition & 1 deletion redact.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: redact
version: 0.2.0.1
version: 0.3.0.0
category: Utils
synopsis: hide secret text on the terminal
description:
Expand Down
24 changes: 23 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
(import ./default.nix).shell
# Nix shell configuration for redact development
#
# Usage:
#
# * Run a Nix shell with the default compiler:
#
# $ nix-shell
#
# * Run a Nix shell with a specific compiler version:
#
# $ nix-shell --argstr compiler ghc901

{ # This string argument specifies the compiler (example: "ghc8104"). When
# not specified, the default compiler is used.
compiler ? null
# This path argument specifies the packages to use. When not specified, a
# working revision for the selected compiler is used. When a working
# revision for the selected compiler is not defined (below), the packages
# configured on the filesystem are used.
, nixpkgs ? null
}@args:

import ./default.nix (args // { isShell = true; })
2 changes: 1 addition & 1 deletion stack-8.10.4.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-17.13
resolver: lts-18.0

packages:
- .
12 changes: 1 addition & 11 deletions stack-9.0.1.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
compiler: ghc-9.0.1

setup-info:
ghc:
linux64-tinfo6:
9.0.1:
url: https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-x86_64-deb10-linux.tar.xz
content-length: 215436964
sha1: b5bdbac29dfcb73e0d74002ac91b7b9cc2d72d1f

resolver: nightly-2021-05-26
resolver: nightly-2021-06-24

packages:
- .
14 changes: 14 additions & 0 deletions test-all.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Nix configuration for testing redact against all supported GHC versions
#
# Usage:
#
# $ nix-build test-all.nix

{
redact-ghc-822 = import ./default.nix { compiler = "ghc822"; };
redact-ghc-844 = import ./default.nix { compiler = "ghc844"; };
redact-ghc-865 = import ./default.nix { compiler = "ghc865"; };
redact-ghc-884 = import ./default.nix { compiler = "ghc884"; };
redact-ghc-8104 = import ./default.nix { compiler = "ghc8104"; };
redact-ghc-901 = import ./default.nix { compiler = "ghc901"; };
}

0 comments on commit c7b3eca

Please sign in to comment.