fixed issue with sed compatibility (bsd/gnu)
This commit is contained in:
parent
07e7fe1d5e
commit
49a9c81ecd
4 changed files with 54 additions and 141 deletions
86
README.md
86
README.md
|
@ -1,86 +0,0 @@
|
|||
|
||||
# Table of Contents
|
||||
|
||||
1. [Overview](#org574fc8c)
|
||||
2. [F.A.Q](#org23f50e9)
|
||||
3. [Requirements](#orgb7bcbfe)
|
||||
4. [Installation](#org7c8eef8)
|
||||
5. [Usage](#org85647f0)
|
||||
|
||||
|
||||
|
||||
<a id="org574fc8c"></a>
|
||||
|
||||
# Overview
|
||||
|
||||
MSG is an attempt to create a native-like experience for Guix on MacOS, using methods inspired by others like Podman/Docker/Lima. It uses Qemu with a prebuilt installer image to create a customized local Guix instance (supported on Intel and Apple Silicon based Macs). The base image is pretty barebones and is meant to be customized to your liking. To get a good idea of whats included you can reference the /etc/config.scm file within the built image.
|
||||
|
||||
|
||||
<a id="org23f50e9"></a>
|
||||
|
||||
# F.A.Q
|
||||
|
||||
- Q: Why does the cli generate the image locally instead of downloading a complete pre-built image like Podman?
|
||||
- A: This is due to the final image requiring the admin account to be setup with the same UID as the host MacOS user. Podman accomplishes this by passing configuration values in it's ignition file, which are used to initialize the CoreOS image with the correct values on it's first run. Guix doesn't currently support a similar initialization method, so the image must be regenerated after the config has been updated with the correct values (UID, etc…). This is unlikely to change in the near future, unless Guix ends up adding some sort of similar functionality.
|
||||
|
||||
- Q: What are the long term goals of this project?
|
||||
- A: I would like for this project to accomplish a few goals.
|
||||
1. Be able to fully replace docker/podman desktop on MacOS
|
||||
2. Give users a way to manage their MacOS dotfiles using Guix Home
|
||||
3. Improve GUI application performance with X11/Xquartz
|
||||
4. Introduce a MSG Desktop GUI to accompany the cli
|
||||
|
||||
|
||||
<a id="orgb7bcbfe"></a>
|
||||
|
||||
# Requirements
|
||||
|
||||
- wget
|
||||
- qemu
|
||||
- autotools
|
||||
- guile-next
|
||||
- You can get guile-next from the following homebrew tap: <https://github.com/aconchillo/homebrew-guile>
|
||||
- texinfo
|
||||
|
||||
These can be installed by running:
|
||||
|
||||
brew install autoconf automake libtool wget qemu texinfo guile-next
|
||||
|
||||
|
||||
<a id="org7c8eef8"></a>
|
||||
|
||||
# Installation
|
||||
|
||||
1. First clone this repository with:
|
||||
|
||||
git clone https://pagure.io/MSG/msg-cli.git msg
|
||||
cd msg
|
||||
|
||||
2. Build and install the cli using:
|
||||
|
||||
autoreconf -vif && ./configure && make && sudo make install
|
||||
|
||||
3. Make sure to add the correct env vars set for guile-next/msg.
|
||||
|
||||
export GUILE_LOAD_PATH=/opt/homebrew/share/guile/site/3.0
|
||||
export GUILE_LOAD_COMPILED_PATH=/opt/homebrew/lib/guile/3.0/site-ccache
|
||||
export GUILE_SYSTEM_EXTENSIONS_PATH=/opt/homebrew/lib/guile/3.0/extensions
|
||||
|
||||
export GUILE_LOAD_PATH=$GUILE_LOAD_PATH:/usr/local/share/guile/site/3.0/
|
||||
export GUILE_LOAD_COMPILED_PATH=$GUILE_LOAD_COMPILED_PATH:/usr/local/lib/guile/3.0/site-ccache/
|
||||
export GUILE_SYSTEM_EXTENSIONS_PATH=$GUILE_SYSTEM_EXTENSIONS_PATH:/usr/local/lib/guile/3.0/extensions
|
||||
export PATH=/usr/local/bin:$PATH
|
||||
|
||||
|
||||
<a id="org85647f0"></a>
|
||||
|
||||
# Usage
|
||||
|
||||
- msg machine (command)
|
||||
- init: initializes a new MSG instance
|
||||
- reinit: reinitializes an MSG instance (is destructive!)
|
||||
- start: starts the initialized MSG instance
|
||||
- stop: stops the running instance
|
||||
- msg shell
|
||||
- Creates an ssh connection to the running instance
|
||||
|
97
guix.scm
97
guix.scm
|
@ -1,15 +1,15 @@
|
|||
(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)
|
||||
(guix build-system gnu)
|
||||
(guix download)
|
||||
(guix gexp)
|
||||
((guix licenses) #:prefix license:)
|
||||
(guix packages)
|
||||
(srfi srfi-1))
|
||||
|
||||
(package
|
||||
|
@ -26,55 +26,44 @@
|
|||
(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))))))))
|
||||
(list #:modules
|
||||
`(((guix build guile-build-system)
|
||||
#:select
|
||||
(target-guile-effective-version))
|
||||
,@%gnu-build-system-modules)
|
||||
#:phases
|
||||
(with-imported-modules
|
||||
`((guix build guile-build-system) ,@%gnu-build-system-modules)
|
||||
(gexp (modify-phases
|
||||
%standard-phases
|
||||
(add-after
|
||||
'install
|
||||
'hall-wrap-binaries
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(let* ((version (target-guile-effective-version))
|
||||
(site-ccache
|
||||
(string-append "/lib/guile/" version "/site-ccache"))
|
||||
(site (string-append "/share/guile/site/" version))
|
||||
(dep-path
|
||||
(lambda (env path)
|
||||
(list env
|
||||
":"
|
||||
'prefix
|
||||
(cons (string-append (ungexp output) path)
|
||||
(map (lambda (input)
|
||||
(string-append
|
||||
(assoc-ref inputs input)
|
||||
path))
|
||||
(list))))))
|
||||
(bin (string-append (ungexp output) "/bin/")))
|
||||
(for-each
|
||||
(lambda (file)
|
||||
(wrap-program
|
||||
(string-append bin file)
|
||||
(dep-path "GUILE_LOAD_PATH" site)
|
||||
(dep-path "GUILE_LOAD_COMPILED_PATH" site-ccache)
|
||||
(dep-path "GUILE_EXTENSIONS_PATH" "/lib")))
|
||||
(list "msg"))))))))))
|
||||
(native-inputs (list autoconf automake pkg-config texinfo))
|
||||
(inputs (list guile-3.0))
|
||||
(propagated-inputs (list))
|
||||
|
|
|
@ -21,3 +21,13 @@
|
|||
|
||||
(define %copyright '(2023))
|
||||
|
||||
(define %gettext-domain "msg")
|
||||
|
||||
(define G_ identity)
|
||||
|
||||
(define N_ identity)
|
||||
|
||||
(define (init-nls) "Dummy as no NLS is used" #t)
|
||||
|
||||
(define (init-locale) "Dummy as no NLS is used" #t)
|
||||
|
||||
|
|
|
@ -199,5 +199,5 @@
|
|||
|
||||
(define (update-uid)
|
||||
;; Update UID for msg image
|
||||
(system "sed -i \"s/\\$UID/$(id -u)/g\" ~/.guix/home/config.scm")
|
||||
(system "sed -i.bak \"s/\\$UID/$(id -u)/g\" ~/.guix/home/config.scm && rm ~/.guix/home/config.scm.bak")
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'cp /mnt/macos/config.scm /etc/config.scm'"))
|
||||
|
|
Loading…
Add table
Reference in a new issue