From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Gerwitz Subject: Re: Running IceCat in a container Date: Thu, 25 Jan 2018 22:52:09 -0500 Message-ID: <87po5xgtue.fsf@gnu.org> References: <87vag2wopo.fsf@gnu.org> <877esh3gwd.fsf@gnu.org> <87tvvlrzlc.fsf@gnu.org> <87efmeuhvb.fsf@gnu.org> <87zi51r3cg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eewbR-0005Yd-W6 for help-guix@gnu.org; Fri, 26 Jan 2018 00:31:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eewbQ-00021o-NI for help-guix@gnu.org; Fri, 26 Jan 2018 00:31:05 -0500 In-Reply-To: <87zi51r3cg.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 25 Jan 2018 23:16:47 +0100") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: help-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Jan 25, 2018 at 23:16:47 +0100, Ludovic Court=C3=A8s wrote: > If you drop the attached file under guix/scripts/, you can then run: > > guix run icecat icecat > > and similar. This particular example doesn=E2=80=99t work well because o= f the > font issue you=E2=80=99re familiar with, but you get the idea. :-) Oh, this is interesting. I won't get a chance to try this out until tomorrow, but I think it's a good start. I sent a few patches moments ago that I've been sitting on for a bit. My intent was originally to go further, but I ran out of time. But I didn't think `guix environment' was the appropriate place to put such things---this script, though, is a good starting point for them. For example, if one of the dependencies of a program is X11, it can automatically share the X paths (unless overridden by the user). Same with DBUS, sound devices, etc. I mentioned previous ideas earlier in the thread. I'd also want to integrate changes I made to `guix environment'. If people here like the changes and they are merged, I'd want to refactor it into a common place, not just copy the code. I think this gives us a lot to move forward with, and some good discussion to have. A lot of subtle details will have to be worked out, like what default behavior should be. Anyway, here's what I have so far. I still have to get sound working; I took a pause on that, not having spent more than a few minutes on it; I'll get back to it hopefully in the next few days. If anyone else knows exactly what needs to be done, please lmk. #+BEGIN_SRC sh ~/guix/pre-inst-env guix environment \ --container \ --link-profile \ --no-cwd \ --user=3Duser \ --network \ -r "$gc_root" \ --expose=3D/etc/machine-id \ --expose=3D/tmp/.X11-unix/ \ --expose=3D$HOME/.Xauthority \ --share=3D/dev/snd \ --share=3D$HOME/.mozilla/ \ --share=3D$HOME/Downloads/icecat-container/=3D$HOME/Downloads/ \ --ad-hoc mtg-icecat-containerized \ -- \ icecat --display=3D:0.0 "$@" \ #+END_SRC #+BEGIN_SRC scheme (define-module (mtg personal) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (gnu packages) #:use-module (guix build-system trivial) #:use-module (gnu packages gnome) #:use-module (gnu packages gnuzilla) #:use-module (gnu packages fonts) #:use-module (gnu packages fontutils) #:use-module (gnu packages pulseaudio)) (define-public mtg-icecat-containerized (package (name "mtg-icecat-containerized") (version "1.0") (home-page "https://mikegerwitz.com/") (build-system trivial-build-system) (source #f) (native-inputs `(("fontconfig" ,fontconfig))) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) (let* ((share-dir (string-append %output "/share")) (cache-dir (string-append %output "/var/cache")) (bin-dir (string-append %output "/bin")) (fc-dir (string-append share-dir "/fontconfig/conf.avail= ")) (fc-mtg (string-append fc-dir "/52-mtg-container.conf")) (fc-cache-dir (string-append cache-dir "/fontconfig")) (fonts-dir (string-append share-dir "/fonts"))) ;; container script to invoke IceCat (mkdir-p bin-dir) (call-with-output-file (string-append bin-dir "icecat-container") (lambda (port) (format port "#!/bin/bash"))) ;; fontconfig configuration (mkdir-p fc-dir) (call-with-output-file fc-mtg (lambda (port) (format port (string-append " " (string-append (assoc-ref %build-inputs "font-dejavu") "/share/fonts") " " fc-cache-dir " \n")))) (setenv "PATH" (string-append (assoc-ref %build-inputs "fontconfig") "/bin")) (setenv "FONTCONFIG_FILE" fc-mtg) (setenv "XDG_DATA_HOME" share-dir) (mkdir-p cache-dir) (invoke "fc-cache" "-fv"))))) (propagated-inputs `(("icecat" ,icecat) ("zenity" ,zenity) ("font-dejavu" ,font-dejavu) ("pulseaudio" ,pulseaudio) ;;("font-adobe-source-han-sans", font-adobe-source-han-sans) )) (synopsis "GNU IceCat packaged for running within a container") (description "GNU IceCat packaged with various fonts (including multi-lingual). Suitable for use within a container.") (license license:gpl3+))) #+END_SRC =2D-=20 Mike Gerwitz Free Software Hacker+Activist | GNU Maintainer & Volunteer GPG: D6E9 B930 028A 6C38 F43B 2388 FEF6 3574 5E6F 6D05 https://mikegerwitz.com --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJaaqXpAAoJEIyRe39dxRuiLg4QALQnMDWBUIGKb4z78ohK/44n SQ9jH2ef6p51hbIAATye7bzCEA830JVPGtwRiK9nF+a6y+IK79jQ8jLqYgo7cImo XKeBjnmZYLlHxkn/HkqsfpIdOYeRFYN+Ofu1K0chzvK/WdXzyCr/cr/c5hs2dGCq AqHe7ofCmgRnbkF09k8x49F8UXgsTXJmbgwTthyxh5i87qIU1h78N3FomhrJtX9Z ypRZKzhCk5Rq0jN+Y/zUzc4bD3bEu3pVPpw5MpMCWLWrEJ4XBJlgob+dqvKacyRC l5veaOPChVTDPe+c7AxP9JOX+MA9v6RNPqthEI7gfvZNgO45hAVhzLDHIs5fZUos pJFXK7MWOP0rqRdk/U7clwxXJDh5uP1xOQFJRfKeDUAAftG+OU1GGR8FKyVRysMr lMe+IKEodT/zlEIv2MGqKQ+Yg8DZHUyNPzDZyo9KwhSaR+Pq9rmq31+OPf035n+c N92HRWoCV9SVfrKfjsmexQYichIr1CEyNE5AznSg6M4TJ9Pi35SQhCbg9rAmRM9T GdidzAHTloZysTiDBB7g/+xmVRMNOJAMx+NZDx7MG6oJN7qXSO07vB+ATk+W0Km0 NFn3mjqk5tL2H2EFl6WxA+q/8TMQe59U4hLmntW7Y/0cvmxy31E0n7mMAUrgZh34 mg+PaTR300x1va/B3QkL =KO/v -----END PGP SIGNATURE----- --=-=-=--