On Thu, Jan 25, 2018 at 23:16:47 +0100, Ludovic Courtès wrote: > If you drop the attached file under guix/scripts/, you can then run: > > guix run icecat icecat > > and similar. This particular example doesn’t work well because of the > font issue you’re 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=user \ --network \ -r "$gc_root" \ --expose=/etc/machine-id \ --expose=/tmp/.X11-unix/ \ --expose=$HOME/.Xauthority \ --share=/dev/snd \ --share=$HOME/.mozilla/ \ --share=$HOME/Downloads/icecat-container/=$HOME/Downloads/ \ --ad-hoc mtg-icecat-containerized \ -- \ icecat --display=: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 -- Mike Gerwitz Free Software Hacker+Activist | GNU Maintainer & Volunteer GPG: D6E9 B930 028A 6C38 F43B 2388 FEF6 3574 5E6F 6D05 https://mikegerwitz.com