aboutsummaryrefslogtreecommitdiff
path: root/km-packages/git-annex.scm
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-02-06 23:16:24 -0500
committerKyle Meyer <kyle@kyleam.com>2019-02-06 23:16:24 -0500
commitb8aa1b43704c97a18396b88686328d82a1f05af9 (patch)
treec775af09e3000f0d90b96f36111761e39027d5d6 /km-packages/git-annex.scm
downloadguix-packages-b8aa1b43704c97a18396b88686328d82a1f05af9.tar.gz
Initial import
Diffstat (limited to 'km-packages/git-annex.scm')
-rw-r--r--km-packages/git-annex.scm161
1 files changed, 161 insertions, 0 deletions
diff --git a/km-packages/git-annex.scm b/km-packages/git-annex.scm
new file mode 100644
index 0000000..e72ef4e
--- /dev/null
+++ b/km-packages/git-annex.scm
@@ -0,0 +1,161 @@
+;;; git-annex.scm --- custom Guix packages for git-annex
+;;;
+;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
+;;;
+;;; This file is NOT part of GNU Guix.
+;;;
+;;; This program is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program. If not, see
+;;; <https://www.gnu.org/licenses/>.
+
+(define-module (km-packages git-annex)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages haskell)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system haskell)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (ice-9 popen)
+ #:use-module (ice-9 rdelim))
+
+(define %source-dir
+ (string-append (getenv "HOME") "/src/haskell/git-annex"))
+
+;; Copied from guile-daemon.
+(define (git-output . args)
+ "Execute 'git ARGS ...' command and return its output without trailing
+newspace."
+ (with-directory-excursion %source-dir
+ (let* ((port (apply open-pipe* OPEN_READ "git" args))
+ (output (read-string port)))
+ (close-port port)
+ (string-trim-right output #\newline))))
+
+(define (current-commit)
+ (git-output "rev-parse" "HEAD"))
+
+(define-public ghc-concurrent-output
+ (package
+ (name "ghc-concurrent-output")
+ (version "1.10.9")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://hackage.haskell.org/package/concurrent-output/concurrent-output-"
+ version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "0mwf155w89nbbkjln7hhbn8k3f8p0ylcvgrg31cm7ijpx4499i4c"))))
+ (build-system haskell-build-system)
+ (inputs
+ `(("ghc-text" ,ghc-text)
+ ("ghc-async" ,ghc-async)
+ ("ghc-stm" ,ghc-stm)
+ ("ghc-exceptions" ,ghc-exceptions)
+ ("ghc-ansi-terminal" ,ghc-ansi-terminal)
+ ("ghc-terminal-size" ,ghc-terminal-size)))
+ (home-page
+ "http://hackage.haskell.org/package/concurrent-output")
+ (synopsis
+ "Ungarble output from several threads or commands")
+ (description
+ "Lets multiple threads and external processes concurrently output
+to the console, without it getting all garbled up. . Built on top of
+that is a way of defining multiple output regions, which are
+automatically laid out on the screen and can be individually updated
+by concurrent threads. Can be used for progress displays etc. .
+<<https://joeyh.name/code/concurrent-output/demo2.gif>>")
+ (license license:bsd-2)))
+
+(define-public ghc-magic
+ (package
+ (name "ghc-magic")
+ (version "1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://hackage.haskell.org/package/magic/magic-"
+ version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "10p0gjjjwr1dda7hahwrwn5njbfhl67arq3v3nf1jr3vymlkn75j"))))
+ (build-system haskell-build-system)
+ (home-page
+ "http://hackage.haskell.org/package/magic")
+ (synopsis "Interface to C file/magic library")
+ (description
+ "This package provides a Haskell interface to the C libmagic
+library. With it, you can determine the type of a file by examining
+its contents rather than its name. The Haskell interface provides a
+full-featured binding.")
+ ;; TODO: check
+ (license license:bsd-2)))
+
+(define-public git-annex-dev
+ (let ((commit (current-commit)))
+ (package
+ (inherit git-annex)
+ (name "git-annex-dev")
+ (version (string-append "000-" (string-take commit 7)))
+ (source (local-file %source-dir
+ #:recursive? #t
+ #:select? (git-predicate %source-dir)))
+ (arguments
+ `(#:tests? #f
+ ,@(substitute-keyword-arguments (package-arguments git-annex)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'factor-setup 'delete-setup
+ (lambda _
+ ;; Otherwise get write error because is read-only.
+ (delete-file "Setup.hs")
+ #t))
+ (delete 'check))))))
+ (inputs `(("ghc-concurrent-output" ,ghc-concurrent-output)
+ ("ghc-magic" ,ghc-magic)
+ ,@(package-inputs git-annex))))))
+
+;; The package in Guix has an outstanding issue with shebangs in
+;; hooks.
+(define-public git-annex-latest
+ (package
+ (inherit git-annex)
+ (name "git-annex-latest")
+ (version "7.20190129")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://hackage.haskell.org/package/"
+ "git-annex/git-annex-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0gsi1ymv7dmx429vhv58979hfh23zrfvrsam6saf16ckh5hd0n81"))))
+ (arguments
+ `(#:tests? #f
+ ,@(substitute-keyword-arguments (package-arguments git-annex)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'check)
+ (delete 'patch-shell))))))
+ (inputs `(("ghc-concurrent-output" ,ghc-concurrent-output)
+ ("ghc-magic" ,ghc-magic)
+ ,@(package-inputs git-annex)))))