rekahsoft: Abstract legacy vm's (starting with searx0)

* .guix/rekahsoft/guix-config/proxmox-vm-legacy.scm (rekahsoft): New module that abstracts legacy vm's (postgres, searx0, my0, dash0, prom0). The exports of this module mimic the existing proxmox-vm-lvm-minimal module.

* .guix/rekahsoft/guix-config/vms/searx0-home-rekahsoft-ca.scm (rekahsoft): Refactor to use newly added proxmox-vm-legacy module
This commit is contained in:
Collin J. Doering 2022-07-04 00:15:04 -04:00
parent 30b86a67e9
commit 70c381aec5
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
2 changed files with 47 additions and 79 deletions

View File

@ -0,0 +1,28 @@
(define-module (rekahsoft guix-config proxmox-vm-legacy)
#:use-module (gnu)
#:use-module (gnu packages)
#:use-module (rekahsoft guix-config proxmox-vm-lvm-minimal)
#:export (%proxmox-vm-legacy-services
proxmox-vm-legacy))
(define %proxmox-vm-legacy-services %proxmox-vm-lvm-minimal-services)
;; "Legacy" vm's do not use lvm, but are all based on the same image (therefore, same root uuid)
(define (proxmox-vm-legacy host-name)
(let ((base-system (proxmox-vm-lvm-minimal host-name)))
(operating-system
(inherit base-system)
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "f354b908-fd6f-46c9-931b-2bebaac61b56"
'ext4))
(type "ext4"))
%base-file-systems))
(swap-devices
(list (swap-space (target "/dev/sda2"))))
(mapped-devices '()))))

View File

@ -1,87 +1,27 @@
(define-module (rekahsoft guix-config vms searx0-home-rekahsoft-ca)
#:use-module (gnu)
#:use-module (gnu system nss)
#:use-module (gnu packages)
#:use-module (gnu system)
#:use-module (gnu packages shells)
#:use-module (gnu services desktop)
#:use-module (gnu services dbus)
#:use-module (gnu services networking)
#:use-module (gnu services ssh)
#:use-module (gnu services monitoring)
#:use-module (gnu services docker)
#:use-module (gnu services xorg)
#:use-module (srfi srfi-1)
#:use-module (rekahsoft guix-config proxmox-vm-legacy)
#:export (%system))
(define base-system (proxmox-vm-legacy "searx0"))
(define %system
(operating-system
(host-name "searx0")
(timezone "America/Toronto")
(locale "en_US.utf8")
(keyboard-layout (keyboard-layout "us"))
(bootloader
(bootloader-configuration
(bootloader grub-bootloader)
(targets '("/dev/sda"))
(keyboard-layout keyboard-layout)))
(initrd-modules
(append '("virtio_scsi") %base-initrd-modules))
(swap-devices
(list (swap-space (target "/dev/sda2"))))
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "f354b908-fd6f-46c9-931b-2bebaac61b56"
'ext4))
(type "ext4"))
%base-file-systems))
(users (cons (user-account
(name "collin")
(comment "Master User")
(group "users")
(shell #~(string-append #$zsh "/bin/zsh"))
(supplementary-groups
'("wheel" "netdev" "audio" "video" "docker"))
(home-directory "/home/collin"))
%base-user-accounts))
(packages
(append
(map specification->package
'("nss-certs"
"recutils"
"openssh"
"tmux"
"emacs"
"emacs-guix"))
%base-packages))
(services
(append
(list (service openssh-service-type
(openssh-configuration
(password-authentication? #f)
(authorized-keys
`(("collin" ,(local-file "../../../../.pubkeys/collin.pub"))
("root" ,(local-file "../../../../.pubkeys/collin.pub"))))))
(service prometheus-node-exporter-service-type)
(service docker-service-type)
(dbus-service)
(elogind-service)
(service network-manager-service-type)
(service wpa-supplicant-service-type))
(modify-services
%base-services
(guix-service-type
config => (guix-configuration
(inherit config)
(substitute-urls '("https://nexus.home.rekahsoft.ca/repository/guix")))))))
;; Allow resolution of '.local' host names with mDNS.
(name-service-switch %mdns-host-lookup-nss)))
(inherit base-system)
(users (cons*
(user-account
(name "collin")
(comment "Master User")
(group "users")
(shell #~(string-append #$zsh "/bin/zsh"))
(supplementary-groups
'("wheel" "netdev" "audio" "video" "docker"))
(home-directory "/home/collin"))
(operating-system-users base-system)))
(services
(append
(list (service docker-service-type))
%proxmox-vm-legacy-services))))