forked from iand675/hs-opentelemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
146 lines (138 loc) · 4 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
description = "Haskell OpenTelemetry support.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
devenv.url = "github:cachix/devenv/v1.0.5";
# Hack to avoid needing to use impure when loading the devenv root.
#
# See .envrc for how we substitute this with the actual path.
#
# Alternatively, use the --impure flag when running nix develop, nix show, etc.
devenv-root = {
url = "file+file:///dev/null";
flake = false;
};
};
outputs = inputs @ {
devenv-root,
nixpkgs,
devenv,
flake-utils,
...
}: let
inherit (nixpkgs) lib;
inherit
(import ./nix/matrix.nix)
supportedSystems
;
ignoreGeneratedFiles = attrs:
{
excludes =
attrs.excludes
or []
++ [
"^otlp/src/"
".*\\.cabal$"
];
}
// attrs;
pre-commit-hooks = {
# General hooks
end-of-file-fixer = ignoreGeneratedFiles {
enable = true;
excludes = [
".*\\.l?hs$"
];
};
# Nix hooks
alejandra.enable = true;
deadnix.enable = true;
# Haskell hooks
fourmolu = ignoreGeneratedFiles {
enable = true;
};
hpack.enable = true;
};
in
{
# overlays = {
# default = import ./nix/overlays/temporal-sdk.nix;
# };
}
// flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {inherit system;};
haskellPackageUtils = import ./nix/haskell-packages.nix {
inherit
lib
pkgs
;
};
inherit (haskellPackageUtils) extendedPackageSetByGHCVersions;
mkShellForGHC = ghcVersion: let
myHaskellPackages = extendedPackageSetByGHCVersions.${ghcVersion};
in
devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({...}: {
devenv.root = let
devenvRootFileContent = builtins.readFile devenv-root.outPath;
in
pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent;
packages = with pkgs; [
ghciwatch
];
dotenv.enable = true;
languages.haskell = {
enable = true;
package = myHaskellPackages.ghc.withHoogle (
hpkgs:
lib.attrVals (builtins.attrNames (haskellPackageUtils.localDevPackageDepsAsAttrSet myHaskellPackages)) hpkgs
);
};
pre-commit.hooks = pre-commit-hooks;
})
];
};
in {
packages =
{
# devenv-up = self.devShells.${system}.default.config.procfileScript;
}
// haskellPackageUtils.localPackageMatrix;
devShells = rec {
default = ghc96;
# ghc810 = mkShellForGHC "ghc810";
# ghc90 = mkShellForGHC "ghc90";
ghc92 = mkShellForGHC "ghc92";
ghc94 = mkShellForGHC "ghc94";
ghc96 = mkShellForGHC "ghc96";
ghc98 = mkShellForGHC "ghc98";
ghc910 = mkShellForGHC "ghc98";
};
checks = {
pre-commit-check = devenv.inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = pre-commit-hooks;
};
};
});
# --- Flake Local Nix Configuration ----------------------------
nixConfig = {
# This sets the flake to use the IOG nix cache.
# Nix should ask for permission before using it,
# but remove it here if you do not want it to.
extra-substituters = [
"https://cache.iog.io"
"https://cache.garnix.io"
"https://devenv.cachix.org"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
allow-import-from-derivation = "true";
};
}