-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguix.scm
More file actions
152 lines (135 loc) · 5.04 KB
/
guix.scm
File metadata and controls
152 lines (135 loc) · 5.04 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
;; guix.scm
;; SPDX-License-Identifier: PMPL-1.0-or-later
;;
;; GNU Guix package definition for tma-mark2
;; Primary build system - Nix is fallback
;;
;; Usage:
;; guix build -f guix.scm
;; guix shell -m guix.scm
;; guix pack -f docker -S /bin=bin tma-mark2
(use-modules (guix packages)
(guix download)
(guix git-download)
(guix build-system gnu)
(guix build-system cargo)
(guix gexp)
((guix licenses) #:prefix license:)
(gnu packages)
(gnu packages base)
(gnu packages compression)
(gnu packages certs)
(gnu packages erlang)
(gnu packages rust)
(gnu packages rust-apps)
(gnu packages tls)
(gnu packages ncurses)
(gnu packages image)
(gnu packages pdf)
(gnu packages fonts)
(gnu packages security-token)
(gnu packages linux)
(gnu packages vpn))
(define-public tma-mark2
(package
(name "tma-mark2")
(version "2.0.0")
(source (local-file "." "tma-mark2-checkout"
#:recursive? #t
#:select? (git-predicate ".")))
(build-system gnu-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
;; No configure script
(delete 'configure)
;; Set up Elixir/Erlang environment
(add-before 'build 'setup-elixir-env
(lambda* (#:key inputs #:allow-other-keys)
(setenv "HOME" (getcwd))
(setenv "MIX_ENV" "prod")
(setenv "MIX_HOME" (string-append (getcwd) "/.mix"))
(setenv "HEX_HOME" (string-append (getcwd) "/.hex"))
;; Install Hex and Rebar locally
(invoke "mix" "local.hex" "--force")
(invoke "mix" "local.rebar" "--force")))
;; Build Rust NIFs first
(add-before 'build 'build-rust-nifs
(lambda* (#:key inputs #:allow-other-keys)
(when (file-exists? "native/tma_crypto/Cargo.toml")
(invoke "cargo" "build" "--release"
"--manifest-path" "native/tma_crypto/Cargo.toml"))
(when (file-exists? "native/tma_nlp/Cargo.toml")
(invoke "cargo" "build" "--release"
"--manifest-path" "native/tma_nlp/Cargo.toml"))))
;; Build Elixir application
(replace 'build
(lambda _
(invoke "mix" "deps.get" "--only" "prod")
(invoke "mix" "deps.compile")
(invoke "mix" "compile")
;; Build assets if they exist
(when (file-exists? "assets")
(invoke "mix" "assets.deploy"))
(invoke "mix" "release")))
;; Install the release
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(copy-recursively "_build/prod/rel/etma_handler"
out))))
;; Skip check for now (tests need network)
(delete 'check))))
(native-inputs
(list erlang
elixir
rust
`(,rust "cargo")
git))
(inputs
(list ;; Runtime dependencies
nss-certs ; TLS certificates
openssl ; Crypto
ncurses ; Terminal
zlib ; Compression
;; Security tools
clamav ; Virus scanning
wireguard-tools ; VPN
nftables ; Firewall
;; Document processing
tesseract-ocr ; OCR
poppler ; PDF handling
;; Fonts
font-liberation
font-dejavu))
(synopsis "eTMA Handler - Open University Marking Tool")
(description
"A secure, offline-first tool for marking electronic Tutor Marked
Assignments (eTMAs) for Open University tutors. Features include virus
scanning, plagiarism detection, feedback management, and post-quantum
cryptography support.")
(home-page "https://github.com/hyperpolymath/tma-mark2")
;; PMPL-1.0-or-later is not in Guix's license list yet.
;; Using non-copyleft as placeholder — the actual license is PMPL-1.0-or-later.
(license (list license:non-copyleft
"https://github.com/hyperpolymath/palimpsest-license"))))
;; Development environment
(define-public tma-mark2-dev
(package
(inherit tma-mark2)
(name "tma-mark2-dev")
(arguments
(substitute-keyword-arguments (package-arguments tma-mark2)
((#:phases phases)
#~(modify-phases #$phases
;; Don't delete check phase in dev
(delete 'delete-check)))))
(native-inputs
(modify-inputs (package-native-inputs tma-mark2)
(prepend ;; Development tools
erlang-ls ; Language server
rebar3 ; Build tool
rust-analyzer)))))
;; Export the package
tma-mark2