-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
131 lines (124 loc) · 4.1 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
{
description = "Haskell bindings to the Temporal Core library as well as an SDK built on top of it.";
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.
devenv-root = {
url = "file+file:///dev/null";
flake = false;
};
fenix = {
url = "github:nix-community/fenix";
inputs = {nixpkgs.follows = "nixpkgs";};
};
};
outputs = inputs @ {
self,
devenv-root,
nixpkgs,
devenv,
flake-utils,
...
}: let
inherit (nixpkgs) lib;
inherit
(import ./nix/matrix.nix)
supportedSystems
;
in
{
lib = {
haskellOverlay = import ./nix/overlays/temporal-sdk.nix;
};
}
// flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {inherit system;};
temporalBridgeAndFriends = import ./nix/temporal-bridge.nix {
inherit
pkgs
;
};
temporal-bridge = temporalBridgeAndFriends.temporal-bridge;
haskellPackageUtils = import ./nix/haskell-packages.nix {
inherit
lib
pkgs
temporal-bridge
;
};
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;
# There should be a way to get this from the flake in the future.
# devenv.root = "/Users/ian/Code/mercury/hs-temporal-sdk";
packages = with pkgs; [
ghciwatch
];
env.LIBRARY_PATH = "${temporal-bridge.lib}/lib";
env.TEMPORAL_BRIDGE_LIB_DIR = "${temporal-bridge.lib}/lib";
languages.haskell = {
enable = true;
package = myHaskellPackages.ghc.withHoogle (
hpkgs:
lib.attrVals (builtins.attrNames (haskellPackageUtils.localDevPackageDepsAsAttrSet myHaskellPackages)) hpkgs
);
};
})
(import ./nix/devenv/temporal-dev-server.nix)
(import ./nix/devenv/temporal-bridge.nix {
proto-lens-protoc = extendedPackageSetByGHCVersions.${ghcVersion}.proto-lens-protoc;
temporal-sdk-core = temporalBridgeAndFriends.temporal-sdk-core-src;
})
(import ./nix/devenv/repo-wide-checks.nix)
];
};
in {
packages =
{
inherit temporal-bridge;
devenv-up = self.devShells.${system}.default.config.procfileScript;
}
// haskellPackageUtils.localPackageMatrix;
devShells = rec {
default = ghc96;
ghc96 = mkShellForGHC "ghc96";
ghc98 = 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";
};
}