From 70c381aec5ca2957aefe2599fb7cbc5d47590cfe Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Mon, 4 Jul 2022 00:15:04 -0400 Subject: [PATCH] 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 --- .../guix-config/proxmox-vm-legacy.scm | 28 ++++++ .../vms/searx0-home-rekahsoft-ca.scm | 98 ++++--------------- 2 files changed, 47 insertions(+), 79 deletions(-) create mode 100644 .guix/rekahsoft/guix-config/proxmox-vm-legacy.scm diff --git a/.guix/rekahsoft/guix-config/proxmox-vm-legacy.scm b/.guix/rekahsoft/guix-config/proxmox-vm-legacy.scm new file mode 100644 index 0000000..2142a01 --- /dev/null +++ b/.guix/rekahsoft/guix-config/proxmox-vm-legacy.scm @@ -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 '())))) diff --git a/.guix/rekahsoft/guix-config/vms/searx0-home-rekahsoft-ca.scm b/.guix/rekahsoft/guix-config/vms/searx0-home-rekahsoft-ca.scm index 5adc92a..6cd57f4 100644 --- a/.guix/rekahsoft/guix-config/vms/searx0-home-rekahsoft-ca.scm +++ b/.guix/rekahsoft/guix-config/vms/searx0-home-rekahsoft-ca.scm @@ -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))))