dotfiles/seedfile.org
2021-09-26 21:12:19 +01:00

10 KiB

What is this?

Welcome to the seedfile! This file contains all the code required to generate (so far) the following:

  • Multi-device emacs configuration (WIP).
  • Base Guix configuration and per device configuration.

Other things may be added later. In the meantime, enjoy the tangle!

Emacs Configuration

Starting in 2021, I've moved what I would use Sublime Text for over to Emacs. As such, I need a relatively usable configuration. Attempts to use DOOMEmacs/spacemacs mostly led to frustration as I didn't learn the underlying editor.

The Basics & UI Tweaks

Some of the basics include turning off some of the defaults for a more focused experience, akin to what you'd expect from ST.

(setq inhibit-startup-message  t)

(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(set-fringe-mode 10)

(menu-bar-mode -1)

(set-face-attribute 'default nil :font "IBM Plex Mono" :height 120)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(setq org-edit-src-content-indentation 0
      org-src-tab-acts-natively t
      org-src-preserve-indentation t)

Packages

Next is a relatively lengthy packages block. There's a few key elements here, including my theme of choice (Monokai Pro) and the setup of several useful UI/UX elements such as treemacs, LSP mode, ivy and projectile, among others. Eventually this will be split into its own file.

;; Packages stuff.
(require 'package)

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
			 ("org" . "https://orgmode.org/elpa/")
			 ("elpa" . "https://elpa.gnu.org/packages/")))

(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)

