init push
This commit is contained in:
commit
235ec69321
16 changed files with 474 additions and 0 deletions
65
.gitignore
vendored
Normal file
65
.gitignore
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
*.eps
|
||||||
|
*.go
|
||||||
|
*.log
|
||||||
|
*.pdf
|
||||||
|
*.png
|
||||||
|
*.tar.xz
|
||||||
|
*.tar.gz
|
||||||
|
*.tmp
|
||||||
|
*~
|
||||||
|
.#*
|
||||||
|
\#*\#
|
||||||
|
,*
|
||||||
|
/ABOUT-NLS
|
||||||
|
/INSTALL
|
||||||
|
/aclocal.m4
|
||||||
|
/autom4te.cache
|
||||||
|
/build-aux/ar-lib
|
||||||
|
/build-aux/compile
|
||||||
|
/build-aux/config.guess
|
||||||
|
/build-aux/config.rpath
|
||||||
|
/build-aux/config.sub
|
||||||
|
/build-aux/depcomp
|
||||||
|
/build-aux/install-sh
|
||||||
|
/build-aux/mdate-sh
|
||||||
|
/build-aux/missing
|
||||||
|
/build-aux/test-driver
|
||||||
|
/build-aux/texinfo.tex
|
||||||
|
/config.status
|
||||||
|
/configure
|
||||||
|
/doc/*.1
|
||||||
|
/doc/.dirstamp
|
||||||
|
/doc/contributing.*.texi
|
||||||
|
/doc/*.aux
|
||||||
|
/doc/*.cp
|
||||||
|
/doc/*.cps
|
||||||
|
/doc/*.fn
|
||||||
|
/doc/*.fns
|
||||||
|
/doc/*.html
|
||||||
|
/doc/*.info
|
||||||
|
/doc/*.info-[0-9]
|
||||||
|
/doc/*.ky
|
||||||
|
/doc/*.pg
|
||||||
|
/doc/*.toc
|
||||||
|
/doc/*.t2p
|
||||||
|
/doc/*.tp
|
||||||
|
/doc/*.vr
|
||||||
|
/doc/*.vrs
|
||||||
|
/doc/stamp-vti
|
||||||
|
/doc/version.texi
|
||||||
|
/doc/version-*.texi
|
||||||
|
/m4/*
|
||||||
|
/pre-inst-env
|
||||||
|
/test-env
|
||||||
|
/test-tmp
|
||||||
|
/tests/*.trs
|
||||||
|
GPATH
|
||||||
|
GRTAGS
|
||||||
|
GTAGS
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
config.cache
|
||||||
|
stamp-h[0-9]
|
||||||
|
tmp
|
||||||
|
/.version
|
||||||
|
/doc/stamp-[0-9]
|
3
AUTHORS
Normal file
3
AUTHORS
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Contributors to Msg 0.1:
|
||||||
|
|
||||||
|
Chad Nelson <>
|
3
COPYING
Normal file
3
COPYING
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
This project's license is GPL 3+.
|
||||||
|
|
||||||
|
You can read the full license at https://www.gnu.org/licenses/gpl.html.
|
1
ChangeLog
Normal file
1
ChangeLog
Normal file
|
@ -0,0 +1 @@
|
||||||
|
For a complete log, please see the Git commit log at </PATH/TO/LOG>.
|
54
HACKING
Normal file
54
HACKING
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# -*- mode: org; coding: utf-8; -*-
|
||||||
|
|
||||||
|
#+TITLE: Hacking msg
|
||||||
|
|
||||||
|
* Contributing
|
||||||
|
|
||||||
|
By far the easiest way to hack on msg is to develop using Guix:
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
# Obtain the source code
|
||||||
|
cd /path/to/source-code
|
||||||
|
guix shell -Df guix.scm
|
||||||
|
# In the new shell, run:
|
||||||
|
hall build --execute && autoreconf -vif && ./configure && make check
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
You may also want to set your directory as an authorized directory for
|
||||||
|
`guix shell' so it works without arguments. To do that, simply run
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
echo $(pwd) >> $HOME/.config/guix/shell-authorized-directories
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
You can now hack this project's files to your heart's content, whilst
|
||||||
|
testing them from your `guix shell' shell.
|
||||||
|
|
||||||
|
To try out any scripts in the project you can now use
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
./pre-inst-env scripts/${script-name}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
If you'd like to tidy the project again, but retain the ability to test the
|
||||||
|
project from the commandline, simply run:
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
./hall clean --skip "scripts/${script-name},pre-inst-env" --execute
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Manual Installation
|
||||||
|
|
||||||
|
If you do not yet use Guix, you will have to install this project's
|
||||||
|
dependencies manually:
|
||||||
|
- autoconf
|
||||||
|
- automake
|
||||||
|
- pkg-config
|
||||||
|
- texinfo
|
||||||
|
- guile-hall
|
||||||
|
|
||||||
|
Once those dependencies are installed you can run:
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
hall build -x && autoreconf -vif && ./configure && make check
|
||||||
|
#+END_SRC
|
14
NEWS
Normal file
14
NEWS
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# -*- mode: org; coding: utf-8; -*-
|
||||||
|
|
||||||
|
#+TITLE: Msg NEWS – history of user-visible changes
|
||||||
|
#+STARTUP: content hidestars
|
||||||
|
|
||||||
|
Copyright © (2023) Chad Nelson <>
|
||||||
|
|
||||||
|
Copying and distribution of this file, with or without modification,
|
||||||
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
notice and this notice are preserved.
|
||||||
|
|
||||||
|
Please send Msg bug reports to .
|
||||||
|
|
||||||
|
* Publication at 0.1
|
1
README
Symbolic link
1
README
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
README.org
|
4
README.org
Normal file
4
README.org
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- mode: org; coding: utf-8; -*-
|
||||||
|
|
||||||
|
#+TITLE: README for Msg
|
||||||
|
|
60
doc/msg.texi
Normal file
60
doc/msg.texi
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
\input texinfo
|
||||||
|
@c -*-texinfo-*-
|
||||||
|
|
||||||
|
@c %**start of header
|
||||||
|
@setfilename msg.info
|
||||||
|
@documentencoding UTF-8
|
||||||
|
@settitle Msg Reference Manual
|
||||||
|
@c %**end of header
|
||||||
|
|
||||||
|
@include version.texi
|
||||||
|
|
||||||
|
@copying
|
||||||
|
Copyright @copyright{} 2023 Chad Nelson
|
||||||
|
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
|
any later version published by the Free Software Foundation; with no
|
||||||
|
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
||||||
|
copy of the license is included in the section entitled ``GNU Free
|
||||||
|
Documentation License''.
|
||||||
|
@end copying
|
||||||
|
|
||||||
|
@dircategory The Algorithmic Language Scheme
|
||||||
|
@direntry
|
||||||
|
* Msg: (msg).
|
||||||
|
@end direntry
|
||||||
|
|
||||||
|
@titlepage
|
||||||
|
@title The Msg Manual
|
||||||
|
@author Chad Nelson
|
||||||
|
|
||||||
|
@page
|
||||||
|
@vskip 0pt plus 1filll
|
||||||
|
Edition @value{EDITION} @*
|
||||||
|
@value{UPDATED} @*
|
||||||
|
|
||||||
|
@insertcopying
|
||||||
|
@end titlepage
|
||||||
|
|
||||||
|
@contents
|
||||||
|
|
||||||
|
@c *********************************************************************
|
||||||
|
@node Top
|
||||||
|
@top Msg
|
||||||
|
|
||||||
|
This document describes Msg version @value{VERSION}.
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Introduction:: Why Msg?
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@c *********************************************************************
|
||||||
|
@node Introduction
|
||||||
|
@chapter Introduction
|
||||||
|
|
||||||
|
INTRODUCTION HERE
|
||||||
|
|
||||||
|
This documentation is a stub.
|
||||||
|
|
||||||
|
@bye
|
85
guix.scm
Normal file
85
guix.scm
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
(use-modules
|
||||||
|
(guix packages)
|
||||||
|
((guix licenses) #:prefix license:)
|
||||||
|
(guix download)
|
||||||
|
(guix gexp)
|
||||||
|
(guix build-system gnu)
|
||||||
|
(gnu packages)
|
||||||
|
(gnu packages autotools)
|
||||||
|
(gnu packages guile)
|
||||||
|
(gnu packages guile-xyz)
|
||||||
|
(gnu packages pkg-config)
|
||||||
|
(gnu packages texinfo)
|
||||||
|
(srfi srfi-1))
|
||||||
|
|
||||||
|
(package
|
||||||
|
(name "msg")
|
||||||
|
(version "0.1")
|
||||||
|
(source
|
||||||
|
(local-file
|
||||||
|
(dirname (current-filename))
|
||||||
|
#:recursive?
|
||||||
|
#t
|
||||||
|
#:select?
|
||||||
|
(lambda (file stat)
|
||||||
|
(not (any (lambda (my-string) (string-contains file my-string))
|
||||||
|
(list ".git" ".dir-locals.el" "guix.scm"))))))
|
||||||
|
(build-system gnu-build-system)
|
||||||
|
(arguments
|
||||||
|
`(#:modules
|
||||||
|
((ice-9 match) (ice-9 ftw) ,@%gnu-build-system-modules)
|
||||||
|
#:phases
|
||||||
|
(modify-phases
|
||||||
|
%standard-phases
|
||||||
|
(add-after
|
||||||
|
'install
|
||||||
|
'hall-wrap-binaries
|
||||||
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
|
(let* ((compiled-dir
|
||||||
|
(lambda (out version)
|
||||||
|
(string-append out "/lib/guile/" version "/site-ccache")))
|
||||||
|
(uncompiled-dir
|
||||||
|
(lambda (out version)
|
||||||
|
(string-append
|
||||||
|
out
|
||||||
|
"/share/guile/site"
|
||||||
|
(if (string-null? version) "" "/")
|
||||||
|
version)))
|
||||||
|
(dep-path
|
||||||
|
(lambda (env modules path)
|
||||||
|
(list env
|
||||||
|
":"
|
||||||
|
'prefix
|
||||||
|
(cons modules
|
||||||
|
(map (lambda (input)
|
||||||
|
(string-append
|
||||||
|
(assoc-ref inputs input)
|
||||||
|
path))
|
||||||
|
,''())))))
|
||||||
|
(out (assoc-ref outputs "out"))
|
||||||
|
(bin (string-append out "/bin/"))
|
||||||
|
(site (uncompiled-dir out "")))
|
||||||
|
(match (scandir site)
|
||||||
|
(("." ".." version)
|
||||||
|
(for-each
|
||||||
|
(lambda (file)
|
||||||
|
(wrap-program
|
||||||
|
(string-append bin file)
|
||||||
|
(dep-path
|
||||||
|
"GUILE_LOAD_PATH"
|
||||||
|
(uncompiled-dir out version)
|
||||||
|
(uncompiled-dir "" version))
|
||||||
|
(dep-path
|
||||||
|
"GUILE_LOAD_COMPILED_PATH"
|
||||||
|
(compiled-dir out version)
|
||||||
|
(compiled-dir "" version))))
|
||||||
|
,''("msg"))
|
||||||
|
#t))))))))
|
||||||
|
(native-inputs (list autoconf automake pkg-config texinfo))
|
||||||
|
(inputs (list guile-3.0))
|
||||||
|
(propagated-inputs (list))
|
||||||
|
(synopsis "")
|
||||||
|
(description "")
|
||||||
|
(home-page "")
|
||||||
|
(license license:gpl3+))
|
||||||
|
|
40
hall.scm
Normal file
40
hall.scm
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
(hall-description
|
||||||
|
(name "msg")
|
||||||
|
(prefix "")
|
||||||
|
(version "0.1")
|
||||||
|
(author "Chad Nelson")
|
||||||
|
(email "")
|
||||||
|
(copyright (2023))
|
||||||
|
(synopsis "")
|
||||||
|
(description "")
|
||||||
|
(home-page "")
|
||||||
|
(license gpl3+)
|
||||||
|
(dependencies `())
|
||||||
|
(skip ())
|
||||||
|
(features ((guix #f) (native-language-support #f) (licensing #f)))
|
||||||
|
(files (libraries
|
||||||
|
((scheme-file "msg")
|
||||||
|
(directory
|
||||||
|
"msg"
|
||||||
|
((scheme-file "machine")
|
||||||
|
(scheme-file "hconfig")
|
||||||
|
(scheme-file "helpers")))))
|
||||||
|
(tests ((directory "tests" ())))
|
||||||
|
(programs ((directory "scripts" ((in-file "msg")))))
|
||||||
|
(documentation
|
||||||
|
((org-file "README")
|
||||||
|
(symlink "README" "README.org")
|
||||||
|
(text-file "HACKING")
|
||||||
|
(text-file "COPYING")
|
||||||
|
(directory
|
||||||
|
"doc"
|
||||||
|
((texi-file "msg")
|
||||||
|
(text-file ".dirstamp")
|
||||||
|
(info-file "msg")
|
||||||
|
(texi-file "version")
|
||||||
|
(text-file "stamp-vti")))
|
||||||
|
(text-file "NEWS")
|
||||||
|
(text-file "AUTHORS")
|
||||||
|
(text-file "ChangeLog")))
|
||||||
|
(infrastructure
|
||||||
|
((scheme-file "guix") (text-file ".gitignore") (scheme-file "hall")))))
|
0
msg.scm
Normal file
0
msg.scm
Normal file
23
msg/hconfig.scm
Normal file
23
msg/hconfig.scm
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
(define-module
|
||||||
|
(msg hconfig)
|
||||||
|
#:use-module
|
||||||
|
(srfi srfi-26)
|
||||||
|
#:export
|
||||||
|
(%version
|
||||||
|
%author
|
||||||
|
%license
|
||||||
|
%copyright
|
||||||
|
%gettext-domain
|
||||||
|
G_
|
||||||
|
N_
|
||||||
|
init-nls
|
||||||
|
init-locale))
|
||||||
|
|
||||||
|
(define %version "0.1")
|
||||||
|
|
||||||
|
(define %author "Chad Nelson")
|
||||||
|
|
||||||
|
(define %license 'gpl3+)
|
||||||
|
|
||||||
|
(define %copyright '(2023))
|
||||||
|
|
21
msg/helpers.scm
Normal file
21
msg/helpers.scm
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
(define-module (msg helpers)
|
||||||
|
#:use-module (ice-9 ftw)
|
||||||
|
#:use-module (ice-9 popen)
|
||||||
|
#:use-module (ice-9 rdelim)
|
||||||
|
#:use-module (system foreign)
|
||||||
|
#:export (directory-exists?
|
||||||
|
run-shell-command
|
||||||
|
start-command-in-background))
|
||||||
|
|
||||||
|
(define (directory-exists? path)
|
||||||
|
(catch 'system-error
|
||||||
|
(lambda ()
|
||||||
|
(stat path))
|
||||||
|
(lambda args #f)))
|
||||||
|
|
||||||
|
(define (run-shell-command command)
|
||||||
|
(let* ((port (open-input-pipe command))
|
||||||
|
(str (read-line port)))
|
||||||
|
;;(close-pipe port)
|
||||||
|
port))
|
||||||
|
|
79
msg/machine.scm
Normal file
79
msg/machine.scm
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
(define-module (msg machine)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (ice-9 rdelim)
|
||||||
|
#:use-module (ice-9 textual-ports)
|
||||||
|
#:use-module (system foreign)
|
||||||
|
#:use-module (msg helpers)
|
||||||
|
#:export (machine))
|
||||||
|
|
||||||
|
|
||||||
|
(define* (machine #:optional (args (command-line)))
|
||||||
|
;;(define clean-args (cdr args))
|
||||||
|
(match args
|
||||||
|
(("-h")
|
||||||
|
(help))
|
||||||
|
(("init")
|
||||||
|
(init))
|
||||||
|
(("reinit")
|
||||||
|
(clear-install)
|
||||||
|
(init))
|
||||||
|
(_
|
||||||
|
(display "Please enter a valid command or -h for help.\n"))))
|
||||||
|
|
||||||
|
(define* (help)
|
||||||
|
(display "\nHere are the available commands:\n\n")
|
||||||
|
(display "start: Start the MSG envrionment.\n"))
|
||||||
|
|
||||||
|
(define* (clear-install)
|
||||||
|
(display "This is a destructive command and will remove your entire guix instance. Proceed? (y/n)\n")
|
||||||
|
(define response (read-line))
|
||||||
|
(if (string=? response "y")
|
||||||
|
(begin
|
||||||
|
(system "rm -r ~/.guix"))
|
||||||
|
(display "Please enter a valid response.")))
|
||||||
|
|
||||||
|
(define* (init)
|
||||||
|
(define home-path (getenv "HOME"))
|
||||||
|
(define arch (run-shell-command "uname -m"))
|
||||||
|
|
||||||
|
|
||||||
|
(if (not (directory-exists? (format #f "~a/.guix" home-path)))
|
||||||
|
(begin
|
||||||
|
(system "mkdir -p $HOME/.guix/qemu $HOME/.guix/home $HOME/.guix/ssh-cert")
|
||||||
|
;; Get msg image
|
||||||
|
|
||||||
|
(cond ((string=? arch "arm64")
|
||||||
|
(system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-aarch64guix-user.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||||
|
(system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||||
|
(define pid (run-shell-command "/opt/homebrew/bin/qemu-system-aarch64 \
|
||||||
|
-machine virt,highmem=on \
|
||||||
|
-accel hvf \
|
||||||
|
-cpu host \
|
||||||
|
-smp 4 \
|
||||||
|
-display none \
|
||||||
|
-hda $HOME/.guix/qemu/guix-user.qcow2 \
|
||||||
|
-m 4G \
|
||||||
|
-virtfs local,path=$HOME/.guix/home,security_model=mapped,mount_tag=macos \
|
||||||
|
-bios /opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd \
|
||||||
|
-device virtio-net,netdev=vmnic \
|
||||||
|
-netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22 &"))
|
||||||
|
(display pid))
|
||||||
|
((string=? arch "x86_64")
|
||||||
|
(system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-x86_64guix-user-x86.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||||
|
(system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||||
|
(system "/usr/local/bin/qemu-system-x86_64 \
|
||||||
|
-machine type=q35,accel=hvf \
|
||||||
|
-smp 4 \
|
||||||
|
-hda $HOME/.guix/qemu/guix-user.qcow2 \
|
||||||
|
-m 4G \
|
||||||
|
-display none \
|
||||||
|
-cpu Nehalem \
|
||||||
|
-virtfs local,path=$HOME/.guix,security_model=mapped,mount_tag=macos \
|
||||||
|
-device virtio-net,netdev=vmnic \
|
||||||
|
-netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22")
|
||||||
|
))
|
||||||
|
|
||||||
|
;; Get msg ssh-key
|
||||||
|
(system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg_rsa -O $HOME/.guix/ssh-cert/msg_rsa")))
|
||||||
|
|
||||||
|
(system "ssh -o StrictHostKeychecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'guix'"))
|
21
scripts/msg.in
Normal file
21
scripts/msg.in
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!@GUILE@ \
|
||||||
|
--no-auto-compile -e main -s
|
||||||
|
!#
|
||||||
|
|
||||||
|
(use-modules (msg machine)
|
||||||
|
(ice-9 match))
|
||||||
|
|
||||||
|
(define* (main #:optional (args (command-line)))
|
||||||
|
(define clean-args (cdr args))
|
||||||
|
|
||||||
|
(match clean-args
|
||||||
|
(("machine" rest ...)
|
||||||
|
(machine rest))
|
||||||
|
(("-h")
|
||||||
|
(help))
|
||||||
|
(_
|
||||||
|
(display "Please enter a valid command or -h for help.\n"))))
|
||||||
|
|
||||||
|
(define* (help)
|
||||||
|
(display "\nHere are the available commands:\n\n")
|
||||||
|
(display "machine: interact with the vm environment for MSG.\n"))
|
Loading…
Add table
Reference in a new issue