From 3cf990c50d04b4a1aba4e0c1f5ed524752af970c Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Fri, 28 Jan 2022 19:31:10 +0100 Subject: Add a guix.scm file --- guix.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 guix.scm diff --git a/guix.scm b/guix.scm new file mode 100644 index 0000000..1034b68 --- /dev/null +++ b/guix.scm @@ -0,0 +1,79 @@ +(use-modules (guix packages) + (guix gexp) + (guix store) + (guix monads) + (guix derivations) + (gnu packages base) + (gnu packages compression) + (gnu packages emacs) + (gnu packages gettext) + (gnu packages guile) + (gnu packages guile-xyz) + (gnu packages version-control)) + +(let ((local-repo + (local-file ".git" "disfluid.git" #:recursive? #t)) + (bootstrap-script + (computed-file + "bootstrap.scm" + #~(call-with-output-file #$output + (lambda (port) + (write + '((@ (disfluid build bootstrap) main) + #:emacs #$(file-append emacs "/bin/emacs") + #:hall #$(file-append guile-hall "/bin/hall") + #:git #$(file-append git "/bin/git") + #:mkdir #$(file-append coreutils "/bin/mkdir") + #:which #$(file-append which "/bin/which") + #:autoreconf #$(file-append coreutils "/bin/true")) + port)))))) + (run-with-store (open-connection) + (mlet %store-monad + ((guix.scm + (gexp->derivation + "guix.scm" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (set-path-environment-variable "PATH" '("bin") (list #$guile-3.0)) + (invoke #$(file-append git "/bin/git") "clone" #$local-repo ".") + (delete-file "guix.scm") + (setenv "HOME" (getcwd)) + (invoke #$(file-append guile-3.0 "/bin/guile") "-L" "." "-s" #$bootstrap-script) + (invoke #$(file-append guile-hall "/bin/hall") "guix" "-x") + (copy-file "guix.scm" #$output))))) + (snapshot.tar.gz + (gexp->derivation + "disfluid-snapshot.tar.gz" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (set-path-environment-variable "PATH" '("bin") (list #$gzip)) + (invoke #$(file-append git "/bin/git") "clone" #$local-repo ".") + (invoke #$(file-append git "/bin/git") "archive" "-o" #$output "HEAD")))))) + (mlet %store-monad + ((built (built-derivations (list guix.scm snapshot.tar.gz)))) + (let ((base (load (derivation->output-path guix.scm)))) + (return + (package + (inherit base) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'bootstrap + (lambda* (#:key inputs #:allow-other-keys) + (chdir "..") + (setenv "HOME" (getcwd)) + (invoke "guile" "./bootstrap")))))) + (native-inputs + `(,@(package-native-inputs base) + ("guile-hall" ,guile-hall) + ("emacs" ,emacs) + ("gettext" ,gnu-gettext) + ("autoconf-archive" ,autoconf-archive))) + (source (derivation->output-path snapshot.tar.gz)) + (synopsis + (format #f "[SNAPSHOT]: ~a" (package-synopsis base))) + (description + (format #f "~a\n\nThis package version is @strong{not} released yet." + (package-description base)))))))))) -- cgit v1.2.3