From a4a4bfe63b28a7768e68f2dd3381f1310eef2165 Mon Sep 17 00:00:00 2001 From: u_quark Date: Sun, 12 Nov 2023 05:23:59 +0200 Subject: [PATCH] Move to vty 6.0+ vty moved to separate different platform specific functionality to different package. We want vty-unix. iAlso move to brick 2.1.1 that now supports vty 6.0. --- flake.lock | 49 ++++++++++++++++++++++++++++++------ flake.nix | 8 ++++++ nix/gg.nix | 3 +++ nix/haskell-pkgs-overlay.nix | 9 +++++++ package.yaml | 1 + src/GG/UI.hs | 4 ++- 6 files changed, 66 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index cdb0e02..0abc6c1 100644 --- a/flake.lock +++ b/flake.lock @@ -19,11 +19,11 @@ "brick": { "flake": false, "locked": { - "lastModified": 1698178979, - "narHash": "sha256-tE56wo37xJW7KJOd1ynY+7TfsYiuxQGANH2HLvV1IcY=", + "lastModified": 1699576624, + "narHash": "sha256-e4/Pnd+G6+4UgcHp5lxDxJcKBxvk1b6MNJcF+ALsWZk=", "owner": "jtdaugherty", "repo": "brick", - "rev": "53d9b207e285a4819d7f8d05be46bcfa1d75c5e6", + "rev": "d93cdfca4514664fe04242fcdc3e1ee34742e6c2", "type": "github" }, "original": { @@ -107,7 +107,9 @@ "libgit2": "libgit2", "nixpkgs": "nixpkgs", "static-haskell": "static-haskell", - "vty": "vty" + "vty": "vty", + "vty-crossplatform": "vty-crossplatform", + "vty-unix": "vty-unix" } }, "static-haskell": { @@ -130,11 +132,11 @@ "vty": { "flake": false, "locked": { - "lastModified": 1697979126, - "narHash": "sha256-um/v1bufLeVq8OKOZL/lAb3pshR+uQ4d8MMiLj/o3P4=", + "lastModified": 1699726422, + "narHash": "sha256-eLUvb3Y3vzWfUfuMcDYWgf25yruEGSYABE0Ouw/A0Dw=", "owner": "u-quark", "repo": "vty", - "rev": "781fff10814412760e657ca1add131a8b2774b6a", + "rev": "955322a4068a61aa46e98eceaa4ba9e9240e662e", "type": "github" }, "original": { @@ -143,6 +145,39 @@ "repo": "vty", "type": "github" } + }, + "vty-crossplatform": { + "flake": false, + "locked": { + "lastModified": 1699071306, + "narHash": "sha256-RnetAxIQJjKHEzfzA0MWaFunVbRZ2Qn8Sl/NpnpF7j8=", + "owner": "jtdaugherty", + "repo": "vty-crossplatform", + "rev": "640ea8ee49ea991bab89734f3be126c19c0445a5", + "type": "github" + }, + "original": { + "owner": "jtdaugherty", + "repo": "vty-crossplatform", + "type": "github" + } + }, + "vty-unix": { + "flake": false, + "locked": { + "lastModified": 1699758157, + "narHash": "sha256-nGLT+6LE69AC5WarOYe+Crh9w4KgeawxaMAwggkWnZc=", + "owner": "u-quark", + "repo": "vty-unix", + "rev": "d44a3a0c43ad0a4f044a1467480700b583e3f3fd", + "type": "github" + }, + "original": { + "owner": "u-quark", + "ref": "gg", + "repo": "vty-unix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index be25b44..92bbf54 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,14 @@ url = "github:u-quark/vty?ref=gg"; flake = false; }; + vty-unix = { + url = "github:u-quark/vty-unix?ref=gg"; + flake = false; + }; + vty-crossplatform = { + url = "github:jtdaugherty/vty-crossplatform"; + flake = false; + }; brick = { url = "github:jtdaugherty/brick"; flake = false; diff --git a/nix/gg.nix b/nix/gg.nix index 7b9edb2..b0e44cf 100644 --- a/nix/gg.nix +++ b/nix/gg.nix @@ -14,6 +14,7 @@ http-client, brick, vty, + vty-unix, lens, generic-lens, vector, @@ -59,6 +60,7 @@ mkDerivation { http-client brick vty + vty-unix lens generic-lens vector @@ -66,6 +68,7 @@ mkDerivation { bytestring MissingH wreq + colour # C deps libgit2 ]; diff --git a/nix/haskell-pkgs-overlay.nix b/nix/haskell-pkgs-overlay.nix index ddc3b32..7019dfa 100644 --- a/nix/haskell-pkgs-overlay.nix +++ b/nix/haskell-pkgs-overlay.nix @@ -7,7 +7,16 @@ let modifyPkg = pkg: dontHaddock (disableExecutableProfiling (disableLibraryProf self: super: rec { vty = modifyPkg (callCabal2nix "vty" inputs.vty {}); + vty-unix = modifyPkg (callCabal2nix "vty-unix" inputs.vty-unix { + vty = vty; + }); + vty-crossplatform = modifyPkg (callCabal2nix "vty-crossplatform" inputs.vty-crossplatform { + vty = vty; + vty-unix = vty-unix; + }); brick = modifyPkg (callCabal2nix "brick" inputs.brick { vty = vty; + vty-unix = vty-unix; + vty-crossplatform = vty-crossplatform; }); } diff --git a/package.yaml b/package.yaml index 48442b1..63781af 100644 --- a/package.yaml +++ b/package.yaml @@ -26,6 +26,7 @@ dependencies: - time - brick - vty +- vty-unix - lens - generic-lens - vector diff --git a/src/GG/UI.hs b/src/GG/UI.hs index 46ed5ee..04b61b6 100644 --- a/src/GG/UI.hs +++ b/src/GG/UI.hs @@ -53,6 +53,8 @@ import qualified GG.UI.Attrs as Attr import GG.UI.Theme (getAttrMap) import GG.Utils (uncurry3) import qualified Graphics.Vty as V +import Graphics.Vty.Platform.Unix + (mkVty) import qualified Libgit2 as G import Prelude hiding (head) import System.Environment (lookupEnv, setEnv) @@ -772,7 +774,7 @@ easeOut t = buildVty :: IO V.Vty buildVty = do - vty <- V.mkVty V.defaultConfig + vty <- mkVty V.defaultConfig let output_interface = V.outputIface vty when (V.supportsMode output_interface V.Mouse) $ liftIO $ V.setMode output_interface V.Mouse True