summaryrefslogtreecommitdiff
path: root/contrib/guix.scm
blob: 1967484dd360b34ad387748f0103189658d574f8 (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
;; Guix package for marginaltool. To build or install, run from the toplevel directory:
;;
;;   guix build --file=contrib/guix.scm
;;   guix package --install-from-file=contrib/guix.scm
;;
;; To create and enter a development environment:
;;
;;   guix environment --pure --load=contrib/guix.scm

(define-module (marginaltool)
  #:use-module (gnu)
  #:use-module (guix build-system gnu)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages python)
  #:use-module (gnu packages security-token)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages version-control))

(define %source-dir (dirname (dirname (current-filename))))

(define (git-version directory)
  (with-directory-excursion directory
    (read-line (open-pipe* OPEN_READ "git" "describe" "--always" "--tags"))))

(define-public marginaltool
  (package
    (name "marginaltool")
    (version "master")
    (source
     (local-file %source-dir #:recursive? #t #:select? (git-predicate %source-dir)))
    (build-system gnu-build-system)
    (arguments
     (list
      #:make-flags #~(list (string-append "PREFIX=" #$output))
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key inputs #:allow-other-keys)
              (for-each (lambda (binary)
                          (substitute* "marginaltool"
                            ((binary) (search-input-file inputs (string-append "/bin/" binary)))))
                        '("openssl" "pkcs11-tool"))))
          (delete 'build))))
    (inputs
     (list openssl opensc))
    (propagated-inputs
     (list `(,python "tk")))
    (home-page "https://sr.ht/~jetomit/marginaltool")
    (synopsis "MargTools replacement")
    (description "Python script to replace MargTools.
Can be used to sign documents with GovernmentConnect.")
    (license license:unlicense)))

marginaltool