Skip to content

Latest commit

 

History

History
506 lines (472 loc) · 16.1 KB

File metadata and controls

506 lines (472 loc) · 16.1 KB

Guix Notes

Chapters

Installation

Installation Process

Partitioning and System Init

(U)EFI

Basic (U)EFI Partition Layout and Creation Process:

Partition

If you want a swap partition, format and partition disks like this:

sudo parted /dev/sda --script \
     mklabel gpt \
     mkpart primary linux-swap 1MiB 4096MiB \
     name 1 guix-swap \
     mkpart ESP fat32 4096MiB 6144MiB \
     name 2 guix-efi \
     set 2 esp on \
     mkpart primary ext4 6144MiB 100% \
     name 3 guix-root

sudo mkswap -L guix-swap /dev/sda1
sudo swapon /dev/sda1
sudo mkfs.fat -F32 -n guix-efi /dev/sda2
sudo mkfs.ext4 -L guix-root /dev/sda3
sudo mount /dev/sda3 /mnt
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/sda2 /mnt/boot/efi

Otherwise, partition like this:

sudo parted /dev/sda --script \
  mklabel gpt \
  mkpart ESP fat32 1MiB 2048MiB \
  name 1 guix-efi \
  set 1 esp on \
  mkpart primary ext4 2048MiB 100% \
  name 2 guix-root

