-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
114 lines (104 loc) · 4.03 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
description = "Haskell Development Tools by Nix";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.nix-hs-utils.url = "github:tbidne/nix-hs-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs =
inputs@{
flake-parts,
nix-hs-utils,
nixpkgs,
self,
}:
flake-parts.lib.mkFlake { inherit inputs; } {
perSystem =
{ pkgs, ... }:
let
hlib = pkgs.haskell.lib;
ghcVers = "ghc981";
compiler = pkgs.haskell.packages."${ghcVers}".override {
overrides = final: prev: { stylish-haskell = prev.stylish-haskell_0_14_6_0; };
};
pkgsUtils = {
inherit nix-hs-utils pkgs;
};
compilerPkgs = {
inherit compiler nix-hs-utils pkgs;
};
# misc
title = "nix-hs-tools";
desc = ''
Nix-hs-tools uses nix to provide tools for haskell development.
In general, we take some 3rd party tool (e.g. ormolu) and provide it with nix,
along with some extra functionality 'on top' for convenience.\n
To see a tool's individual usage, pass the '--nh-help' arg e.g.
\t$ nix run github:tbidne/nix-hs-tools#ormolu -- --nh-help
\tnix run github:tbidne/nix-hs-tools#ormolu -- [--dir PATH] <args>
Note that the tools themselves generally have their own builtin-help pages
with more detail:
\t$ nix run github:tbidne/nix-hs-tools#ormolu -- --help
\tUsage: ormolu ...
Tools:
\tHaskell Formatters:
\t - cabal-fmt: ${compiler.cabal-fmt.version}
\t - fourmolu: ${compiler.fourmolu.version}
\t - ormolu: ${compiler.ormolu.version}
\t - stylish: ${compiler.stylish-haskell.version}
\tHaskell Linters:
\t - hlint: ${compiler.hlint.version}
\tHaskell Miscellaneous:
\t - cabal-plan: ${compiler.cabal-plan.version}
\t - hie: ${compiler.implicit-hie.version}
\tNix Formatters:
\t - nixfmt: ${pkgs.nixfmt-rfc-style.version}
\t - nixpkgs-fmt: ${pkgs.nixpkgs-fmt.version}
\Other:
\t - prettier: ${pkgs.nodePackages.prettier.version}
\t - yamllint: ${pkgs.yamllint.version}
\tInformation:
\t - help
\t - version
See github.com/tbidne/nix-hs-tools#readme.
'';
version = "0.10";
in
{
apps = {
cabal-plan = import ./tools/cabal-plan.nix compilerPkgs;
cabal-fmt = import ./tools/cabal-fmt.nix compilerPkgs;
fourmolu = import ./tools/fourmolu.nix compilerPkgs;
help = nix-hs-utils.mkShellApp {
inherit pkgs;
name = "help";
text = ''
echo -e "${title}: Haskell development tools by Nix\n"
echo -e "Usage: nix run github:tbidne/nix-hs-tools#<tool> -- <args>\n"
echo -e "${desc}"
echo Version: ${version}
'';
runtimeInputs = [ ];
};
hie = import ./tools/hie.nix compilerPkgs;
hlint = import ./tools/hlint.nix compilerPkgs;
nixfmt = import ./tools/nixfmt.nix pkgsUtils;
nixpkgs-fmt = import ./tools/nixpkgs-fmt.nix pkgsUtils;
ormolu = import ./tools/ormolu.nix compilerPkgs;
prettier = import ./tools/prettier.nix pkgsUtils;
stylish = import ./tools/stylish.nix compilerPkgs;
yamllint = import ./tools/yamllint.nix pkgsUtils;
version = {
type = "app";
program = "${pkgs.writeShellScript "version.sh" ''
echo ${title} ${version}
''}";
};
};
};
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
};
}