generated from hasktorch/hasktorch-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
75 lines (68 loc) · 2.32 KB
/
flake.nix
File metadata and controls
75 lines (68 loc) · 2.32 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
{
nixConfig = {
bash-prompt = "[hech-interp]$ ";
};
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs?rev=01d7c7caba0f021e986f7e46fae3c8e41265a145";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
# needed for building tiktoken-1.0.3, which this nixpkgs url doesn't support
config.allowBroken = true;
config.cudaSupport = system == "x86_64-linux";
config.ihaskell.packages = pkgs: with pkgs; [
hasktorch
];
};
haskellPackages = pkgs.haskell.packages.ghc984.override {
overrides = self: super: {
# Override megaparsec to use version 9.6.1 instead of 9.7.0
# so that tiktoken-1.0.3 builds
megaparsec = self.callHackage "megaparsec" "9.6.1" {};
};
};
# Use the custom package set for GHC and dependencies
ghcWithHasktorch = haskellPackages.ghcWithPackages (pkgs: with pkgs; [
hasktorch
libtorch-ffi
safe-exceptions
aeson
binary
bytestring
containers
]);
# Create a separate HLS derivation using the same package set
hls = haskellPackages.haskell-language-server;
in {
defaultPackage = haskellPackages.callCabal2nix "hech-interp" ./. {};
devShell = with pkgs; mkShell {
buildInputs = [
ghcWithHasktorch
hls # Use the HLS from the same package set
cabal-install
stack
ihaskell
# Add build tools
gcc
gnumake
pkg-config
git
pcre
];
shellHook = ''
source ${git}/share/bash-completion/completions/git-prompt.sh
# Ensure HLS uses the GHC from this environment
export HIE_BIOS_GHC="${ghcWithHasktorch}/bin/ghc"
export HIE_BIOS_GHC_ARGS=""
# Use unwrapped compiler to avoid --target warnings
export NIX_CFLAGS_COMPILE_FOR_TARGET=""
export NIX_CFLAGS_LINK_FOR_TARGET=""
'';
};
});
}