From eab555988ea136c68d03a4e2a970ba994748a7c3 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 26 Nov 2022 20:48:26 +0100 Subject: [PATCH] utils/ormolu: init Add tool for formatting haskell files --- flake.nix | 7 ------- shell.nix | 2 ++ utils/ormolu.nix | 4 ++++ 3 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 utils/ormolu.nix diff --git a/flake.nix b/flake.nix index cbdd7d1..94ce8f7 100644 --- a/flake.nix +++ b/flake.nix @@ -22,13 +22,6 @@ home-manager-search nix-option-search nix-package-search nix2json; }; - checks.${system} = let - - in { - # hlint = pkgs.callPackage ./utils/hlint.nix {}; - # format = pkgs.callPackage ./utils/format.nix {}; - }; - hydraJobs = with pkgs.lib; mapAttrs' (name: value: nameValuePair name { ${system} = value; }) self.packages.${system}; diff --git a/shell.nix b/shell.nix index 4117474..bbd308d 100644 --- a/shell.nix +++ b/shell.nix @@ -5,8 +5,10 @@ pkgs.mkShell { shellHook = let format = pkgs.callPackage ./utils/format.nix { }; hlint = pkgs.callPackage ./utils/hlint.nix { }; + ormolu = pkgs.callPackage ./utils/ormolu.nix { }; in '' alias nasf=${format}/bin/nix-attrs-search-format alias nashl=${hlint}/bin/nix-attrs-search-hlint + alias nashf=${ormolu}/bin/nix-attrs-search-ormolu ''; } diff --git a/utils/ormolu.nix b/utils/ormolu.nix new file mode 100644 index 0000000..92c83a2 --- /dev/null +++ b/utils/ormolu.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +pkgs.writeScriptBin "nix-attrs-search-ormolu" '' + find -name '*.hs' -exec '${pkgs.ormolu}/bin/ormolu' --mode inplace {} \; +''