diff mbox

Hack font family for GuixSD.

Message ID CAH3JXcHG1PMKXAr+ikmkE=9TdMgJMn1xW1XN2HfdwmmFCX62TQ@mail.gmail.com
State New
Headers show

Commit Message

Dmitry Nikolaev June 2, 2016, 5:13 a.m. UTC
Hi. I wrote expression for adding Hack font family to GuixSD. You can see
it my guix package repository:

https://github.com/8p8c/my-guix/blob/master/packages/font-hack.scm

Here is patch for fonts.scm:

+    (native-inputs `(("source" ,source)
+                     ("unzip" ,unzip)))
+    (home-page "https://sourcefoundry.org/hack/")
+    (synopsis "A typeface designed for sourcecode.")
+    (description "The Hack Font is designed for the screen.")
+    (license
+     (license:non-copyleft ;;FIXME
+      "https://github.com/chrissimpkins/Hack/blob/master/LICENSE.md"
+      "Hack Open Font License v2.0"))))

But there are two FIXME issues. First with URI string generation. Sorry, I
haven't mastered Scheme yet:

              (uri (string-append
                    "
https://github.com/chrissimpkins/Hack/releases/download/v"
                    version
                    "/Hack-v"
                    "2_020" ;; FIXME. This should be generated from version
"2.020"
                    "-ttf.zip"))

And second with licence. I've marked it as non-copyleft, but I'm not sure
about it:

    (license
     (license:non-copyleft ;;FIXME
      "https://github.com/chrissimpkins/Hack/blob/master/LICENSE.md"
      "Hack Open Font License v2.0"))

Dmitry

Comments

=?utf-8?B?5a6L5paH5q2m?= June 2, 2016, 11:55 a.m. UTC | #1
Dmitry Nikolaev <cameltheman@gmail.com> writes:

> Hi. I wrote expression for adding Hack font family to GuixSD. You can
> see it my guix package repository:
>
> https://github.com/8p8c/my-guix/blob/master/packages/font-hack.scm
>
> Here is patch for fonts.scm:

The indention is missing, you can get the patch from git by:

git format-patch -1 <commit>

And attach it in the mail.
>
> --- fonts.scm 2016-06-02 08:01:49.387086500 +0300
> +++ fonts.new.scm 2016-06-02 08:05:30.005373478 +0300
> @@ -9,6 +9,7 @@
> ;;; Copyright © 2016 Nils Gillmann <niasterisk@grrlz.net>
> ;;; Copyright © 2016 Jookia <166291@gmail.com>
> ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
> +;;; Copyright © 2016 Dmitry Nikolaev <cameltheman@gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -921,3 +922,54 @@
> (home-page "https://fontlibrary.org/en/font/fantasque-sans-mono")
> (license license:silofl1.1)))
>
> +(define-public font-hack
> + (package
> + (name "font-hack")
> + (version "2.020")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append
> + "https://github.com/chrissimpkins/Hack/releases/download/v"
> + version
> + "/Hack-v"
> + "2_020" ;; FIXME
> + "-ttf.zip"))
> + (sha256
> + (base32
> + "16kkmc3psckw1b7k07ccn1gi5ymhlg9djh43nqjzg065g6p6d184"))))
> + (build-system trivial-build-system)
> + (arguments
> + `(#:modules ((guix build utils))
> + #:builder (begin
> + (use-modules (guix build utils)
> + (srfi srfi-26))
> +
> + (let ((PATH (string-append (assoc-ref %build-inputs
> + "unzip")
> + "/bin"))
> + (font-dir (string-append %output
> + "/share/fonts/truetype"))
> + (doc-dir (string-append %output "/share/doc/"
> + ,name "-" ,version)))
> + (setenv "PATH" PATH)
> + (system* "unzip" (assoc-ref %build-inputs "source"))
> +
> + (mkdir-p font-dir)
> + (mkdir-p doc-dir)
> + (for-each (lambda (ttf)
> + (copy-file ttf
> + (string-append font-dir "/" ttf)))
> + (find-files "." "\\.ttf$"))
> + (for-each (lambda (doc)
> + (copy-file doc
> + (string-append doc-dir "/" doc)))
> + (find-files "." "\\.txt$"))))))
> + (native-inputs `(("source" ,source)
> + ("unzip" ,unzip)))
> + (home-page "https://sourcefoundry.org/hack/")
> + (synopsis "A typeface designed for sourcecode.")
Don't include the leading 'A'.

> + (description "The Hack Font is designed for the screen.")
Could expand it a bit, how about:

"Hack is designed to be a workhorse typeface for code, it expands
upon the Bitstream Vera & DejaVu projects, provides 1561 glyphs
including powerline support."

> + (license
> + (license:non-copyleft ;;FIXME
> + "https://github.com/chrissimpkins/Hack/blob/master/LICENSE.md"
> + "Hack Open Font License v2.0"))))
>
> But there are two FIXME issues. First with URI string generation.
> Sorry, I haven't mastered Scheme yet:
>
> (uri (string-append
> "https://github.com/chrissimpkins/Hack/releases/download/v"
> version
> "/Hack-v"
> "2_020" ;; FIXME. This should be generated from version "2.020"
> "-ttf.zip"))
You can use:  `(string-replace-substring version "." "_")', which
is the (guix utils) module.  (I find the behavior of `string-replace'
builtin in Guile a bit suprised.. while the string-replace procudure
in Racket actually is our string-replace-substring as I except.)

>
> And second with licence. I've marked it as non-copyleft, but I'm not
> sure about it:
>
> (license
> (license:non-copyleft ;;FIXME
> "https://github.com/chrissimpkins/Hack/blob/master/LICENSE.md"
> "Hack Open Font License v2.0"))
This license looks the same as Bitstream Vera font, which
use "license:x11-style".


Could you send a update?  Thanks!
diff mbox

Patch

--- fonts.scm    2016-06-02 08:01:49.387086500 +0300
+++ fonts.new.scm    2016-06-02 08:05:30.005373478 +0300
@@ -9,6 +9,7 @@ 
 ;;; Copyright © 2016 Nils Gillmann <niasterisk@grrlz.net>
 ;;; Copyright © 2016 Jookia <166291@gmail.com>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2016 Dmitry Nikolaev <cameltheman@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -921,3 +922,54 @@ 
     (home-page "https://fontlibrary.org/en/font/fantasque-sans-mono")
     (license license:silofl1.1)))

+(define-public font-hack
+  (package
+    (name "font-hack")
+    (version "2.020")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "
https://github.com/chrissimpkins/Hack/releases/download/v"
+                    version
+                    "/Hack-v"
+                    "2_020" ;; FIXME
+                    "-ttf.zip"))
+              (sha256
+               (base32
+                "16kkmc3psckw1b7k07ccn1gi5ymhlg9djh43nqjzg065g6p6d184"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+                 #:builder (begin
+                             (use-modules (guix build utils)
+                                          (srfi srfi-26))
+
+                             (let ((PATH     (string-append (assoc-ref
%build-inputs
+
"unzip")
+                                                            "/bin"))
+                                   (font-dir (string-append %output
+
"/share/fonts/truetype"))
+                                   (doc-dir  (string-append %output
"/share/doc/"
+                                                            ,name "-"
,version)))
+                               (setenv "PATH" PATH)
+                               (system* "unzip" (assoc-ref %build-inputs
"source"))
+
+                               (mkdir-p font-dir)
+                               (mkdir-p doc-dir)
+                               (for-each (lambda (ttf)
+                                           (copy-file ttf
+                                                      (string-append
font-dir "/" ttf)))
+                                         (find-files "." "\\.ttf$"))
+                               (for-each (lambda (doc)
+                                           (copy-file doc
+                                                      (string-append
doc-dir "/" doc)))
+                                         (find-files "." "\\.txt$"))))))