-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
121 lines (116 loc) · 4.05 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
# file: flake.nix
{
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
rsdd.url = "github:stites/rsdd/4969c0c?dir=nix";
#rsdd.url = "path:/home/stites/git/rust/rsdd-ng/nix";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-root.url = "github:srid/flake-root";
mission-control.url = "github:Platonic-Systems/mission-control";
cachix-push.url = "github:juspay/cachix-push";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
imports = [
inputs.haskell-flake.flakeModule
inputs.treefmt-nix.flakeModule
inputs.flake-root.flakeModule
inputs.mission-control.flakeModule
inputs.cachix-push.flakeModule
];
flake.haskellFlakeProjectModules.default = { ... }: {
#packages = {
# #rsdd-hs.source = ;
#};
};
perSystem = { inputs', self', system, lib, config, pkgs, ... }: {
cachix-push.cacheName = "stites";
packages = {
default = self'.packages.rsdd-hs;
rsdd = inputs'.rsdd.packages.rsdd.overrideAttrs (old: {
#rsdd = (pkgs.callPackage ./rsdd/nix {}).overrideAttrs (old: {
# getting a lot of thrash on the API -- might as well disable this for now.
doCheck = false;
});
};
haskellProjects.default = {
basePackages = pkgs.haskell.packages.ghc94.extend (
final: prev: {
# seems like a dirty hack since this is a rust package...
inherit (config.packages) rsdd;
}
);
# NOTE: doesn't seem to work...
# settings.rsdd-hs = { ... }: {
# extraBuildDepends = [ config.packages.rsdd ];
# };
devShell = {
hlsCheck.enable = false;
tools = hp: {
treefmt = config.treefmt.build.wrapper;
} // config.treefmt.build.programs;
};
autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell
};
treefmt.config = {
projectRootFile = "flake.nix";
programs.ormolu.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.cabal-fmt.enable = true;
programs.hlint.enable = true;
};
mission-control.scripts = {
docs = {
description = "Start Hoogle server for project dependencies";
exec = ''
echo http://127.0.0.1:8888
hoogle serve -p 8888 --local
'';
category = "Dev Tools";
};
repl = {
description = "Start the cabal repl";
exec = ''
cabal repl "$@"
'';
category = "Dev Tools";
};
fmt = {
description = "Format the source tree";
exec = config.treefmt.build.wrapper;
category = "Dev Tools";
};
run = {
description = "Run the project with ghcid auto-recompile";
exec = ''
ghcid -c "cabal repl lib:rsdd-hs --extra-lib-dirs=${config.packages.rsdd}/lib" --warnings
'';
category = "Primary";
};
run-example = {
description = "Run the project with ghcid auto-recompile";
exec = ''
ghcid -c "cabal repl exe:example --extra-lib-dirs=${config.packages.rsdd}/lib" --warnings -T :main
'';
category = "Primary";
};
};
devShells.default = pkgs.mkShell {
name = "development shell";
inputsFrom = [
config.haskellProjects.default.outputs.devShell
config.treefmt.build.devShell
config.flake-root.devShell
config.mission-control.devShell
];
nativeBuildInputs = [
config.packages.rsdd
];
};
};
};
}