diff options
| author | Jordan Moore <lockbox@struct.foo> | 2024-12-02 22:00:53 -0500 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2025-01-06 12:14:28 +0200 |
| commit | c2ef33aeb52ecc79788b4ef2b3b5f510651469b5 (patch) | |
| tree | ee67cd048d7b9af2cb4b469ea5393640f0a13154 /gnu/packages/shellutils.scm | |
| parent | fc598e4f49982848b344c59460645b7d439da4fd (diff) | |
gnu: Add starship.
* gnu/packages/shellutils.scm (starship): New variable.
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: Ie454eb5e7e9aa507038bcd8be2052a68ea674533
Diffstat (limited to 'gnu/packages/shellutils.scm')
| -rw-r--r-- | gnu/packages/shellutils.scm | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm index 740c4fab88f..23ed9e22ddb 100644 --- a/gnu/packages/shellutils.scm +++ b/gnu/packages/shellutils.scm | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> | 20 | ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> |
| 21 | ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> | 21 | ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> |
| 22 | ;;; Copyright © 2024 Brian Kubisiak <brian@kubisiak.com> | 22 | ;;; Copyright © 2024 Brian Kubisiak <brian@kubisiak.com> |
| 23 | ;;; Copyright © 2024 Jordan Moore <lockbox@struct.foo> | ||
| 23 | ;;; | 24 | ;;; |
| 24 | ;;; This file is part of GNU Guix. | 25 | ;;; This file is part of GNU Guix. |
| 25 | ;;; | 26 | ;;; |
| @@ -43,6 +44,7 @@ | |||
| 43 | #:use-module (guix packages) | 44 | #:use-module (guix packages) |
| 44 | #:use-module (guix download) | 45 | #:use-module (guix download) |
| 45 | #:use-module (guix git-download) | 46 | #:use-module (guix git-download) |
| 47 | #:use-module (guix build-system cargo) | ||
| 46 | #:use-module (guix build-system copy) | 48 | #:use-module (guix build-system copy) |
| 47 | #:use-module (guix build-system gnu) | 49 | #:use-module (guix build-system gnu) |
| 48 | #:use-module (guix build-system go) | 50 | #:use-module (guix build-system go) |
| @@ -52,6 +54,11 @@ | |||
| 52 | #:use-module (gnu packages base) | 54 | #:use-module (gnu packages base) |
| 53 | #:use-module (gnu packages bison) | 55 | #:use-module (gnu packages bison) |
| 54 | #:use-module (gnu packages check) | 56 | #:use-module (gnu packages check) |
| 57 | #:use-module (gnu packages cmake) | ||
| 58 | #:use-module (gnu packages crates-crypto) | ||
| 59 | #:use-module (gnu packages crates-io) | ||
| 60 | #:use-module (gnu packages crates-vcs) | ||
| 61 | #:use-module (gnu packages crates-windows) | ||
| 55 | #:use-module (gnu packages flex) | 62 | #:use-module (gnu packages flex) |
| 56 | #:use-module (gnu packages golang-build) | 63 | #:use-module (gnu packages golang-build) |
| 57 | #:use-module (gnu packages golang-check) | 64 | #:use-module (gnu packages golang-check) |
| @@ -68,6 +75,7 @@ | |||
| 68 | #:use-module (gnu packages shells) | 75 | #:use-module (gnu packages shells) |
| 69 | #:use-module (gnu packages textutils) | 76 | #:use-module (gnu packages textutils) |
| 70 | #:use-module (gnu packages tmux) | 77 | #:use-module (gnu packages tmux) |
| 78 | #:use-module (gnu packages version-control) | ||
| 71 | #:use-module (gnu packages vim)) | 79 | #:use-module (gnu packages vim)) |
| 72 | 80 | ||
| 73 | (define-public ascii | 81 | (define-public ascii |
| @@ -463,6 +471,149 @@ Shell}, @url{https://www.gnu.org/software/bash/,Bash}, and | |||
| 463 | @url{http://www.mirbsd.org/mksh.htm,mksh}.") | 471 | @url{http://www.mirbsd.org/mksh.htm,mksh}.") |
| 464 | (license license:bsd-3))) | 472 | (license license:bsd-3))) |
| 465 | 473 | ||
| 474 | (define-public starship | ||
| 475 | (package | ||
| 476 | (name "starship") | ||
| 477 | (version "1.21.1") | ||
| 478 | (source | ||
| 479 | (origin | ||
| 480 | (method url-fetch) | ||
| 481 | (uri (crate-uri "starship" version)) | ||
| 482 | (file-name (string-append name "-" version ".tar.gz")) | ||
| 483 | (sha256 | ||
| 484 | (base32 "1ikdy6jwlc36add55acxlba6f009dln9iyz368c1ndbfpgn4n42g")))) | ||
| 485 | (build-system cargo-build-system) | ||
| 486 | (arguments | ||
| 487 | (list | ||
| 488 | #:install-source? #f | ||
| 489 | #:phases | ||
| 490 | #~(modify-phases %standard-phases | ||
| 491 | (add-after 'install 'install-completions | ||
| 492 | (lambda* (#:key native-inputs outputs #:allow-other-keys) | ||
| 493 | (let* ((out (assoc-ref outputs "out")) | ||
| 494 | (starship-bin | ||
| 495 | (if #$(%current-target-system) | ||
| 496 | (search-input-file native-inputs "/bin/starship") | ||
| 497 | (string-append out "/bin/starship"))) | ||
| 498 | (share (string-append out "/share")) | ||
| 499 | (bash-completion-dir | ||
| 500 | (string-append out "/etc/bash-completion.d/")) | ||
| 501 | (zsh-completion-dir | ||
| 502 | (string-append share "/zsh/site-functions/")) | ||
| 503 | (fish-completion-dir | ||
| 504 | (string-append share "/fish/vendor_completions.d/")) | ||
| 505 | (elvish-completion-dir | ||
| 506 | (string-append share "/elvish/lib"))) | ||
| 507 | ;; Make the directories | ||
| 508 | (mkdir-p bash-completion-dir) | ||
| 509 | (mkdir-p zsh-completion-dir) | ||
| 510 | (mkdir-p fish-completion-dir) | ||
| 511 | (mkdir-p elvish-completion-dir) | ||
| 512 | ;; Use the built starship to generate the completions. | ||
| 513 | (with-output-to-file | ||
| 514 | (string-append bash-completion-dir "/starship") | ||
| 515 | (lambda _ (invoke starship-bin "completions" "bash"))) | ||
| 516 | (with-output-to-file | ||
| 517 | (string-append zsh-completion-dir "/_starship") | ||
| 518 | (lambda _(invoke starship-bin "completions" "zsh"))) | ||
| 519 | (with-output-to-file | ||
| 520 | (string-append fish-completion-dir "/starship.fish") | ||
| 521 | (lambda _ (invoke starship-bin "completions" "fish"))) | ||
| 522 | (with-output-to-file | ||
| 523 | (string-append elvish-completion-dir "/starship") | ||
| 524 | (lambda _ (invoke starship-bin "completions" "elvish")))))) | ||
| 525 | ;; Some tests require a writable home directory | ||
| 526 | (add-after 'unpack 'patch-test-shell | ||
| 527 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 528 | ;; search through the rust files and then replace `/bin/sh' | ||
| 529 | ;; with the path to the `/bin/sh' in the drv inputs | ||
| 530 | (let ((rust-files (find-files "." "\\.rs$"))) | ||
| 531 | (for-each (lambda (file) | ||
| 532 | (substitute* file | ||
| 533 | (("/bin/sh") | ||
| 534 | (search-input-file inputs "/bin/sh")))) | ||
| 535 | rust-files)))) | ||
| 536 | ;; Set "HOME" to be located inside the cwd so it is writable | ||
| 537 | ;; for tests checking for user-configs | ||
| 538 | (add-before 'check 'set-test-env-vars | ||
| 539 | (lambda _ | ||
| 540 | (setenv "HOME" | ||
| 541 | (string-append (getcwd) "/.test-home"))))) | ||
| 542 | #:cargo-inputs `(("rust-chrono" ,rust-chrono-0.4) | ||
| 543 | ("rust-clap" ,rust-clap-4) | ||
| 544 | ("rust-clap-complete" ,rust-clap-complete-4) | ||
| 545 | ("rust-deelevate" ,rust-deelevate-0.2) | ||
| 546 | ("rust-dirs" ,rust-dirs-5) | ||
| 547 | ("rust-dunce" ,rust-dunce-1) | ||
| 548 | ("rust-gix" ,rust-gix-0.66) | ||
| 549 | ("rust-gix-features" ,rust-gix-features-0.38) | ||
| 550 | ("rust-guess-host-triple" ,rust-guess-host-triple-0.1) | ||
| 551 | ("rust-home" ,rust-home-0.5) | ||
| 552 | ("rust-indexmap" ,rust-indexmap-2) | ||
| 553 | ("rust-log" ,rust-log-0.4) | ||
| 554 | ("rust-nix" ,rust-nix-0.29) | ||
| 555 | ("rust-notify-rust" ,rust-notify-rust-4) | ||
| 556 | ("rust-nu-ansi-term" ,rust-nu-ansi-term-0.50) | ||
| 557 | ("rust-open" ,rust-open-5) | ||
| 558 | ("rust-os-info" ,rust-os-info-3) | ||
| 559 | ("rust-path-slash" ,rust-path-slash-0.2) | ||
| 560 | ("rust-pest" ,rust-pest-2) | ||
| 561 | ("rust-pest-derive" ,rust-pest-derive-2) | ||
| 562 | ("rust-process-control" ,rust-process-control-5) | ||
| 563 | ("rust-quick-xml" ,rust-quick-xml-0.36) | ||
| 564 | ("rust-rand" ,rust-rand-0.8) | ||
| 565 | ("rust-rayon" ,rust-rayon-1) | ||
| 566 | ("rust-regex" ,rust-regex-1) | ||
| 567 | ("rust-rust-ini" ,rust-rust-ini-0.21) | ||
| 568 | ("rust-schemars" ,rust-schemars-0.8) | ||
| 569 | ("rust-semver" ,rust-semver-1) | ||
| 570 | ("rust-serde" ,rust-serde-1) | ||
| 571 | ("rust-serde-json" ,rust-serde-json-1) | ||
| 572 | ("rust-sha1" ,rust-sha1-0.10) | ||
| 573 | ("rust-shadow-rs" ,rust-shadow-rs-0.35) | ||
| 574 | ("rust-shell-words" ,rust-shell-words-1) | ||
| 575 | ("rust-starship-battery" ,rust-starship-battery-0.10) | ||
| 576 | ("rust-strsim" ,rust-strsim-0.11) | ||
| 577 | ("rust-systemstat" ,rust-systemstat-0.2) | ||
| 578 | ("rust-terminal-size" ,rust-terminal-size-0.4) | ||
| 579 | ("rust-toml" ,rust-toml-0.8) | ||
| 580 | ("rust-toml-edit" ,rust-toml-edit-0.22) | ||
| 581 | ("rust-unicode-segmentation" ,rust-unicode-segmentation-1) | ||
| 582 | ("rust-unicode-width" ,rust-unicode-width-0.2) | ||
| 583 | ("rust-urlencoding" ,rust-urlencoding-2) | ||
| 584 | ("rust-versions" ,rust-versions-6) | ||
| 585 | ("rust-which" ,rust-which-6) | ||
| 586 | ("rust-whoami" ,rust-whoami-1) | ||
| 587 | ("rust-windows" ,rust-windows-0.58) | ||
| 588 | ("rust-winres" ,rust-winres-0.1) | ||
| 589 | ("rust-yaml-rust2" ,rust-yaml-rust2-0.9)) | ||
| 590 | #:cargo-development-inputs `(("rust-mockall" ,rust-mockall-0.13) | ||
| 591 | ("rust-tempfile" ,rust-tempfile-3)))) | ||
| 592 | (inputs (list cmake-minimal)) | ||
| 593 | (native-inputs | ||
| 594 | (append | ||
| 595 | (if (%current-target-system) | ||
| 596 | (list this-package) | ||
| 597 | '()) | ||
| 598 | (list git-minimal))) | ||
| 599 | (home-page "https://starship.rs") | ||
| 600 | (synopsis | ||
| 601 | "The minimal, blazing-fast, and infinitely customizable prompt for any shell!") | ||
| 602 | (description | ||
| 603 | "This package provides The minimal, blazing-fast, and infinitely customizable | ||
| 604 | prompt for any shell! | ||
| 605 | |||
| 606 | @itemize | ||
| 607 | @item Fast: it's fast - *really really* fast :rocket: | ||
| 608 | @item Customizable: configure every aspect of your prompt | ||
| 609 | @item Universal: works on any shell, on any operating system | ||
| 610 | @item Intelligent: shows relevant information at a glance | ||
| 611 | @item Feature rich: support for all your favorite tools | ||
| 612 | @item Easy: quick to install - start using it in minutes | ||
| 613 | @end itemize | ||
| 614 | |||
| 615 | Note: users must have a nerd font installed and enabled in their terminal") | ||
| 616 | (license license:isc))) | ||
| 466 | 617 | ||
| 467 | (define-public envstore | 618 | (define-public envstore |
| 468 | (package | 619 | (package |
