forked from sthaeron/forsyde-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
86 lines (83 loc) · 2.77 KB
/
flake.nix
File metadata and controls
86 lines (83 loc) · 2.77 KB
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
{
description = "ForSyDe Development Flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs =
{ self, flake-utils, ... }@inputs:
let
ghcVersion = "ghc9102";
overlay = final: prev: {
haskell = prev.haskell // {
packages = prev.haskell.packages // {
"${ghcVersion}" = prev.haskell.packages.${ghcVersion}.extend (
hfinal: hprev: {
forsyde-devtools =
let
unmodified = hprev.callCabal2nix "forsyde-devtools" ./. { };
in
prev.haskell.lib.enableSharedExecutables (
unmodified.overrideAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [
prev.makeWrapper
];
postInstall = (old.postInstall or "") + ''
wrapProgram $out/bin/forsyde-devtools-exe \
--prefix PATH : ${dirOf "${old.passthru.env.NIX_GHC}"} \
--set GHC_PACKAGE_PATH "${old.passthru.env.NIX_GHC_LIBDIR}/package.conf.d:"
'';
})
);
}
);
};
};
forsyde-devtools = final.haskell.packages.${ghcVersion}.forsyde-devtools;
};
in
{
inherit overlay;
}
// flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ overlay ];
config = {
haskell.compiler = pkgs.haskell.compilers.${ghcVersion};
};
};
hspkgs = pkgs.haskell.packages.${ghcVersion};
pypkgs = pkgs.python313Packages;
in
{
devShells.default = hspkgs.shellFor {
name = "forsyde-devtools";
withHoogle = true;
packages = (p: [ p.forsyde-devtools ]);
buildInputs = [
# Haskell specific dev tools
hspkgs.cabal-install
hspkgs.haskell-language-server
hspkgs.ormolu
# For making mkkdocs site
pypkgs.mkdocs-material
pypkgs.mkdocs-mermaid2-plugin
# General dev tools
pkgs.gnumake
pkgs.clang-tools # For clang-format generated C code
];
nativeBuildInputs = [ hspkgs.ghc ];
shellHook = ''
cp .githooks/* .git/hooks/
chmod +x .git/hooks/*
'';
};
packages.default = pkgs.forsyde-devtools;
apps.forsyde-devtools = {
type = "app";
program = "${self.packages.${system}.forsyde-devtools}/bin/forsyde-devtools-exe";
};
}
);
}