Replace bin/format with lint-utils

This commit is contained in:
Sridhar Ratnakumar 2022-03-25 14:09:08 -04:00
parent 69564d969a
commit 50e04b3658
4 changed files with 49 additions and 6 deletions

View file

@ -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

View file

@ -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

38
flake.lock generated
View file

@ -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"
}
}

View file

@ -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;
}) // {