(define-module (pantheon packages terminals) #:use-module ((guix licenses) #:prefix license:) #:use-module ((guix build utils) #:select (alist-replace)) #:use-module (guix build-system cargo) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system glib-or-gtk) #:use-module (guix build-system go) #:use-module (guix build-system meson) #:use-module (guix build-system pyproject) #:use-module (guix build-system python) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages assembly) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages crates-io) #:use-module (gnu packages crates-graphics) #:use-module (gnu packages crypto) #:use-module (gnu packages curl) #:use-module (gnu packages dlang) #:use-module (gnu packages digest) #:use-module (gnu packages docbook) #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages fribidi) #:use-module (gnu packages gettext) #:use-module (gnu packages ghostscript) #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages golang) #:use-module (gnu packages golang-build) #:use-module (gnu packages golang-check) #:use-module (gnu packages golang-xyz) #:use-module (gnu packages gtk) #:use-module (gnu packages image) #:use-module (gnu packages libcanberra) #:use-module (gnu packages libevent) #:use-module (gnu packages libunwind) #:use-module (gnu packages linux) #:use-module (gnu packages man) #:use-module (gnu packages ncurses) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages perl-check) #:use-module (gnu packages pkg-config) #:use-module (gnu packages popt) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-check) #:use-module (gnu packages python-xyz) #:use-module (gnu packages qt) #:use-module (gnu packages serialization) #:use-module (gnu packages sphinx) #:use-module (gnu packages ssh) #:use-module (gnu packages textutils) #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (srfi srfi-26)) ;; via gnu/packages/terminals.scm ;; https://github.com/zzkt/guix/blob/endless/channel/zzkt/packages/kitty.scm (define-public go-1.22 (package (inherit go-1.21) (name "go") (version "1.22.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/golang/go") (commit (string-append "go" version)))) (file-name (git-file-name name version)) (sha256 (base32 "00j6sn2zysk5pdzxw1wfdi31wggzw1h1026ah3x3mi85dwsijhjs")))) (arguments (substitute-keyword-arguments (package-arguments go-1.21) ((#:phases phases) #~(modify-phases #$phases (replace 'unpatch-perl-shebangs (lambda _ ;; Avoid inclusion of perl in closure by rewriting references ;; to perl input in sourcecode generators and test scripts (substitute* (find-files "src" "\\.pl$") (("^#!.*") "#!/usr/bin/env perl\n")))))))) (native-inputs ;; Go 1.22 and later requires Go 1.20 (min. 1.20.6, which we don't have) ;; as the bootstrap toolchain. (alist-replace "go" (list go-1.21) (package-native-inputs go-1.21))))) (define-public go-github-com-altree-bigfloat (package (name "go-github-com-altree-bigfloat") (version "0.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ALTree/bigfloat") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1jvqg5w4azwqv0ranir6vhlh6403pn6043jqbwsldan4vj6n5xmh")))) (build-system go-build-system) (arguments (list #:import-path "github.com/ALTree/bigfloat")) (native-inputs (list go-1.22)) (home-page "https://github.com/ALTree/bigfloat") (synopsis "Example") (description "Package bigfloat provides arbitrary-precision natural logarithm and exponentiation for the standard library's @@code{big.Float} type.") (license license:expat))) (define-public go-github-com-bmatcuk-doublestar-v4 (package (name "go-github-com-bmatcuk-doublestar-v4") (version "4.6.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/bmatcuk/doublestar") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "12rf4a9isgg2nh927gikgbmyaynaqp4kjahgscb4qnr04m3vpr41")))) (build-system go-build-system) (arguments (list #:import-path "github.com/bmatcuk/doublestar/v4")) (home-page "https://github.com/bmatcuk/doublestar") (synopsis "doublestar") (description "Path pattern matching and globbing supporting @@code{doublestar} (@@code{**}) patterns.") (license license:expat))) (define-public go-github-com-seancfoley-bintree (package (name "go-github-com-seancfoley-bintree") (version "1.2.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/seancfoley/bintree") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "17faiyfbf8x688ij40d3g80s2z2m5h5w23j92mf2k0ws5g6fi9vx")))) (build-system go-build-system) (arguments (list #:go go-1.18 #:import-path "github.com/seancfoley/bintree/tree" #:unpack-path "github.com/seancfoley/bintree")) (home-page "https://github.com/seancfoley/bintree") (synopsis "bintree") (description "Binary trees and tries") (license license:asl2.0))) (define-public go-github-com-seancfoley-ipaddress-go-ipaddr (package (name "go-github-com-seancfoley-ipaddress-go-ipaddr") (version "1.5.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/seancfoley/ipaddress-go") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "03yz5pb1mgj25i4n90sfqnmwr88872s096pna178g8zh90r55628")))) (build-system go-build-system) (arguments (list #:go go-1.18 #:import-path "github.com/seancfoley/ipaddress-go/ipaddr" #:unpack-path "github.com/seancfoley/ipaddress-go")) (propagated-inputs `(("go-github-com-seancfoley-bintree" ,go-github-com-seancfoley-bintree))) (home-page "https://github.com/seancfoley/ipaddress-go") (synopsis #f) (description "IPAddress is a library for handling IP addresses and subnets, both IPv4 and IPv6.") (license (list license:asl2.0 license:asl2.0)))) (define-public go-github-com-rwcarlsen-goexif-exif (package (name "go-github-com-rwcarlsen-goexif-exif") (version "0.0.0-20190401172101-9e8deecbddbd") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rwcarlsen/goexif") (commit (go-version->git-ref version)))) (file-name (git-file-name name version)) (sha256 (base32 "1drqhzplg72lvrf3qmb9awbggnjqp23hwn2pgvksi3spv17kc9h2")))) (build-system go-build-system) (arguments (list #:import-path "github.com/rwcarlsen/goexif/exif" #:unpack-path "github.com/rwcarlsen/goexif")) (home-page "https://github.com/rwcarlsen/goexif") (synopsis "goexif") (description "This package provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality is split into two packages - \"exif\" and \"tiff\" The exif package depends on the tiff package.") (license license:bsd-2))) (define-public go-github-com-rwcarlsen-goexif-tiff (package (name "go-github-com-rwcarlsen-goexif-tiff") (version "0.0.0-20190401172101-9e8deecbddbd") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/rwcarlsen/goexif") (commit (go-version->git-ref version)))) (file-name (git-file-name name version)) (sha256 (base32 "1drqhzplg72lvrf3qmb9awbggnjqp23hwn2pgvksi3spv17kc9h2")))) (build-system go-build-system) (arguments (list #:import-path "github.com/rwcarlsen/goexif/tiff" #:unpack-path "github.com/rwcarlsen/goexif")) (home-page "https://github.com/rwcarlsen/goexif") (synopsis "goexif") (description "This package provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality is split into two packages - \"exif\" and \"tiff\" The exif package depends on the tiff package.") (license license:bsd-2))) (define-public go-github-com-edwvee-exiffix (package (name "go-github-com-edwvee-exiffix") (version "0.0.0-20240229113213-0dbb146775be") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/edwvee/exiffix") (commit (go-version->git-ref version)))) (file-name (git-file-name name version)) (sha256 (base32 "1i4p1xnbm04ih2735h58n1p1j6cjmr6d3bfx41862ki0qc12lfn4")))) (build-system go-build-system) (arguments (list #:import-path "github.com/edwvee/exiffix")) (propagated-inputs (list go-golang-org-x-image go-github-com-disintegration-imaging go-github-com-rwcarlsen-goexif-exif go-github-com-rwcarlsen-goexif-tiff)) (home-page "https://github.com/edwvee/exiffix") (synopsis "Exiffix") (description "Exiffix is a one function golang library made to be a replacement for image.Decode to handle orientation stored in EXIF data.") (license license:expat))) (define-public go-github-com-kovidgoyal-imaging (package (name "go-github-com-kovidgoyal-imaging") (version "1.6.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/kovidgoyal/imaging") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "123hfgjzp2401l8rfb3h2agyijj03w2a2sdxcziybmplw4r8pbi3")))) (build-system go-build-system) (arguments (list #:go go-1.21 #:import-path "github.com/kovidgoyal/imaging")) (propagated-inputs `(("go-golang-org-x-image" ,go-golang-org-x-image))) (home-page "https://github.com/kovidgoyal/imaging") (synopsis "Imaging") (description "Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.).") (license license:expat))) (define-public go-github-com-klauspost-cpuid-v2 (package (name "go-github-com-klauspost-cpuid-v2") (version "2.2.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/klauspost/cpuid") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0i1y5zgcj350l3idqfxjkcs18ii5w315xjmmabqbqrx27sn8fqh1")))) (build-system go-build-system) (arguments (list #:import-path "github.com/klauspost/cpuid/v2")) (propagated-inputs `(("go-golang-org-x-sys" ,go-golang-org-x-sys))) (home-page "https://github.com/klauspost/cpuid") (synopsis "cpuid") (description "Package cpuid provides information about the CPU running the current program.") (license license:expat))) (define-public go-github-com-zeebo-assert (package (name "go-github-com-zeebo-assert") (version "1.3.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/zeebo/assert") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0xfklg04ic4xl5q7xy913jzvn2v9bxmrsnm4lyjqznninysgs9xb")))) (build-system go-build-system) (arguments (list #:import-path "github.com/zeebo/assert")) (home-page "https://github.com/zeebo/assert") (synopsis "package assert") (description "See the api docs. There's not a lot of surface area, and that's the goal.") (license license:cc0))) (define-public go-github-com-zeebo-xxh3 (package (name "go-github-com-zeebo-xxh3") (version "1.0.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/zeebo/xxh3") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1gy666r5v1d1n2cfig9plhyp7z09f06k6mr5lrf0mk6psk6bnwgi")))) (build-system go-build-system) (arguments (list #:import-path "github.com/zeebo/xxh3")) (propagated-inputs `(("go-github-com-zeebo-assert" ,go-github-com-zeebo-assert) ("go-github-com-klauspost-cpuid-v2" ,go-github-com-klauspost-cpuid-v2))) (home-page "https://github.com/zeebo/xxh3") (synopsis "XXH3") (description "This package is a port of the @@url{https://github.com/Cyan4973/@code{xxHash,xxh3}} library to Go.") (license license:bsd-2))) (define-public go-github-com-alecthomas-chroma-v2-13 (package (inherit go-github-com-alecthomas-chroma) (name "go-github-com-alecthomas-chroma-v2-13") (version "2.13.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/alecthomas/chroma") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1vq53pma340g3v9xb5g8wpj9zvl9jsdshq6gw245f4hczn569sdd")))) (arguments (list #:go go-1.22 #:import-path "github.com/alecthomas/chroma/v2" #:unpack-path "github.com/alecthomas/chroma/v2")) (propagated-inputs (list go-github-com-dlclark-regexp2)) (native-inputs (list go-github-com-alecthomas-assert-v2 go-github-com-alecthomas-repr)))) (define-public kitty-next (let ((commit "b3cc5aed30c8e83715fa955e9d3183a0e433a9c3") (revision "0")) (package (name "kitty-next") (version (git-version "0.34.1" revision commit)) (home-page "https://sw.kovidgoyal.net/kitty/") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/kovidgoyal/kitty") (commit commit) (recursive? #t))) (file-name (git-file-name name version)) (sha256 (base32 "0n841kyhbm7icbby575blx75ykac9zj0a3jjy35ymkhqnz5dayq1")) (modules '((guix build utils))) (snippet '(begin ;; patch needed as sphinx-build is used as a python script ;; whereas the guix package uses a bash script launching the ;; python script (substitute* "docs/conf.py" (("(from kitty.constants import str_version)" kitty-imp) (string-append "sys.path.append(\"..\")\n" kitty-imp))) (substitute* "docs/Makefile" (("^SPHINXBUILD[[:space:]]+= (python3.*)$") "SPHINXBUILD = sphinx-build\n")) #t)))) (build-system go-build-system) (propagated-inputs (list go-golang-org-x-sys go-golang-org-x-exp go-github-com-altree-bigfloat go-github-com-bmatcuk-doublestar-v4 go-github-com-seancfoley-ipaddress-go-ipaddr go-github-com-dhowett-go-plist go-github-com-shirou-gopsutil-v3 go-github-com-google-uuid go-github-com-edwvee-exiffix go-github-com-kovidgoyal-imaging go-golang-org-x-image go-github-com-alecthomas-chroma-v2-13 go-github-com-dlclark-regexp2 go-github-com-zeebo-xxh3)) (native-inputs (list dbus mesa libxcursor libxi libxinerama libxkbcommon libxrandr ncurses ;; for tic command pkg-config python-sphinx wayland-protocols go-1.22 simde git)) (inputs (list fontconfig freetype harfbuzz lcms libcanberra libpng python-pygments python-wrapper wayland openssl xxhash zlib)) (arguments (list #:go go-1.22 #:import-path "kitty" #:phases #~(modify-phases %standard-phases (delete 'configure) ;no configure script (replace 'build (lambda* (#:key inputs #:allow-other-keys) ;; The "kitty" sub-directory must be writable prior to ;; configuration (e.g., un-setting updates). (chdir "src/kitty") (for-each make-file-writable (find-files "kitty")) (invoke "python3" "setup.py" "linux-package" ;; Do not phone home. "--update-check-interval=0" "--skip-building-kitten" ;; Wayland backend requires EGL, which isn't ;; found out-of-the-box for some reason. (string-append "--egl-library=" (search-input-file inputs "/lib/libEGL.so.1"))))) (delete 'check) ;; (replace 'check ;; (lambda* (#:key tests? #:allow-other-keys) ;; (when tests? ;; ;; Fix "cannot find kitty executable" error when running ;; ;; tests. ;; (invoke "ls" "-l") ;; (setenv "PATH" (string-append "linux-package/bin:" ;; (getenv "PATH"))) ;; (invoke "python3" "test.py")))) (add-before 'install 'rm-pycache ;; created python cache __pycache__ are non deterministic (lambda _ (let ((pycaches (find-files "linux-package/" "__pycache__" #:directories? #t))) (for-each delete-file-recursively pycaches)))) (delete 'install-license-files) (replace 'install (lambda _ (let* ((obin (string-append #$output "/bin")) (olib (string-append #$output "/lib")) (oshare (string-append #$output "/share"))) (copy-recursively "linux-package/bin" obin) (copy-recursively "linux-package/share" oshare) (copy-recursively "linux-package/lib" olib))))))) (synopsis "Fast, featureful, GPU based terminal emulator") (description "Kitty is a fast and featureful GPU-based terminal emulator: @itemize @item Offloads rendering to the GPU for lower system load and buttery smooth scrolling. Uses threaded rendering to minimize input latency. @item Supports all modern terminal features: graphics (images), unicode, true-color, OpenType ligatures, mouse protocol, focus tracking, bracketed paste and several new terminal protocol extensions. @item Supports tiling multiple terminal windows side by side in different layouts without needing to use an extra program like tmux. @item Can be controlled from scripts or the shell prompt, even over SSH. @item Has a framework for Kittens, small terminal programs that can be used to extend kitty's functionality. For example, they are used for Unicode input, hints, and side-by-side diff. @item Supports startup sessions which allow you to specify the window/tab layout, working directories and programs to run on startup. @item Allows you to open the scrollback buffer in a separate window using arbitrary programs of your choice. This is useful for browsing the history comfortably in a pager or editor. @end itemize") (license license:gpl3+))))