diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f103e37..dd8f769 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - uses: haskell-actions/hlint-run@v2 with: fail-on: warning - path: '["Blammo/src/", "Blammo/tests/"]' + path: '["Blammo/src/", "Blammo/tests/", "Blammo-wai/src/"]' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ea067c..eaa02fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ jobs: matrix: package: - Blammo + - Blammo-wai steps: - uses: actions/checkout@v4 @@ -30,4 +31,4 @@ jobs: working-directory: ${{ matrix.package }} env: HACKAGE_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }} - STACK_YAML: ../stack-lts-14.27.yaml + STACK_YAML: ../stack-lts-16.31.yaml diff --git a/Blammo-wai/Blammo-wai.cabal b/Blammo-wai/Blammo-wai.cabal new file mode 100644 index 0000000..593cb67 --- /dev/null +++ b/Blammo-wai/Blammo-wai.cabal @@ -0,0 +1,92 @@ +cabal-version: 1.18 + +-- This file has been generated from package.yaml by hpack version 0.36.0. +-- +-- see: https://github.com/sol/hpack + +name: Blammo-wai +version: 0.0.0.0 +synopsis: Using Blammo with WAI +description: Please see README.md +category: Logging, Web +homepage: https://github.com/freckle/blammo#readme +bug-reports: https://github.com/freckle/blammo/issues +maintainer: Freckle Education +license: MIT +license-file: LICENSE +build-type: Simple +extra-doc-files: + README.md + CHANGELOG.md + +source-repository head + type: git + location: https://github.com/freckle/blammo + +library + exposed-modules: + Network.Wai.Middleware.Logging + other-modules: + Paths_Blammo_wai + hs-source-dirs: + src + default-extensions: + DerivingStrategies + GeneralizedNewtypeDeriving + LambdaCase + NoImplicitPrelude + OverloadedStrings + RecordWildCards + TypeApplications + ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe + build-depends: + Blammo + , aeson + , base <5 + , bytestring + , case-insensitive + , clock + , http-types + , text + , unliftio-core + , wai + default-language: Haskell2010 + if impl(ghc >= 9.8) + ghc-options: -Wno-missing-role-annotations + if impl(ghc >= 9.2) + ghc-options: -Wno-missing-kind-signatures + if impl(ghc >= 8.10) + ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module + +test-suite readme + type: exitcode-stdio-1.0 + main-is: README.lhs + other-modules: + Paths_Blammo_wai + default-extensions: + DerivingStrategies + GeneralizedNewtypeDeriving + LambdaCase + NoImplicitPrelude + OverloadedStrings + RecordWildCards + TypeApplications + ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-safe -Wno-unsafe -pgmL markdown-unlit + build-depends: + Blammo + , Blammo-wai + , aeson + , base <5 + , lens + , markdown-unlit + , text + , wai + , warp + , yesod-core + default-language: Haskell2010 + if impl(ghc >= 9.8) + ghc-options: -Wno-missing-role-annotations + if impl(ghc >= 9.2) + ghc-options: -Wno-missing-kind-signatures + if impl(ghc >= 8.10) + ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module diff --git a/Blammo-wai/CHANGELOG.md b/Blammo-wai/CHANGELOG.md new file mode 100644 index 0000000..d8a84a1 --- /dev/null +++ b/Blammo-wai/CHANGELOG.md @@ -0,0 +1,9 @@ +## [_Unreleased_](https://github.com/freckle/blammo/compare/v0.0.0.1...main) + +## [v0.0.0.1](https://github.com/freckle/blammo/compare/0.0.0.0...v0.0.0.1) + +... + +## [v0.0.0.0](https://github.com/freckle/blammo/tree/v0.0.0.0) + +First release diff --git a/Blammo-wai/LICENSE b/Blammo-wai/LICENSE new file mode 100644 index 0000000..34c4f31 --- /dev/null +++ b/Blammo-wai/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022-2024 Renaissance Learning Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Blammo-wai/README.lhs b/Blammo-wai/README.lhs new file mode 100644 index 0000000..58c269e --- /dev/null +++ b/Blammo-wai/README.lhs @@ -0,0 +1,100 @@ +# Blammo-wai + +Integration of [Blammo](https://hackage.haskell.org/package/Blammo) +with [wai](https://hackage.haskell.org/package/wai). + + + +```haskell +-- Blammo +import Blammo.Logging + +-- wai +import Network.Wai (Middleware) + +-- Blammo-wai +import Network.Wai.Middleware.Logging + +-- warp +import qualified Network.Wai.Handler.Warp as Warp + +-- yesod +import Yesod.Core (Yesod) +import qualified Yesod.Core as Yesod +``` + + + +```haskell +data App = App + { appLogger :: Logger + -- etc. + } + +instance HasLogger App where + loggerL = lens appLogger $ \x y -> x {appLogger = y} +``` + +## Integration with WAI + +```haskell +waiMiddleware :: App -> Middleware +waiMiddleware app = + addThreadContext ["app" .= ("my-app" :: Text)] + . requestLogger app + . Yesod.defaultMiddlewaresNoLogging +``` + +## Integration with Warp + +```haskell +warpSettings :: App -> Warp.Settings +warpSettings app = Warp.setOnException onEx $ Warp.defaultSettings + where + onEx _req ex = + when (Warp.defaultShouldDisplayException ex) + $ runWithLogger app + $ logError + $ "Warp exception" :# ["exception" .= displayException ex] +``` + +## Integration with Yesod + + + +```haskell +instance Yesod App where + messageLoggerSource app _logger loc source level msg = + runWithLogger app $ monadLoggerLog loc source level msg +``` diff --git a/Blammo-wai/README.md b/Blammo-wai/README.md new file mode 120000 index 0000000..4e381b2 --- /dev/null +++ b/Blammo-wai/README.md @@ -0,0 +1 @@ +README.lhs \ No newline at end of file diff --git a/Blammo-wai/package.yaml b/Blammo-wai/package.yaml new file mode 100644 index 0000000..52767e7 --- /dev/null +++ b/Blammo-wai/package.yaml @@ -0,0 +1,73 @@ +name: Blammo-wai +version: 0.0.0.0 +maintainer: Freckle Education +category: Logging, Web +github: freckle/blammo +synopsis: Using Blammo with WAI +description: Please see README.md + +extra-doc-files: + - README.md + - CHANGELOG.md + +ghc-options: + - -Weverything + - -Wno-all-missed-specialisations + - -Wno-missing-exported-signatures # re-enables missing-signatures + - -Wno-missing-import-lists + - -Wno-missing-local-signatures + - -Wno-monomorphism-restriction + - -Wno-safe + - -Wno-unsafe + +when: + - condition: "impl(ghc >= 9.8)" + ghc-options: + - -Wno-missing-role-annotations + - condition: "impl(ghc >= 9.2)" + ghc-options: + - -Wno-missing-kind-signatures + - condition: "impl(ghc >= 8.10)" + ghc-options: + - -Wno-missing-safe-haskell-mode + - -Wno-prepositive-qualified-module + +dependencies: + - base < 5 + +default-extensions: + - DerivingStrategies + - GeneralizedNewtypeDeriving + - LambdaCase + - NoImplicitPrelude + - OverloadedStrings + - RecordWildCards + - TypeApplications + +library: + source-dirs: src + dependencies: + - aeson + - Blammo + - bytestring + - case-insensitive + - clock + - http-types + - text + - unliftio-core + - wai + +tests: + readme: + main: README.lhs + ghc-options: -pgmL markdown-unlit + dependencies: + - Blammo + - Blammo-wai + - aeson + - lens + - markdown-unlit + - text + - wai + - warp + - yesod-core diff --git a/Blammo/src/Network/Wai/Middleware/Logging.hs b/Blammo-wai/src/Network/Wai/Middleware/Logging.hs similarity index 100% rename from Blammo/src/Network/Wai/Middleware/Logging.hs rename to Blammo-wai/src/Network/Wai/Middleware/Logging.hs diff --git a/Blammo/Blammo.cabal b/Blammo/Blammo.cabal index 73a711b..c2afb24 100644 --- a/Blammo/Blammo.cabal +++ b/Blammo/Blammo.cabal @@ -5,10 +5,10 @@ cabal-version: 1.18 -- see: https://github.com/sol/hpack name: Blammo -version: 1.2.1.0 +version: 2.0.0.0 synopsis: Batteries-included Structured Logging library description: Please see README.md -category: Utils +category: Logging homepage: https://github.com/freckle/blammo#readme bug-reports: https://github.com/freckle/blammo/issues maintainer: Freckle Education @@ -38,7 +38,6 @@ library Blammo.Logging.Test Blammo.Logging.WithLogger Data.Aeson.Compat - Network.Wai.Middleware.Logging System.Log.FastLogger.Compat other-modules: Paths_Blammo @@ -57,14 +56,11 @@ library aeson , base <5 , bytestring - , case-insensitive - , clock , containers , dlist , envparse , exceptions , fast-logger >=3.2.3 - , http-types , lens , monad-logger-aeson , mtl @@ -74,7 +70,6 @@ library , unliftio-core , unordered-containers , vector - , wai default-language: Haskell2010 if impl(ghc >= 9.8) ghc-options: -Wno-missing-role-annotations diff --git a/Blammo/CHANGELOG.md b/Blammo/CHANGELOG.md index 9cdaa25..00aed81 100644 --- a/Blammo/CHANGELOG.md +++ b/Blammo/CHANGELOG.md @@ -1,5 +1,10 @@ ## [_Unreleased_](https://github.com/freckle/blammo/compare/v1.2.1.0...main) +## [v2.0.0.0](https://github.com/freckle/blammo/compare/v1.2.1.0...v2.0.0.0) + +- Remove module `Network.Wai.Middleware.Logging`. It is moved to a new + package, `Blammo-wai`. + ## [v1.2.1.0](https://github.com/freckle/blammo/compare/1.2.0.0...v1.2.1.0) - Add `Blammo.Logging.Simple.withLoggerEnv` diff --git a/Blammo/LICENSE b/Blammo/LICENSE index a247770..34c4f31 100644 --- a/Blammo/LICENSE +++ b/Blammo/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Renaissance Learning Inc +Copyright (c) 2022-2024 Renaissance Learning Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Blammo/README.lhs b/Blammo/README.lhs index 16ace99..c0a7c8c 100644 --- a/Blammo/README.lhs +++ b/Blammo/README.lhs @@ -321,52 +321,6 @@ awsDiscover = do } ``` -## Integration with WAI - -```hs -import Network.Wai.Middleware.Logging - -instance HasLogger App where - -- ... - -waiMiddleware :: App -> Middleware -waiMiddleware app = - addThreadContext ["app" .= ("my-app" :: Text)] - $ requestLogger app - $ defaultMiddlewaresNoLogging -``` - -## Integration with Warp - -```hs -import qualified Network.Wai.Handler.Warp as Warp - -instance HasLogger App where - -- ... - -warpSettings :: App -> Settings -warpSettings app = setOnException onEx $ defaultSettings - where - onEx _req ex = - when (Warp.defaultShouldDisplayException ex) - $ runWithLogger app - $ logError - $ "Warp exception" :# ["exception" .= displayException ex] -``` - -## Integration with Yesod - -```hs -instance HasLogger App where - -- ... - -instance Yesod App where - -- ... - - messageLoggerSource app _logger loc source level msg = - runWithLogger app $ monadLoggerLog loc source level msg -``` - --- [LICENSE](./LICENSE) | [CHANGELOG](./CHANGELOG.md) diff --git a/Blammo/package.yaml b/Blammo/package.yaml index e1813a8..969789c 100644 --- a/Blammo/package.yaml +++ b/Blammo/package.yaml @@ -1,7 +1,7 @@ name: Blammo -version: 1.2.1.0 +version: 2.0.0.0 maintainer: Freckle Education -category: Utils +category: Logging github: freckle/blammo synopsis: Batteries-included Structured Logging library description: Please see README.md @@ -61,13 +61,7 @@ library: - time - vector - unliftio - - # For the wai Middleware - - case-insensitive - - clock - - http-types - unliftio-core - - wai # For aeson 1.x - unordered-containers diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1043e87 --- /dev/null +++ b/flake.lock @@ -0,0 +1,392 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "freckle": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs-22-11": "nixpkgs-22-11", + "nixpkgs-23-05": "nixpkgs-23-05", + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-24-05": "nixpkgs-24-05", + "nixpkgs-haskell-updates": "nixpkgs-haskell-updates", + "nixpkgs-master-2023-05-06": "nixpkgs-master-2023-05-06", + "nixpkgs-master-2023-07-18": "nixpkgs-master-2023-07-18", + "nixpkgs-master-2023-09-15": "nixpkgs-master-2023-09-15", + "nixpkgs-master-2024-01-27": "nixpkgs-master-2024-01-27", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-stable-2023-07-25": "nixpkgs-stable-2023-07-25", + "nixpkgs-unstable-2023-10-21": "nixpkgs-unstable-2023-10-21", + "nixpkgs-unstable-2024-02-20": "nixpkgs-unstable-2024-02-20", + "nixpkgs-unstable-2024-04-03": "nixpkgs-unstable-2024-04-03", + "nixpkgs-unstable-2024-05-30": "nixpkgs-unstable-2024-05-30" + }, + "locked": { + "dir": "main", + "lastModified": 1720803681, + "narHash": "sha256-Z5CtHFadOrWzHK3bE6IQO+YQNAPUHi9uZvcFtqEbh2M=", + "ref": "refs/heads/main", + "rev": "02f46f10a0583bdb53ff9fb3d5fff5ee144025d1", + "revCount": 50, + "type": "git", + "url": "ssh://git@github.com/freckle/flakes?dir=main" + }, + "original": { + "dir": "main", + "type": "git", + "url": "ssh://git@github.com/freckle/flakes?dir=main" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "freckle", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1720066371, + "narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "622f829f5fe69310a866c8a6cd07e747c44ef820", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs-22-11": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-23-05": { + "locked": { + "lastModified": 1704290814, + "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-24-05": { + "locked": { + "lastModified": 1720553833, + "narHash": "sha256-IXMiHQMtdShDXcBW95ctA+m5Oq2kLxnBt7WlMxvDQXA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "249fbde2a178a2ea2638b65b9ecebd531b338cf9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-haskell-updates": { + "locked": { + "lastModified": 1720656888, + "narHash": "sha256-OZruDiu8Zyt49KxLU1uQOrzbcSYYACi0L96UdFwOcbk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "40f675fdb81fb6a0d2c35da269bc5f733962cb45", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-master-2023-05-06": { + "locked": { + "lastModified": 1683392273, + "narHash": "sha256-pZTuxvcuDeBG+vvE1zczNyEUzlPbzXVh8Ed45Fzo+tQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "16b3b0c53b1ee8936739f8c588544e7fcec3fc60", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "16b3b0c53b1ee8936739f8c588544e7fcec3fc60", + "type": "github" + } + }, + "nixpkgs-master-2023-07-18": { + "locked": { + "lastModified": 1689680872, + "narHash": "sha256-brNix2+ihJSzCiKwLafbyejrHJZUP0Fy6z5+xMOC27M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "08700de174bc6235043cb4263b643b721d936bdb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "08700de174bc6235043cb4263b643b721d936bdb", + "type": "github" + } + }, + "nixpkgs-master-2023-09-15": { + "locked": { + "lastModified": 1694760568, + "narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e", + "type": "github" + } + }, + "nixpkgs-master-2024-01-27": { + "locked": { + "lastModified": 1706367331, + "narHash": "sha256-AqgkGHRrI6h/8FWuVbnkfFmXr4Bqsr4fV23aISqj/xg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "160b762eda6d139ac10ae081f8f78d640dd523eb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "160b762eda6d139ac10ae081f8f78d640dd523eb", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720553833, + "narHash": "sha256-IXMiHQMtdShDXcBW95ctA+m5Oq2kLxnBt7WlMxvDQXA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "249fbde2a178a2ea2638b65b9ecebd531b338cf9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable-2023-07-25": { + "locked": { + "lastModified": 1690271650, + "narHash": "sha256-qwdsW8DBY1qH+9luliIH7VzgwvL+ZGI3LZWC0LTiDMI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6dc93f0daec55ee2f441da385aaf143863e3d671", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6dc93f0daec55ee2f441da385aaf143863e3d671", + "type": "github" + } + }, + "nixpkgs-unstable-2023-10-21": { + "locked": { + "lastModified": 1697793076, + "narHash": "sha256-02e7sCuqLtkyRgrZmdOyvAcQTQdcXj+vpyp9bca6cY4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "038b2922be3fc096e1d456f93f7d0f4090628729", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "038b2922be3fc096e1d456f93f7d0f4090628729", + "type": "github" + } + }, + "nixpkgs-unstable-2024-02-20": { + "locked": { + "lastModified": 1708296515, + "narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa", + "type": "github" + } + }, + "nixpkgs-unstable-2024-04-03": { + "locked": { + "lastModified": 1712143413, + "narHash": "sha256-kI6WYXuj8/2AtBF4o0gYnkYNO1xtc6PaPbW/qmaV67A=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "62e885a4013446453b10fd7780eba4337f6f42e0", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "62e885a4013446453b10fd7780eba4337f6f42e0", + "type": "github" + } + }, + "nixpkgs-unstable-2024-05-30": { + "locked": { + "lastModified": 1717070961, + "narHash": "sha256-0JN98HVWPMlxj48Ot9K3eF0CWfwvo7/7VAYO+VAHg1Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "aa61b27554a5fc282758bf0324781e3464ef2cde", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "aa61b27554a5fc282758bf0324781e3464ef2cde", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "freckle": "freckle", + "stable": "stable" + } + }, + "stable": { + "locked": { + "lastModified": 1721226092, + "narHash": "sha256-UBvzVpo5sXSi2S/Av+t+Q+C2mhMIw/LBEZR+d6NMjws=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c716603a63aca44f39bef1986c13402167450e0a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3fb7377 --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + inputs = { + stable.url = "github:nixos/nixpkgs/nixos-24.05"; + freckle.url = "git+ssh://git@github.com/freckle/flakes?dir=main"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = + inputs: + inputs.flake-utils.lib.eachDefaultSystem ( + system: + let + nixpkgsArgs = { + inherit system; + config = { }; + }; + + nixpkgs = { + stable = import inputs.stable nixpkgsArgs; + }; + freckle = inputs.freckle.packages.${system}; + freckleLib = inputs.freckle.lib.${system}; + + in + rec { + packages = { + fourmolu = freckle.fourmolu-0-13-x; + + ghc = freckleLib.haskellBundle { + ghcVersion = "ghc-9-2-8"; + enableHLS = true; + }; + }; + + devShells.default = nixpkgs.stable.mkShell { + buildInputs = with (nixpkgs.stable); [ + pcre + zlib + ]; + + nativeBuildInputs = with (packages); [ + fourmolu + ghc + ]; + + shellHook = '' + export STACK_YAML=stack.yaml + ''; + }; + } + ); +} diff --git a/stack-lts-14.27.yaml b/stack-lts-14.27.yaml deleted file mode 100644 index dadaea7..0000000 --- a/stack-lts-14.27.yaml +++ /dev/null @@ -1,18 +0,0 @@ -resolver: lts-14.27 -extra-deps: - - envparse-0.5.0 - - fast-logger-3.2.3 - - monad-logger-0.3.39 - - monad-logger-aeson-0.4.0.3 - - # See https://github.com/jship/monad-logger-aeson/blob/main/stack-lts-14.yaml - - aeson-1.5.2.0 - - context-0.2.0.1 - - hspec-2.7.9 - - hspec-core-2.7.9 - - hspec-discover-2.7.9 - - primitive-0.7.4.0 - - these-1.1 - -packages: - - Blammo diff --git a/stack-lts-14.27.yaml.lock b/stack-lts-14.27.yaml.lock deleted file mode 100644 index 4116249..0000000 --- a/stack-lts-14.27.yaml.lock +++ /dev/null @@ -1,89 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - hackage: envparse-0.5.0@sha256:ba9ad793ed2fcfce644b3ebb8eb6c2fef2e44924f75e1b324956340e664c416e,2849 - pantry-tree: - sha256: 419a6843224ad32755064276f8e36500c71238db1b5807a2c9596fa4ed909a5a - size: 1181 - original: - hackage: envparse-0.5.0 -- completed: - hackage: fast-logger-3.2.3@sha256:41b4f1c07d5ee4a7cc785689eb7772554d29ddbbcced3cc184fe50fc63ece3f7,2176 - pantry-tree: - sha256: c4a8dcfa5f5bc3bd77cfe86d904e96f90607adc1e4f3f1cf082e722673ee7230 - size: 1302 - original: - hackage: fast-logger-3.2.3 -- completed: - hackage: monad-logger-0.3.39@sha256:edd49f160b77abe4883f0579839d30403cd425853ab83397abb44473ebc5445a,1759 - pantry-tree: - sha256: 3c41320fd5a111cc02b13f1190bdb98b92cc270d7d52cfe5a85c667b08fbc528 - size: 396 - original: - hackage: monad-logger-0.3.39 -- completed: - hackage: monad-logger-aeson-0.4.0.3@sha256:1fc0f9f1f2dc8598c8f6f24625023b892a477cee3abaa67a4cc0e81b0dcdf6c6,6215 - pantry-tree: - sha256: c2b3130a2326606a1087c8548c8f1682a299b554ffe84d9a460b7c382b3ebd84 - size: 7096 - original: - hackage: monad-logger-aeson-0.4.0.3 -- completed: - hackage: aeson-1.5.2.0@sha256:d00c7aa51969b2849550e4dee14c9ce188504d55ed8d7f734ce9f6976db452f6,6786 - pantry-tree: - sha256: 992b01282d72e4db664289db69a846a4ec675379ca96824ba902a7541104d409 - size: 39758 - original: - hackage: aeson-1.5.2.0 -- completed: - hackage: context-0.2.0.1@sha256:b5a1390a5ad11b7edd0449c9ef96823f082bff4988bd09583e37a4e93e9aad10,1891 - pantry-tree: - sha256: ebb043dd007864588c6b1676a0d30e521deab4353a3f19716f6f6f7d52b62817 - size: 952 - original: - hackage: context-0.2.0.1 -- completed: - hackage: hspec-2.7.9@sha256:74cc9958698d9964047072971cb5557c95ebb4ee8a605d8a9458ac86a41da6ec,1709 - pantry-tree: - sha256: 0505115fce89d92eea16223d996e7aae57302c83d588db0de84abdd1b110a230 - size: 583 - original: - hackage: hspec-2.7.9 -- completed: - hackage: hspec-core-2.7.9@sha256:c17d18974f057edb662dca266cc114c0650f1d5674e0ddc65969137e92feb946,4748 - pantry-tree: - sha256: c510d5513116c815a5a675eb09e8d1ad79e8efcd8d482bfd3734335b35499e04 - size: 3886 - original: - hackage: hspec-core-2.7.9 -- completed: - hackage: hspec-discover-2.7.9@sha256:7b16072af84135b8a66c4fd2cce3a9b30d0a6509ac4ca6cb4394ab038efc8ed5,2183 - pantry-tree: - sha256: ee98d716f75904f3d7359c2a4df85cddff94e70befd6a687d5d8c17346cecaed - size: 1131 - original: - hackage: hspec-discover-2.7.9 -- completed: - hackage: primitive-0.7.4.0@sha256:c2f0ed97b3dce97f2f43b239c3be8b136e4368f1eb7b61322ee9ac98f604622b,2982 - pantry-tree: - sha256: 1cd1f40729b3038f1140fbf506ce59ab2db3f745b1727e0beba6390621aa9630 - size: 1655 - original: - hackage: primitive-0.7.4.0 -- completed: - hackage: these-1.1@sha256:18ff38deaaf314cec509f9bd41c2a7a2a6b64210846eed89976173534b5bccb6,2650 - pantry-tree: - sha256: 3b40e44bbd8f184b5c4a1a3134a4a0826a2aa03cd8b33f2e6533bd336e6f9fe8 - size: 351 - original: - hackage: these-1.1 -snapshots: -- completed: - sha256: 7ea31a280c56bf36ff591a7397cc384d0dff622e7f9e4225b47d8980f019a0f0 - size: 524996 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml - original: lts-14.27 diff --git a/stack-lts-16.31.yaml b/stack-lts-16.31.yaml index d38865c..1de544e 100644 --- a/stack-lts-16.31.yaml +++ b/stack-lts-16.31.yaml @@ -9,3 +9,4 @@ extra-deps: packages: - Blammo + - Blammo-wai diff --git a/stack-lts-18.28.yaml b/stack-lts-18.28.yaml index d032620..f6605b9 100644 --- a/stack-lts-18.28.yaml +++ b/stack-lts-18.28.yaml @@ -7,3 +7,4 @@ extra-deps: packages: - Blammo + - Blammo-wai diff --git a/stack-lts-19.33.yaml b/stack-lts-19.33.yaml index 5ea02fc..b6a2f74 100644 --- a/stack-lts-19.33.yaml +++ b/stack-lts-19.33.yaml @@ -7,3 +7,4 @@ extra-deps: packages: - Blammo + - Blammo-wai diff --git a/stack-nightly.yaml b/stack-nightly.yaml index e69bf39..74a1e47 100644 --- a/stack-nightly.yaml +++ b/stack-nightly.yaml @@ -8,3 +8,4 @@ allow-newer-deps: packages: - Blammo + - Blammo-wai diff --git a/stack.yaml b/stack.yaml index 2eb4a76..01ca341 100644 --- a/stack.yaml +++ b/stack.yaml @@ -9,3 +9,4 @@ allow-newer-deps: packages: - Blammo + - Blammo-wai