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-28 22:59:48 +0100
commit3cf990c50d04b4a1aba4e0c1f5ed524752af970c (patch)
treeacbdd96943ab84203e09bf4dfd33e7b184581c5f
parent03f821d802c3ce4e31b3ed441452e5e10125aeeb (diff)
Add a guix.scm file0.0.2
-rw-r--r--guix.scm79
1 files changed, 79 insertions, 0 deletions
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))))))))))