From d6ab47713a134b513a117e5d7dd2e99d8902b32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Mon, 10 Jul 2023 23:14:40 +0200 Subject: [PATCH] Guix posodobitve, nekaj sprememb --- .config/sway/config | 15 +++-- .zshrc | 7 +- bin/inactive-windows-transparency.py | 2 +- config.scm | 98 +++++++++++++++++----------- guix/services/mako.scm | 75 +++++++++++++++++++++ guix/services/pipewire.scm | 87 ++++++++++++++++++++++++ 6 files changed, 234 insertions(+), 50 deletions(-) create mode 100644 guix/services/mako.scm create mode 100644 guix/services/pipewire.scm diff --git a/.config/sway/config b/.config/sway/config index 65763fa..2903f80 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -16,6 +16,9 @@ set $term foot # Font font pango:Iosevka SS05 Medium 10 +# Kurzor +seat * xcursor_theme Bibata-Modern-Classic 24 + # Launcher set $menu "rofi -combi-modi window,drun,run -show combi -modi combi" #set $menu j4-dmenu-desktop @@ -281,9 +284,9 @@ bindsym Mod1+shift+x exec playerctl play-pause bindsym Mod1+shift+c exec playerctl play-pause # Zvok -set $vol_down_cmd amixer -q sset Master 5%- -set $vol_up_cmd amixer -q sset Master 5%+ -set $vol_toggle_cmd amixer -q sset Master toggle +set $vol_down_cmd pamixer -d 5 +set $vol_up_cmd pamixer -i 5 +set $vol_toggle_cmd pamixer -t bindsym $mod+shift+d exec "$vol_up_cmd" bindsym XF86AudioRaiseVolume exec "$vol_up_cmd" @@ -301,8 +304,8 @@ exec_always { } # Zvetlost zaslona -bindsym XF86MonBrightnessUp exec "light -A 3" -bindsym XF86MonBrightnessDown exec "light -U 3" +bindsym XF86MonBrightnessUp exec "brightnessctl set 3%+" +bindsym XF86MonBrightnessDown exec "brightnessctl set 3%-" # Zunanji skrin bindsym $mod+p exec "swaymsg output HDMI-A-2 enable" @@ -330,7 +333,7 @@ exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSO exec ~/bin/inactive-windows-transparency.py # Desktop notifikacije -exec mako --default-timeout=10000 --icon-path /usr/share/icons/Numix +exec mako --default-timeout=5000 --icon-path /usr/share/icons/Numix # Autotiling https://github.com/nwg-piotr/autotiling exec ~/bin/autotiling.py diff --git a/.zshrc b/.zshrc index 7a2e86c..1ee1442 100644 --- a/.zshrc +++ b/.zshrc @@ -62,10 +62,11 @@ bindkey '^R' history-incremental-pattern-search-backward #} # Aliasi +alias ll='ls -l' +alias grep='grep --color=auto' alias ls='ls --color -C' alias vi='vim' alias sudo='sudo env PATH=$PATH ' -alias grep="grep --color=auto" alias ag="rg" alias less="less -R" @@ -78,9 +79,6 @@ alias offer-files="python3 -m http.server" # X on wayland alias wxon="xhost +local:" -# RŠ aliasi -alias omnom="ssh root@debeli" - # Ljudmila alias scdev="ssh culture@milci.ljudmila.org" alias scnew="ssh culture@zala.ljudmila.org" @@ -99,7 +97,6 @@ alias srs='f(){ ssh jurijp@$1.radiostudent.local };f' alias srr='f(){ ssh root@$1.radiostudent.local };f' alias rss='f(){ ssh jurijp@$1.radiostudent.si };f' alias rsr='f(){ ssh root@$1.radiostudent.si };f' -alias zw="ssh zeljko@dev.radiostudent.si" # Poslusaj snemanje alias poslusaj='pactl load-module module-loopback latency_msec=1' diff --git a/bin/inactive-windows-transparency.py b/bin/inactive-windows-transparency.py index 8f954dd..053eb92 100755 --- a/bin/inactive-windows-transparency.py +++ b/bin/inactive-windows-transparency.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # This script requires i3ipc-python package (install it from a system package manager diff --git a/config.scm b/config.scm index 152a029..30dc826 100644 --- a/config.scm +++ b/config.scm @@ -1,51 +1,59 @@ +;; -*- mode: scheme; -*- ;; This is an operating system configuration template ;; for a "desktop" setup with GNOME and Xfce. -(use-modules (gnu) (srfi srfi-1) (gnu system nss)) -(use-service-modules desktop networking) +(use-modules (gnu) + (gnu system nss) + (guix utils) + (nongnu packages linux) + (nongnu system linux-initrd) + (srfi srfi-1)) +(use-service-modules desktop xorg dns networking) (use-package-modules bootloaders certs shells ssh version-control emacs vim wm freedesktop xorg fontutils) -;; ZSH location G-expr -(define zsh-location - #~(string-append #$zsh "/bin/zsh")) - -;; Replace wicd with NetworkManager -(define %desktop-services-nm - (cons* (service network-manager-service-type (network-manager-configuration)) - (service wpa-supplicant-service-type) - ;;(service account-service-type) - (remove (lambda (service) (eq? wicd-service-type (service-kind service))) %desktop-services))) - - (operating-system - (host-name "gpnx") + (host-name "apnx") (timezone "Europe/Ljubljana") - (locale "en_US.UTF-8") + (locale "sl_SI.utf8") + + ;; Use the UEFI variant of GRUB with the EFI System + ;; Partition mounted on /boot/efi. + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (targets '("/boot/efi")))) + + (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) - ;; Assuming /dev/sdX is the target hard disk, and "my-root" - ;; is the label of the target root file system. - (bootloader (grub-configuration (grub grub);;-efi) - ;;(device "/dev/sda1"))) - (device "/dev/sda"))) (file-systems (cons* (file-system - (device "gpnx") - (title "GNU Guix SD pnx") - (mount-point "/") - (type "ext4")) - (file-system - (device "/dev/sda1") - (mount-point "/boot/efi") - (type "vfat")) - %base-file-systems)) + (device "/dev/sda3") + (mount-point "/") + (type "btrfs") + (options "compress")) + (file-system + (device "/dev/sda2") + (mount-point "/boot/efi") + (type "vfat")) + %base-file-systems)) + + (swap-devices + (list (swap-space (target "/swapfile")))) (users (cons* (user-account - (name "yuri") - (comment "Silly Yuri") + (name "g1smo") + (comment "Yuri") (group "users") - (shell zsh-location) (supplementary-groups '("wheel" "netdev" - "audio" "video")) - (home-directory "/home/yuri")) + "audio" "video" "dialout")) + (home-directory "/home/g1smo")) + (user-account + (name "bask") + (comment "Balkan Anarchist Bookfair") + (group "users") + (supplementary-groups '("wheel" "netdev" + "audio" "video" "dialout")) + (home-directory "/home/bask")) %base-user-accounts)) ;; This is where we specify system-wide packages. @@ -66,9 +74,23 @@ ;; include the X11 log-in service, networking with Wicd, ;; and more. - (services (cons* ;;(xfce-desktop-service) - (gnome-desktop-service) - %desktop-services-nm)) + (services (cons* (service xfce-desktop-service-type) + (service gnome-desktop-service-type) + (service dnsmasq-service-type + (dnsmasq-configuration + (cache-size 1500))) + (service network-manager-service-type + (network-manager-configuration + (dns "dnsmasq"))) + (service pam-limits-service-type + (list + (pam-limits-entry "@audio" 'both 'rtprio 99) + (pam-limits-entry "@audio" 'both 'memlock 'unlimited))) + + (remove + (lambda (service) + (eq? network-manager-service-type (service-kind service))) + %desktop-services))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) diff --git a/guix/services/mako.scm b/guix/services/mako.scm new file mode 100644 index 0000000..5e1f9ad --- /dev/null +++ b/guix/services/mako.scm @@ -0,0 +1,75 @@ +(define-module (home services mako) + #:use-module (ice-9 match) + #:use-module (gnu home services) + #:use-module (gnu services configuration) + #:use-module (guix packages) + #:use-module (guix gexp) + #:use-module (gnu packages wm) + #:use-module (guix import utils) + #:use-module ((gnu home-services-utils) #:select (maybe-object->string)) + #:export (home-mako-service-type + home-mako-configuration)) + +(define-configuration/no-serialization home-mako-configuration + (package + (package mako) + "mako package to use") + (config + (alist '()) + "")) + +(define (serialize-mako-config config) + (define* (serialize-criteria criteria #:optional (res '())) + (match criteria + ((field value) + (format #f "[~a]\n" + (string-join + (cons (format #f "~a=\"~a\"" field value) res)))) + ((field value . rest) + (serialize-criteria + rest + (cons (format #f "~a=\"~a\"" field value) res))))) + + (define (serialize-key key) + (if (list? key) + (serialize-criteria key) + (string-append (maybe-object->string key) "="))) + + (define (serialize-val val) + (cond + ((or (number? val) (symbol? val)) (maybe-object->string val)) + ((list? val) (serialize-mako-config val)) + (else val))) + + (define (serialize-field key val) + (let ((val (serialize-val val)) + (key (serialize-key key))) + (list key val))) + + (generic-serialize-alist + (lambda args (flatten (interpose args))) + serialize-field + config)) + +(define (add-mako-configuration config) + (let ((cfg (home-mako-configuration-config config))) + `(("mako/config" + ,(apply mixed-text-file + "config" + (serialize-mako-config cfg)))))) + +(define add-mako-package + (compose list home-mako-configuration-package)) + +(define home-mako-service-type + (service-type + (name 'home-mako) + (extensions + (list (service-extension + home-xdg-configuration-files-service-type + add-mako-configuration) + (service-extension + home-profile-service-type + add-mako-package))) + (default-value (home-mako-configuration)) + (description ""))) diff --git a/guix/services/pipewire.scm b/guix/services/pipewire.scm new file mode 100644 index 0000000..e266e56 --- /dev/null +++ b/guix/services/pipewire.scm @@ -0,0 +1,87 @@ +(define-module (home services pipewire) + #:use-module (guix gexp) + + #:use-module (gnu packages linux) + #:use-module (gnu packages pulseaudio) + + #:use-module (gnu home services) + #:use-module (gnu home services shepherd)) + +(define (home-pipewire-files-service _) + `(("alsa/asoundrc" + ,(mixed-text-file + "asoundrc" + #~(string-append + "<" + #$(file-append + pipewire + "/share/alsa/alsa.conf.d/50-pipewire.conf") + ">\n<" + #$(file-append + pipewire + "/share/alsa/alsa.conf.d/99-pipewire-default.conf") + ">\n" + " +pcm_type.pipewire { + lib " #$(file-append + pipewire + "/lib/alsa-lib/libasound_module_pcm_pipewire.so") " +} + +ctl_type.pipewire { + lib " #$(file-append + pipewire + "/lib/alsa-lib/libasound_module_ctl_pipewire.so") " +} +"))))) + +(define (home-pipewire-shepherd-service _) + (list + (shepherd-service + (requirement '(dbus)) + (provision '(pipewire)) + (stop #~(make-kill-destructor)) + (start #~(make-forkexec-constructor + (list #$(file-append pipewire "/bin/pipewire"))))) + (shepherd-service + (requirement '(pipewire)) + (provision '(wireplumber)) + (stop #~(make-kill-destructor)) + (start #~(make-forkexec-constructor + (list #$(file-append wireplumber "/bin/wireplumber"))))) + #; + (shepherd-service + (requirement '(pipewire)) + (provision '(pipewire-media-session)) + (stop #~(make-kill-destructor)) + (start #~(make-forkexec-constructor + (list + #$(file-append + pipewire-media-session + "/bin/pipewire-media-session") + "-c" + #$(file-append + pipewire-media-session + "/share/pipewire/media-session.d/media-session.conf"))))) + (shepherd-service + (requirement '(pipewire)) + (provision '(pipewire-pulse)) + (stop #~(make-kill-destructor)) + (start #~(make-forkexec-constructor + (list #$(file-append pipewire "/bin/pipewire-pulse"))))))) + +(define-public home-pipewire-service-type + (service-type + (name 'home-pipewire) + (extensions + (list (service-extension + home-xdg-configuration-files-service-type + home-pipewire-files-service) + (service-extension + home-shepherd-service-type + home-pipewire-shepherd-service) + (service-extension + home-profile-service-type + (const (list pipewire pulseaudio))))) + (default-value #f) + (description "run pipewire and stuff")))