From 1a4498858505c2264da44703c8bff8bf38c53d61 Mon Sep 17 00:00:00 2001
From: solomon <ssbothwell@gmail.com>
Date: Sun, 20 Nov 2022 19:10:06 -0800
Subject: [PATCH] Updates matrix-client to 0.1.4.2 and ghc to 924. Removes
 brittany.

---
 .github/workflows/cabal.yml |  4 +-
 .gitignore                  |  2 +
 brittany.yaml               | 22 -----------
 cabal.project               |  2 +-
 flake.lock                  | 34 ++++++++--------
 flake.nix                   | 35 +++--------------
 nix/deps/matrix-client.nix  | 77 -------------------------------------
 nix/scripts.nix             |  4 --
 shell.nix                   |  3 --
 stack.yaml                  |  4 +-
 10 files changed, 30 insertions(+), 157 deletions(-)
 delete mode 100644 brittany.yaml
 delete mode 100644 nix/deps/matrix-client.nix
 delete mode 100644 nix/scripts.nix
 delete mode 100644 shell.nix

diff --git a/.github/workflows/cabal.yml b/.github/workflows/cabal.yml
index becd4ff..6d751fa 100644
--- a/.github/workflows/cabal.yml
+++ b/.github/workflows/cabal.yml
@@ -23,7 +23,7 @@ jobs:
     strategy:
       matrix:
         cabal: ["3.4"]
-        ghc: ["8.10.7"]
+        ghc: ["8.10.7", "9.0.2", "9.2.4"]
 
     env:
       CONFIG: "--project-file=cabal.project"
@@ -61,4 +61,4 @@ jobs:
 #        run: cabal test $CONFIG
 #
 #      - run: cabal haddock $CONFIG
-#      - run: cabal sdist
\ No newline at end of file
+#      - run: cabal sdist
diff --git a/.gitignore b/.gitignore
index a71cefc..8b38d59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
 /dist-newstyle/
 .pre-commit-config.yaml
 /hie.yaml
+/.direnv/
+/.envrc.local
diff --git a/brittany.yaml b/brittany.yaml
deleted file mode 100644
index 86ec5cf..0000000
--- a/brittany.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-conf_forward:
-  options_ghc:
-  - -XDataKinds
-  - -XDeriveFunctor
-  - -XDeriveGeneric
-  - -XDerivingVia
-  - -XFlexibleContexts
-  - -XFlexibleInstances
-  - -XGeneralizedNewtypeDeriving
-  - -XInstanceSigs
-  - -XImportQualifiedPost
-  - -XLambdaCase
-  - -XNamedFieldPuns
-  - -XOverloadedStrings
-  - -XPatternSynonyms
-  - -XRecordWildCards
-  - -XScopedTypeVariables
-  - -XStandaloneKindSignatures
-  - -XTupleSections
-  - -XTypeApplications
-  - -XTypeFamilies
-  - -XTypeOperators
diff --git a/cabal.project b/cabal.project
index 5b938e9..e333796 100644
--- a/cabal.project
+++ b/cabal.project
@@ -3,5 +3,5 @@ packages: *
 source-repository-package
   type: git
   location: https://github.com/softwarefactory-project/matrix-client-haskell.git
-  tag: f8610d8956bd146105292bb75821ca078d01b5ff
+  tag: 0.1.4.2
   subdir: matrix-client
