From 6ad97610bfbd0c348b044bb28120b2e6a6acce3a Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 21 Sep 2022 13:07:37 -0600 Subject: [PATCH] pkgs: add zutty, use it on stan and europa --- hosts/europa/default.nix | 3 ++ hosts/stan/default.nix | 2 ++ pkgs/zutty.nix | 65 ++++++++++++++++++++++++++++++++++++++++ pkgs/zutty_go.diff | 24 +++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 pkgs/zutty.nix create mode 100644 pkgs/zutty_go.diff diff --git a/hosts/europa/default.nix b/hosts/europa/default.nix index 984cac3..dccc508 100644 --- a/hosts/europa/default.nix +++ b/hosts/europa/default.nix @@ -231,6 +231,9 @@ in { virt-manager yt-dlp zig + + (callPackage ../../pkgs/zutty.nix { }) + ]; # for Pharo diff --git a/hosts/stan/default.nix b/hosts/stan/default.nix index b559bb8..46723d0 100644 --- a/hosts/stan/default.nix +++ b/hosts/stan/default.nix @@ -121,6 +121,8 @@ in { virt-manager wireshark zig + + (callPackage ../../pkgs/zutty.nix { }) ]; virtualisation.libvirtd.enable = true; diff --git a/pkgs/zutty.nix b/pkgs/zutty.nix new file mode 100644 index 0000000..582c673 --- /dev/null +++ b/pkgs/zutty.nix @@ -0,0 +1,65 @@ +{ lib, stdenv, fetchpatch, fetchFromGitHub, pkgs, go-font, ... }: + +stdenv.mkDerivation rec { + pname = "zutty"; + version = "0.13"; + + src = fetchFromGitHub { + owner = "tomszilagyi"; + repo = "zutty"; + rev = version; + sha256 = "sha256-1eB5GDhWGwyhiKzxpepzjQ44Co0ZeL9JJI5ppPE1TJw="; + }; + + patches = [ + ./zutty_go.diff + ]; + + nativeBuildInputs = with pkgs; [ + gcc + pkg-config + python + wafHook + xlibsWrapper + xorg.libXmu + #xorg.libXau + #xorg.libXdmcp + libGL + ]; + + buildInputs = with pkgs; [ freetype fontconfig ]; + + prePatch = '' + substituteInPlace src/options.h \ + --replace "/usr/share/fonts" "${go-font}/share/fonts" + ''; + + postInstall = '' + mkdir -p $out/share/applications/ + for size in 16 32 48 64 96 128; do + mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps/ + cp icons/zutty_''${size}x''${size}.png \ + $out/share/icons/hicolor/''${size}x''${size}/apps/zutty.png + done + cp icons/zutty.desktop $out/share/applications/ + ''; + + meta = with lib; { + description = + "X terminal emulator rendering through OpenGL ES Compute Shaders"; + longDescription = '' + Zutty is a terminal emulator for the X Window System, functionally + similar to several other X terminal emulators such as xterm, rxvt and + countless others. It is also similar to other, much more modern, + GPU-accelerated terminal emulators such as Alacritty and Kitty. What + really sets Zutty apart is its radically simple, yet extremely + efficient rendering implementation, coupled with a sufficiently + complete feature set to make it useful for a wide range of users. + ''; + homepage = "" "https://tomscii.sig7.se/zutty/"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ qbit ]; + }; +} + diff --git a/pkgs/zutty_go.diff b/pkgs/zutty_go.diff new file mode 100644 index 0000000..914840b --- /dev/null +++ b/pkgs/zutty_go.diff @@ -0,0 +1,24 @@ +diff --git a/src/options.h b/src/options.h +index 7bac116..67b2e1d 100644 +--- a/src/options.h ++++ b/src/options.h +@@ -52,15 +52,15 @@ namespace zutty + // option parseType implValue hardDefault helpDescr + {"altScroll", NoArg, "true", "false", "Alternate scroll mode"}, + {"autoCopy", NoArg, "true", "false", "Sync primary to clipboard"}, +- {"bg", SepArg, nullptr, "#000", "Background color"}, ++ {"bg", SepArg, nullptr, "#ffffea", "Background color"}, + {"boldColors", NoArg, "true", "true", "Enable bright for bold"}, + {"border", SepArg, nullptr, "2", "Border width in pixels"}, + {"cr", SepArg, nullptr, nullptr, "Cursor color"}, + {"display", SepArg, nullptr, nullptr, "Display to connect to"}, + {"dwfont", SepArg, nullptr, "18x18ja", "Double-width font to use"}, +- {"fg", SepArg, nullptr, "#fff", "Foreground color"}, +- {"font", SepArg, nullptr, "9x18", "Font to use"}, +- {"fontsize", SepArg, nullptr, "16", "Font size"}, ++ {"fg", SepArg, nullptr, "#000", "Foreground color"}, ++ {"font", SepArg, nullptr, "go-mono", "Font to use"}, ++ {"fontsize", SepArg, nullptr, "13", "Font size"}, + {"fontpath", SepArg, nullptr, fontpath, "Font search path"}, + {"geometry", SepArg, nullptr, "80x24", "Terminal size in chars"}, + {"glinfo", NoArg, "true", "false", "Print OpenGL information"},