sudo mkfs.fat -F32 -n guix-efi /dev/sda1
sudo mkfs.ext4 -L guix-root /dev/sda2
sudo mount /dev/sda2 /mnt
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/sda1 /mnt/boot/efi
Bootloader and Filesystem Configuration for (U)EFI Setup
(bootloader (bootloader-configuration
  (bootloader grub-efi-bootloader)
  (targets '("/boot/efi"))
  (keyboard-layout keyboard-layout)))

(file-systems (cons* (file-system
                      (device (file-system-label "guix-root"))
                      (mount-point "/")
                      (type "ext4"))
                     (file-system
                      (device (file-system-label "guix-efi"))
                      (mount-point "/boot/efi")
                      (type "vfat"))
                     %base-file-systems))

;; If you enabled Swap, add this:
(swap-devices (list
               (swap-space
                (target (file-system-label "guix-swap")))))
Legacy/BIOS

Basic Legacy/BIOS Partition Layout anc Creation Process:

Partition and Mount
sudo parted /dev/sda --script \
  mklabel msdos \
  mkpart primary ext4 1MiB 100% \
  set 1 boot on

sudo mkfs.ext4 -L guix-root /dev/sda1
sudo mount /dev/sda1 /mnt

If you want a swap partition, do this instead:

sudo parted /dev/sda --script \
     mklabel msdos \
     mkpart primary linux-swap 1MiB 4096MiB \
     mkpart primary ext4 4096MiB 100% \
     set 2 boot on


sudo mkswap -L guix-swap /dev/sda1
sudo swapon /dev/sda1
sudo mkfs.ext4 -L guix-root /dev/sda2
sudo mount /dev/sda2 /mnt
Bootloader and Filesystem
(bootloader (bootloader-configuration
              (bootloader grub-bootloader)
              (keyboard-layout keyboard-layout)
              (targets '("/dev/sdb")))) ; or other '/dev/sdX'-drive with root partition.

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

;; If you enabled Swap, add this:
(swap-devices (list
               (swap-space
                (target (file-system-label "guix-swap")))))
System Initialization

To initialize the Guix System, run `guix system init /path/to/config.scm /mnt`, e.g.:

mkdir -p /mnt/etc/guix
mv /path/to/geex/* /mnt/etc/guix/
herd start cow-store /mnt
guix system init /mnt/etc/guix/config.scm /mnt

The command `herd start cow-store /mnt` initializes a copy-on-write /gnu/store inside /mnt, so that the downloaded and installed packages, derivations, and files, get installed to /mnt/gnu/store, and not into RAM or any other temporary/live /gnu/store.

Passwords

Set passwords for users inside the “/mnt”-mounted GNU+Linux install.

passwd -R /mnt root
passwd -R /mnt puppy

Channel Setup

Authorize channel keys via ‘sudo guix archive –authorize < /etc/guix/files/keys/nonguix.pub’.

guix shell git-minimal
git clone https://github.com/librepup/geex.git
mkdir -p /mnt/geex
mkdir -p ~/.config/guix
cp ./geex/channels.scm ~/.config/guix/channels.scm
guix archive --authorize < ./geex/files/keys/nonguix.pub
; Optional, define channels file: 'guix pull --channels=/path/to/channels.scm'
guix pull

Wifi Configuration

Commands

Find WiFi Device/Cards Name via ‘ifconfig -a’.

sudo ip link set interface1s0 up
sudo rfkill unblock wifi
rfkill unblock all
wpa_supplicant -c wifi.conf -i interface1s0 -B
dhclient -v interface1s0
nmcli device wifi list
nmcli device wifi connect "SSID" password "PASSWORD"

Then check ip address assignment via ‘ip addr show interface1s0’, and check the routing table with ‘ip route show’. If the routing got set up correctly, a line starting with “default via …” should appear.

wifi.conf

network={
  ssid="ssid-name"
  key_mgmt=WPA-PSK
  psk="password"
}

Or for an open network:

network={
  ssid="ssid-name"
  key_mgmt=NONE
  priority=1
}

After Fist Install

To update the Guix Channels and pull the latest Guix and Channel Versions, run `guix pull`. Then, to rebuild your system, run `sudo guix system reconfigure /path/to/config.scm`. After running `guix pull`, remember to run `hash guix` to update bash’s cache and clear it of the old guix binary location. Also make sure that “~/.config/guix/channels.scm” or “/etc/guix/channels.scm” is the first item in your $PATH.

Useful Commands

List System Generations

guix system list-generations

Describe System Generation

guix system describe

Delete Generations older than 1 Month

sudo guix system delete-generations 1m

Roll Back to Older Generation

sudo guix system roll-back

Guix Garbage Collector

Delete Generations older than 1 Month, and try to free up at least 10GiB.

guix gc -d 1m -F 10G

Deduplicate/Optimize Guix Store

guix gc --optimize

Reconfigure Guix Home

guix home reconfigure /path/to/home.scm

Describe/List Channels

guix describe

Upgrade Packages

guix upgrade

Reformat/Style Scheme File

This can help to find syntax errors, such as misplaced brackets, easier.

guix style -f config.scm

List Installed Packages

guix package --list-installed

Install Package

guix install

Remove Package

guix remove

Delete Old Package Generations

guix package --delete-generations

Shepherd Commands

Start Service

sudo herd start name

Stop Service

sudo herd stop name

Restart Service

sudo herd restart name

Service Status

sudo herd status name

List Services

sudo herd status

Combinations

Guix Garbage Collecting

  1. `guix gc`
  2. `sudo guix system delete-generations 1d`
  3. `guix package –delete-generations`

Guix Pull and Daemon Restart

  1. `guix pull`
  2. `sudo systemctl restart guix-daemon.service` or `sudo herd restart guix-daemon`

Snippets

Manual Emacs Daemon

(simple-service 'emacs-daemon shepherd-root-service-type
                (list (shepherd-service (documentation "Emacs Daemon")
                                        (provision '(emacs-daemon))
                                        (requirement '(user-processes))
                                        (start #~(make-forkexec-constructor
                                                  (list #+(file-append
                                                           emacs-pgtk
                                                           "/bin/emacs")
                                                        "--fg-daemon")
                                                  #:user "puppy"
                                                  #:group "users"
                                                  #:log-file
                                                  "/var/log/emacs-daemon.log"
                                                  #:environment-variables (list
                                                                           (string-append
                                                                            "HOME=/home/puppy")
                                                                           "TERM=kitty")))
                                        (stop #~(make-kill-destructor))
                                        (respawn? #t))))

Mute Audio Devices Service

(simple-service 'null-audio boot-service-type
                (list (shepherd-service (documentation "Null Out Audio")
                                        (provision '(audio-null-out))
                                        (requirement '(alsa))
                                        (start #~(make-forkexec-constructor
                                                  (list #+(file-append
                                                           alsa-utils
                                                           "/bin/amixer")
                                                        "set" "Master"
                                                        "0%")))
                                        (stop #~(make-kill-destructor)))))
(simple-service 'mute-audio boot-service-type
                (list (shepherd-service (documentation "Mute Audio")
                                        (provision '(audio-mute))
                                        (requirement '(alsa))
                                        (start #~(make-forkexec-constructor
                                                  (list #+(file-append
                                                           alsa-utils
                                                           "/bin/amixer")
                                                        "set" "Master"
                                                        "mute")))
                                        (stop #~(make-kill-destructor)))))

Pin Kernel Version

Use this to pin nonguix & guix channel to linux kernel 6.18.7 commit, so that not every rebuild, rebuilds the entire kernel.

(operating-system
  (kernel (let*
              ((channels
                (list (channel
                       (name 'nonguix)
                       (url "https://gitlab.com/nonguix/nonguix")
                       (commit "6c0ea215e0bd089bf3b2097e5c59dd726fbbe3045"))
                      (channel
                       (name 'guix)
                       (url "https://git.guix.gnu.org/guix.git")
                       (commit "9e6705676ffb7568d03b2b6c9fa3944afa2341e7"))))
               (inferior
                (inferior-for-channels channels)))
              (first (lookup-inferior-packages inferior "linux" "6.18.7"))))
)

PantherX Channel

(append (list
         (channel
          (name 'pantherx)
          (url "https://codeberg.org/gofranz/panther.git")
          (introduction
           (make-channel-introduction
            "54b4056ac571611892c743b65f4c47dc298c49da"
            (openpgp-fingerprint
             "A36A D41E ECC7 A871 1003  5D24 524F EB1A 9D33 C9CB")))))
        %default-channels)

Alsa Service

The Alsa Service is already included in “%desktop-services”, so no need to manually add it.

(service alsa-service-type)

Bootloader

Legacy/BIOS

(bootloader (bootloader-configuration
             (keyboard-layout keyboard-layout)
             (bootloader grub-bootloader)
             (targets '("/dev/sda"))))

(U)EFI

(bootloader (bootloader-configuration
             (keyboard-layout keyboard-layout)
             (bootloader grub-efi-bootloader)
             (targets '("/boot/efi"))))

File-System

Create the root (/) partition with label “guix-root”, and the boot partition (if present) with label “guix-efi” or “guix-boot”. Labels can be attached afterwards via ‘sudo e2label /dev/sda1 guix-root’ or ‘sudo tune2fs -L guix-root /dev/sda1’.

Encrypted

(file-systems (append
               (list (file-system
                      (device "/dev/mapper/cryptroot")
                      (mount-point "/")
                      (type "ext4")
                      (dependencies mapped-devices))
                     (file-system
                      (device (file-system-label "guix-efi"))
                      ; or: (device (uuid "boot-partition-uuid" 'fat32))
                      (mount-point "/boot/efi")
                      (type "vfat")))
               %base-file-systems))

Regular (U)EFI

(file-systems (cons* (file-system
                      (mount-point "/")
                      (device (file-system-label "guix-root"))
                      (type "ext4"))
                     (file-system
                      (mount-point "/boot/efi")
                      (device (file-system-label "guix-efi"))
                      ; or:
                      ;  (device (uuid "PartitionUUID"))
                      ; optional:
                      ;  (device (uuid "PartitionUUID" 'fat32))
                      (type "vfat"))
                     %base-file-systems))

Regular (Legacy/BIOS)

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

Nonguix Transformation

See Nonguix Documentation (https://gitlab.com/nonguix/nonguix), Section: NVIDIA Graphics Card -> System Setup.

Xorg

((nonguix-transformation-nvidia #:configure-xorg? #t)
 %guix-os)

Wayland

((compose (nonguix-transformation-nvidia))
 %guix-os)

Service Configuration

Delete Service

(modify-services %desktop-services
 (delete pulseaudio-service-type)
)

Xorg Nvidia Service

(services
 (append
  (list
   (set-xorg-configuration
    (xorg-configuration
     (keyboard-layout keyboard-layout)
     (modules (cons nvidia-driver %default-xorg-modules))
     (drivers '("nvidia"))))
  )
 )
)

Specify Package’s Source Channel

To specify the channel a package should be pulled from, define the name like so:

(use-modules (jonabron packages emacs) #:rename (emacs-fancy-dabbrev jonabron-emacs-fancy-dabbrev))
(use-modules (emacs packages melpa) #:rename (emacs-fancy-dabbrev melpa-emacs-fancy-dabbrev))

And then add the renamed package to the packages list:

(home-environment
 (packages (specifications->packages
            (list "jonabron-emacs-fancy-dabbrev") ; or: "melpa-emacs-fancy-dabbrev"
 ))
)

GNU Hurd

System Service Setup

(services
 (append
  (list
   (service hurd-vm-service-type
            (hurd-vm-configuration
             (memory-size 2048)
             (secret-directory "/etc/guix/hurd-secrets")))
  )
 )
)

Entering

Enter Hurd via `ssh -p 2222 root@localhost`. (+`-X` for X11 passthrough)

File Transfer

Copy files to Hurd via `scp -P 2222 <file> root@localhost:~/`, and similarly, from Hurd, via `scp -P 2222 root@localhost:/hurd/path/to/file ./`.

SSH Setup

Generate SSH Key via `ssh-keygen -t ed25519`, spam enter to not set a passphrase and use the default settings, then copy the `~/.ssh/id_XXXXXXX.pub` key into `/etc/guix/hurd-secrets` before rebuilding the system.

Shepherd Service Commands

Hurd Status

`herd status hurd-vm`

Stop Hurd

`herd stop hurd-vm`

Start Hurd

`herd start hurd-vm`

Optional Fixes

X11 Forwarding

In case X11/Xorg forwarding via SSH does not work, it may be advised to set an option such as `xhost +local:root`.