manifest_codesign.scm raw

   1  (use-modules ((gnu packages bash) #:select (bash-minimal))
   2               ((gnu packages compression) #:select (gzip zip))
   3               ((gnu packages crypto) #:select (osslsigncode))
   4               ((gnu packages python-build) #:select (python-poetry-core))
   5               ((gnu packages python-crypto) #:select (python-asn1crypto python-oscrypto))
   6               ((gnu packages tls) #:select (openssl))
   7               ((gnu packages version-control) #:select (git-minimal))
   8               (guix build-system python)
   9               (guix build-system pyproject)
  10               (guix git-download)
  11               ((guix licenses) #:prefix license:)
  12               (guix packages))
  13  
  14  (define-public python-elfesteem
  15    (let ((commit "2eb1e5384ff7a220fd1afacd4a0170acff54fe56"))
  16      (package
  17        (name "python-elfesteem")
  18        (version (git-version "0.1" "1" commit))
  19        (source
  20         (origin
  21           (method git-fetch)
  22           (uri (git-reference
  23                 (url "https://github.com/LRGH/elfesteem")
  24                 (commit commit)))
  25           (file-name (git-file-name name commit))
  26           (sha256
  27            (base32
  28             "07x6p8clh11z8s1n2kdxrqwqm2almgc5qpkcr9ckb6y5ivjdr5r6"))))
  29        (build-system python-build-system)
  30        ;; There are no tests, but attempting to run python setup.py test leads to
  31        ;; PYTHONPATH problems, just disable the test
  32        (arguments '(#:tests? #f))
  33        (home-page "https://github.com/LRGH/elfesteem")
  34        (synopsis "ELF/PE/Mach-O parsing library")
  35        (description "elfesteem parses ELF, PE and Mach-O files.")
  36        (license license:lgpl2.1))))
  37  
  38  (define-public python-oscryptotests
  39    (package (inherit python-oscrypto)
  40      (name "python-oscryptotests")
  41      (propagated-inputs
  42        (list python-oscrypto))
  43      (arguments
  44       `(#:tests? #f
  45         #:phases
  46         (modify-phases %standard-phases
  47           (add-after 'unpack 'hard-code-path-to-libscrypt
  48             (lambda* (#:key inputs #:allow-other-keys)
  49               (chdir "tests")
  50               #t)))))))
  51  
  52  (define-public python-certvalidator
  53    (let ((commit "a145bf25eb75a9f014b3e7678826132efbba6213"))
  54      (package
  55        (name "python-certvalidator")
  56        (version (git-version "0.1" "1" commit))
  57        (source
  58         (origin
  59           (method git-fetch)
  60           (uri (git-reference
  61                 (url "https://github.com/achow101/certvalidator")
  62                 (commit commit)))
  63           (file-name (git-file-name name commit))
  64           (sha256
  65            (base32
  66             "1qw2k7xis53179lpqdqyylbcmp76lj7sagp883wmxg5i7chhc96k"))))
  67        (build-system python-build-system)
  68        (propagated-inputs
  69          (list openssl
  70                python-asn1crypto
  71                python-oscrypto
  72                python-oscryptotests)) ;; certvalidator tests import oscryptotests
  73        (arguments
  74         `(#:phases
  75           (modify-phases %standard-phases
  76             (add-after 'unpack 'disable-broken-tests
  77               (lambda _
  78                 (substitute* "tests/test_certificate_validator.py"
  79                   (("^(.*)class CertificateValidatorTests" line indent)
  80                    (string-append indent
  81                                   "@unittest.skip(\"Disabled by Guix\")\n"
  82                                   line)))
  83                 (substitute* "tests/test_crl_client.py"
  84                   (("^(.*)def test_fetch_crl" line indent)
  85                    (string-append indent
  86                                   "@unittest.skip(\"Disabled by Guix\")\n"
  87                                   line)))
  88                 (substitute* "tests/test_ocsp_client.py"
  89                   (("^(.*)def test_fetch_ocsp" line indent)
  90                    (string-append indent
  91                                   "@unittest.skip(\"Disabled by Guix\")\n"
  92                                   line)))
  93                 (substitute* "tests/test_registry.py"
  94                   (("^(.*)def test_build_paths" line indent)
  95                    (string-append indent
  96                                   "@unittest.skip(\"Disabled by Guix\")\n"
  97                                   line)))
  98                 (substitute* "tests/test_validate.py"
  99                   (("^(.*)def test_revocation_mode_hard" line indent)
 100                    (string-append indent
 101                                   "@unittest.skip(\"Disabled by Guix\")\n"
 102                                   line)))
 103                 (substitute* "tests/test_validate.py"
 104                   (("^(.*)def test_revocation_mode_soft" line indent)
 105                    (string-append indent
 106                                   "@unittest.skip(\"Disabled by Guix\")\n"
 107                                   line)))
 108                 #t))
 109             (replace 'check
 110               (lambda _
 111                 (invoke "python" "run.py" "tests")
 112                 #t)))))
 113        (home-page "https://github.com/wbond/certvalidator")
 114        (synopsis "Python library for validating X.509 certificates and paths")
 115        (description "certvalidator is a Python library for validating X.509
 116  certificates or paths. Supports various options, including: validation at a
 117  specific moment in time, whitelisting and revocation checks.")
 118        (license license:expat))))
 119  
 120  (define-public python-signapple
 121    (let ((commit "3fab3bb57f227f0dd31007b417683035f5204838"))
 122      (package
 123        (name "python-signapple")
 124        (version (git-version "0.2.0" "1" commit))
 125        (source
 126         (origin
 127           (method git-fetch)
 128           (uri (git-reference
 129                 (url "https://github.com/achow101/signapple")
 130                 (commit commit)))
 131           (file-name (git-file-name name commit))
 132           (sha256
 133            (base32
 134             "0qpr78bs50rw79dbihr9ifjq19y6819ih5pn9jd2rbjyifimzf7p"))))
 135        (build-system pyproject-build-system)
 136        (propagated-inputs
 137          (list python-asn1crypto
 138                python-oscrypto
 139                python-certvalidator
 140                python-elfesteem))
 141        (native-inputs (list python-poetry-core))
 142        (arguments
 143         ;; There are no tests, but attempting to run python setup.py test leads to
 144         ;; problems, just disable the test
 145         (list #:tests? #f
 146               #:phases
 147               #~(modify-phases %standard-phases
 148                   ;; Add a phase to inject OpenSSL paths for oscrypto.
 149                   (add-after 'wrap 'wrap-openssl-paths
 150                     (lambda* (#:key inputs #:allow-other-keys)
 151                       (let ((openssl (assoc-ref inputs "openssl")))
 152                         (wrap-program (string-append #$output "/bin/signapple")
 153                           `("SIGNAPPLE_OSCRYPTO_SSL_PATHS" =
 154                             (,(string-append openssl "/lib/libcrypto.so" "," openssl "/lib/libssl.so"))))))))))
 155        (home-page "https://github.com/achow101/signapple")
 156        (synopsis "Mach-O binary signature tool")
 157        (description "signapple is a Python tool for creating, verifying, and
 158  inspecting signatures in Mach-O binaries.")
 159        (license license:expat))))
 160  
 161  (packages->manifest
 162   (append
 163    (list ;; The Basics
 164          bash-minimal
 165          coreutils-minimal
 166          ;; File(system) inspection
 167          findutils
 168          ;; Compression and archiving
 169          tar
 170          gzip
 171          zip
 172          ;; Git
 173          git-minimal)
 174    (let ((target (getenv "HOST")))
 175      (cond ((string-suffix? "-mingw32" target)
 176             (list osslsigncode))
 177            ((string-contains target "darwin")
 178             (list python-signapple))
 179            (else '())))))
 180