-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
88 lines (74 loc) · 2.98 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
{
description = "Description for the project";
inputs = {
devenv.url = "github:cachix/devenv";
nix2container.url = "github:nlewo/nix2container";
nix2container.inputs.nixpkgs.follows = "nixpkgs";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-root.url = "github:srid/flake-root";
haskell-nix.url = "github:input-output-hk/haskell.nix";
# Should be pinned via haskellNix for caching of ghc compiler
# nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
};
nixConfig = {
extra-trusted-public-keys = ''
devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
'';
extra-substituters = ''
https://devenv.cachix.org
https://cache.iog.io
'';
allow-import-from-derivation = true;
accept-flake-config = true;
};
outputs = inputs@{ self, nixpkgs, flake-parts, flake-root, ... }:
flake-parts.lib.mkFlake { inherit self inputs; }
{
debug = true;
imports = [
inputs.flake-root.flakeModule
inputs.devenv.flakeModule
inputs.treefmt-nix.flakeModule
./myhaskell.nix
];
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, lib, ... }:
{
_module.args.pkgs = import nixpkgs { config.allowUnfree = true; inherit system; };
flake-root.projectRootFile = "flake.nix";
treefmt.config = import ./treefmt.nix { inherit pkgs config; };
devShells.default = self'.devShells."myhaskell";
packages.default = self'.packages."myhaskell:exe:myhaskell";
apps.default = self'.apps."myhaskell:exe:myhaskell";
# https://devenv.sh/reference/options/
devenv.shells."myhaskell" = {
languages.nix.enable = true;
packages =
self'.devShells.dev.buildInputs ++
self'.devShells.dev.nativeBuildInputs ++
self'.devShells.dev.propagatedBuildInputs ++
self'.devShells.dev.propagatedNativeBuildInputs ++
[
config.treefmt.build.wrapper
] ++ lib.attrValues config.treefmt.build.programs;
processes = {
dev = {
exec = "ghcid";
process-compose = {
depends_on.watch-style.condition = "process_started";
depends_on.watch-statics.condition = "process_started";
readiness_probe = {
exec.command = "curl -s http://localhost:8080/";
initial_delay_seconds = 2;
period_seconds = 30;
};
shutdown.signal = 2; # SIGINT (Ctrl-C) to ghcid
};
};
};
};
};
};
}