diff --git a/README.md b/README.md index 6c0965a..d336f6b 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ git add . && git commit -m rename ## Tips - Run `nix flake update` to update all flake inputs. nixpkgs is pinned to a specific a rev in `flake.nix`, which you can advance to the latest rev reported in [status.nixos.org](https://status.nixos.org). +- Run `nix run .#format` to autoformat the project. ## Alternatives diff --git a/bin/format b/bin/format deleted file mode 100755 index d9b7096..0000000 --- a/bin/format +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env nix-shell -#! nix-shell ../shell.nix -i bash -set -xe -find src -name \*.hs | xargs fourmolu -m inplace -o -XImportQualifiedPost -o -XTypeApplications -nixpkgs-fmt *.nix -cabal-fmt -i *.cabal \ No newline at end of file diff --git a/flake.lock b/flake.lock index 5087662..c3acea3 100644 --- a/flake.lock +++ b/flake.lock @@ -31,6 +31,43 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "lint-utils": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1648231648, + "narHash": "sha256-1X5rhcb53AFiMPiln5l/694L+J1PRudFKkemQtJSOL4=", + "ref": "lc/fourmolu", + "rev": "d4418e62a1b4ca84915ca35af22beb303569e649", + "revCount": 15, + "type": "git", + "url": "https://gitlab.homotopic.tech/nix/lint-utils.git" + }, + "original": { + "ref": "lc/fourmolu", + "type": "git", + "url": "https://gitlab.homotopic.tech/nix/lint-utils.git" + } + }, "nixpkgs": { "locked": { "lastModified": 1647893727, @@ -51,6 +88,7 @@ "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "lint-utils": "lint-utils", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 214a4c1..1dc2c5f 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,12 @@ flake-compat.url = "github:edolstra/flake-compat"; flake-compat.flake = false; flake-compat.inputs.nixpkgs.follows = "nixpkgs"; + lint-utils = { + type = "git"; + url = "https://gitlab.homotopic.tech/nix/lint-utils.git"; + ref = "lc/fourmolu"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem @@ -50,6 +56,10 @@ # Used by `nix build` & `nix run` (prod exe) defaultPackage = project false; + apps = { + format = inputs.lint-utils.apps.${system}.fourmoluStandard8107; + }; + # Used by `nix develop` (dev shell) devShell = project true; }) // {