From a1d56f65ae40c16d416384020e47a1f690edb4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 10 Jun 2023 15:28:09 +0100 Subject: [PATCH] format --- flake.nix | 201 ++++++++++++++++++------------------ matrix-media-expanded.cabal | 27 ++--- 2 files changed, 114 insertions(+), 114 deletions(-) diff --git a/flake.nix b/flake.nix index e1711f6..44ced94 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ }; outputs = inputs: - inputs.flake-parts.lib.mkFlake {inherit inputs;} { + inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = import inputs.systems; imports = [ inputs.haskell-flake.flakeModule @@ -20,125 +20,124 @@ inputs.flake-root.flakeModule inputs.mission-control.flakeModule ]; - perSystem = { - self', - system, - lib, - config, - pkgs, - ... - }: { - # Our only Haskell project. You can have multiple projects, but this template - # has only one. - # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix - haskellProjects.default = { - # The base package set (this value is the default) - # basePackages = pkgs.haskellPackages; + perSystem = + { self' + , system + , lib + , config + , pkgs + , ... + }: { + # Our only Haskell project. You can have multiple projects, but this template + # has only one. + # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix + haskellProjects.default = { + # The base package set (this value is the default) + # basePackages = pkgs.haskellPackages; - # Packages to add on top of `basePackages` - packages = { - # Add source or Hackage overrides here - # (Local packages are added automatically) - /* + # Packages to add on top of `basePackages` + packages = { + # Add source or Hackage overrides here + # (Local packages are added automatically) + /* aeson.source = "1.5.0.0" # Hackage version shower.source = inputs.shower; # Flake input - */ - }; + */ + }; - # Add your package overrides here - settings = { - /* + # Add your package overrides here + settings = { + /* haskell-template = { haddock = false; }; aeson = { check = false; }; - */ + */ + }; + + # Development shell configuration + devShell = { + # TODO: Remove this after https://github.com/numtide/treefmt-nix/issues/65 + tools = hp: + { + treefmt = config.treefmt.build.wrapper; + } + // config.treefmt.build.programs; + hlsCheck.enable = false; + }; + + # What should haskell-flake add to flake outputs? + autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell }; - # Development shell configuration - devShell = { - # TODO: Remove this after https://github.com/numtide/treefmt-nix/issues/65 - tools = hp: - { - treefmt = config.treefmt.build.wrapper; - } - // config.treefmt.build.programs; - hlsCheck.enable = true; + # Auto formatters. This also adds a flake check to ensure that the + # source tree was auto formatted. + treefmt.config = { + inherit (config.flake-root) projectRootFile; + package = pkgs.treefmt; + + programs.ormolu.enable = true; + programs.nixpkgs-fmt.enable = true; + programs.cabal-fmt.enable = true; + programs.hlint.enable = true; + + # We use fourmolu + programs.ormolu.package = pkgs.haskellPackages.fourmolu; + settings.formatter.ormolu = { + options = [ + "--ghc-opt" + "-XImportQualifiedPost" + ]; + }; }; - # What should haskell-flake add to flake outputs? - autoWire = ["packages" "apps" "checks"]; # Wire all but the devShell - }; + # Dev shell scripts. + mission-control.scripts = { + docs = { + description = "Start Hoogle server for project dependencies"; + exec = '' + echo http://127.0.0.1:8888 + hoogle serve -p 8888 --local + ''; + category = "Dev Tools"; + }; + repl = { + description = "Start the cabal repl"; + exec = '' + cabal repl "$@" + ''; + category = "Dev Tools"; + }; + fmt = { + description = "Format the source tree"; + exec = config.treefmt.build.wrapper; + category = "Dev Tools"; + }; + run = { + description = "Run the project with ghcid auto-recompile"; + exec = '' + ghcid -c "cabal repl exe:matrix-media-expanded" --warnings -T :main + ''; + category = "Primary"; + }; + }; - # Auto formatters. This also adds a flake check to ensure that the - # source tree was auto formatted. - treefmt.config = { - inherit (config.flake-root) projectRootFile; - package = pkgs.treefmt; + # Default package & app. + packages.default = self'.packages.matrix-media-expanded; + apps.default = self'.apps.matrix-media-expanded; - programs.ormolu.enable = true; - programs.nixpkgs-fmt.enable = true; - programs.cabal-fmt.enable = true; - programs.hlint.enable = true; - - # We use fourmolu - programs.ormolu.package = pkgs.haskellPackages.fourmolu; - settings.formatter.ormolu = { - options = [ - "--ghc-opt" - "-XImportQualifiedPost" + # Default shell. + devShells.default = pkgs.mkShell { + name = "matrix-media-expanded"; + inputsFrom = [ + config.haskellProjects.default.outputs.devShell + config.flake-root.devShell + config.mission-control.devShell ]; }; }; - - # Dev shell scripts. - mission-control.scripts = { - docs = { - description = "Start Hoogle server for project dependencies"; - exec = '' - echo http://127.0.0.1:8888 - hoogle serve -p 8888 --local - ''; - category = "Dev Tools"; - }; - repl = { - description = "Start the cabal repl"; - exec = '' - cabal repl "$@" - ''; - category = "Dev Tools"; - }; - fmt = { - description = "Format the source tree"; - exec = config.treefmt.build.wrapper; - category = "Dev Tools"; - }; - run = { - description = "Run the project with ghcid auto-recompile"; - exec = '' - ghcid -c "cabal repl exe:matrix-media-expanded" --warnings -T :main - ''; - category = "Primary"; - }; - }; - - # Default package & app. - packages.default = self'.packages.matrix-media-expanded; - apps.default = self'.apps.matrix-media-expanded; - - # Default shell. - devShells.default = pkgs.mkShell { - name = "matrix-media-expanded"; - inputsFrom = [ - config.haskellProjects.default.outputs.devShell - config.flake-root.devShell - config.mission-control.devShell - ]; - }; - formatter = pkgs.alejandra; - }; flake = { hydraJobs = { inherit (inputs.self) packages devShells checks; diff --git a/matrix-media-expanded.cabal b/matrix-media-expanded.cabal index 2934276..753d120 100644 --- a/matrix-media-expanded.cabal +++ b/matrix-media-expanded.cabal @@ -93,30 +93,31 @@ common shared default-language: Haskell2010 library - import: shared + import: shared exposed-modules: Codec.Multibase - , Codec.Multibase.Error - , Codec.Multibase.Identity + Codec.Multibase.Error + Codec.Multibase.Identity executable matrix-media-expanded import: shared main-is: Main.hs test-suite test - import: shared + import: shared build-depends: , tasty - , tasty-smallcheck - , tasty-quickcheck , tasty-hunit - type: exitcode-stdio-1.0 + , tasty-quickcheck + , tasty-smallcheck + + type: exitcode-stdio-1.0 hs-source-dirs: test - main-is: Test.hs - ghc-options: -main-is Test + main-is: Test.hs + ghc-options: -main-is Test other-modules: Codec.Multibase.Error - , Codec.Multibase.Identity - , Test.Codec - , Test.Codec.Multibase - , Test.Codec.Multibase.Identity + Codec.Multibase.Identity + Test.Codec + Test.Codec.Multibase + Test.Codec.Multibase.Identity