\ No newline at end of file
diff --git a/flake.lock b/flake.lock
index bbaa536..c862594 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
   "nodes": {
     "flake-utils": {
       "locked": {
-        "lastModified": 1656928814,
-        "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
+        "lastModified": 1667395993,
+        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
         "owner": "numtide",
         "repo": "flake-utils",
-        "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
+        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
         "type": "github"
       },
       "original": {
@@ -17,11 +17,11 @@
     },
     "flake-utils_2": {
       "locked": {
-        "lastModified": 1644229661,
-        "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
+        "lastModified": 1667077288,
+        "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
         "owner": "numtide",
         "repo": "flake-utils",
-        "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
+        "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817",
         "type": "github"
       },
       "original": {
@@ -32,27 +32,27 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1659446231,
-        "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
+        "lastModified": 1668908668,
+        "narHash": "sha256-oimCE4rY7Btuo/VYmA8khIyTHSMV7qUWTpz9w8yc9LQ=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
+        "rev": "b68a6a27adb452879ab66c0eaac0c133e32823b2",
         "type": "github"
       },
       "original": {
         "owner": "NixOS",
-        "ref": "nixos-21.11",
+        "ref": "nixos-22.05",
         "repo": "nixpkgs",
         "type": "github"
       }
     },
     "nixpkgs_2": {
       "locked": {
-        "lastModified": 1645655918,
-        "narHash": "sha256-ZfbEFRW7o237+A1P7eTKhXje435FCAoe0blj2n20Was=",
-        "owner": "nixos",
+        "lastModified": 1667292599,
+        "narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=",
+        "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "77a7a4197740213879b9a1d2e1788c6c8ade4274",
+        "rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68",
         "type": "github"
       },
       "original": {
@@ -66,11 +66,11 @@
         "nixpkgs": "nixpkgs_2"
       },
       "locked": {
-        "lastModified": 1659629599,
-        "narHash": "sha256-c9rvaqaH3HZo/C70E7rB18YSywa4ryTtN7CZ3cuCmoA=",
+        "lastModified": 1668960094,
+        "narHash": "sha256-RwSw+hh4Vacceh57gSaquzUoDmBu+ey6rjR+mZ8vsIg=",
         "owner": "cachix",
         "repo": "pre-commit-hooks.nix",
-        "rev": "6a9402e8f233de16536349d1dd3f4595c23386a4",
+        "rev": "0c9555d4e0943fec80a9087b8d3855a49533f399",
         "type": "github"
       },
       "original": {
diff --git a/flake.nix b/flake.nix
index 73a55d5..39f8086 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,7 +3,7 @@
   description = "Cofree.Coffee Matrix Bot";
 
   inputs = {
-    nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
+    nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
 
     flake-utils = {
       url = github:numtide/flake-utils;
@@ -15,7 +15,7 @@
 
   outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
     let
-      ghcVersion = "8107";
+      ghcVersion = "924";
       compiler = "ghc${ghcVersion}";
       # default systems compatible with pre-commit-hooks.nix
       # https://github.com/cachix/pre-commit-hooks.nix/pull/122
@@ -40,23 +40,8 @@
         hsPkgs = evalPkgs.haskell.packages.${compiler}.override {
           overrides = hfinal: hprev: {
             cofree-bot = hfinal.callCabal2nix "cofree-bot" ./. { };
-
-            # command to reproduce:
-            # cabal2nix https://github.com/softwarefactory-project/matrix-client-haskell --subpath matrix-client --revision f8610d8956bd146105292bb75821ca078d01b5ff > .nix/deps/matrix-client.nix
-            matrix-client = hfinal.callPackage ./nix/deps/matrix-client.nix { };
           };
         };
-
-        brittany-config = pkgs.writeTextFile {
-          name = "brittany-config";
-          text = builtins.readFile ./brittany.yaml;
-        };
-
-        scripts = import ./nix/scripts.nix {
-          inherit brittany-config;
-          s = pkgs.writeShellScriptBin;
-          brittany = pkgs.haskellPackages.brittany;
-        };
       in
       rec {
 
@@ -65,14 +50,13 @@
         devShell = pkgs.mkShell {
           inherit (self.checks.${system}.pre-commit-check) shellHook;
           buildInputs = with pkgs; [
-            haskellPackages.brittany
-            (haskell-language-server.override { supportedGhcVersions = [ ghcVersion ]; })
+            cabal2nix
             cabal-install
-            ghc
             ghcid
-            cabal2nix
+            haskell.compiler.${compiler}
+            haskell.packages.${compiler}.haskell-language-server
             zlib
-          ] ++ (builtins.attrValues scripts);
+          ];
         };
 
         packages = flake-utils.lib.flattenTree {
@@ -88,13 +72,6 @@
             src = ./.;
             hooks = {
               nixpkgs-fmt.enable = true;
-              brittany = {
-                name = "brittany";
-                entry = "${hsPkgs.brittany}/bin/brittany --write-mode=inplace --config-file=${brittany-config}";
-                files = "\\.l?hs$";
-                language = "system";
-                pass_filenames = false;
-              };
               cabal-fmt.enable = true;
             };
           };
diff --git a/nix/deps/matrix-client.nix b/nix/deps/matrix-client.nix
deleted file mode 100644
index d8e8225..0000000
--- a/nix/deps/matrix-client.nix
+++ /dev/null
@@ -1,77 +0,0 @@
-{ mkDerivation
-, aeson
-, aeson-casing
-, aeson-pretty
-, base
-, base64
-, bytestring
-, containers
-, exceptions
-, fetchgit
-, hashable
-, hspec
-, http-client
-, http-client-tls
-, http-types
-, lib
-, profunctors
-, retry
-, SHA
-, text
-, time
-, unordered-containers
-}:
-mkDerivation {
-  pname = "matrix-client";
-  version = "0.1.2.0";
-  src = fetchgit {
-    url = "https://github.com/softwarefactory-project/matrix-client-haskell";
-    sha256 = "1am6xp93c48h76nfnwsfr5l54aw1wrmi1yy0ib7fy6ghc3bmd7pk";
-    rev = "f8610d8956bd146105292bb75821ca078d01b5ff";
-    fetchSubmodules = true;
-  };
-  postUnpack = "sourceRoot+=/matrix-client; echo source root reset to $sourceRoot";
-  libraryHaskellDepends = [
-    aeson
-    aeson-casing
-    base
-    base64
-    bytestring
-    containers
-    exceptions
-    hashable
-    http-client
-    http-client-tls
-    http-types
-    profunctors
-    retry
-    SHA
-    text
-    time
-    unordered-containers
-  ];
-  testHaskellDepends = [
-    aeson
-    aeson-casing
-    aeson-pretty
-    base
-    base64
-    bytestring
-    containers
-    exceptions
-    hashable
-    hspec
-    http-client
-    http-client-tls
-    http-types
-    profunctors
-    retry
-    SHA
-    text
-    time
-    unordered-containers
-  ];
-  homepage = "https://github.com/softwarefactory-project/matrix-client-haskell#readme";
-  description = "A matrix client library";
-  license = lib.licenses.asl20;
-}
diff --git a/nix/scripts.nix b/nix/scripts.nix
deleted file mode 100644
index fe9ffb9..0000000
--- a/nix/scripts.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-{ s, brittany, brittany-config }:
-{
-  format = s "format" "${brittany}/bin/brittany --write-mode=inplace --config-file=${brittany-config} src/**/*.hs";
-}
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index 9730ebd..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-{ system ? builtins.currentSystem }:
-
-(builtins.getFlake (toString ./.)).devShell.${system}
diff --git a/stack.yaml b/stack.yaml
index cd7c4d8..eb9bf3f 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,11 +1,11 @@
-resolver: lts-18.16
+resolver: lts-20.1
 
 packages:
 - .
 
 extra-deps:
 - git: https://github.com/cofree-coffee/matrix-client-haskell.git
-  commit: f8610d8956bd146105292bb75821ca078d01b5ff
+  commit: 0.1.4.2
   subdirs:
     - matrix-client