guix系统安装配置

  • 国内下载

https://mirrors.sjtug.sjtu.edu.cn/gnu/guix/
https://mirrors.aliyun.com/gnu/guix/

# 镜像说明
https://guix.org.cn/wiki/mirror/
# 换源之后还是很慢,应该是第三方的包
  • 进入live之后

# 连接网络并启用sshd
ifconfig eth0 up
dhclient eth0
herd start ssh-daemon

# 自行格式化磁盘,并挂载
cfdisk

# 配置文件
mkdir /mnt/etc
cp /etc/configuration/bare-bones.scm /mnt/etc/config.scm
# 在现在语法检查
https://www.tutorialspoint.com/execute_lisp_online.php

# 启用cow-store服务
herd start cow-store /mnt
# 安装
guix system init /mnt/etc/config.scm /mnt --substitute-urls=https://mirror.sjtu.edu.cn/guix/
; 12.1 Using the Configuration System
;; 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 screen ssh)
(gnu services docker)

;; 定义源
(define %cn-source
  (modify-services %base-services
    (guix-service-type config =>
                       (guix-configuration
                        (inherit config)
                        ;; Fetch substitutes from example.org.
                        (substitute-urls
                          (list "https://mirror.sjtu.edu.cn/guix/"
                                "https://ci.guix.gnu.org"))))))

(operating-system
  (host-name "guixone")
  (timezone "Asia/Shanghai")
  (locale "zh_CN.utf8")

  ;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
  ;; target hard disk, and "my-root" is the label of the target
  ;; root file system.
  (bootloader
              ;; (bootloader-configuration
              ;;   (bootloader grub-bootloader)
              ;;   (targets '("/dev/sda"))))
            ; 如果是uefi使用boot/efi的位置
              (bootloader-configuration
                (bootloader grub-efi-bootloader)
                (targets '("/boot/efi")))

  ;; It's fitting to support the equally bare bones ‘-nographic’
  ;; QEMU option, which also nicely sidesteps forcing QWERTY.
  (kernel-arguments (list "console=ttyS0,115200"))
  ;; 文件系统
  (file-systems (append
                 (list (file-system
                         (device "/dev/sda2")
                         (mount-point "/")
                         (type "ext4")
                         (dependencies mapped-devices))
                       (file-system
                         (device "/dev/sda1")
                         (mount-point "/boot/efi")
                         (type "vfat")))
                 %base-file-systems))
  ;; Specify a swap file for the system, which resides on the
  ;; root file system.
  (swap-devices (list (swap-space
                       (target "/swapfile"))))

  ;; 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 "jcleng")
                (comment "jclengs home account")
                (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")))
               %base-user-accounts))

  ;; Globally-installed packages.
  ;; (packages (cons screen %base-packages))
  (packages (append (list
                     ;; window managers
                     ratpoison i3-wm i3status dmenu
                     ;; emacs emacs-exwm emacs-desktop-environment
                     git
                     ;; terminal emulator
                     xterm
                     ;; for HTTPS access
                     nss-certs)
                    %base-packages))

  ;; Add services to the baseline: a DHCP client and
  ;; an SSH server.
  (services (append (list (service dhcp-client-service-type)
                          (service openssh-service-type
                                   (openssh-configuration
                                    (openssh openssh-sans-x)
                                    (port-number 2222)))
                          ;; x11
                          (service gnome-desktop-service-type)
                          (service xfce-desktop-service-type)
                          (set-xorg-configuration
                            (xorg-configuration
                            (keyboard-layout keyboard-layout))
                            sddm-service-type)
                          ;; 源
                          (service %cn-source)
                    )
                    %desktop-services)))

; 其他说明
; 磁盘挂载点: https://guix.gnu.org/manual/en/html_node/File-Systems.html
  • 虚拟机安装

qemu-system-x86_64 -m 1024 -boot d -smp 8,sockets=2,cores=4 -net nic -net user -drive format=raw,file=vm.img -cdrom guix.iso