summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2022-01-28 19:31:10 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2022-01-29 16:42:24 +0100
commitfc8809fc034973898a2577f2c2b900526ec4596d (patch)
treefa500940ea1a0214ba5697c781851a58b524c555
parent03f821d802c3ce4e31b3ed441452e5e10125aeeb (diff)
Add a guix.scm file
-rw-r--r--disfluid/build/bootstrap.scm4
-rw-r--r--guix.scm79
2 files changed, 82 insertions, 1 deletions
diff --git a/disfluid/build/bootstrap.scm b/disfluid/build/bootstrap.scm
index 158c1b9..b4ee375 100644
--- a/disfluid/build/bootstrap.scm
+++ b/disfluid/build/bootstrap.scm
@@ -139,6 +139,8 @@
(beginning-of-buffer)
(insert "SUBDIRS = po")
(newline)
+ (search-forward "EXTRA_DIST =")
+ (insert " guix.scm ")
(save-buffer))))
(system* mkdir "-p" "po")
(call-with-output-file "po/Makevars"
@@ -234,6 +236,6 @@ DIST_DEPENDS_ON_UPDATE_PO = yes
(format #f "~s"
`(progn
(search-forward "EXTRA_DIST =")
- (insert "channels.scm ")
+ (insert " channels.scm ")
(save-buffer))))
(system* autoreconf "-vif")))
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))))))))))