Refactor guix configs

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-06-05 00:12:42 -04:00
parent 4f217c505b
commit 9947dd5e94
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
6 changed files with 128 additions and 102 deletions

View File

@ -1,19 +1,19 @@
(define-module (cobra bin)
#:use-module (guix gexp)
#:use-module (gnu packages base)
#:export (bin-torbrowser
bin-suspend-wrap
bin-suspend
bin-start-pipewire
bin-screenshot
bin-logout-wofi
bin-lock
bin-fss
bin-beep-wrapper
bin-beep
bin-backtick))
#:export (%bin:torbrowser
%bin:suspend-wrap
%bin:suspend
%bin:start-pipewire
%bin:screenshot
%bin:logout-wofi
%bin:lock
%bin:fss
%bin:beep-wrapper
%bin:beep
%bin:backtick))
(define bin-torbrowser
(define %bin:torbrowser
(computed-file "bin-torbrowser"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -29,7 +29,7 @@ LD_LIBRARY_PATH=\\$LIBRARY_PATH ./start-tor-browser -v
EOT" "\nEOF"))
(chmod #$output #o755))))
(define bin-suspend-wrap
(define %bin:suspend-wrap
(computed-file "bin-suspend-wrap"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -41,7 +41,7 @@ while grep -v '\\[' /sys/power/state; do
done" "\nEOF"))
(chmod #$output #o755))))
(define bin-suspend
(define %bin:suspend
(computed-file "bin-suspend"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -49,7 +49,7 @@ done" "\nEOF"))
echo mem > /sys/power/state" "\nEOF"))
(chmod #$output #o755))))
(define bin-start-pipewire
(define %bin:start-pipewire
(computed-file "bin-start-pipewire"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -64,7 +64,7 @@ pipewire-pulse &
wireplumber &" "\nEOF"))
(chmod #$output #o755))))
(define bin-screenshot
(define %bin:screenshot
(computed-file "bin-screenshot"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -114,7 +114,7 @@ case $1 in
esac" "\nEOF"))
(chmod #$output #o755))))
(define bin-logout-wofi
(define %bin:logout-wofi
(computed-file "bin-logout-wofi"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -129,7 +129,7 @@ case \"$(printf \"logout\\nreboot\\nshutdown\\nsleep\\n\" | wofi --dmenu -i -H 5
esac" "\nEOF"))
(chmod #$output #o755))))
(define bin-lock
(define %bin:lock
(computed-file "bin-lock"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -146,7 +146,7 @@ if ! ps aux | grep -v grep | grep swaylock; then
fi" "\nEOF"))
(chmod #$output #o755))))
(define bin-fss
(define %bin:fss
(computed-file "bin-fss"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -160,7 +160,7 @@ else
fi" "\nEOF"))
(chmod #$output #o755))))
(define bin-beep-wrapper
(define %bin:beep-wrapper
(computed-file "bin-beep-wrapper"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -180,7 +180,7 @@ while sleep 1; do
done" "\nEOF"))
(chmod #$output #o755))))
(define bin-beep
(define %bin:beep
(computed-file "bin-beep"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
@ -188,7 +188,7 @@ done" "\nEOF"))
echo $1 > /proc/acpi/ibm/beep" "\nEOF"))
(chmod #$output #o755))))
(define bin-backtick
(define %bin:backtick
(computed-file "bin-backtick"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\

View File

@ -1,17 +1,17 @@
(define-module (cobra config)
#:use-module (guix gexp)
#:export (waybar-style
waybar-config
config-swaylock
config-sway
config-mpv
config-mako
config-foot
config-colorscheme
config-hyfetch
config-neofetch))
#:export (%waybar:style
%waybar:config
%config:swaylock
%config:sway
%config:mpv
%config:mako
%config:foot
%config:colorscheme
%config:hyfetch
%config:neofetch))
(define waybar-style
(define %waybar:style
(plain-file "waybar-style" "\
/* =============================================================================
*
@ -226,7 +226,7 @@
color: #f4c815;
}"))
(define waybar-config
(define %waybar:config
(plain-file "waybar-config" "\
// =============================================================================
//
@ -394,7 +394,7 @@
}"))
(define config-swaylock
(define %config:swaylock
(plain-file "config-swaylock" "\
ignore-empty-password
show-failed-attempts
@ -422,7 +422,7 @@ text-wrong-color=fcf5f3
image=~/.config/sway/background.png
font=\"Fira Code\""))
(define config-sway
(define %config:sway
(plain-file "config-sway" "\
# SWAY CONFIG
@ -630,7 +630,7 @@ bar {
include /etc/sway/config.d/*"))
(define config-mpv
(define %config:mpv
(plain-file "config-mpv" "\
ytdl-format=\"bestvideo[height=?480][fps<=?30][vcodec!=?vp9]+bestaudio/best\"
user-agent=\"Mozilla/5.0\"
@ -642,7 +642,7 @@ hwdec=vaapi
hwdec-codecs=all
video-sync=display-resample"))
(define config-mako
(define %config:mako
(plain-file "config-mako" "\
default-timeout=8000
# configversion: b2dba52da9a482ccd1a8170517e502c5
@ -663,7 +663,7 @@ background-color=#900000
text-color=#ffffff
background-color=#ff0000"))
(define config-foot
(define %config:foot
(plain-file "config-foot" "\
# -*- conf -*-
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
@ -851,7 +851,7 @@ scrollback-down-line=Mod1+n
# vim: ft=dosini"))
(define config-colorscheme
(define %config:colorscheme
(plain-file "config-colorscheme" "\
#!/bin/sh
foreground=e0e0e0
@ -877,10 +877,10 @@ if [[ \"$TERM\" = \"vt102\" || \"$TERM\" = \"linux\" ]]; then
printf \"\\e]P$background\\e]P1$regular1\\e]P2$regular2\\e]P3$regular3\\e]P4$regular4\\e]P5$regular5\\e]P6$regular6\\e]P7$foreground\\e]P8$bright0\\e]P9$bright1\\e]PA$bright2\\e]PB$bright3\\e]PC$bright4\\e]PD$bright5\\e]PE$bright6\\e]PF$bright7\"
fi"))
(define config-hyfetch
(define %config:hyfetch
(plain-file "config-hyfetch" "{\"preset\": \"transgender\", \"mode\": \"rgb\", \"light_dark\": \"dark\", \"lightness\": 0.65, \"color_align\": {\"mode\": \"horizontal\", \"custom_colors\": [], \"fore_back\": null}}"))
(define config-neofetch
(define %config:neofetch
(plain-file "config-neofetch" "\
print_info() {
info title

View File

@ -1,11 +1,11 @@
(define-module (cobra homedir)
#:use-module (guix gexp)
#:export (devspec
bashrc
prompt
bash-profile))
#:export (%home:devspec
%home:bashrc
%home:prompt
%home:bash-profile))
(define devspec
(define %home:devspec
(plain-file "devspec" "\
#!/usr/bin/env bash
@ -29,7 +29,7 @@ else
WM=\"bash\"
fi"))
(define bash-profile
(define %home:bash-profile
(plain-file "bash_profile" "\
# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
@ -56,7 +56,7 @@ if [[ $(tty) == /dev/tty2 ]]; then
exec $WM
fi"))
(define prompt
(define %home:prompt
(plain-file "prompt" "\
#!/bin/bash
# shebang for syntax highlighting purposes
@ -265,7 +265,7 @@ __prompt() {
PROMPT_COMMAND=__prompt"))
(define bashrc
(define %home:bashrc
(plain-file "bashrc" "\
# Source other files
[ -r ~/.prompt ] && . ~/.prompt

View File

@ -168,31 +168,31 @@
("UPDATE" . "guix pull --branch=master && reconf && hreconf")))
(simple-service 'dotfiles
home-files-service-type
(list `(".bashrc" ,bashrc)
`(".prompt" ,prompt)
`(".devspec" ,devspec)
`(".bash_profile" ,bash-profile)
(list `(".bashrc" ,%home:bashrc)
`(".prompt" ,%home:prompt)
`(".devspec" ,%home:devspec)
`(".bash_profile" ,%home:bash-profile)
`(".local/bin/backtick" ,bin-backtick)
`(".local/bin/beep" ,bin-beep)
`(".local/bin/beep-wrapper" ,bin-beep-wrapper)
`(".local/bin/fss" ,bin-fss)
`(".local/bin/lock" ,bin-lock)
`(".local/bin/logout-wofi" ,bin-logout-wofi)
`(".local/bin/screenshot" ,bin-screenshot)
`(".local/bin/start-pipewire" ,bin-start-pipewire)
`(".local/bin/__suspend" ,bin-suspend)
`(".local/bin/suspend" ,bin-suspend-wrap)
`(".local/bin/torbrowser" ,bin-torbrowser)
`(".local/bin/backtick" ,%bin:backtick)
`(".local/bin/beep" ,%bin:beep)
`(".local/bin/beep-wrapper" ,%bin:beep-wrapper)
`(".local/bin/fss" ,%bin:fss)
`(".local/bin/lock" ,%bin:lock)
`(".local/bin/logout-wofi" ,%bin:logout-wofi)
`(".local/bin/screenshot" ,%bin:screenshot)
`(".local/bin/start-pipewire" ,%bin:start-pipewire)
`(".local/bin/__suspend" ,%bin:suspend)
`(".local/bin/suspend" ,%bin:suspend-wrap)
`(".local/bin/torbrowser" ,%bin:torbrowser)
`(".config/neofetch/config.conf" ,config-neofetch)
`(".config/hyfetch.json" ,config-hyfetch)
`(".config/colorscheme" ,config-colorscheme)
`(".config/foot/foot.ini" ,config-foot)
`(".config/mako/config" ,config-mako)
`(".config/mpv/mpv.conf" ,config-mpv)
`(".config/swaylock/config" ,config-swaylock)
`(".config/sway/config" ,config-sway)
`(".config/neofetch/config.conf" ,%config:neofetch)
`(".config/hyfetch.json" ,%config:hyfetch)
`(".config/colorscheme" ,%config:colorscheme)
`(".config/foot/foot.ini" ,%config:foot)
`(".config/mako/config" ,%config:mako)
`(".config/mpv/mpv.conf" ,%config:mpv)
`(".config/swaylock/config" ,%config:swaylock)
`(".config/sway/config" ,%config:sway)
`(".config/waybar/config" ,waybar-config)
`(".config/waybar/style.css" ,waybar-style))))))
`(".config/waybar/config" ,%waybar:config)
`(".config/waybar/style.css" ,%waybar:style))))))

View File

@ -7,7 +7,8 @@
#:use-module (guix gexp)
#:use-module (cobra packages)
#:use-module (cobra lists)
#:export (guix-thinkpad))
#:export (%thinkpad:t500
%thinkpad:t60))
(define sudoers
(plain-file "sudoers" "\
@ -17,7 +18,18 @@ Cmnd_Alias WITHOUTPW = /home/cobra/.local/bin/__suspend, /home/cobra/.local/bin/
Defaults!WITHOUTPW !authenticate
"))
(define guix-thinkpad
(define %devmap:fde
(mapped-device
(source (uuid "ffffffff-ffff-ffff-ffff-ffffffffffff"))
(target "fde")
(type luks-device-mapping)))
(define %devmap:matrix
(mapped-device
(source "matrix")
(targets (list "matrix-rootvol"))
(type lvm-device-mapping)))
(define %thinkpad
(operating-system
(kernel linux-libre)
(kernel-loadable-modules (list v4l2loopback-linux-module))
@ -31,8 +43,26 @@ Defaults!WITHOUTPW !authenticate
(inherit grub-bootloader)
(installer #~(const #t))))
(keyboard-layout keyboard-layout)))
(host-name "ThinkPad")
(file-systems %base-file-systems)
(host-name "Noble-Gas")
(mapped-devices (list
(mapped-device
(source (uuid "ffffffff-ffff-ffff-ffff-ffffffffffff"))
(target "fde")
(type luks-device-mapping))
(mapped-device
(source "matrix")
(targets (list "matrix-rootvol"))
(type lvm-device-mapping))))
(file-systems (append (list
(file-system
(type "btrfs")
(mount-point "/")
(device (file-system-label "root"))
(flags '(no-atime))
(options "space_cache=v2")
(needed-for-boot? #t)
(dependencies mapped-devices)))
%base-file-systems))
(users (append (list
(user-account
(name "cobra")
@ -56,3 +86,20 @@ Defaults!WITHOUTPW !authenticate
(name-service-switch %mdns-host-lookup-nss)
(services service-list)
(sudoers-file sudoers)))
(define %thinkpad:t500
(operating-system
(inherit %thinkpad)
(host-name "Oganesson")
(mapped-devices (list
(mapped-device (inherit %devmap:fde)
(source (uuid "e836ef6e-97a8-442b-a025-e81ab58bbc04")))
%devmap:matrix))))
(define %thinkpad:t60
(operating-system
(inherit %thinkpad)
(host-name "Neon")
(mapped-devices (list
(mapped-device (inherit %devmap:fde)
(source (uuid "72cd3842-a6e5-4fb5-b994-1ce11d2d0a16")))
%devmap:matrix))))

View File

@ -1,26 +1,5 @@
(add-to-load-path "/etc/guix-config")
(use-modules (gnu) (cobra os))
(use-modules (cobra os))
(operating-system
(inherit guix-thinkpad)
(host-name "Oganesson")
(mapped-devices (list
(mapped-device
(source (uuid "e836ef6e-97a8-442b-a025-e81ab58bbc04"))
(target "fde")
(type luks-device-mapping))
(mapped-device
(source "matrix")
(targets (list "matrix-rootvol"))
(type lvm-device-mapping))))
(file-systems (append (list
(file-system
(type "btrfs")
(mount-point "/")
(device (file-system-label "root"))
(flags '(no-atime))
(options "space_cache=v2")
(needed-for-boot? #t)
(dependencies mapped-devices)))
%base-file-systems)))
%thinkpad:t500