GuixSD

by Daniel Pimentel — Fri 01 January 2016

GuixSD (Guix System Distribution) is an advanced distribution of the GNU operating system developed by the GNU Project —which respects the freedom of computer users. GuixSD has GNU Guix package manager, in addition to standard package management features, supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and more. It provides Guile Scheme APIs, including high-level embedded domain-specific languages (EDSLs) to define packages and whole-system configurations.

Keyboard

loadkeys br-abnt2

Wired

ifconfig [interface] up
dhclient [interface]

Wireless

zile wpa_supplicant.conf
network={
  ssid="ssid"
  key_mgmt=WPA-PSK
  psk="passphrase"
}
wpa_supplicant -c wpa_supplicant.conf -i [interface] -B
dhclient [interface]

Disk

parted /dev/sda
mkfs.ext4 -L root /dev/sda1
mount -L root /mnt
mkdir /mnt/etc

Encrypted Disk

parted /dev/sda
cryptsetup luksFormat /dev/sda1
cryptsetup open --type luks /dev/sda1 root
mkfs.ext4 -L root /dev/mapper/root
mount -L root /mnt
mkdir /mnt/etc

Swap

mkswap /dev/sda1
swapon /dev/sda1

Shepherd

herd start cow-store /mnt

Server

cp /etc/configuration/bare-bones.scm /mnt/etc/config.scm
zile /mnt/etc/config.scm
;; This is an operating system configuration template
;; for a "bare bones" setup, with no X11 display server.

(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules admin)

