From c3405c27b450570e760b42d8f3bba49f67c43df6 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 9 Jul 2024 13:50:32 -0600 Subject: [PATCH] Pin Haskell tool versions for VS Code This also has the flake get its version pins (when possible) from the VS Code settings. And we pin Cabal now, too. --- .vscode/settings.json | 7 +++++++ flake.nix | 12 ++++++++---- nix/haskell-nix-flake.nix | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..6002d51193 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "haskell.toolchain": { + "cabal": "3.10.3.0", + "hls": "2.8.0.0", + "stack": "2.15.7" + } +} diff --git a/flake.nix b/flake.nix index 0be2f8da81..a266bd2e29 100644 --- a/flake.nix +++ b/flake.nix @@ -26,11 +26,15 @@ "aarch64-darwin" ] (system: let - versions = { - ormolu = "0.7.2.0"; - hls = "2.8.0.0"; - stack = "2.15.7"; + ## It’s much easier to read from a JSON file than to have JSON import from some other file, so we extract some + ## configuration from the VS Code settings to avoid duplication. + vscodeSettings = nixpkgs-release.lib.importJSON ./.vscode/settings.json; + versions = + vscodeSettings."haskell.toolchain" + ## There are some things we want to pin that the VS Code Haskell extension doesn’t let us control. + // { hpack = "0.35.2"; + ormolu = "0.7.2.0"; }; pkgs = import nixpkgs-haskellNix { inherit system; diff --git a/nix/haskell-nix-flake.nix b/nix/haskell-nix-flake.nix index 25930790c1..97c8f1ebc0 100644 --- a/nix/haskell-nix-flake.nix +++ b/nix/haskell-nix-flake.nix @@ -28,7 +28,7 @@ tools = (args.tools or {}) // { - cabal = {}; + cabal = {version = versions.cabal;}; ormolu = {version = versions.ormolu;}; haskell-language-server = { version = versions.hls;