guix-modular.scm 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. ;;;
  19. ;;; This file defines a continuous integration job to build the same modular
  20. ;;; Guix as 'guix pull', which is defined in (guix self).
  21. ;;;
  22. (use-modules (guix store)
  23. (guix config)
  24. (guix utils)
  25. ((guix packages) #:select (%hydra-supported-systems))
  26. (guix derivations)
  27. (guix monads)
  28. ((guix licenses) #:prefix license:)
  29. (srfi srfi-1)
  30. (ice-9 match))
  31. ;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output
  32. ;; port to the bit bucket, let us write to the error port instead.
  33. (setvbuf (current-error-port) 'line)
  34. (set-current-output-port (current-error-port))
  35. (define* (build-job store source version system)
  36. "Return a Hydra job a list building the modular Guix derivation from SOURCE
  37. for SYSTEM. Use VERSION as the version identifier."
  38. (lambda ()
  39. (define build
  40. (primitive-load (string-append source "/build-aux/build-self.scm")))
  41. (let ((drv (run-with-store store
  42. (build source #:version version #:system system
  43. #:pull-version 1
  44. #:guile-version "2.2"))))
  45. `((derivation . ,(derivation-file-name drv)) ;the latest 2.2.x
  46. (log . ,(log-file store (derivation-file-name drv)))
  47. (outputs . ,(filter-map (lambda (res)
  48. (match res
  49. ((name . path)
  50. `(,name . ,path))))
  51. (derivation->output-paths drv)))
  52. (nix-name . ,(derivation-name drv))
  53. (system . ,(derivation-system drv))
  54. (description . "Modular Guix")
  55. (long-description
  56. . "This is the modular Guix package as produced by 'guix pull'.")
  57. (license . ,license:gpl3+)
  58. (home-page . ,%guix-home-page-url)
  59. (maintainers . (,%guix-bug-report-address))))))
  60. (define (hydra-jobs store arguments)
  61. "Return Hydra jobs."
  62. (define systems
  63. (match (assoc-ref arguments 'systems)
  64. (#f %hydra-supported-systems)
  65. ((lst ...) lst)
  66. ((? string? str) (call-with-input-string str read))))
  67. (define guix-checkout
  68. (or (assq-ref arguments 'guix) ;Hydra on hydra
  69. (assq-ref arguments 'guix-modular))) ;Cuirass on berlin
  70. (define version
  71. (or (assq-ref guix-checkout 'revision)
  72. "0.unknown"))
  73. (let ((file (assq-ref guix-checkout 'file-name)))
  74. (format (current-error-port) "using checkout ~s (~s; arguments: ~s)~%"
  75. guix-checkout file arguments)
  76. (map (lambda (system)
  77. (let ((name (string->symbol
  78. (string-append "guix." system))))
  79. `(,name
  80. . ,(build-job store file version system))))
  81. systems)))