(operating-system
  (host-name "d4n1")
  (timezone "America/Maceio")
  (locale "en_US.utf8")

  ;; Assuming /dev/sdX is the target hard disk, and "my-root" is
  ;; the label of the target root file system.
  (bootloader (grub-configuration (device "/dev/sda")))
  (file-systems (cons (file-system
                        (device "root")
                        (title 'label)
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))

  ;; This is where user accounts are specified.  The "root"
  ;; account is implicit, and is initially created with the
  ;; empty password.
  (users (cons (user-account
                (name "d4n1")
                (comment "d4n1")
                (group "users")

                ;; Adding the account to the "wheel" group
                ;; makes it a sudoer.  Adding it to "audio"
                ;; and "video" allows the user to play sound
                ;; and access the webcam.
                (supplementary-groups '("wheel"
                                        "audio" "video"))
                (home-directory "/home/d4n1"))
               %base-user-accounts))

  ;; Globally-installed packages.
  (packages (cons tcpdump %base-packages))

  ;; Add services to the baseline: a DHCP client and
  ;; an SSH server.
  (services (cons* (dhcp-client-service)
                   (service openssh-service-type
                            (openssh-configuration
                              (port-number 2222)))
                   %base-services)))

Desktop (GNOME + XFCE + LUKS)

cp /etc/configuration/desktop.scm /mnt/etc/config.scm
zile /mnt/etc/config.scm
;; This is an operating system configuration template
;; for a "desktop" setup with GNOME and Xfce where the
;; root partition is encrypted with LUKS.

(use-modules (gnu) (gnu system nss))
(use-service-modules desktop)
(use-package-modules certs gnome)

(operating-system
  (host-name "d4n1")
  (timezone "America/Maceio")
  (locale "en_US.utf8")

  ;; Assuming /dev/sdX is the target hard disk, and "root"
  ;; is the label of the target root file system.
  (bootloader (grub-configuration (device "/dev/sda")))

  ;; Specify a mapped device for the encrypted root partition.
  ;; The UUID is that returned by 'cryptsetup luksUUID'.
  (mapped-devices
   (list (mapped-device
          (source (uuid "12345678-1234-1234-1234-123456789abc"))
          (target "the-root-device")
          (type luks-device-mapping))))

  (file-systems (cons (file-system
                        (device "root")
                        (title 'label)
                        (mount-point "/")
                        (type "ext4")
                        (dependencies mapped-devices))
                      %base-file-systems))

  (users (cons (user-account
                (name "d4n1")
                (comment "d4n1")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/d4n1"))
               %base-user-accounts))

  ;; This is where we specify system-wide packages.
  (packages (cons* nss-certs         ;for HTTPS access
                   gvfs              ;for user mounts
                   %base-packages))

  ;; Add GNOME and/or Xfce---we can choose at the log-in
  ;; screen with F1.  Use the "desktop" services, which
  ;; include the X11 log-in service, networking with Wicd,
  ;; and more.
  (services (cons* (gnome-desktop-service)
                   (xfce-desktop-service)
                   %desktop-services))

  ;; Allow resolution of '.local' host names with mDNS.
  (name-service-switch %mdns-host-lookup-nss))

Lightweight Desktop (Ratpoison + i3 + UEFI)

cp /etc/configuration/lighting.scm /mnt/etc/config.scm
zile /mnt/etc/config.scm
;; This is an operating system configuration template
;; for a "desktop" setup without full-blown desktop
;; environments.

(use-modules (gnu) (gnu system nss))
(use-service-modules desktop)
(use-package-modules bootloaders certs ratpoison suckless wm)

(operating-system
  (host-name "d4n1")
  (timezone "America/Maceio")
  (locale "en_US.utf8")

  ;; Use the UEFI variant of GRUB with the EFI System
  ;; Partition on /dev/sda1.
  (bootloader (grub-configuration (grub grub-efi)
                                  (device "/dev/sda1")))

  ;; Assume the target root file system is labelled "root".
  (file-systems (cons* (file-system
                         (device "root")
                         (title 'label)
                         (mount-point "/")
                         (type "ext4"))
                       (file-system
                         ;; Specify partition here since FAT
                         ;; labels are currently unsupported.
                         (device "/dev/sda1")
                         (mount-point "/boot/efi")
                         (type "vfat"))
                       %base-file-systems))

  (users (cons (user-account
                (name "d4n1")
                (comment "d4n1")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/d4n1"))
               %base-user-accounts))

  ;; Add a bunch of window managers; we can choose one at
  ;; the log-in screen with F1.
  (packages (cons* ratpoison i3-wm i3status dmenu ;window managers
                   nss-certs                      ;for HTTPS access
                   %base-packages))

  ;; Use the "desktop" services, which include the X11
  ;; log-in service, networking with Wicd, and more.
  (services %desktop-services)

  ;; Allow resolution of '.local' host names with mDNS.
  (name-service-switch %mdns-host-lookup-nss))

My Desktop

cp /etc/configuration/desktop.scm /mnt/etc/config.scm
zile /mnt/etc/config.scm
;; This is an operating system configuration template
;; for a "desktop" setup with GNOME.

(use-modules (gnu) (gnu system nss))
(use-service-modules desktop)
(use-package-modules certs gnome)

(operating-system
  (host-name "d4n1")
  (timezone "America/Maceio")
  (locale "en_US.utf8")

  ;; Assuming /dev/sdX is the target hard disk, and "root"
  ;; is the label of the target root file system.
  (bootloader (grub-configuration (device "/dev/sda")))

  (file-systems (cons (file-system
                        (device "root")
                        (title 'label)
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))

  (swap-devices '("/dev/sda2"))

  (users (cons (user-account
                (name "d4n1")
                (comment "d4n1")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/d4n1"))
               %base-user-accounts))

  ;; This is where we specify system-wide packages.
  (packages (cons* nss-certs         ;for HTTPS access
                   gvfs              ;for user mounts
                   %base-packages))

  ;; Add GNOME.  Use the "desktop" services, which
  ;; include the X11 log-in service, networking with Wicd,
  ;; and more.
  (services (cons* (gnome-desktop-service)      
                   %desktop-services))

  ;; Allow resolution of '.local' host names with mDNS.
  (name-service-switch %mdns-host-lookup-nss))

Install

guix system init /mnt/etc/config.scm /mnt

Reboot

reboot
GuixSD
2000-2016 by Daniel Pimentel under GFDL