-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
57 lines (52 loc) · 1.6 KB
/
flake.nix
File metadata and controls
57 lines (52 loc) · 1.6 KB
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
{
description = "Jsonnet implementation in pure Haskell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
flake-utils,
treefmt-nix,
pre-commit-hooks,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
overlay = self: super: {
unbound-generics = pkgs.haskell.lib.unmarkBroken super.unbound-generics;
jsonnet = self.callCabal2nix "jsonnet" ./. {};
};
haskellPackages = pkgs.haskell.packages.ghc910.extend overlay;
in rec {
# nix build
packages.default = haskellPackages.jsonnet;
# nix develop
devShell = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
];
};
# nix flake check
checks = {
formatting = treefmtEval.config.build.check self;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
treefmt.package = formatter;
treefmt.enable = true;
};
};
};
# nix fmt
formatter = treefmtEval.config.build.wrapper;
});
}