2019-04-26 11:39:53 +02:00
|
|
|
;; This is an operating system configuration for a VM image.
|
|
|
|
;; Modify it as you see fit and instantiate the changes by running:
|
|
|
|
;;
|
|
|
|
;; guix system reconfigure /etc/config.scm
|
|
|
|
;;
|
2017-05-14 02:44:36 +02:00
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
(use-modules (gnu) (srfi srfi-1))
|
2019-04-27 10:15:34 +02:00
|
|
|
(use-service-modules desktop networking ssh xorg)
|
2019-04-28 15:12:50 +02:00
|
|
|
(use-package-modules bootloaders certs fonts nvi wget xorg)
|
2017-05-14 02:44:36 +02:00
|
|
|
|
|
|
|
(define vm-image-motd (plain-file "motd" "
|
2019-04-26 11:39:53 +02:00
|
|
|
\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m
|
2017-05-14 02:44:36 +02:00
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
This instance of Guix is a template for virtualized environments.
|
|
|
|
You can reconfigure the whole system by adjusting /etc/config.scm
|
|
|
|
and running:
|
2017-05-14 02:44:36 +02:00
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
guix system reconfigure /etc/config.scm
|
|
|
|
|
2019-04-27 14:58:27 +02:00
|
|
|
Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
|
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
\x1b[1;33mConsider setting a password for the 'root' and 'guest' \
|
|
|
|
accounts.\x1b[0m
|
|
|
|
"))
|
|
|
|
|
|
|
|
(define this-file
|
2019-04-26 16:47:11 +02:00
|
|
|
(local-file (basename (assoc-ref (current-source-location) 'filename))
|
|
|
|
"config.scm"))
|
2017-05-14 02:44:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
(operating-system
|
|
|
|
(host-name "gnu")
|
|
|
|
(timezone "Etc/UTC")
|
|
|
|
(locale "en_US.utf8")
|
2019-04-26 11:39:53 +02:00
|
|
|
(keyboard-layout (keyboard-layout "us" "altgr-intl"))
|
2017-05-14 02:44:36 +02:00
|
|
|
|
2019-01-21 19:37:59 +01:00
|
|
|
(firmware '())
|
2018-12-11 15:42:56 +01:00
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
;; Below we assume /dev/vda is the VM's hard disk.
|
|
|
|
;; Adjust as needed.
|
2017-09-03 01:19:38 +02:00
|
|
|
(bootloader (bootloader-configuration
|
|
|
|
(bootloader grub-bootloader)
|
2019-04-26 11:39:53 +02:00
|
|
|
(target "/dev/vda")
|
2017-09-03 01:19:38 +02:00
|
|
|
(terminal-outputs '(console))))
|
2017-05-14 02:44:36 +02:00
|
|
|
(file-systems (cons (file-system
|
|
|
|
(mount-point "/")
|
2019-04-26 11:39:53 +02:00
|
|
|
(device "/dev/vda1")
|
2017-05-14 02:44:36 +02:00
|
|
|
(type "ext4"))
|
|
|
|
%base-file-systems))
|
|
|
|
|
2019-04-26 11:39:53 +02:00
|
|
|
(users (cons (user-account
|
|
|
|
(name "guest")
|
|
|
|
(comment "GNU Guix Live")
|
|
|
|
(password "") ;no password
|
|
|
|
(group "users")
|
|
|
|
(supplementary-groups '("wheel" "netdev"
|
|
|
|
"audio" "video")))
|
|
|
|
%base-user-accounts))
|
|
|
|
|
2019-04-27 15:07:31 +02:00
|
|
|
;; Our /etc/sudoers file. Since 'guest' initially has an empty password,
|
|
|
|
;; allow for password-less sudo.
|
|
|
|
(sudoers-file (plain-file "sudoers" "\
|
|
|
|
root ALL=(ALL) ALL
|
|
|
|
%wheel ALL=NOPASSWD: ALL\n"))
|
|
|
|
|
2019-04-28 15:12:50 +02:00
|
|
|
(packages (append (list font-bitstream-vera nss-certs nvi wget)
|
2019-04-27 14:57:36 +02:00
|
|
|
%base-packages))
|
2019-04-26 11:39:53 +02:00
|
|
|
|
|
|
|
(services
|
|
|
|
(append (list (service xfce-desktop-service-type)
|
|
|
|
|
|
|
|
;; Copy this file to /etc/config.scm in the OS.
|
|
|
|
(simple-service 'config-file etc-service-type
|
|
|
|
`(("config.scm" ,this-file)))
|
|
|
|
|
|
|
|
;; Choose SLiM, which is lighter than the default GDM.
|
|
|
|
(service slim-service-type
|
|
|
|
(slim-configuration
|
|
|
|
(auto-login? #t)
|
|
|
|
(default-user "guest")
|
|
|
|
(xorg-configuration
|
|
|
|
(xorg-configuration
|
2019-04-26 18:24:55 +02:00
|
|
|
(keyboard-layout keyboard-layout)))))
|
2019-04-26 11:39:53 +02:00
|
|
|
|
2019-04-27 10:15:34 +02:00
|
|
|
;; Uncomment the line below to add an SSH server.
|
|
|
|
;;(service openssh-service-type)
|
|
|
|
|
2019-04-26 18:24:55 +02:00
|
|
|
;; Use the DHCP client service rather than NetworkManager.
|
|
|
|
(service dhcp-client-service-type))
|
|
|
|
|
|
|
|
;; Remove GDM, NetworkManager, and wpa-supplicant, which don't make
|
|
|
|
;; sense in a VM.
|
2019-04-26 11:39:53 +02:00
|
|
|
(remove (lambda (service)
|
2019-04-26 18:24:55 +02:00
|
|
|
(let ((type (service-kind service)))
|
|
|
|
(memq type (list gdm-service-type
|
|
|
|
wpa-supplicant-service-type
|
|
|
|
cups-pk-helper-service-type
|
|
|
|
network-manager-service-type))))
|
2019-04-26 11:39:53 +02:00
|
|
|
(modify-services %desktop-services
|
|
|
|
(login-service-type config =>
|
|
|
|
(login-configuration
|
|
|
|
(inherit config)
|
|
|
|
(motd vm-image-motd)))))))
|
|
|
|
|
|
|
|
;; Allow resolution of '.local' host names with mDNS.
|
|
|
|
(name-service-switch %mdns-host-lookup-nss))
|