From 09882de5f3cbfd62d59b9ec94723a90d67555b7d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 30 Aug 2021 20:19:13 -0400 Subject: Update to ghc 8.10.4 This also makes some changes to the build tooling to clean up the environment a bit, and get us closer to 'bild -s'. --- Biz/Bild.nix | 37 ++++++++----------------------------- Biz/Bild/Constants.nix | 4 ++++ Biz/Bild/Deps.nix | 4 ++-- Biz/Bild/Deps/Haskell.nix | 5 +++++ Biz/Bild/ShellHook.sh | 3 ++- Biz/Bild/Sources.json | 10 +++++----- Biz/Dev/Configuration.nix | 3 ++- Biz/Dragons.hs | 4 ++-- Biz/Ide/bild | 2 -- Biz/Ide/lint | 2 +- Biz/Ide/pre-commit | 2 ++ Biz/Ide/pre-push | 2 ++ 12 files changed, 35 insertions(+), 43 deletions(-) create mode 100644 Biz/Bild/Constants.nix delete mode 100755 Biz/Ide/bild create mode 100755 Biz/Ide/pre-commit create mode 100755 Biz/Ide/pre-push (limited to 'Biz') diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 3cd5026..6a0ce0c 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -1,10 +1,8 @@ { nixpkgs ? import ./Bild/Nixpkgs.nix }: +with import ./Bild/Constants.nix; let - ghcCompiler = "ghc884"; - ghcjsCompiler = "ghcjs86"; - # provided by .envrc root = builtins.getEnv "BIZ_ROOT"; @@ -23,6 +21,7 @@ let mkGhcPackageSet = nixpkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle; #mkGhcjsPackageSet = nixpkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; + ghcPackageSetFull = mkGhcPackageSet haskellDeps; in rec { inherit (nixpkgs) lib stdenv pkgs sources; @@ -32,8 +31,7 @@ in rec { name = "bild"; src = ../.; nativeBuildInputs = [ ghcPackageSetFull ]; - buildInputs = [ ghcPackageSetFull nixpkgs.makeWrapper ]; - propagatedBuildInputs = [ ghcPackageSetFull ]; + buildInputs = [ nixpkgs.makeWrapper ]; strictDeps = true; buildPhase = '' mkdir -p $out/bin @@ -72,7 +70,6 @@ in rec { (lib.trivial.importJSON (runBildAnalyze main + "/analysis.json")); - ghcPackageSetFull = mkGhcPackageSet haskellDeps; ghc = main: let @@ -127,27 +124,10 @@ in rec { env = pkgs.mkShell { name = "bizdev"; buildInputs = with nixpkgs.pkgs; [ - # haskell deps - (mkGhcPackageSet haskellDeps) - # ghcjs doesn't need everything, and many things fail to build - #(mkGhcjsPackageSet (hp: with hp; [ - # aeson - # clay - # containers - # miso - # protolude - # servant - # split - # text - # ghcjs-base - #])) - - # python deps - (python38.withPackages (p: - [ p.black p.pylint ])) - - # tools + ghcPackageSetFull # need this until 'bild -s' works + # this should just be dev tools haskell.packages.${ghcCompiler}.apply-refact + bild cmark figlet haskell.packages.${ghcCompiler}.fast-tags @@ -156,8 +136,8 @@ in rec { niv.niv nixops ormolu - python37Packages.black - python37Packages.pylint + python38Packages.black + python38Packages.pylint shellcheck wemux gmnisrv @@ -167,7 +147,6 @@ in rec { guile #inspekt3d #libfive - ccze ]; shellHook = ". ${./Bild/ShellHook.sh}"; diff --git a/Biz/Bild/Constants.nix b/Biz/Bild/Constants.nix new file mode 100644 index 0000000..652e022 --- /dev/null +++ b/Biz/Bild/Constants.nix @@ -0,0 +1,4 @@ +{ + ghcCompiler = "ghc8104"; + ghcjsCompiler = "ghcjs86"; +} diff --git a/Biz/Bild/Deps.nix b/Biz/Bild/Deps.nix index 946a834..4f16250 100644 --- a/Biz/Bild/Deps.nix +++ b/Biz/Bild/Deps.nix @@ -1,16 +1,16 @@ self: super: +with import ./Constants.nix; let buildCabal = sel: name: sel.callCabal2nix name super.sources.${name} {}; buildCabalSubdir = sel: {name, src ? super.sources.${name}, subdir ? name}: sel.callCabal2nix name (src + "/${subdir}") {}; - ghc = "ghc884"; in rec { haskell = super.haskell // { packages = super.haskell.packages // { - "${ghc}" = super.haskell.packages."${ghc}".override (old: { + "${ghcCompiler}" = super.haskell.packages."${ghcCompiler}".override (old: { overrides = with super.pkgs.haskell.lib; sel: sup: super.overridePinnedDeps (buildCabal sel) // { acid-state = dontCheck sup.acid-state; # mac: "too many open files" diff --git a/Biz/Bild/Deps/Haskell.nix b/Biz/Bild/Deps/Haskell.nix index 8dfcc82..bbc8ac4 100644 --- a/Biz/Bild/Deps/Haskell.nix +++ b/Biz/Bild/Deps/Haskell.nix @@ -1,4 +1,9 @@ hpkgs: + +# This is the global set of Haskell packages which gets deployed to Hoogle, and +# is used to create the global 'nix-shell' environment. Eventually, bild should +# create the environment for me. + with hpkgs; [ MonadRandom diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh index 11954a7..d402755 100644 --- a/Biz/Bild/ShellHook.sh +++ b/Biz/Bild/ShellHook.sh @@ -29,7 +29,8 @@ alias tree="tree -I _ -F" rm -f $BIZ_ROOT/.git/hooks/{post-checkout,post-merge,pre-commit} ln -s $BIZ_ROOT/Biz/Ide/post-checkout $BIZ_ROOT/.git/hooks/post-checkout ln -s $BIZ_ROOT/Biz/Ide/post-merge $BIZ_ROOT/.git/hooks/post-merge -ln -s $BIZ_ROOT/Biz/Lint.py $BIZ_ROOT/.git/hooks/pre-commit +ln -s $BIZ_ROOT/Biz/Ide/pre-commit $BIZ_ROOT/.git/hooks/pre-commit +ln -s $BIZ_ROOT/Biz/Ide/pre-push $BIZ_ROOT/.git/hooks/pre-push function deps() { niv --sources-file $BIZ_ROOT/Biz/Bild/Sources.json $@ diff --git a/Biz/Bild/Sources.json b/Biz/Bild/Sources.json index f513c5d..0b2ab61 100644 --- a/Biz/Bild/Sources.json +++ b/Biz/Bild/Sources.json @@ -26,15 +26,15 @@ "version": "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee" }, "docopt": { - "branch": "monad-fail", + "branch": "master", "description": "A command-line interface description language and parser that will make you smile", "homepage": "http://docopt.org/", - "owner": "gelisam", + "owner": "docopt", "repo": "docopt.hs", - "rev": "16dc7bc596c0ea4fa4466b12f474b1abfa72c885", - "sha256": "1m15zhm1b9sn7ihkxxavbgaihaybmpsrhx26pn1wyng9dh8vsp8b", + "rev": "cdd32227eaff46fb57330ced96d5c290cbd9e035", + "sha256": "1nfbm7fpmk522n58d52m44y86a7z4nm6gc3m3gc1hb3wac6vmffc", "type": "tarball", - "url": "https://github.com/gelisam/docopt.hs/archive/16dc7bc596c0ea4fa4466b12f474b1abfa72c885.tar.gz", + "url": "https://github.com/docopt/docopt.hs/archive/cdd32227eaff46fb57330ced96d5c290cbd9e035.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ghc-exactprint": { diff --git a/Biz/Dev/Configuration.nix b/Biz/Dev/Configuration.nix index fcd55b7..2dcc816 100644 --- a/Biz/Dev/Configuration.nix +++ b/Biz/Dev/Configuration.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: let + ghcCompiler = (import ../Bild/Constants.nix).ghcCompiler; ports = import ../Cloud/Ports.nix; in { networking = { @@ -114,7 +115,7 @@ in { port = ports.hoogle; home = "//hoogle.simatime.com"; packages = import ../Bild/Deps/Haskell.nix; - haskellPackages = pkgs.haskell.packages.ghc884; + haskellPackages = pkgs.haskell.packages.${ghcCompiler}; host = "0.0.0.0"; }; diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs index 4294172..e6b5368 100644 --- a/Biz/Dragons.hs +++ b/Biz/Dragons.hs @@ -992,7 +992,7 @@ htmlApp cooks kp cfg jwk oAuthArgs = Right repos -> pure <. App.Html <| SelectRepo user repos, getAnalyses = guardAuth - >=> \user@User {..} -> + >=> \user@User {} -> GetAnalysesByAsker user |> Acid.query' kp +> Analyses user @@ -1278,7 +1278,7 @@ instance App.HasCss Analyses where instance Lucid.ToHtml Analyses where toHtmlRaw = Lucid.toHtml - toHtml (Analyses user@User {..} analyses) = do + toHtml (Analyses user@User {} analyses) = do header <| Just user Lucid.main_ <| do Lucid.section_ <| do diff --git a/Biz/Ide/bild b/Biz/Ide/bild deleted file mode 100755 index 1305e21..0000000 --- a/Biz/Ide/bild +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -runghc -i$BIZ_ROOT Biz.Bild $@ diff --git a/Biz/Ide/lint b/Biz/Ide/lint index 3f98dcb..f8bcc1e 100755 --- a/Biz/Ide/lint +++ b/Biz/Ide/lint @@ -1,2 +1,2 @@ #!/usr/bin/env bash -runghc -i$BIZ_ROOT Biz.Lint $@ +bild $BIZ_ROOT/Biz/Lint.hs && $BIZ_ROOT/_/bin/lint $@ diff --git a/Biz/Ide/pre-commit b/Biz/Ide/pre-commit new file mode 100755 index 0000000..8b17092 --- /dev/null +++ b/Biz/Ide/pre-commit @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec $BIZ_ROOT/Biz/Ide/lint **/* diff --git a/Biz/Ide/pre-push b/Biz/Ide/pre-push new file mode 100755 index 0000000..2a5ee7b --- /dev/null +++ b/Biz/Ide/pre-push @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +ci -- cgit v1.2.3