Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nix] Drop GHC 8 support #157

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ packages:
./inferno-types
./inferno-lsp
./inferno-vc
./inferno-ml
./inferno-ml-server-types
./inferno-ml-server

source-repository-package
type: git
Expand All @@ -15,3 +18,49 @@ source-repository-package
location: https://github.com/plow-technologies/hspec-golden-cereal.git
tag: f9e3e485409c5a1de1de99a8ec0f35226c79da79
--sha256: j+SZk5AZsNP674fb+1aiA7vrsk6Eq5BQM2losQSnaeE=

source-repository-package
type: git
location: https://github.com/hasktorch/hasktorch.git
tag: 4b5242b5a4507c92e1c53a35e0c3e6eb46a07a72
--sha256: QZJ+N0ftT7WjOC9PEOsMSJxtDf/Wwt1ZRqCyBGJY84U=
subdir:
libtorch-ffi
libtorch-ffi-helper
hasktorch

source-repository-package
type: git
location: https://github.com/hasktorch/tokenizers
tag: 9d25f0ba303193e97f8b22b9c93cbc84725886c3
--sha256: 03nm9kd1j6v5ygxiyc86gbr4sjzj4l9xibmpccyws49vwzf02p2k
subdir: bindings/haskell/tokenizers-haskell

source-repository-package
type: git
location: https://github.com/hasktorch/typelevel-rewrite-rules
--sha256: 0nfs6qyrhc2hxskdnlhsr6rrqdqa1kw5a18d2fiybiygxy75z140
tag: 4176e10d4de2d1310506c0fcf6a74956d81d59b6

source-repository-package
type: git
location: https://github.com/hasktorch/type-errors-pretty
--sha256: 0sdw3ga7gbffyywpyx7xn8ghdw9gzsy4l68cas41hwfbkrwxwdg6
tag: 32d7abec6a21c42a5f960d7f4133d604e8be79ec

source-repository-package
type: git
location: https://github.com/fpco/inline-c
--sha256: tT/LqUCrVC++N5Mu3eKpK0uXweLg+Qlil5yS9gp1CIE=
tag: ef87fbae38ed9f646b912f94606d895d0582f1b4
subdir: inline-c
subdir: inline-c-cpp

-- TODO
-- `hasktorch` configures these automatically as well in their
-- haskell.nix setup
package libtorch-ffi
ghc-options: -j +RTS -A128m -n2m -RTS

package hasktorch
ghc-options: -j +RTS -A128m -n2m -RTS
6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@

} // builtins.listToAttrs
(
# NOTE It's a bit silly to a `forEach` for a list with a single
# element, but we might want to add more compiler versions back
# in the future, so I'm keeping it as a list of compiler versions
# for now
lib.lists.forEach
(
[ defaultCompiler ]
# only GHC 8.10.7 or newer is supported on M1 Macs
++ lib.optional (pkgs.system != "aarch64-darwin") "ghc884"
)
(
compiler: lib.attrsets.nameValuePair
Expand Down
2 changes: 1 addition & 1 deletion inferno-ml-server-types/inferno-ml-server-types.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: inferno-ml-server-types
version: 0.12.0
version: 0.12.1
synopsis: Types for Inferno ML server
description: Types for Inferno ML server
homepage: https://github.com/plow-technologies/inferno.git#readme
Expand Down
2 changes: 1 addition & 1 deletion inferno-ml-server/inferno-ml-server.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: inferno-ml-server
version: 2024.11.29
version: 2025.12.21
synopsis: Server for Inferno ML
description: Server for Inferno ML
homepage: https://github.com/plow-technologies/inferno.git#readme
Expand Down
31 changes: 0 additions & 31 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,6 @@ pkgs.haskell-nix.cabalProject {
inherit src;
name = "inferno";
compiler-nix-name = compiler;
# This is necessary to support GHC 9 conditionally. Although the conditional
# import works with Cabal directly, it doesn't seem to work with haskell.nix

# If we want to include the GHC 9 configuration, it can be read in directly
# into the generated cabal.project instead of using an `import` stanza.
# If we're building for GHC 8, it's omitted entirely
cabalProject = ''
${builtins.readFile "${src}/cabal.project"}
${
lib.optionalString hasktorchSupport
(builtins.readFile "${src}/nix/ghc9.cabal.project")
}
'';
shell = {
withHoogle = false;
tools = {
Expand Down Expand Up @@ -111,26 +98,8 @@ pkgs.haskell-nix.cabalProject {
${setpath}
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${inputs.tokenizers}/lib"
'';
# This inserts the `import` stanza into a `cabal.project.local`, removing
# the need to include the stanza in the actual `cabal.project` (which
# doesn't work with haskell.nix, see above) and also allowing us to use
# an absolute path to the extra configuration (meaning that `cabal` will
# work when invoked from anywhere in the repository)
cabalHook = ''
top=$(git rev-parse --show-toplevel)
path=$top/cabal.project.local
if [[ ! -f $path ]]; then
cat <<EOF >$path
if impl(ghc >= 9)
import: $top/nix/ghc9.cabal.project
EOF
else
echo 'Refusing to overwrite cabal.project.local'
fi
'';
in
''
${cabalHook}
${lib.optionalString (hasktorchSupport && pkgs.stdenv.isLinux) torchHook}
'';
};
Expand Down
52 changes: 0 additions & 52 deletions nix/ghc9.cabal.project

This file was deleted.

Loading