aboutsummaryrefslogtreecommitdiff
path: root/.guix/modules/guix-package.scm
blob: bda9204b67978ef8e030893106f4e102f41aac68 (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
(define-module (genenetwork-auth)
  #:use-module (guix)
  #:use-module (guix git-download)
  #:use-module (guix build-system python)
  #:use-module ((guix licenses) #:prefix license:)

  #:use-module (git oid)
  #:use-module (git bindings)
  #:use-module (git reference)
  #:use-module (git repository)


  ;; Packages from guix
  #:use-module (gnu packages check)

  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-crypto)

  #:use-module (gnu packages databases)


  ;; Packages from guix-bioinformatics
  #:use-module (gn packages python-web))

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

(define (get-commit)
  "Retrieve the commit if the source directory is a repository."
  (if (git-predicate %source-dir)
      (begin (let ((commit #f))
	       (libgit2-init!)
	       (set! commit (oid->string
			     (reference-target
			      (repository-head (repository-open %source-dir)))))
	       (libgit2-shutdown!)
	       commit))
      "NOTAREPOSITORY"))

(define (get-latest-version)
  "Get latest version tag from repository."
  ;; TODO: Implement
  "v0.0.0")

(define vcs-file?
  (or (git-predicate %source-dir)
      (const #t)))

(package
 (name "genenetwork-auth")
 (version (string-append (get-latest-version)
			 "-git-"
			 (substring (get-commit) 0 9)))
 (source (local-file %source-dir "genenetwork-auth-checkout"
		     #:recursive? #t
		     #:select? vcs-file?))
 (build-system python-build-system)
 ;; (inputs (list))
 (native-inputs
  (list python-pytest
	python-pylint))
 (propagated-inputs
  (list python-flask
	python-authlib
	yoyo-migrations
	python-argon2-cffi
	python-email-validator))
 (home-page "https://github.com/genenetwork/gn-auth")
 (synopsis "Authentication and Authorisation server for GeneNetwork services.")
 (description "Authentication and Authorisation server for GeneNetwork services.")
 (license license:agpl3+))