summaryrefslogtreecommitdiff
path: root/guix/vkraus/packages/email-key-rotation.scm
blob: 4cbcc70c76961c4271fdeb3267f5ec173d23b8c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(define-module (vkraus packages email-key-rotation)
  #:use-module (guix packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix git-download)
  #:use-module (guix build-system guile)
  #:use-module (guix gexp)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages tls)
  #:declarative? #t)

(define-public email-key-rotation
  (package
    (name "email-key-rotation")
    (version "0.0.7")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
	     (url "https://labo.planete-kraus.eu/email-key-rotation.git")
	     (commit version)))
       (sha256
        (base32
         "0rq4v80hdnsm6nxls31jj2pvypkap2s2fn646qxwfpraql50mck8"))))
    (build-system guile-build-system)
    (outputs (list "out" "updated-po"))
    (arguments
     (list
      #:source-directory "guile"
      #:phases
      #~(modify-phases
	    %standard-phases
	  (add-after 'unpack 'set-openssl-binary
	    (lambda* (#:key inputs #:allow-other-keys)
	      (substitute*
	          "guile/email-key-rotation/openssl.scm"
	        (("/usr/bin/openssl")
	         (search-input-file inputs "bin/openssl")))))
          (add-after 'unpack 'set-localedir
            (lambda _
              (substitute* "guile/email-key-rotation.scm"
                (("/usr/local/share/locale")
                 (string-append #$output "/share/locale")))))
          (add-after 'build 'generate-pot
            (lambda _
              (apply invoke "xgettext"
                     "-o" (string-append "po/" #$name ".pot")
                     "-L" "Scheme"
                     "-kG_"
                     (find-files "guile" "\\.scm$"))))
          (add-after 'generate-pot 'merge-po
            (lambda _
              (mkdir-p #$output:updated-po)
              (for-each
               (lambda (po-file)
                 (let ((merged-po-file
                        (string-append #$output:updated-po
                                       "/" (basename po-file))))
                   (invoke "msgmerge" "-o" merged-po-file po-file (string-append "po/" #$name ".pot"))))
               (find-files "po" "\\.po$"))))
          (add-after 'merge-po 'compile-po
            (lambda _
              (for-each
               (lambda (po-file)
                 (let ((locale (basename po-file ".po")))
                   (let ((output-file
                          (string-append
                           #$output "/share/locale/"
                           locale "/LC_MESSAGES/" #$name ".mo")))
                     (mkdir-p (dirname output-file))
                     (invoke "msgfmt" "-o" output-file po-file))))
               (find-files #$output:updated-po "\\.po$")))))))
   (native-inputs
    (list guile-3.0 gnu-gettext))
   (inputs
    (list guile-3.0 openssl))
   (propagated-inputs
    (list guile-json-4))
   (home-page "https://labo.planete-kraus.eu/email-key-rotation.git")
   (synopsis "A simple library to help rotate DKIM and SRS secrets")
   (description
    "This package can help rotate DKIM keys and SRS secrets, and
 publish DNS records to Gandi LiveDNS.")
   (license license:agpl3+)))