|
1 | 1 | {
|
2 | 2 | description = "cardano-open-oracle-protocol";
|
| 3 | + nixConfig.bash-prompt = |
| 4 | + "\\[\\e[0m\\][\\[\\e[0;2m\\]nix-develop \\[\\e[0;1m\\]cardano-open-oracle-protocol \\[\\e[0;93m\\]\\w\\[\\e[0m\\]]\\[\\e[0m\\]$ \\[\\e[0m\\]"; |
3 | 5 |
|
4 | 6 | inputs = {
|
5 |
| - haskell-nix.url = "github:input-output-hk/haskell.nix"; |
| 7 | + haskell-nix.url = "github:mlabs-haskell/haskell.nix"; |
6 | 8 | nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
7 |
| - pre-commit-hooks = { |
8 |
| - url = "github:cachix/pre-commit-hooks.nix"; |
9 |
| - inputs.flake-utils.follows = "flake-utils"; |
10 |
| - }; |
11 | 9 | flake-utils = {
|
12 | 10 | url = "github:numtide/flake-utils";
|
13 | 11 | inputs.nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
14 | 12 | };
|
| 13 | + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; |
| 14 | + http2-grpc-native = { |
| 15 | + url = github:haskell-grpc-native/http2-grpc-haskell; |
| 16 | + flake = false; |
| 17 | + }; |
15 | 18 | };
|
16 | 19 |
|
17 |
| - outputs = inputs @ { |
18 |
| - self, |
19 |
| - nixpkgs, |
20 |
| - flake-utils, |
21 |
| - haskell-nix, |
22 |
| - ... |
23 |
| - }: |
24 |
| - flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin"] (system: let |
25 |
| - extra-tools = []; |
26 |
| - |
| 20 | + outputs = |
| 21 | + { self |
| 22 | + , nixpkgs |
| 23 | + , flake-utils |
| 24 | + , haskell-nix |
| 25 | + , pre-commit-hooks |
| 26 | + , http2-grpc-native |
| 27 | + , ... |
| 28 | + }: |
| 29 | + flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system: |
| 30 | + let |
| 31 | + inherit self;# To appease nix-linter |
27 | 32 | pkgs = import nixpkgs {
|
28 | 33 | inherit system;
|
29 |
| - inherit (haskell-nix) config; |
30 | 34 | };
|
31 | 35 | pkgsWithOverlay = import nixpkgs {
|
32 |
| - inherit system overlays; |
| 36 | + inherit system; |
33 | 37 | inherit (haskell-nix) config;
|
| 38 | + overlays = [ haskell-nix.overlay ]; |
34 | 39 | };
|
35 |
| - ghcVersion = "921"; |
36 |
| - compiler-nix-name = "ghc" + ghcVersion; |
37 | 40 |
|
38 |
| - hls = |
39 |
| - pkgs.haskell-language-server.override |
40 |
| - { |
41 |
| - supportedGhcVersions = [ghcVersion]; |
42 |
| - }; |
43 |
| - |
44 |
| - pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { |
45 |
| - src = ./.; |
46 |
| - settings = { |
47 |
| - ormolu.defaultExtensions = [ |
48 |
| - "TypeApplications" |
49 |
| - "QualifiedDo" |
50 |
| - ]; |
51 |
| - }; |
52 |
| - hooks = { |
53 |
| - alejandra.enable = true; |
54 |
| - cabal-fmt.enable = true; |
55 |
| - fourmolu.enable = true; |
56 |
| - }; |
| 41 | + pre-commit-check = pre-commit-hooks.lib.${system}.run (import ./pre-commit-check.nix); |
| 42 | + pre-commit-devShell = pkgs.mkShell { |
| 43 | + inherit (pre-commit-check) shellHook; |
57 | 44 | };
|
| 45 | + ghcVersion = "8107"; |
| 46 | + compiler-nix-name = "ghc" + ghcVersion; |
58 | 47 |
|
59 |
| - overlays = [ |
60 |
| - haskell-nix.overlay |
61 |
| - (final: prev: { |
62 |
| - cardano-open-oracle-protocol = final.haskell-nix.project' { |
63 |
| - inherit compiler-nix-name; |
64 |
| - src = ./pure-impl; |
65 |
| - shell = { |
66 |
| - buildInputs = |
67 |
| - [ |
68 |
| - pkgs.nixpkgs-fmt |
69 |
| - pkgs.haskellPackages.cabal-fmt |
70 |
| - pkgs.haskellPackages.fourmolu |
71 |
| - hls |
72 |
| - ] |
73 |
| - ++ extra-tools; |
74 |
| - tools = { |
75 |
| - cabal = {}; |
76 |
| - hlint = {}; |
77 |
| - }; |
78 |
| - crossPlatform = []; |
79 |
| - inherit (pre-commit-check) shellHook; |
80 |
| - }; |
81 |
| - }; |
82 |
| - }) |
83 |
| - ]; |
84 |
| - |
85 |
| - flake = pkgsWithOverlay.cardano-open-oracle-protocol.flake {crossPlatforms = p: [];}; |
86 |
| - |
87 |
| - package = flake.packages."cardano-open-oracle-protocol:exe:cardano-open-oracle-protocol"; |
88 |
| - |
89 |
| - # the nix code formatter for nix fmt |
90 |
| - formatter = pkgs.alejandra; |
| 48 | + pureImplProj = import ./pure-impl/pure-impl.nix { |
| 49 | + inherit pkgs compiler-nix-name; |
| 50 | + haskell-nix = pkgsWithOverlay.haskell-nix; |
| 51 | + }; |
| 52 | + pureImplFlake = pureImplProj.flake { }; |
| 53 | + protoProj = import ./proto/proto.nix { |
| 54 | + inherit pkgs compiler-nix-name http2-grpc-native; |
| 55 | + haskell-nix = pkgsWithOverlay.haskell-nix; |
| 56 | + }; |
| 57 | + protoFlake = protoProj.flake { }; |
91 | 58 |
|
92 |
| - checks = {inherit pre-commit-check;}; |
93 | 59 | in
|
94 |
| - flake |
95 |
| - // { |
96 |
| - defaultPackage = package; |
97 |
| - inherit formatter; |
98 |
| - inherit checks; |
99 |
| - }); |
| 60 | + { |
| 61 | + |
| 62 | + # Standard flake attributes |
| 63 | + packages = pureImplFlake.packages // protoFlake.packages; |
| 64 | + checks = pureImplFlake.checks // protoFlake.checks // pre-commit-check; |
| 65 | + devShells = rec { |
| 66 | + proto = protoFlake.devShell; |
| 67 | + pure-impl = pureImplFlake.devShell; |
| 68 | + pre-commit = pre-commit-devShell; |
| 69 | + default = proto; |
| 70 | + }; |
| 71 | + }); |
100 | 72 | }
|
0 commit comments