;; I like Monokai Pro, sue me ;)
(use-package monokai-pro-theme
  :ensure t
  :config
  (load-theme 'monokai-pro-spectrum t))

(use-package doom-modeline
  :ensure t
  :init (doom-modeline-mode 1)
  :custom
   (doom-mode-line-height  15))
(use-package all-the-icons :ensure t)

(use-package treemacs
  :ensure t
  :defer t
  :init
  :bind (:map global-map
	      ("M-0" . treemacs-select-window)
	      ("C-x t t" . treemacs)))
(use-package treemacs-projectile
  :ensure t)
;; LSP config.
(use-package spinner :ensure t)
(use-package lsp-mode
  :ensure t
  :init
  (setq lsp-keymap-prefix "C-c l")
  :hook ((rust-mode . lsp)
	 (lsp-mode . lsp-enable-which-key-integration))
  :commands lsp)

(use-package lsp-ui :commands lsp-ui-mode)
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
(use-package lsp-treemacs :commands lsp-treemacs-errors-list)

(use-package rust-mode)

;; Can't have lisps without paredit!
(use-package paredit
  :ensure t
  :config
  (add-hook 'emacs-lisp-mode-hook #'paredit-mode)
  ;; enable in the *scratch* buffer
  (add-hook 'lisp-interaction-mode-hook #'paredit-mode)
  (add-hook 'ielm-mode-hook #'paredit-mode)
  (add-hook 'lisp-mode-hook #'paredit-mode)
  (add-hook 'eval-expression-minibuffer-setup-hook #'paredit-mode))

(use-package projectile
  :ensure t
  :init
  (projectile-mode +1)
  :bind (:map projectile-mode-map
	      ("s-p" . projectile-command-map)
	      ("C-c p" . projectile-command-map))
  :config
  (setq projectile-project-search-path '("~/Projects")))

;; Ivy/Swiper/Counsel config.
(use-package swiper)
(use-package counsel)
(use-package ivy
  :diminish
  :bind (("C-s" . swiper)
	 :map ivy-minibuffer-map
	 ("TAB" . ivy-alt-done)
	 ("C-l" . ivy-alt-done)
	 ("C-j" . ivy-next-line)
	 ("C-k" . ivy-previous-line)
	 :map ivy-switch-buffer-map
	 ("C-k" . ivy-previous-line)
	 ("C-l" . ivy-done)
	 ("C-d" . ivy-switch-buffer-kill)
	 :map ivy-reverse-i-search-map
	 ("C-k" . ivy-previous-line)
	 ("C-d" . ivy-reverse-i-search-kill))
  :config
  (ivy-mode 1))
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   '(treemacs-projectile projectile paredit all-the-fonts doom-modeline rust-mode swipe spinner lsp-treemacs lsp-ivy lsp-ui lsp-mode counsel swiper ivy treemacs use-package monokai-pro-theme)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Guix Configuration

Channels

I don't really need any fancy channels, besides nonguix and my own repository.

;; This file is generated from ~/dotfiles/guix/system-config/base.org.
(list (channel
       (name 'nonguix)
       (url "https://gitlab.com/nonguix/nonguix"))
      (channel
       (name 'gguix)
       (url "https://github.com/gmemstr/gguix"))
      (channel
       (name 'guix)
       (url "https://git.savannah.gnu.org/git/guix.git")
       (introduction
	(make-channel-introduction
	 "9edb3f66fd807b096b48283debdcddccfea34bad"
	 (openpgp-fingerprint
	  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")))))

Systems

Base Configuration

Just some basic importing of modules for now. I'm using the nonfree Linux kernel from nonguix.

;; This file is geneated from ~/dotfiles/guix/system-config/base.org
(define-module (base-system)
  #:use-module (gnu)
  #:use-module (srfi srfi-1)
  #:use-module (gnu system nss)
  #:use-module (gnu services pm)
  #:use-module (gnu services cups)
  #:use-module (gnu services desktop)
  #:use-module (gnu services docker)
  #:use-module (gnu services networking)
  #:use-module (gnu services virtualization)
  #:use-module (gnu packages wm)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages vim)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages file-systems)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages mtools)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages gnuzilla)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages web-browsers)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages package-management)
  #:use-module (nongnu packages linux)
  #:use-module (nongnu system linux-initrd))

(use-service-modules nix)
(use-service-modules desktop xorg)
(use-package-modules certs)
(use-package-modules shells)

(define %xorg-libinput-config
  "Section \"InputClass\"
  Identifier \"Touchpads\"
  Driver \"libinput\"
  MatchDevicePath \"/dev/input/event*\"
  MatchIsTouchpad \"on\"

  Option \"Tapping\" \"on\"
  Option \"TappingDrag\" \"on\"
  Option \"DisableWhileTyping\" \"on\"
  Option \"MiddleEmulation\" \"on\"
  Option \"ScrollMethod\" \"twofinger\"
EndSection
Section \"InputClass\"
  Identifier \"Keyboards\"
  Driver \"libinput\"
  MatchDevicePath \"/dev/input/event*\"
  MatchIsKeyboard \"on\"
EndSection
")

And now we can configure the actual base OS. This is more or less everything I'd need in a typing install of Guix/Linux.

(define-public base-operating-system
  (operating-system
   (host-name "london")
   (timezone "Europe/London")
   (locale "en_US.utf8")

   ;; Nonfree stuff
   (kernel linux)
   (firmware (list linux-firmware))
   (initrd microcode-initrd)

   (keyboard-layout (keyboard-layout "us" "intl"))

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

   (file-systems (cons*
		  (file-system
		   (device "/dev/sda1")
		   (mount-point "/boot")
		   (type "vfat"))
		  (file-system
		   (device "/dev/sda2")
		   (mount-point "/")
		   (type "ext4")) %base-file-systems))

   (users (cons (user-account
		 (name "gsimmer")
		 (comment "Gabriel Simmer")
		 (password (crypt "pass" "$6$abc"))
		 (group "users")
		 (supplementary-groups '("wheel" "netdev"
					"audio" "video"
					"docker" "kvm"
					"tty" "input"
					"realtime" "audio"
					"video")))
		%base-user-accounts))
   (groups (cons (user-group (system? #t) (name "realtime"))
		 %base-groups))

   (packages (append (list
		      git
		      exfat-utils
		      fuse-exfat
		      stow
		      vim
		      emacs
		      xterm
		      pulseaudio
		      xf86-input-libinput
		      nss-certs
		      gvfs) %base-packages))
   (services (append (list (service gnome-desktop-service-type)
			   (set-xorg-configuration
			    (xorg-configuration
			     (keyboard-layout keyboard-layout)))
			   (service docker-service-type))
		     %desktop-services))
   (name-service-switch %mdns-host-lookup-nss)))

Individual Systems

London

London is my primary custom built desktop, with

  • 256GB Samsung 860 NVMe SSD + 1TB WD SATA SSD + 500GB Samsung SATA SSD
  • 16GB Corsair Vengeance RGB Pro DDR4-3200 CL16
  • AMD Ryzen 7 3700x
  • Asus GeForce GTX 1070 8GB
(define-module (london)
  #:use-module (base-system)
  #:use-module (gnu))

(operating-system
 (inherit base-operating-system)
 (host-name "london")

 (file-systems (cons*
		(file-system
		 (device "/dev/nvme0n1p1")
		 (mount-point "/boot/efi")
		 (type "vfat"))
		(file-system
		 (device "/dev/nvme0n1p2")
		 (mount-point "/")
		 (type "ext4"))
		(file-system
		 (device "/dev/sda1")
		 (mount-point "/home/gsimmer/wd")
		 (type "ext4"))
		(file-system
		 (device "/dev/sdb1")
		 (mount-point "/home/gsimmer/fhg")
		 (type "ext4"))
		%base-file-systems)))
Virtual

This applies to any random Guix VM I spin up, usually for testing configurations.

(define-module (virtual)
  #:use-module (base-system)
  #:use-module (gnu))

(operating-system
 (inherit base-operating-system)
 (host-name "virtual")
 (bootloader (bootloader-configuration
	      (bootloader grub-bootloader)
	      (target "/dev/sda")
	      (keyboard-layout (keyboard-layout "us")))))