Skip to content

Instantly share code, notes, and snippets.

@ivangrozni
Last active August 10, 2019 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivangrozni/734c74e4f3836044f857d8f864ff4bf1 to your computer and use it in GitHub Desktop.
Save ivangrozni/734c74e4f3836044f857d8f864ff4bf1 to your computer and use it in GitHub Desktop.
dasht guix package
(define-module (dasht dasht)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
#:use-module (guix git-download)
;; Should I list all dependencies here as well? yes.
#:use-module (gnu packages sqlite)
#:use-module (gnu packages wget)
#:use-module (gnu packages w3m)
#:use-module (gnu packages networking))
(define-public dasht
(package
(name "dasht")
(version "v2.3.0")
(source
(origin (method git-fetch)
(uri (git-reference
(url "https://github.com/sunaku/dasht")
(commit "v2.3.0")))
(file-name (git-file-name name "v2.3.0"))
;; how to determine sha256sum from code - which branch/commit?
;; git checkout v2.3.0 && guix hash -rx .
(sha256 (base32 "0d0pcjalba58nvxdgn39m4b6n9ifajf3ygyjaqgvzwxzgpzw0a60"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases
%standard-phases
(delete 'configure)
(replace 'install
(lambda*
(#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")))
(for-each
(lambda (file)
(install-file file bin)
(wrap-program
(string-append bin "/" (basename file)) `("PATH" ":" prefix (,(getenv "PATH"))))
)
(find-files "./bin" "dasht.*")
)
(mkdir-p (string-append out "share/man/man1"))
(copy-recursively "./man/man1" (string-append out "/share/man/man1/"))
) ;; not sure if out should be here or only path to bin folder
;; copy man to man
;; check if zsh exists and copy etc there as well
)
)
(delete 'build)
)
)
)
(synopsis "Search API docs offline, in terminal or browser")
(description
"dasht is a collection of shell scripts for searching, browsing, and managing API documentation (in the form of 150+ offline documentation sets, courtesy of Dash for OS X) all from the comfort of your own terminal!
The name \"dasht\" is a portmanteau of Dash and the letter \"t\", for terminal. Etymologically, \"dasht\" is Persian for plain, as in an flat expanse of land, which aptly characterizes the terminal environment where everything is text.")
(home-page "https://github.com/sunaku/dasht")
(license isc)
(propagated-inputs
`(("w3m" ,w3m)
("sqlite" ,sqlite)
("wget" ,wget)
("socat" ,socat)
))))
dasht
@rekado
Copy link

rekado commented Aug 10, 2019

(define-module (dasht)
  #:use-module (guix packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses)
  #:use-module (guix git-download)
  ;; Should I list all dependencies here as well? yes.
  
  ;; Answer: these are the modules containing the definitions of the
  ;; package variables you are referencing in the "inputs" field
  ;; below.
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages wget)
  #:use-module (gnu packages w3m)
  #:use-module (gnu packages networking))

(define-public dasht
  (package
   (name "dasht")
   (version "2.3.0")
   (source (origin
             (method git-fetch)
             (uri (git-reference
		           (url "https://github.com/sunaku/dasht")
		           (commit (string-append "v" version))))
	         (file-name (git-file-name name version))
	         (sha256
              (base32
               "0d0pcjalba58nvxdgn39m4b6n9ifajf3ygyjaqgvzwxzgpzw0a60"))))
   (build-system gnu-build-system)
   (arguments
    `(#:tests? #f ; there are none
      #:phases
      (modify-phases %standard-phases
        (delete 'configure)
        (delete 'build)
        (replace 'install
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((out (assoc-ref outputs "out"))
                   (bin (string-append out "/bin")))

              ;; Install all scripts and wrap them in PATH
              (for-each (lambda (file)
                          (install-file file bin)
                          (wrap-program (string-append bin "/" (basename file))
                            `("PATH" ":" prefix (,(getenv "PATH")))))
                        (find-files "./bin" "dasht.*"))

              ;; Install the man pages.
              (let ((man (string-append out "/share/man/man1")))
                (mkdir-p man)
                (copy-recursively "man/man1" man))

              ;; Install Zsh goodies.
              (let ((etc (string-append out "/etc")))
                (mkdir-p etc)
                (copy-recursively "etc" etc))
              #t))))))
   (inputs
    `(("w3m" ,w3m)
      ("sqlite" ,sqlite)
      ("wget" ,wget)
      ("socat" ,socat)))
   (home-page "https://github.com/sunaku/dasht")
   (synopsis "Search API docs offline, in terminal or browser")
   (description
    "Dasht is a collection of shell scripts for searching, browsing,
and managing API documentation (in the form of 150+ offline
documentation sets) all from the comfort of your own terminal!  The
name \"dasht\" is a portmanteau of Dash and the letter \"t\", for
terminal.")
   (license isc)))

dasht

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment