From b1bf5499155e259341e4868863b0fd743b6bd65f Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Fri, 13 May 2022 10:09:51 +0100 Subject: [PATCH] nix update (#2892) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Drop -haddock as ghc 8.10.7 fails to build ghc-lib with: ``` compiler/GHC/CmmToAsm/AArch64/CodeGen.hs:176:15: error: 2081 Error: parse error on input {- | debugIsOn -} 2082 | 2083 176 | ann doc instr {- | debugIsOn -} = ANN doc instr 2084 | ^^^^^^^^^^^^^^^^^ ``` # Please enter the commit message for your changes. Lines starting * flake.lock: Update Flake lock file updates: • Updated input 'flake-compat': 'github:edolstra/flake-compat/b7547d3eed6f32d06102ead8991ec52ab0a4f1a7' (2022-01-03) → 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19) • Updated input 'flake-utils': 'github:numtide/flake-utils/997f7efcb746a9c140ce1f13c72263189225f482' (2021-08-20) → 'github:numtide/flake-utils/a4b154ebbdc88c8498a5c7b01589addc9e9cb678' (2022-04-11) • Updated input 'gitignore': 'github:hercules-ci/gitignore.nix/211907489e9f198594c0eb0ca9256a1949c9d412' (2021-01-26) → 'github:hercules-ci/gitignore.nix/bff2832ec341cf30acb3a4d3e2e7f1f7b590116a' (2022-03-05) • Updated input 'hie-bios': 'https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz?narHash=sha256-nd+FfUQVZNxJfKZkAWA3dF0JwRgXntL+1gGvyNHDbKc=' → 'https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz?narHash=sha256-5RqspT27rb%2ftMBwrKr4VfSSbq0+c0LMNuaKlTun0Kkk=' • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c473cc8714710179df205b153f4e9fa007107ff9' (2021-12-13) → 'github:NixOS/nixpkgs/ab83c5d70528f1edc7080dead3a5dee61797b3ff' (2022-04-24) • Updated input 'pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/397f0713d007250a2c7a745e555fa16c5dc8cadb' (2021-06-29) → 'github:cachix/pre-commit-hooks.nix/e5e7b3b542e7f4f96967966a943d7e1c07558042' (2022-04-04) • Updated input 'pre-commit-hooks/flake-utils': 'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28) → 'github:numtide/flake-utils/3cecb5b042f7f209c56ffd8371b2711a290ec797' (2022-02-07) • Updated input 'pre-commit-hooks/nixpkgs': 'github:NixOS/nixpkgs/6f05cfdb1e78d36c0337516df674560e4b51c79b' (2022-01-01) → 'github:nixos/nixpkgs/77a7a4197740213879b9a1d2e1788c6c8ade4274' (2022-02-23) * nix flake update & bump ghc921 -> ghc922 ghc921 is no longer available on Nix, see: https://github.com/NixOS/nixpkgs/pull/163426 * myst-parser: bump docutils version requirements * fix devShells and packages default * use ghc-exactprint 1.5.0 for ghc922 * ghc902: add flag hlint34 to nix * macosx: add SSE-enabled ptr-poker dependency * ghc902 requires ghc-lib-parser >= 9.2 * nix: ghcDefault supports HLS tweaks * fix typo * add support for pre-commit in mkDevShell * fix typo * add ptr-poker to nix shell * add ghc-884 configuration tweaks * fix stylish-haskell for ghc-884 * fix default ghc lookup * ghc884: fixup brittany version to 0.13.1.2 * ghc884: fixup aeson version to 1.5.2.0 * ghc884: fixup ormolu/fourmolu * add configuration tweak for ghc8107 * rename configuration-ghc-xxx.nix files * update hackage index * use current cabal/hackage to fetch ptr-poker in mkDevShell * reinstate .pre-commit.yaml * nix: temporary disable "build binaries" from the work flow * nix: temporary disable builds and partially populate cachix * nix: temporarily disable ghc 884 and 8107 * nix: temporarily disable nix develop run * nix: re-enable ghc8107/ghc884 builds, disable "build all binaries" * nix: noop push commit to test cachix * nix: touch flake.nix, remove ghc 884 * nix: rm ghc 810, ghc88 + disableLibraryProfiling * nix: build all binaries again * Update flake.nix Co-authored-by: Michael Peyton Jones * Update flake.nix Co-authored-by: Michael Peyton Jones * Update flake.nix Co-authored-by: Michael Peyton Jones * revert change made on comment * rm myst-parser.nix * fix typo (thanks @guibou) * explain why we disable library profiling with nix * ghc922, disable "hls-hlint-plugin" Co-authored-by: Pepe Iborra Co-authored-by: Providence Salumu Co-authored-by: Providence Salumu --- .gitignore | 2 +- cabal.project | 2 +- configuration-ghc-90.nix | 45 ++++++++ configuration-ghc-92.nix | 40 +++++++ docs/requirements.txt | 2 +- docutils.nix | 32 ++++++ flake.lock | 230 ++++++++++++++++++++++++++++++++++----- flake.nix | 135 ++++++++++++++++------- myst-parser.nix | 33 ------ 9 files changed, 420 insertions(+), 101 deletions(-) create mode 100644 configuration-ghc-90.nix create mode 100644 configuration-ghc-92.nix create mode 100644 docutils.nix delete mode 100644 myst-parser.nix diff --git a/.gitignore b/.gitignore index 8b90d2018..61cfe5877 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ test/testdata/**/hie.yaml .shake/ # pre-commit-hook.nix -#.pre-commit-config.yaml +.pre-commit-config.yaml # direnv /.direnv/ diff --git a/cabal.project b/cabal.project index 4cc16fa34..c4d3e08b8 100644 --- a/cabal.project +++ b/cabal.project @@ -43,7 +43,7 @@ package * write-ghc-environment-files: never -index-state: 2022-04-27T09:22:49Z +index-state: 2022-04-30T21:02:45Z constraints: hyphenation +embed, diff --git a/configuration-ghc-90.nix b/configuration-ghc-90.nix new file mode 100644 index 000000000..2a19f397a --- /dev/null +++ b/configuration-ghc-90.nix @@ -0,0 +1,45 @@ +{ pkgs, inputs }: + +let + disabledPlugins = [ "hls-brittany-plugin" "hls-stylish-haskell-plugin" ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; + { + hlsDisabledPlugins = disabledPlugins; + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + } // (builtins.mapAttrs (_: drv: disableLibraryProfiling drv) { + # ptr-poker breaks on MacOS without SSE2 optimizations + # https://github.com/nikita-volkov/ptr-poker/issues/11 + ptr-poker = hself.callCabal2nix "ptr-poker" inputs.ptr-poker { }; + + ghc-lib = hself.ghc-lib_9_2_2_20220307; + ghc-lib-parser = hself.ghc-lib-parser_9_2_2_20220307; + ghc-lib-parser-ex = hself.ghc-lib-parser-ex_9_2_0_3; + + Cabal = hself.Cabal_3_6_3_0; + ormolu = hself.ormolu_0_4_0_0; + fourmolu = hself.fourmolu_0_6_0_0; + + # Hlint is still broken + hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint-34 { }); + + hls-hlint-plugin = hself.callCabal2nixWithOptions "hls-hlint-plugin" + ./plugins/hls-hlint-plugin + (pkgs.lib.concatStringsSep " " [ "-fhlint34" "-fghc-lib" ]) { }; + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ "-f-brittany" "-f-stylishhaskell" ]) + { }; + }); +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/configuration-ghc-92.nix b/configuration-ghc-92.nix new file mode 100644 index 000000000..1577a7a2c --- /dev/null +++ b/configuration-ghc-92.nix @@ -0,0 +1,40 @@ +{ pkgs, inputs }: + +let + disabledPlugins = [ + "hls-hlint-plugin" + # That one is not technically a plugin, but by putting it in this list, we + # get it removed from the top level list of requirement and it is not pull + # in the nix shell. + "shake-bench" + ]; + + hpkgsOverride = hself: hsuper: + with pkgs.haskell.lib; + { + hlsDisabledPlugins = disabledPlugins; + # YOLO + mkDerivation = args: + hsuper.mkDerivation (args // { + jailbreak = true; + doCheck = false; + }); + } // (builtins.mapAttrs (_: drv: disableLibraryProfiling drv) { + # ptr-poker breaks on MacOS without SSE2 optimizations + # https://github.com/nikita-volkov/ptr-poker/issues/11 + ptr-poker = hself.callCabal2nix "ptr-poker" inputs.ptr-poker { }; + + ghc-exactprint = + hself.callCabal2nix "ghc-exactprint" inputs.ghc-exactprint-150 { }; + # Hlint is still broken + hlint = doJailbreak (hself.callCabal2nix "hlint" inputs.hlint { }); + + # Re-generate HLS drv excluding some plugins + haskell-language-server = + hself.callCabal2nixWithOptions "haskell-language-server" ./. + (pkgs.lib.concatStringsSep " " [ "-fpedantic" "-f-hlint" ]) { }; + }); +in { + inherit disabledPlugins; + tweakHpkgs = hpkgs: hpkgs.extend hpkgsOverride; +} diff --git a/docs/requirements.txt b/docs/requirements.txt index 66d33da6c..b46859cb9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ Sphinx==4.0.2 sphinx-rtd-theme==0.5.2 myst-parser==0.15.1 -docutils<0.17 +docutils<0.19 diff --git a/docutils.nix b/docutils.nix new file mode 100644 index 000000000..1c47e1455 --- /dev/null +++ b/docutils.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchPypi, buildPythonPackage, isPy3k, python }: + +buildPythonPackage rec { + pname = "docutils"; + version = "0.17.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"; + }; + + # Only Darwin needs LANG, but we could set it in general. + # It's done here conditionally to prevent mass-rebuilds. + checkPhase = lib.optionalString (isPy3k && stdenv.isDarwin) + ''LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" '' + '' + ${python.interpreter} test/alltests.py + ''; + + # Create symlinks lacking a ".py" suffix, many programs depend on these names + postFixup = '' + for f in $out/bin/*.py; do + ln -s $(basename $f) $out/bin/$(basename $f .py) + done + ''; + + meta = with lib; { + description = "Python Documentation Utilities"; + homepage = "http://docutils.sourceforge.net/"; + license = with licenses; [ publicDomain bsd2 psfl gpl3Plus ]; + maintainers = with maintainers; [ AndersonTorres ]; + }; +} diff --git a/flake.lock b/flake.lock index b1d15496c..c73bd0fc2 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,29 @@ { "nodes": { + "aeson-1520": { + "flake": false, + "locked": { + "narHash": "sha256-btKp7CTOgC0wT33lROffARW9qr1jx9oKE5EWydaR52c=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz" + } + }, + "brittany-01312": { + "flake": false, + "locked": { + "narHash": "sha256-4rDE2bu4C8cv1D6lkTtLxMwLRyDfIK70BnptSrygK60=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz" + } + }, "constraints-extras": { "flake": false, "locked": { @@ -15,11 +39,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1641205782, - "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { @@ -30,11 +54,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1629481132, - "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "owner": "numtide", "repo": "flake-utils", - "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", "type": "github" }, "original": { @@ -45,11 +69,26 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "type": "github" }, "original": { @@ -70,6 +109,18 @@ "url": "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz" } }, + "fourmolu-0300": { + "flake": false, + "locked": { + "narHash": "sha256-SFBwhkXfDArITiBSxGSp2qf8gl+yBpWHglBB5aKeaBU=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz" + } + }, "ghc-exactprint": { "flake": false, "locked": { @@ -82,14 +133,26 @@ "url": "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz" } }, + "ghc-exactprint-150": { + "flake": false, + "locked": { + "narHash": "sha256-f+WmS86c7B0dx2SMABIMm66z6sbRVWdqSZ1QBBEpUMw=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz" + } + }, "gitignore": { "flake": false, "locked": { - "lastModified": 1611672876, - "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", + "lastModified": 1646480205, + "narHash": "sha256-kekOlTlu45vuK2L9nq8iVN17V3sB0WWPqTTW3a2SQG0=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", + "rev": "bff2832ec341cf30acb3a4d3e2e7f1f7b590116a", "type": "github" }, "original": { @@ -101,13 +164,13 @@ "hie-bios": { "flake": false, "locked": { - "narHash": "sha256-nd+FfUQVZNxJfKZkAWA3dF0JwRgXntL+1gGvyNHDbKc=", + "narHash": "sha256-5RqspT27rb/tMBwrKr4VfSSbq0+c0LMNuaKlTun0Kkk=", "type": "tarball", - "url": "https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz" + "url": "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz" }, "original": { "type": "tarball", - "url": "https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz" + "url": "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz" } }, "hlint": { @@ -122,6 +185,18 @@ "url": "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz" } }, + "hlint-34": { + "flake": false, + "locked": { + "narHash": "sha256-mDncRtVkjWnUbZc1fgDMGcGjy8CFNxUF8z2HGuuN7GU=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz" + } + }, "implicit-hie-cradle": { "flake": false, "locked": { @@ -170,13 +245,30 @@ "url": "https://hackage.haskell.org/package/lsp-types-1.4.0.1/lsp-types-1.4.0.1.tar.gz" } }, + "myst-parser": { + "flake": false, + "locked": { + "lastModified": 1650933355, + "narHash": "sha256-Osd3urvH1bn9w/6sAMyLKHO7gxuYePpGJ9y8ReBfp4E=", + "owner": "smunix", + "repo": "MyST-Parser", + "rev": "57d0d78169a0e157406c35df951bdffdf94b4f9b", + "type": "github" + }, + "original": { + "owner": "smunix", + "ref": "fix.hls-docutils", + "repo": "MyST-Parser", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1639357775, - "narHash": "sha256-mJJFCPqZi1ZO3CvgEfN2nFAYv4uAJSRnTKzLFi61+WA=", + "lastModified": 1650792148, + "narHash": "sha256-n1MZSZIzvP70BJ56tV8GwQ5L0wHt/nTH9UkF5HTGB/4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c473cc8714710179df205b153f4e9fa007107ff9", + "rev": "ab83c5d70528f1edc7080dead3a5dee61797b3ff", "type": "github" }, "original": { @@ -188,11 +280,26 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1641016545, - "narHash": "sha256-JMNwvnBzG0RjGG3eH27Y5/GlJ9ryeCdGJfqGbqxnmZY=", + "lastModified": 1650933476, + "narHash": "sha256-kBefFyATME/AGGFMudAltOeKYnSc3YDOI0YgDjjIhzw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6f05cfdb1e78d36c0337516df674560e4b51c79b", + "rev": "7deb7b084d6959f4076bcf0ff4aa0a120f1d31ca", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1645655918, + "narHash": "sha256-ZfbEFRW7o237+A1P7eTKhXje435FCAoe0blj2n20Was=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "77a7a4197740213879b9a1d2e1788c6c8ade4274", "type": "github" }, "original": { @@ -200,17 +307,37 @@ "type": "indirect" } }, - "pre-commit-hooks": { + "poetry2nix": { "inputs": { "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1624971177, - "narHash": "sha256-Amf/nBj1E77RmbSSmV+hg6YOpR+rddCbbVgo5C7BS0I=", + "lastModified": 1650693998, + "narHash": "sha256-rypGV9HND1VsR/DEtD4O3cPcwCJVfIiTKvEbYskQSqg=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "8cfd980262181bd3ef15899708ceeb2e3f33958b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1649054408, + "narHash": "sha256-wz8AH7orqUE4Xog29WMTqOYBs0DMj2wFM8ulrTRVgz0=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "397f0713d007250a2c7a745e555fa16c5dc8cadb", + "rev": "e5e7b3b542e7f4f96967966a943d7e1c07558042", "type": "github" }, "original": { @@ -219,6 +346,18 @@ "type": "github" } }, + "ptr-poker": { + "flake": false, + "locked": { + "narHash": "sha256-ll3wuUjkhTE8Grcs8LfGpdiuyobrSBmwgjqPOTlrPac=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz" + } + }, "retrie": { "flake": false, "locked": { @@ -233,21 +372,60 @@ }, "root": { "inputs": { + "aeson-1520": "aeson-1520", + "brittany-01312": "brittany-01312", "constraints-extras": "constraints-extras", "flake-compat": "flake-compat", "flake-utils": "flake-utils", "fourmolu": "fourmolu", + "fourmolu-0300": "fourmolu-0300", "ghc-exactprint": "ghc-exactprint", + "ghc-exactprint-150": "ghc-exactprint-150", "gitignore": "gitignore", "hie-bios": "hie-bios", "hlint": "hlint", + "hlint-34": "hlint-34", "implicit-hie-cradle": "implicit-hie-cradle", "lsp": "lsp", "lsp-test": "lsp-test", "lsp-types": "lsp-types", + "myst-parser": "myst-parser", "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", "pre-commit-hooks": "pre-commit-hooks", - "retrie": "retrie" + "ptr-poker": "ptr-poker", + "retrie": "retrie", + "sphinx_rtd_theme": "sphinx_rtd_theme", + "stylish-haskell-01220": "stylish-haskell-01220" + } + }, + "sphinx_rtd_theme": { + "flake": false, + "locked": { + "lastModified": 1628276861, + "narHash": "sha256-fzqi0QfDSiN8YXtAiWXIoOlyHZQI4V32uOKZjPfWeWY=", + "owner": "readthedocs", + "repo": "sphinx_rtd_theme", + "rev": "34f81daaf52466366c80003db293d50075c1b896", + "type": "github" + }, + "original": { + "owner": "readthedocs", + "repo": "sphinx_rtd_theme", + "rev": "34f81daaf52466366c80003db293d50075c1b896", + "type": "github" + } + }, + "stylish-haskell-01220": { + "flake": false, + "locked": { + "narHash": "sha256-uQIvhz/xRbKLHe9et+tHUVE9To5vt1Pz3+vvDEqJaLI=", + "type": "tarball", + "url": "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz" } } }, diff --git a/flake.nix b/flake.nix index d7975491b..51d0d5e43 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,10 @@ url = "https://hackage.haskell.org/package/lsp-test-0.14.0.2/lsp-test-0.14.0.2.tar.gz"; flake = false; }; + ghc-exactprint-150 = { + url = "https://hackage.haskell.org/package/ghc-exactprint-1.5.0/ghc-exactprint-1.5.0.tar.gz"; + flake = false; + }; ghc-exactprint = { url = "https://hackage.haskell.org/package/ghc-exactprint-1.4.1/ghc-exactprint-1.4.1.tar.gz"; flake = false; @@ -51,10 +55,34 @@ url = "https://hackage.haskell.org/package/fourmolu-0.5.0.1/fourmolu-0.5.0.1.tar.gz"; flake = false; }; + fourmolu-0300 = { + url = "https://hackage.haskell.org/package/fourmolu-0.3.0.0/fourmolu-0.3.0.0.tar.gz"; + flake = false; + }; + aeson-1520= { + url = "https://hackage.haskell.org/package/aeson-1.5.2.0/aeson-1.5.2.0.tar.gz"; + flake = false; + }; + brittany-01312 = { + url = "https://hackage.haskell.org/package/brittany-0.13.1.2/brittany-0.13.1.2.tar.gz"; + flake = false; + }; hlint = { url = "https://hackage.haskell.org/package/hlint-3.3.6/hlint-3.3.6.tar.gz"; flake = false; }; + hlint-34 = { + url = "https://hackage.haskell.org/package/hlint-3.4/hlint-3.4.tar.gz"; + flake = false; + }; + ptr-poker = { + url = "https://hackage.haskell.org/package/ptr-poker-0.1.2.8/ptr-poker-0.1.2.8.tar.gz"; + flake = false; + }; + stylish-haskell-01220 = { + url = "https://hackage.haskell.org/package/stylish-haskell-0.12.2.0/stylish-haskell-0.12.2.0.tar.gz"; + flake = false; + }; implicit-hie-cradle = { url = "https://hackage.haskell.org/package/implicit-hie-cradle-0.3.0.5/implicit-hie-cradle-0.3.0.5.tar.gz"; flake = false; @@ -63,11 +91,21 @@ url = "https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz"; flake = false; }; + myst-parser = { + url = "github:smunix/MyST-Parser?ref=fix.hls-docutils"; + flake = false; + }; + # For https://github.com/readthedocs/sphinx_rtd_theme/pull/1185, otherwise lists are broken locally + sphinx_rtd_theme = { + url = "github:readthedocs/sphinx_rtd_theme?rev=34f81daaf52466366c80003db293d50075c1b896"; + flake = false; + }; + poetry2nix.url = "github:nix-community/poetry2nix/master"; }; outputs = inputs@{ self, nixpkgs, flake-compat, flake-utils, pre-commit-hooks, gitignore, ... }: { - overlay = final: prev: + overlays.default = final: prev: with prev; let haskellOverrides = hself: hsuper: { @@ -85,6 +123,10 @@ in hsuper.mkDerivation (args // { jailbreak = if broken then true else jailbreak; doCheck = if broken then false else check; + # Library profiling is disabled as it causes long compilation time + # on our CI jobs. Nix users are free tor revert this anytime. + enableLibraryProfiling = false; + doHaddock = false; }); }; gitignoreSource = (import gitignore { inherit lib; }).gitignoreSource; @@ -114,8 +156,6 @@ github = overrideCabal hsuper.github (drv: { patches = []; }); # GHCIDE requires hie-bios ^>=0.9.1 hie-bios = hself.callCabal2nix "hie-bios" inputs.hie-bios {}; - # We need an older version - hiedb = hself.hiedb_0_4_1_0; lsp = hsuper.callCabal2nix "lsp" inputs.lsp {}; lsp-types = hsuper.callCabal2nix "lsp-types" inputs.lsp-types {}; @@ -171,7 +211,7 @@ let pkgs = import nixpkgs { inherit system; - overlays = [ self.overlay ]; + overlays = [ self.overlays.default inputs.poetry2nix.overlay ]; config = { allowBroken = true; }; }; @@ -206,29 +246,43 @@ }; }; - ghc901Config = (import ./configuration-ghc-901.nix) { inherit pkgs; }; - ghc921Config = (import ./configuration-ghc-921.nix) { inherit pkgs inputs; }; + ghc902Config = (import ./configuration-ghc-90.nix) { inherit pkgs inputs; }; + ghc922Config = (import ./configuration-ghc-92.nix) { inherit pkgs inputs; }; # GHC versions - ghcDefault = pkgs.hlsHpkgs ("ghc" - + pkgs.lib.replaceStrings [ "." ] [ "" ] - pkgs.haskellPackages.ghc.version); - ghc884 = pkgs.hlsHpkgs "ghc884"; - ghc8107 = pkgs.hlsHpkgs "ghc8107"; - ghc901 = ghc901Config.tweakHpkgs (pkgs.hlsHpkgs "ghc901"); - ghc921 = ghc921Config.tweakHpkgs (pkgs.hlsHpkgs "ghc921"); + # While HLS still works fine with 8.10 GHCs, we only support the versions that are cached + # by upstream nixpkgs, which now only includes GHC version 9+ + supportedGHCs = let + ghcVersion = "ghc" + (pkgs.lib.replaceStrings ["."] [""] pkgs.haskellPackages.ghc.version); + cases = { + ghc902 = ghc902Config.tweakHpkgs (pkgs.hlsHpkgs "ghc902"); + ghc922 = ghc922Config.tweakHpkgs (pkgs.hlsHpkgs "ghc922"); + }; + in { default = cases."${ghcVersion}"; } // cases; + + ghc902 = supportedGHCs.ghc902; + ghc922 = supportedGHCs.ghc922; + ghcDefault = supportedGHCs.default; # For markdown support - myst-parser = pkgs.python3Packages.callPackage ./myst-parser.nix {}; - sphinx_rtd_theme = pkgs.python3Packages.sphinx_rtd_theme.overrideAttrs (oldAttrs: { - # For https://github.com/readthedocs/sphinx_rtd_theme/pull/1185, otherwise lists are broken locally - src = pkgs.fetchFromGitHub { - owner = "readthedocs"; - repo = "sphinx_rtd_theme"; - rev = "34f81daaf52466366c80003db293d50075c1b896"; - sha256 = "0rkrsvvqr6g2p3v5vq88jhfp5sd0r1jqjh3vc5y26jn30z8s4fkz"; - }; - }); + myst-parser = pkgs.poetry2nix.mkPoetryEnv { + projectDir = inputs.myst-parser; + python = pkgs.python39; + overrides = [ + pkgs.poetry2nix.defaultPoetryOverrides + ]; + }; + sphinx_rtd_theme = pkgs.poetry2nix.mkPoetryEnv { + projectDir = inputs.sphinx_rtd_theme; + python = pkgs.python39; + overrides = [ + pkgs.poetry2nix.defaultPoetryOverrides + (self: super: { + # The RTD theme doesn't work with newer docutils + docutils = pkgs.python3Packages.callPackage ./docutils.nix {}; + }) + ]; + }; pythonWithPackages = pkgs.python3.withPackages (ps: [ps.sphinx myst-parser sphinx_rtd_theme ps.pip]); docs = pkgs.stdenv.mkDerivation { @@ -270,6 +324,7 @@ capstone tracy # ormolu # stylish-haskell + pre-commit ]; @@ -280,7 +335,7 @@ export PATH=$PATH:$HOME/.local/bin # Enable the shell hooks - ${(pre-commit-check ghcDefault).shellHook} + ${self.checks.${system}.pre-commit-check.shellHook} # If the cabal project file is not the default one. # Print a warning and generate an alias. @@ -334,32 +389,31 @@ # Developement shell with only compiler simpleDevShells = { haskell-language-server-dev = mkDevShell ghcDefault "cabal.project"; - haskell-language-server-884-dev = mkDevShell ghc884 "cabal.project"; - haskell-language-server-8107-dev = mkDevShell ghc8107 "cabal.project"; - haskell-language-server-901-dev = mkDevShell ghc901 "cabal.project"; - haskell-language-server-921-dev = mkDevShell ghc921 "cabal.project"; + haskell-language-server-902-dev = mkDevShell ghc902 "cabal.project"; + haskell-language-server-922-dev = mkDevShell ghc922 "cabal.project"; }; # Developement shell, haskell packages are also provided by nix nixDevShells = { haskell-language-server-dev-nix = mkDevShellWithNixDeps ghcDefault "cabal.project"; - haskell-language-server-884-dev-nix = mkDevShellWithNixDeps ghc884 "cabal.project"; - haskell-language-server-8107-dev-nix = mkDevShellWithNixDeps ghc8107 "cabal.project"; - haskell-language-server-901-dev-nix = mkDevShellWithNixDeps ghc901 "cabal.project"; - haskell-language-server-921-dev-nix = mkDevShellWithNixDeps ghc921 "cabal.project"; + haskell-language-server-902-dev-nix = mkDevShellWithNixDeps ghc902 "cabal.project"; + haskell-language-server-922-dev-nix = mkDevShellWithNixDeps ghc922 "cabal.project"; }; allPackages = { haskell-language-server = mkExe ghcDefault; - haskell-language-server-884 = mkExe ghc884; - haskell-language-server-8107 = mkExe ghc8107; - haskell-language-server-901 = mkExe ghc901; - haskell-language-server-921 = mkExe ghc921; + haskell-language-server-902 = mkExe ghc902; + haskell-language-server-922 = mkExe ghc922; }; - devShells = simpleDevShells // nixDevShells; + devShells = simpleDevShells // nixDevShells // { + default = simpleDevShells.haskell-language-server-dev; + inherit (self.checks.${system}.pre-commit-check) shellHook; + }; packages = allPackages // { + default = allPackages.haskell-language-server; + # See https://github.com/NixOS/nix/issues/5591 # nix flake cannot build a list/set of derivation in one command. # Using a linkFarmFromDrvs, I'm creating a unique entry point to @@ -377,9 +431,12 @@ docs = docs; }; - defaultPackage = packages.haskell-language-server; + checks = { pre-commit-check = pre-commit-check ghcDefault; }; - devShell = devShells.haskell-language-server-dev; + # The attributes for the default shell and package changed in recent versions of Nix, + # these are here for backwards compatibility with the old versions. + devShell = devShells.default; + defaultPackage = packages.default; }); nixConfig = { diff --git a/myst-parser.nix b/myst-parser.nix deleted file mode 100644 index 8f332d5f8..000000000 --- a/myst-parser.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, markdown-it-py -, mdit-py-plugins -, pyyaml -, docutils -, sphinx -}: - -buildPythonPackage rec { - pname = "myst-parser"; - version = "0.16.0"; - - src = fetchPypi { - inherit pname version; - sha256 = "14lzbhciw7ksi219lrcy9afglmg5mx0rmfvrr2x8ssghv4kf8cdy"; - }; - - propagatedBuildInputs = [ - markdown-it-py - mdit-py-plugins - pyyaml - docutils - sphinx - ]; - - meta = with lib; { - description = "An extended commonmark compliant parser, with bridges to docutils & sphinx"; - homepage = https://github.com/executablebooks/MyST-Parser; - license = licenses.mit; - }; -}