├── .gitattributes ├── .gitignore ├── .guix-authorizations ├── .guix-channel ├── LICENSE ├── README.org ├── build-iso.sh ├── engstrand ├── channels.scm ├── configs.scm ├── configs │ ├── fredrik.scm │ └── johan.scm ├── features │ ├── audio.scm │ ├── base.scm │ ├── bluetooth.scm │ ├── display.scm │ ├── documents.scm │ ├── dwl-guile.scm │ ├── emacs.scm │ ├── laptop.scm │ ├── messaging.scm │ ├── neovim.scm │ ├── networking.scm │ ├── nix.scm │ ├── publish.scm │ ├── radio.scm │ ├── shells.scm │ ├── state.scm │ ├── statusbar.scm │ ├── sync.scm │ ├── theming.scm │ ├── utils.scm │ ├── version-control.scm │ ├── video.scm │ ├── virtualization.scm │ ├── wayland.scm │ ├── web-browsers.scm │ └── xorg.scm ├── files │ ├── aliasrc │ ├── bashrc │ ├── config │ │ └── nvim │ │ │ ├── autoload │ │ │ └── plug.vim │ │ │ └── init.vim │ ├── inputrc │ ├── nix-channels │ ├── nonguix-signing-key.pub │ ├── qute-rbw │ ├── shell-profile │ └── zshrc ├── home-services │ └── qutebrowser.scm ├── installer.scm ├── packages │ ├── browsers.scm │ ├── documents.scm │ ├── linux.scm │ ├── python.scm │ ├── utils.scm │ ├── wayland.scm │ └── xorg.scm ├── reconfigure.scm ├── serializers │ └── qutebrowser.scm ├── systems.scm ├── systems │ ├── fractal.scm │ ├── ghost.scm │ ├── kommunbook.scm │ ├── p400s.scm │ ├── pavilion.scm │ ├── silverstone.scm │ └── tuxedo.scm ├── themes.scm ├── utils.scm └── utils │ └── bemenu-prompt.scm └── images ├── apps.jpeg └── desktop.jpeg /.gitattributes: -------------------------------------------------------------------------------- 1 | engstrand/files/config/nvim/autoload/* linguist-vendored 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .config/nvim/.netrwhist 2 | .local/share/* 3 | *.iso 4 | *.pdf 5 | *.tex 6 | *.html 7 | \#*\# 8 | .\#* 9 | -------------------------------------------------------------------------------- /.guix-authorizations: -------------------------------------------------------------------------------- 1 | (authorizations 2 | (version 0) 3 | (("C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C" 4 | (name "frewacom")) 5 | ("DFC6 C6B7 0EF5 F7CB 75EE 97E6 DF30 88DD BCAD 566D" 6 | (name "johanengstrand")))) 7 | -------------------------------------------------------------------------------- /.guix-channel: -------------------------------------------------------------------------------- 1 | (channel 2 | (version 0) 3 | (dependencies 4 | (channel 5 | (name nonguix) 6 | (url "https://gitlab.com/nonguix/nonguix") 7 | (introduction 8 | (channel-introduction 9 | (version 0) 10 | (commit "897c1a470da759236cc11798f4e0a5f7d4d59fbc") 11 | (signer "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5")))) 12 | (channel 13 | (name home-service-dwl-guile) 14 | (url "https://github.com/engstrand-config/home-service-dwl-guile") 15 | (branch "main") 16 | (introduction 17 | (channel-introduction 18 | (version 0) 19 | (commit "314453a87634d67e914cfdf51d357638902dd9fe") 20 | (signer "C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C")))) 21 | (channel 22 | (name home-service-dtao-guile) 23 | (url "https://github.com/engstrand-config/home-service-dtao-guile") 24 | (branch "main") 25 | (introduction 26 | (channel-introduction 27 | (version 0) 28 | (commit "64d0b70c547095ddc840dd07424b9a46ccc2e64e") 29 | (signer "C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C")))) 30 | (channel 31 | (name farg) 32 | (url "https://github.com/engstrand-config/farg") 33 | (branch "main") 34 | (introduction 35 | (channel-introduction 36 | (version 0) 37 | (commit "f94df02065d8691880dd5414e5c5ad27388d450f") 38 | (signer "C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C")))) 39 | (channel 40 | (name wallpapers) 41 | (url "https://github.com/engstrand-config/wallpapers") 42 | (branch "main") 43 | (introduction 44 | (channel-introduction 45 | (version 0) 46 | (commit "d876bfd1f49fe58cca185d20b5b57ae5c93d208e") 47 | (signer "C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C")))) 48 | (channel 49 | (name rde) 50 | (url "https://git.sr.ht/~abcdw/rde") 51 | (introduction 52 | (channel-introduction 53 | (version 0) 54 | (commit "257cebd587b66e4d865b3537a9a88cccd7107c95") 55 | (signer "2841 9AC6 5038 7440 C7E9 2FFA 2208 D209 58C1 DEB0")))))) 56 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | * The GNU/Linux+Engstrand system 2 | 3 | This is our opinionated, minimalist GNU Guix configuration. 4 | It features [[https://sr.ht/~abcdw/rde][ =rde= ]], Emacs (evil mode) and various Wayland applications. 5 | 6 | [[./images/desktop.jpeg]] 7 | [[./images/apps.jpeg]] 8 | 9 | ** Applications 10 | We have patched some of our favorite applications with GNU Guile support and also created some tools from scratch in Guile, for example: 11 | |---------------+--------------------------------+--------------------| 12 | | Application | Description | Links | 13 | |---------------+--------------------------------+--------------------| 14 | | =dwl-guile= | dynamic tiling window manager | [[https://github.com/engstrand-config/dwl-guile][repo]], [[https://github.com/engstrand-config/home-service-dwl-guile][home service]] | 15 | | =dtao-guile= | a minimal status bar | [[https://github.com/engstrand-config/dtao-guile][repo]], [[https://github.com/engstrand-config/home-service-dtao-guile][home service]] | 16 | | =farg= | system colorscheme manager | [[https://github.com/engstrand-config/farg][repo/home service]] | 17 | | =bemenu-prompt= | create =bemenu= prompts in Guile | [[https://github.com/engstrand-config/guix-dotfiles/blob/main/engstrand/utils/bemenu-prompt.scm][source]] | 18 | |---------------+--------------------------------+--------------------| 19 | 20 | We like configuring as much as possible (WM, status bar etc.) in Guile, since it brings a unified approach to the configuration of our computing environment. 21 | # This allows us to keep track of and reproduce configuration settings with the help of Guix derivations. 22 | 23 | ** System level configuration 24 | We own a number of desktop/laptop computers and they all have their own configuration file in =./engstrand/systems=. 25 | In the system-specific configuration file we define hardware-specific settings such as mount points for drives, LUKS encryption, the resolution and refresh rate of monitors and more. 26 | 27 | ** User-level configuration 28 | Our user-level configurations reside in =./engstrand/configs=. 29 | This includes name, email address, GPG public key, default applications, personalized appearance of the window manager etc. 30 | 31 | ** Reconfiguring the system 32 | The entry point for applying a configuration to our =rde=-powered Guix system is =~/.config/guix/config.scm=, so in order to reconfigure the system we run 33 | #+begin_src sh 34 | RDE_USER=$USER \ 35 | RDE_TARGET=system \ 36 | sudo guix system reconfigure ~/.config/guix/config.scm 37 | #+end_src 38 | and similarly, to reconfigure the home environment 39 | #+begin_src sh 40 | RDE_USER=$USER \ 41 | RDE_TARGET=home \ 42 | guix home reconfigure ~/.config/guix/config.scm 43 | #+end_src 44 | 45 | So, what is in =~/.config/guix/config.scm=? 46 | That depends on the user and system configuration we would like to apply. For example, on the desktop system named =ghost= that the user =johan= uses, =config.scm= contains the following: 47 | #+begin_src scheme 48 | (use-modules (engstrand reconfigure)) 49 | (make-config #:user "johan" #:system "ghost") 50 | #+end_src 51 | 52 | ** Building an installation ISO 53 | The =build-iso.sh= script builds a GNU Guix System ISO that has 54 | - the full Linux kernel 55 | - the channels in =./engstrand/channels.scm= included 56 | 57 | ** Usage 58 | *** Bitwarden CLI setup using rbw 59 | Passwords for e.g. git send-mail are fetched from Bitwarden using the =rbw= binary. On newly installed computers, you need to first register your device to the Bitwarden API. 60 | 61 | 1. Login to your Bitwarden account in your browser. 62 | 2. Navigate to https://vault.bitwarden.com/#/settings/security/security-keys. 63 | 3. Create/view your API key. 64 | 4. Run =rbw register=. 65 | 5. Enter the client id and secret as requested. 66 | 6. If you are using 2FA for your account, login using =rbw login=. 67 | 7. Done. 68 | 69 | *** Qutebrowser adblock 70 | To improve the adblock in qutebrowser, you need to install the Brave adblocker. This needs to be manually downloaded from pip (for now). 71 | 72 | Run =pip install adblock=, followed by =:adblock-update= in qutebrowser. 73 | -------------------------------------------------------------------------------- /build-iso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Based on https://github.com/systemcrafters/guix-install 3 | 4 | # ----------------------------------------------------------------------------- 5 | # Utilities 6 | # ----------------------------------------------------------------------------- 7 | 8 | die() { 9 | # ** 10 | # Prints a message to stderr & exits script with non-successful code "1" 11 | # * 12 | 13 | printf '%s\n' "$@" >&2 14 | exit 1 15 | } 16 | 17 | # ----------------------------------------------------------------------------- 18 | # Main 19 | # ----------------------------------------------------------------------------- 20 | 21 | # Write out the channels file so it can be included 22 | guix time-machine -C './engstrand/channels.scm' -- \ 23 | describe -f channels > './channels.scm' 24 | 25 | # Build the image 26 | printf 'Attempting to build the image...\n\n' 27 | image=$(guix time-machine -C './channels.scm' -- system image -t iso9660 './engstrand/installer.scm') \ 28 | || die 'Could not create image.' 29 | 30 | release_tag=$(date +"%Y%m%d%H%M") 31 | cp "${image}" "./guix-installer-${release_tag}.iso" || 32 | die 'An error occurred while copying.' 33 | 34 | printf 'Image was succesfully built: %s\n' "${image}" 35 | 36 | # cleanup 37 | rm -f ./channels.scm 38 | unset -f die 39 | unset -v image release_tag 40 | -------------------------------------------------------------------------------- /engstrand/channels.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand channels) 2 | #:use-module (guix channels)) 3 | 4 | (list 5 | (channel 6 | (name 'guix) 7 | (url "https://git.savannah.gnu.org/git/guix.git") 8 | (introduction 9 | (make-channel-introduction 10 | "9edb3f66fd807b096b48283debdcddccfea34bad" 11 | (openpgp-fingerprint 12 | "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))) 13 | (channel 14 | (name 'engstrand-config) 15 | (url "https://github.com/engstrand-config/guix-dotfiles") 16 | (branch "main") 17 | (introduction 18 | (make-channel-introduction 19 | "005c42a980c895e0853b821494534d67c7b85e91" 20 | (openpgp-fingerprint 21 | "C9BE B8A0 4458 FDDF 1268 1B39 029D 8EB7 7E18 D68C"))))) 22 | -------------------------------------------------------------------------------- /engstrand/configs.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand configs) 2 | #:use-module (guix gexp) 3 | #:use-module (gnu packages fonts) 4 | #:use-module (rde features) 5 | #:use-module (rde features xdg) 6 | #:use-module (rde features ssh) 7 | #:use-module (rde features base) 8 | #:use-module (rde features shells) 9 | #:use-module (rde features linux) 10 | #:use-module (rde features shellutils) 11 | #:use-module (rde features fontutils) 12 | #:use-module (rde features image-viewers) 13 | #:use-module (rde features mail) 14 | #:use-module (rde features video) 15 | #:use-module (rde features version-control) 16 | #:use-module (rde features password-utils) 17 | #:use-module (dwl-guile patches) 18 | #:use-module (dwl-guile home-service) 19 | #:use-module (dtao-guile home-service) 20 | #:use-module (farg provider) 21 | #:use-module (farg home-service) 22 | #:use-module (engstrand utils) 23 | #:use-module (engstrand systems) 24 | #:use-module (engstrand features nix) 25 | #:use-module (engstrand features base) 26 | #:use-module (engstrand features audio) 27 | #:use-module (engstrand features utils) 28 | #:use-module (engstrand features video) 29 | #:use-module (engstrand features state) 30 | #:use-module (engstrand features shells) 31 | #:use-module (engstrand features neovim) 32 | #:use-module (engstrand features theming) 33 | #:use-module (engstrand features wayland) 34 | #:use-module (engstrand features dwl-guile) 35 | #:use-module (engstrand features documents) 36 | #:use-module (engstrand features statusbar) 37 | #:use-module (engstrand features messaging) 38 | #:use-module (engstrand features networking) 39 | #:use-module (engstrand features version-control) 40 | #:export ( 41 | %engstrand-email-primary 42 | %engstrand-base-system-packages 43 | %engstrand-base-home-packages 44 | %engstrand-base-features)) 45 | 46 | ;; This module is responsible for creating the rde config. 47 | ;; It will define all the different base system services. 48 | ;; 49 | ;; Operating system configuration should be done in engstrand/systems.scm, 50 | ;; and computer specific settings in each corresponding file in engstrand/systems/. 51 | (define rde-user (getenv "RDE_USER")) 52 | 53 | (define %engstrand-email-primary 54 | (format #f "~a@engstrand.nu" rde-user)) 55 | 56 | (define %engstrand-base-system-packages 57 | (pkgs '("git" "nss-certs"))) 58 | 59 | ;; Move some of the packages to separate features? 60 | (define %engstrand-base-home-packages 61 | (pkgs '("curl" "htop" "ncurses" 62 | "hicolor-icon-theme" "adwaita-icon-theme" "gnome-themes-extra"))) 63 | 64 | ;; Dynamically create a configuration that can be reproduced 65 | ;; without having the correct environment variables set. 66 | ;; This is required for some commands to work, e.g. guix pull. 67 | (define (make-entrypoint) 68 | (scheme-file "entrypoint.scm" 69 | #~(begin 70 | (use-modules (engstrand reconfigure)) 71 | (make-config #:user #$rde-user 72 | #:system #$(gethostname))))) 73 | 74 | (define %engstrand-base-features 75 | (list 76 | (feature-base-services 77 | #:guix-substitute-urls (list "https://substitutes.nonguix.org") 78 | #:guix-authorized-keys (list (local-file "files/nonguix-signing-key.pub"))) 79 | (feature-desktop-services) 80 | (feature-networking) 81 | (feature-switch-to-tty-on-boot) 82 | ;; TODO: Move to systems/*.scm? 83 | (feature-hidpi 84 | #:console-font (file-append font-terminus "/share/consolefonts/ter-132b")) 85 | (feature-git 86 | #:sign-commits? #t 87 | #:git-send-email? #t) 88 | (feature-git-colorscheme) 89 | (feature-fonts 90 | #:font-monospace 91 | (font 92 | (name "Iosevka Comfy Wide") 93 | (size 13) 94 | (package font-iosevka-comfy)) 95 | #:font-sans 96 | (font 97 | (name "Iosevka Aile") 98 | (size 13) 99 | (package font-iosevka-aile)) 100 | #:font-serif 101 | (font 102 | (name "Iosevka Aile") 103 | (size 13) 104 | (package font-iosevka-aile))) 105 | (feature-latex) 106 | (feature-python) 107 | (feature-pipewire) 108 | (feature-pulseaudio-control) 109 | (feature-playerctl) 110 | (feature-backlight) 111 | (feature-bash) 112 | (feature-zsh) 113 | (feature-ssh) 114 | (feature-xdg 115 | #:xdg-user-directories-configuration 116 | (home-xdg-user-directories-configuration 117 | (download "$HOME/downloads") 118 | (documents "$HOME/documents") 119 | (pictures "$HOME/images") 120 | (music "$HOME/music") 121 | (videos "$HOME/videos") 122 | (publicshare "$HOME") 123 | (templates "$HOME") 124 | (desktop "$HOME"))) 125 | (feature-base-packages 126 | #:system-packages %engstrand-base-system-packages 127 | #:home-packages %engstrand-base-home-packages) 128 | (feature-dotfiles 129 | #:dotfiles 130 | `((".aliasrc" ,(local-file "files/aliasrc")) 131 | (".inputrc" ,(local-file "files/inputrc")) 132 | (".nix-channels" ,(local-file "files/nix-channels")) 133 | (".config/guix/channels.scm" ,(local-file "channels.scm")) 134 | (".config/guix/config.scm" ,(make-entrypoint)) 135 | (".config/nvim/init.vim" ,(local-file "files/config/nvim/init.vim")) 136 | (".config/nvim/autoload/plug.vim" ,(local-file "files/config/nvim/autoload/plug.vim")))) 137 | (feature-farg) 138 | (feature-nix) 139 | ;; (feature-mpv) 140 | (feature-youtube-dl) 141 | (feature-obs) 142 | (feature-imv) 143 | (feature-rbw 144 | #:email %engstrand-email-primary) 145 | (feature-neovim) 146 | (feature-zathura 147 | #:default-reader? #t) 148 | (feature-signal) 149 | (feature-password-store) 150 | (feature-mail-settings 151 | #:mail-accounts 152 | (list 153 | (mail-account (id 'personal) 154 | (fqda %engstrand-email-primary) 155 | (type 'generic) 156 | (pass-cmd "rbw get \"$(rbw ls | bemenu)\"")))) 157 | (feature-emacs-message) 158 | (feature-notmuch) 159 | (feature-msmtp 160 | #:msmtp-provider-settings 161 | `((generic . ((host . "eagle.mxlogin.com") 162 | (port . 587) 163 | (tls_starttls . on))))) 164 | (feature-isync #:isync-verbose #t) 165 | (feature-l2md) 166 | (feature-dwl-guile) 167 | (feature-wayland-swaybg) 168 | (feature-wayland-bemenu) 169 | (feature-wayland-bemenu-power) 170 | (feature-wayland-foot) 171 | (feature-wayland-mako) 172 | (feature-wayland-wlsunset) 173 | (feature-wayland-screenshot) 174 | (feature-wayland-swaylock) 175 | (feature-statusbar-dtao-guile))) 176 | -------------------------------------------------------------------------------- /engstrand/configs/fredrik.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand configs fredrik) 2 | #:use-module (rde features) 3 | #:use-module (rde features ssh) 4 | #:use-module (rde features base) 5 | #:use-module (rde features gnupg) 6 | #:use-module (gnu services) 7 | #:use-module (gnu services databases) 8 | #:use-module (gnu home-services ssh) ;; rde home-service 9 | #:use-module (farg source pywal) 10 | #:use-module (dwl-guile home-service) 11 | #:use-module (engstrand utils) 12 | #:use-module (engstrand configs) 13 | #:use-module (engstrand themes) 14 | #:use-module (engstrand wallpapers) ;; get-wallpaper-path 15 | #:use-module (engstrand features base) 16 | #:use-module (engstrand features xorg) 17 | #:use-module (engstrand features sync) 18 | #:use-module (engstrand features utils) 19 | #:use-module (engstrand features state) 20 | #:use-module (engstrand features emacs) 21 | #:use-module (engstrand features publish) 22 | #:use-module (engstrand features theming) 23 | #:use-module (engstrand features documents) 24 | #:use-module (engstrand features dwl-guile) 25 | #:use-module (engstrand features virtualization) 26 | #:use-module (engstrand features web-browsers) 27 | #:use-module (engstrand features wayland)) 28 | 29 | (define-public %user-theme (engstrand-theme-dark)) 30 | 31 | (define-public %user-features 32 | (append 33 | (list 34 | (feature-user-info 35 | #:user-name "fredrik" 36 | #:full-name "Fredrik Engstrand" 37 | #:email %engstrand-email-primary) 38 | (feature-gnupg 39 | #:gpg-primary-key "C9BEB8A04458FDDF12681B39029D8EB77E18D68C" 40 | #:pinentry-flavor 'bemenu) 41 | (feature-ssh 42 | #:ssh-configuration 43 | (home-ssh-configuration 44 | (extra-config 45 | (list 46 | (ssh-host 47 | (host "aur.archlinux.org") 48 | (options `((identity-file . "~/.ssh/aur") 49 | (user . "aur")))))))) 50 | (feature-virtualization) 51 | (feature-docker) 52 | (feature-qutebrowser 53 | #:default-browser? #t) 54 | (feature-firefox) 55 | (feature-zathura 56 | #:default-reader? #t) 57 | ;; (feature-sioyek 58 | ;; #:default-reader? #t) 59 | (feature-kdeconnect) 60 | (feature-rbw-qutebrowser) 61 | (feature-dwl-guile-custom-config 62 | #:config 63 | `((setq gaps-oh 0 64 | gaps-ov 0 65 | gaps-ih 0 66 | gaps-iv 0 67 | border-px 1)))) 68 | %engstrand-emacs-base-features 69 | (modify-features %engstrand-base-features 70 | (delete 'zathura) 71 | (delete 'ssh)))) 72 | -------------------------------------------------------------------------------- /engstrand/configs/johan.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand configs johan) 2 | #:use-module (guix gexp) 3 | #:use-module (gnu services) 4 | #:use-module (rde features base) 5 | #:use-module (rde features gnupg) 6 | #:use-module (rde features web-browsers) 7 | #:use-module (farg source pywal) 8 | #:use-module (engstrand utils) 9 | #:use-module (engstrand configs) 10 | #:use-module (engstrand themes) 11 | #:use-module (engstrand wallpapers) ;; get-wallpaper-path 12 | #:use-module (engstrand features audio) 13 | #:use-module (engstrand features documents) 14 | #:use-module (engstrand features sync) 15 | #:use-module (engstrand features emacs) 16 | #:use-module (engstrand features utils) 17 | #:use-module (engstrand features wayland) 18 | #:use-module (engstrand features theming) 19 | #:use-module (engstrand features web-browsers) 20 | #:use-module (engstrand features virtualization)) 21 | 22 | (define-public %user-theme 23 | (engstrand-theme-dark 24 | #:wallpaper 25 | (get-wallpaper-path "art/the-cleveland-museum-of-art-3_m6yeqmbv8-unsplash.jpg"))) 26 | 27 | (define-public %user-features 28 | (append 29 | (list 30 | (feature-user-info 31 | #:user-name "johan" 32 | #:full-name "Johan Engstrand" 33 | #:email %engstrand-email-primary) 34 | (feature-gnupg 35 | #:gpg-primary-key "DFC6C6B70EF5F7CB75EE97E6DF3088DDBCAD566D" 36 | #:pinentry-flavor 'bemenu) 37 | (feature-virtualization) 38 | (feature-kdeconnect) 39 | (feature-piper) 40 | ;; (feature-sioyek) 41 | (feature-ungoogled-chromium) 42 | (feature-firefox 43 | #:default-browser? #t)) 44 | %engstrand-emacs-base-features 45 | %engstrand-base-features)) 46 | -------------------------------------------------------------------------------- /engstrand/features/audio.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features audio) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (guix gexp) 5 | #:use-module (srfi srfi-1) 6 | #:use-module (gnu services) 7 | #:use-module (gnu packages audio) 8 | #:use-module (gnu packages music) 9 | #:use-module (gnu packages pulseaudio) 10 | #:use-module (gnu home services) 11 | #:use-module (engstrand utils) 12 | #:use-module (engstrand packages wayland) 13 | #:use-module (dwl-guile home-service) 14 | #:export (feature-pulseaudio-control 15 | feature-playerctl 16 | feature-ardour 17 | feature-zrythm 18 | feature-calf-plugins 19 | feature-sfz 20 | )) 21 | 22 | (define* (feature-pulseaudio-control 23 | #:key 24 | (step 5) 25 | (increase-volume-key "") 26 | (decrease-volume-key "") 27 | (mute-volume-key "") 28 | (add-keybindings? #t)) 29 | "Install and configure pamixer and add wm keybindings for Pulseaudio control." 30 | 31 | (ensure-pred number? step) 32 | (ensure-pred string? increase-volume-key) 33 | (ensure-pred string? decrease-volume-key) 34 | (ensure-pred string? mute-volume-key) 35 | (ensure-pred boolean? add-keybindings?) 36 | 37 | (define command (file-append pamixer "/bin/pamixer")) 38 | 39 | (define (get-home-services config) 40 | (make-service-list 41 | (simple-service 42 | 'add-pulseaudio-control-home-packages-to-profile 43 | home-profile-service-type 44 | (list pamixer)) 45 | (when (and add-keybindings? (get-value 'dwl-guile config)) 46 | (simple-service 47 | 'add-pamixer-dwl-keybindings 48 | home-dwl-guile-service-type 49 | `((set-keys ,increase-volume-key 50 | (lambda () 51 | (dwl:shcmd ,command 52 | "--unmute" 53 | "--increase" ,(number->string step))) 54 | ,decrease-volume-key 55 | (lambda () 56 | (dwl:shcmd ,command 57 | "--unmute" 58 | "--decrease" ,(number->string step))) 59 | ,mute-volume-key 60 | (lambda () (dwl:shcmd ,command "--toggle-mute")))))))) 61 | 62 | (feature 63 | (name 'pulseaudio-control) 64 | (home-services-getter get-home-services))) 65 | 66 | (define* (feature-playerctl 67 | #:key 68 | (play-key "") 69 | (pause-key "") 70 | (next-key "") 71 | (previous-key "") 72 | (stop-key "") 73 | (add-keybindings? #t)) 74 | 75 | (define command (file-append playerctl "/bin/playerctl")) 76 | 77 | (define (get-home-services config) 78 | (make-service-list 79 | (simple-service 80 | 'add-playerctl-packages-to-profile 81 | home-profile-service-type 82 | (list playerctl)) 83 | (when (and add-keybindings? (get-value 'dwl-guile config)) 84 | (simple-service 85 | 'add-playerctl-dwl-keybindings 86 | home-dwl-guile-service-type 87 | ;; Many keyboards (mine included) have a single key for play/pause. 88 | ;; Consider some additional logic for having separate buttons. 89 | `((set-keys ,play-key (lambda () (dwl:shcmd ,command "play-pause")) 90 | ,pause-key (lambda () (dwl:shcmd ,command "play-pause")) 91 | ,next-key (lambda () (dwl:shcmd ,command "next")) 92 | ,previous-key (lambda () (dwl:shcmd ,command "previous")) 93 | ,stop-key (lambda () (dwl:shcmd ,command "stop")))))))) 94 | 95 | (feature 96 | (name 'playerctl) 97 | (home-services-getter get-home-services))) 98 | 99 | (define* (feature-ardour) 100 | "Install and configure the Ardour DAW." 101 | 102 | (define (get-home-services config) 103 | (make-service-list 104 | (simple-service 105 | 'add-ardour-package-to-profile 106 | home-profile-service-type 107 | (list ardour)))) 108 | 109 | (feature 110 | (name 'ardour) 111 | (home-services-getter get-home-services))) 112 | 113 | (define* (feature-zrythm) 114 | "Install and configure the Zrythm DAW." 115 | 116 | (define (get-home-services config) 117 | (make-service-list 118 | (simple-service 119 | 'add-zrythm-package-to-profile 120 | home-profile-service-type 121 | (list zrythm)))) 122 | 123 | (feature 124 | (name 'zrythm) 125 | (home-services-getter get-home-services))) 126 | 127 | (define* (feature-calf-plugins) 128 | "Install the Calf Studio Gear LV2 plugins." 129 | 130 | (define (get-home-services config) 131 | (make-service-list 132 | (simple-service 133 | 'add-calf-package-to-profile 134 | home-profile-service-type 135 | (list calf)))) 136 | 137 | (feature 138 | (name 'calf-plugins) 139 | (home-services-getter get-home-services))) 140 | 141 | (define* (feature-sfz) 142 | "Install SFZ sampler/parser plugins." 143 | 144 | (define (get-home-services config) 145 | (make-service-list 146 | (simple-service 147 | 'add-sfz-package-to-profile 148 | home-profile-service-type 149 | (list sfizz liquidsfz)))) 150 | 151 | (feature 152 | (name 'sfz) 153 | (home-services-getter get-home-services))) 154 | -------------------------------------------------------------------------------- /engstrand/features/base.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features base) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (guix gexp) 5 | #:use-module (gnu services) 6 | #:use-module (gnu services shepherd) 7 | #:use-module (gnu home services) 8 | #:use-module (gnu packages linux) 9 | #:use-module (gnu packages python) 10 | #:use-module (gnu packages python-build) 11 | #:use-module (engstrand utils) 12 | #:export (feature-switch-to-tty-on-boot 13 | feature-python)) 14 | 15 | (define* (feature-switch-to-tty-on-boot 16 | #:key 17 | (tty 2)) 18 | "Switch to TTY on boot, after base services has been started." 19 | 20 | (ensure-pred number? tty) 21 | 22 | (define (get-system-services config) 23 | "Return a list of system services required for switching tty." 24 | (list 25 | (simple-service 26 | 'switch-tty-after-boot 27 | shepherd-root-service-type 28 | (list (shepherd-service 29 | (provision '(startup-tty)) 30 | (requirement '(user-processes user-file-systems host-name virtual-terminal udev)) 31 | (start #~(lambda () 32 | (invoke #$(file-append kbd "/bin/chvt") 33 | #$(format #f "~a" tty)))) 34 | (one-shot? #t)))))) 35 | 36 | (feature 37 | (name 'switch-tty-after-boot) 38 | (system-services-getter get-system-services))) 39 | 40 | (define* (feature-python) 41 | "Install and configure python and pip." 42 | 43 | (define (get-home-services config) 44 | (list 45 | (simple-service 46 | 'install-python 47 | home-profile-service-type 48 | (list python python-pip)))) 49 | 50 | (feature 51 | (name 'python) 52 | (home-services-getter get-home-services))) 53 | -------------------------------------------------------------------------------- /engstrand/features/bluetooth.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features bluetooth) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (dwl-guile home-service) 6 | #:use-module (engstrand utils) 7 | #:export (feature-bluetooth-quick-connect)) 8 | 9 | (define* (feature-bluetooth-quick-connect 10 | #:key 11 | (key "S-s-b")) 12 | "Add keybinding for quickly connecting to bluetooth devices." 13 | 14 | (define (get-home-services config) 15 | (list 16 | (when (get-value 'dwl-guile config) 17 | (simple-service 18 | 'bluetooth-dwl-guile-add-keybindings 19 | home-dwl-guile-service-type 20 | `((set-keys ,key 21 | (lambda () 22 | ;; emacsclient prevents bluetooth from powering off. 23 | (dwl:spawn "emacsclient" "-c" 24 | "--eval" "(bluetooth-list-devices)")))))))) 25 | 26 | (feature 27 | (name 'bluetooth-quick-connect) 28 | (home-services-getter get-home-services))) 29 | -------------------------------------------------------------------------------- /engstrand/features/display.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features display) 2 | #:use-module (ice-9 format) 3 | #:use-module (guix gexp) 4 | #:use-module (srfi srfi-1) 5 | #:use-module (rde features) 6 | #:use-module (rde features predicates) 7 | #:use-module (rde system services accounts) 8 | #:use-module (gnu services) 9 | #:use-module (gnu services base) 10 | #:use-module (gnu home services) 11 | #:use-module (gnu home services shepherd) 12 | #:use-module (gnu packages wm) 13 | #:use-module (gnu packages hardware) 14 | #:use-module (gnu packages linux) 15 | #:use-module (dwl-guile utils) 16 | #:use-module (dwl-guile patches) 17 | #:use-module (dwl-guile home-service) 18 | #:use-module (engstrand utils) 19 | #:use-module (engstrand features wayland) 20 | #:export (feature-display-control 21 | feature-kanshi-autorandr)) 22 | 23 | (define* (feature-display-control 24 | #:key 25 | (step-brightness 10) 26 | (increase-brightness-key "") 27 | (decrease-brightness-key "") 28 | (add-keybindings? #t)) 29 | 30 | (define (get-system-services _) 31 | (list 32 | (simple-service 33 | 'ddcutil-add-i2c-group-to-user 34 | rde-account-service-type 35 | (list "i2c")) 36 | (udev-rules-service 37 | 'ddcutil-add-udev-rules-group 38 | ddcutil 39 | #:groups '("i2c")))) 40 | 41 | (define command (file-append ddcutil "/bin/ddcutil")) 42 | 43 | (define (get-home-services config) 44 | "Return a list of home services required by ddcutil." 45 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 46 | (list 47 | (simple-service 48 | 'add-ddcutil-home-package-to-profile 49 | home-profile-service-type 50 | (list ddcutil)) 51 | (when (and add-keybindings? has-dwl-guile?) 52 | (simple-service 53 | 'add-ddcutil-dwl-keybindings 54 | home-dwl-guile-service-type 55 | `((set-keys ,increase-brightness-key 56 | (lambda () 57 | (dwl:shcmd ,command 58 | "setvcp" "10" 59 | "+" 60 | ,(number->string step-brightness))) 61 | ,decrease-brightness-key 62 | (lambda () 63 | (dwl:shcmd ,command 64 | "setvcp" "10" 65 | "-" 66 | ,(number->string step-brightness)))))))))) 67 | 68 | (feature 69 | (name 'display-control) 70 | (home-services-getter get-home-services) 71 | (system-services-getter get-system-services))) 72 | 73 | (define* (feature-kanshi-autorandr 74 | #:key 75 | (auto-start? #t) 76 | (profiles '())) 77 | "Configure kanshi for automatically enable and disabled outputs on hotplug." 78 | 79 | (ensure-pred boolean? auto-start?) 80 | (ensure-pred list-of-list? profiles) 81 | 82 | (define (serialize-output-fields fields) 83 | (string-join 84 | (map 85 | (lambda (field) 86 | (let ((value (cdr field))) 87 | (format #f "~a ~a" 88 | (car field) 89 | (cond 90 | ((number? field) (number->string value)) 91 | (else value))))) 92 | fields))) 93 | 94 | (define (serialize-output output acc) 95 | (string-append acc (format #f "\toutput ~s ~a\n" 96 | (car output) 97 | (serialize-output-fields (cdr output))))) 98 | 99 | (define (serialize-profile profile acc) 100 | (string-append acc "profile {\n" (fold serialize-output "" profile) "}\n\n")) 101 | 102 | (define (serialize-profiles profiles) 103 | (fold serialize-profile "" profiles)) 104 | 105 | (define (get-home-services config) 106 | "Return a list of home services required by kanshi." 107 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 108 | (list 109 | (simple-service 110 | 'add-kanshi-home-packages-to-profile 111 | home-profile-service-type 112 | (list kanshi)) 113 | (simple-service 114 | 'create-kanshi-config 115 | home-files-service-type 116 | `((".config/kanshi/config" 117 | ,(plain-file "kanshi-config" (serialize-profiles profiles))))) 118 | (simple-service 119 | 'add-kanshi-shepherd-service 120 | home-shepherd-service-type 121 | (list 122 | (shepherd-service 123 | (documentation "Run kanshi autorandr.") 124 | (provision '(kanshi)) 125 | (requirement (if has-dwl-guile? '(dwl-guile) '())) 126 | (auto-start? auto-start?) 127 | (respawn? #t) 128 | (start 129 | #~(make-forkexec-constructor 130 | (list 131 | #$(file-append kanshi "/bin/kanshi")) 132 | #:log-file #$(make-log-file "kanshi"))) 133 | (stop #~(make-kill-destructor)))))))) 134 | 135 | (feature 136 | (name 'kanshi) 137 | (home-services-getter get-home-services))) 138 | -------------------------------------------------------------------------------- /engstrand/features/documents.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features documents) 2 | #:use-module (guix gexp) 3 | #:use-module (rde features) 4 | #:use-module (rde features predicates) 5 | #:use-module (gnu packages pdf) 6 | #:use-module (gnu services) 7 | #:use-module (guix packages) 8 | #:use-module (gnu home services) 9 | #:use-module (gnu packages tex) 10 | #:use-module (gnu packages python-xyz) 11 | #:use-module (engstrand utils) 12 | #:use-module (engstrand packages documents) 13 | #:export ( 14 | feature-zathura 15 | feature-sioyek 16 | feature-latex)) 17 | 18 | ;; NOTE: zathura plugins uses the ZATHURA_PLUGINS_PATH environment variable 19 | ;; for linking to installed plugins. Therefore, you will need to restart 20 | ;; the session after installing for the plugin to be loaded correctly. 21 | (define* (feature-zathura 22 | #:key 23 | (default-reader? #f) 24 | (zathura-pdf-plugin zathura-pdf-mupdf)) 25 | "Setup zathura, a minimal document viewer." 26 | 27 | (ensure-pred boolean? default-reader?) 28 | (ensure-pred package? zathura-pdf-plugin) 29 | 30 | (define (get-home-services config) 31 | "Return a list of system services required by zathura" 32 | (list 33 | (when default-reader? 34 | (simple-service 35 | 'set-zathura-environment-variable 36 | home-environment-variables-service-type 37 | `(("READER" . ,(file-append zathura "/bin/zathura"))))) 38 | (simple-service 39 | 'add-zathura-home-packages-to-profile 40 | home-profile-service-type 41 | (list zathura zathura-pdf-plugin)))) 42 | 43 | (feature 44 | (name 'zathura) 45 | (home-services-getter get-home-services))) 46 | 47 | (define* (feature-sioyek 48 | #:key 49 | (default-reader? #f)) 50 | "Setup zathura, a minimal document viewer." 51 | 52 | (ensure-pred boolean? default-reader?) 53 | 54 | (define (get-home-services config) 55 | "Return a list of system services required by sioyek" 56 | 57 | (define package 58 | (if (get-value 'wayland config) 59 | sioyek/wayland 60 | sioyek)) 61 | 62 | (list 63 | (when default-reader? 64 | (simple-service 65 | 'set-sioyek-environment-variable 66 | home-environment-variables-service-type 67 | `(("READER" . ,(file-append package "/bin/sioyek"))))) 68 | (simple-service 69 | 'add-sioyek-home-packages-to-profile 70 | home-profile-service-type 71 | (list package)))) 72 | 73 | (feature 74 | (name 'sioyek) 75 | (home-services-getter get-home-services))) 76 | 77 | (define* (feature-latex) 78 | (define (get-home-services config) 79 | (list 80 | (simple-service 81 | 'add-latex-home-packages-to-profile 82 | home-profile-service-type 83 | (list texlive-base 84 | texlive-listings 85 | texlive-hyperref 86 | texlive-wrapfig 87 | texlive-amsmath 88 | texlive-amsfonts 89 | texlive-url 90 | texlive-xcolor 91 | texlive-tcolorbox 92 | texlive-minted 93 | texlive-caption 94 | python-pygments)))) 95 | 96 | (feature 97 | (name 'latex) 98 | (values '((latex . #t))) 99 | (home-services-getter get-home-services))) 100 | -------------------------------------------------------------------------------- /engstrand/features/dwl-guile.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features dwl-guile) 2 | #:use-module (rde features) 3 | #:use-module (guix gexp) 4 | #:use-module (gnu services) 5 | #:use-module (gnu home services) 6 | #:use-module (farg colors) 7 | #:use-module (dwl-guile utils) 8 | #:use-module (dwl-guile patches) 9 | #:use-module (dwl-guile home-service) 10 | #:export ( 11 | feature-dwl-guile 12 | feature-dwl-guile-custom-config 13 | 14 | has-dwl-patch? 15 | %engstrand-dwl-guile-patches)) 16 | 17 | ;; Checks if SYMBOL corresponds to a patch that is/will 18 | ;; be applied to dwl-guile, based on the feature values in CONFIG. 19 | ;; SYMBOL should be the name of the patch, not including the ".patch" extension. 20 | ;; I.e. @code{(has-dwl-patch? 'xwayland config)}. 21 | (define (has-dwl-patch? symbol config) 22 | (let ((patch-name (string-append (symbol->string symbol) ".patch"))) 23 | (find (lambda (p) (equal? patch-name (local-file-name p))) 24 | (get-value 'dwl-guile-patches config)))) 25 | 26 | (define %engstrand-dwl-guile-patches 27 | (list %patch-xwayland 28 | %patch-swallow 29 | %patch-movestack 30 | %patch-attachabove 31 | %patch-focusmonpointer 32 | %patch-monitor-config)) 33 | 34 | (define* (feature-dwl-guile 35 | #:key 36 | (repl? #t) 37 | (repl-key "s-S-C-i")) 38 | "Setup dwl-guile." 39 | 40 | (ensure-pred boolean? repl?) 41 | (ensure-pred string? repl-key) 42 | 43 | (lambda (_ palette) 44 | (define (get-home-services config) 45 | "Return a list of home services required by dwl-guile." 46 | (list 47 | (service home-dwl-guile-service-type 48 | (home-dwl-guile-configuration 49 | (package 50 | (patch-dwl-guile-package dwl-guile 51 | #:patches %engstrand-dwl-guile-patches)) 52 | (config 53 | (list 54 | `((setq root-color ,(palette 'bg) 55 | border-color ,(farg:offset (palette 'bg) 10) 56 | focus-color ,(palette 'accent-0) 57 | lockscreen-color ,(farg:with-alpha (palette 'bg) 90) 58 | border-px 2 59 | sloppy-focus? #t 60 | smart-gaps? #t 61 | smart-borders? #t) 62 | 63 | ,@(if repl? 64 | `((define (get-emacs-start-repl-exp) 65 | (object->string 66 | `(progn 67 | (require 'geiser-repl) 68 | (geiser-repl--start-repl 69 | (geiser-repl--get-impl "Connect to Scheme impl: ") 70 | ,dwl:%repl-socket-path) 71 | (kill-buffer "*scratch*") 72 | (delete-other-windows)))) 73 | 74 | (set-keys ,repl-key 75 | (lambda () 76 | (dwl:spawn "emacs" "--eval" 77 | (get-emacs-start-repl-exp)))) 78 | (add-hook! dwl:hook-startup dwl:start-repl-server)) 79 | '())))))))) 80 | 81 | (feature 82 | (name 'wayland-dwl-guile) 83 | (values `((wayland . #t) 84 | (dwl-guile . #t) 85 | (dwl-guile-patches . ,%engstrand-dwl-guile-patches))) 86 | (home-services-getter get-home-services)))) 87 | 88 | (define* (feature-dwl-guile-custom-config 89 | #:key 90 | (name 'dwl-guile-custom-config) 91 | (config '())) 92 | "Personal customization overrides to your dwl-guile configuration." 93 | 94 | (ensure-pred symbol? name) 95 | (ensure-pred list? config) 96 | 97 | (define (get-home-services _) 98 | (list 99 | (simple-service 100 | name 101 | home-dwl-guile-service-type 102 | config))) 103 | 104 | (feature 105 | (name name) 106 | (home-services-getter get-home-services))) 107 | -------------------------------------------------------------------------------- /engstrand/features/emacs.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features emacs) 2 | #:use-module (guix gexp) 3 | #:use-module (dwl-guile home-service) 4 | #:use-module (dwl-guile utils) 5 | #:use-module (farg colors) 6 | #:use-module (farg home-service) 7 | #:use-module (engstrand utils) 8 | #:use-module (gnu home services) 9 | #:use-module (rde home services emacs) 10 | #:use-module (gnu services) 11 | #:use-module (gnu packages emacs) 12 | #:use-module (gnu packages emacs-xyz) 13 | #:use-module (rde gexp) 14 | #:use-module (rde features) 15 | #:use-module (rde features base) 16 | #:use-module (rde features emacs) 17 | #:use-module (rde features emacs-xyz) 18 | #:use-module (contrib features emacs-xyz) 19 | #:use-module (rde packages emacs) 20 | #:export ( 21 | feature-emacs-default-editor 22 | feature-emacs-org-latex-preview 23 | feature-emacs-corfu 24 | feature-emacs-corfu-dabbrev 25 | feature-emacs-dashboard 26 | feature-emacs-transparency 27 | feature-emacs-engstrand-appearance 28 | 29 | %engstrand-emacs-package 30 | %engstrand-emacs-base-features)) 31 | 32 | (define* (make-emacs-feature base-name 33 | #:key 34 | (home-services (const '())) 35 | (system-services (const '()))) 36 | "Creates a basic emacs feature configuration." 37 | (let ((f-name (symbol-append 'emacs- base-name))) 38 | (feature 39 | (name f-name) 40 | (values `((,f-name . #t))) 41 | (home-services-getter home-services) 42 | (system-services-getter system-services)))) 43 | 44 | (define* (feature-emacs-default-editor 45 | #:key 46 | (open-client-keybinding "S-s-e") 47 | (add-keybindings? #t)) 48 | "Configure emacs as the default system editor." 49 | (define emacs-f-name 'default-editor) 50 | 51 | (lambda (_ palette) 52 | (define (get-home-services config) 53 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 54 | (make-service-list 55 | (simple-service 56 | 'set-emacs-environment-variables 57 | home-environment-variables-service-type 58 | `(("EDITOR" . ,(file-append %engstrand-emacs-package "/bin/emacs")) 59 | ;; Used by guix commands, e.g. guix edit. rde sets this by itself, 60 | ;; but the --no-wait option does not seem to play nice with our setup. 61 | ("VISUAL" . ,(get-value 'emacs-client-create-frame config)))) 62 | (when (and add-keybindings? has-dwl-guile?) 63 | (simple-service 64 | 'emacs-dwl-guile-add-keybindings 65 | home-dwl-guile-service-type 66 | `((set-keys ,open-client-keybinding 67 | (lambda () 68 | (dwl:spawn "emacsclient" "-c"))))))))) 69 | 70 | (make-emacs-feature emacs-f-name 71 | #:home-services get-home-services))) 72 | 73 | (define* (feature-emacs-org-latex-preview) 74 | "Add and configure latex previews in Emacs Org mode." 75 | (define emacs-f-name 'org-latex-preview) 76 | 77 | (define (get-home-services config) 78 | ;; Ensure that we have latex enabled. 79 | (require-value 'latex config) 80 | 81 | (list 82 | (simple-service 83 | 'add-org-mode-latex-preview-home-packages-to-profile 84 | home-profile-service-type 85 | ;; Add additional packages needed for preview 86 | (pkgs '("texlive-latex-preview" "texlive-graphics-def"))) 87 | (rde-elisp-configuration-service 88 | emacs-f-name 89 | config 90 | `((require 'org) 91 | ;; Use dvisvgm for latex rendering 92 | (setq org-latex-create-formula-image-program 'dvisvgm) 93 | ;; Increase latex preview scale in org mode 94 | (setq org-format-latex-options (plist-put org-format-latex-options :scale 1)))))) 95 | 96 | (make-emacs-feature emacs-f-name 97 | #:home-services get-home-services)) 98 | 99 | (define* (feature-emacs-corfu 100 | ;; #:key 101 | ;; () 102 | ) 103 | "Add and configure Corfu completion for Emacs." 104 | (define emacs-f-name 'corfu) 105 | 106 | (define (get-home-services config) 107 | (list 108 | (rde-elisp-configuration-service 109 | emacs-f-name 110 | config 111 | `((require 'corfu) 112 | ;; TAB-and-Go completion 113 | (setq corfu-cycle t) 114 | (setq corfu-preselect-first nil) 115 | (setq corfu-auto t) 116 | (global-corfu-mode 1) 117 | (define-key corfu-map (kbd "") 'corfu-next) 118 | (define-key corfu-map (kbd "") 'corfu-previous)) 119 | #:elisp-packages (list 120 | emacs-corfu)))) 121 | 122 | (make-emacs-feature emacs-f-name 123 | #:home-services get-home-services)) 124 | 125 | (define* (feature-emacs-corfu-dabbrev 126 | #:key 127 | (completion-key "M-") 128 | (expand-key "M-C-")) 129 | "Switches the default dabbrev keybindings for usage with Corfu." 130 | (define emacs-f-name 'corfu-dabbrev) 131 | 132 | (ensure-pred string? completion-key) 133 | (ensure-pred string? expand-key) 134 | 135 | (define (get-home-services config) 136 | (list 137 | (rde-elisp-configuration-service 138 | emacs-f-name 139 | config 140 | `((require 'dabbrev) 141 | (global-set-key (kbd ,completion-key) 'dabbrev-completion) 142 | (global-set-key (kbd ,expand-key) 'dabbrev-expand))))) 143 | 144 | (make-emacs-feature emacs-f-name 145 | #:home-services get-home-services)) 146 | 147 | (define* (feature-emacs-dashboard 148 | ;; #:key 149 | ;; (emacs-dashboard emacs-dashboard) 150 | ) 151 | "Add and configure emacs-dashboard as a welcome screen." 152 | (define emacs-f-name 'dashboard) 153 | 154 | (define (get-home-services config) 155 | (list 156 | (rde-elisp-configuration-service 157 | emacs-f-name 158 | config 159 | `((require 'dashboard) 160 | (dashboard-setup-startup-hook) 161 | (setq dashboard-center-content t) 162 | (setq dashboard-set-init-info nil) 163 | (setq dashboard-set-footer nil) 164 | (setq dashboard-page-separator "\n\n") 165 | 166 | (eval-when-compile (require 'project)) 167 | (setq dashboard-projects-backend 'project) 168 | ) 169 | #:elisp-packages (list 170 | emacs-dashboard 171 | emacs-project 172 | ;; Optional dependencies: 173 | ;; emacs-projectile 174 | ;; emacs-page-break-lines 175 | ;; emacs-all-the-icons 176 | )))) 177 | 178 | (make-emacs-feature emacs-f-name 179 | #:home-services get-home-services)) 180 | 181 | (define* (feature-emacs-transparency 182 | #:key 183 | (alpha #f)) 184 | "Set frame background transparency." 185 | (define emacs-f-name 'transparency) 186 | (lambda (_ palette) 187 | (define (get-home-services config) 188 | (let ((emacs-alpha (if alpha alpha (palette 'alpha)))) 189 | (list 190 | (rde-elisp-configuration-service 191 | emacs-f-name 192 | config 193 | `((add-to-list 'default-frame-alist '(alpha-background . ,emacs-alpha)) 194 | ;; remove non-transparent border around frame 195 | (set-frame-parameter (selected-frame) 'internal-border-width 0)))))) 196 | 197 | (make-emacs-feature emacs-f-name 198 | #:home-services get-home-services))) 199 | 200 | (define* (feature-emacs-engstrand-appearance) 201 | "Override default rde Emacs appearance." 202 | (define emacs-f-name 'engstrand-appearance) 203 | 204 | (lambda (_ palette) 205 | (define (get-home-services config) 206 | (list 207 | (rde-elisp-configuration-service 208 | emacs-f-name 209 | config 210 | `((require 'modus-themes) 211 | (window-divider-mode 0) 212 | (setq modus-themes-italic-constructs t 213 | modus-themes-bold-constructs t 214 | modus-themes-mixed-fonts t 215 | modus-themes-subtle-line-numbers t 216 | modus-themes-intense-markup t 217 | modus-themes-lang-checkers nil 218 | modus-themes-mode-line '(borderless) 219 | modus-themes-syntax nil 220 | modus-themes-hl-line '(underline intense) 221 | modus-themes-paren-match nil 222 | modus-themes-links nil 223 | modus-themes-prompts nil 224 | modus-themes-mail-citations 'faint 225 | modus-themes-region '(bg-only accented) 226 | modus-themes-diffs 'nil 227 | modus-themes-org-blocks 'gray-background 228 | modus-themes-org-agenda 229 | '((header-block . (variable-pitch 1.3)) 230 | (header-date . (grayscale workaholic bold-today 1.1)) 231 | (event . (accented varied)) 232 | (scheduled . uniform) 233 | (habit . traffic-light)) 234 | modus-themes-headings 235 | '((1 . (background variable-pitch 1.3)) 236 | (2 . (rainbow overline 1.1)) 237 | (t . (semibold)))) 238 | 239 | (setq modus-themes-common-palette-overrides 240 | `((fg-line-number-inactive "gray50") 241 | (fg-line-number-active fg-main) 242 | (bg-line-number-inactive bg-main) 243 | (bg-line-number-active bg-main) 244 | (border-mode-line-active unspecified) 245 | (border-mode-line-inactive unspecified) 246 | (fringe unspecified))) 247 | (load-theme 'modus-operandi t t) 248 | (load-theme 'modus-vivendi t t) 249 | (enable-theme ',(if (palette 'light?) 'modus-operandi 'modus-vivendi))) 250 | #:elisp-packages (list emacs-modus-themes)))) 251 | 252 | (make-emacs-feature emacs-f-name 253 | #:home-services get-home-services))) 254 | 255 | (define %engstrand-emacs-package emacs-next-pgtk-latest) 256 | 257 | (define %engstrand-emacs-base-features 258 | (list 259 | (feature-emacs-default-editor) 260 | (feature-emacs 261 | #:emacs %engstrand-emacs-package 262 | #:additional-elisp-packages (list emacs-geiser emacs-geiser-guile) 263 | #:extra-init-el '(;; do not open the Emacs welcome screen when we pass an 264 | ;; existing file as a command-line argument 265 | (defun my-inhibit-startup-screen-file () 266 | (ignore 267 | (setq inhibit-startup-screen 268 | (file-exists-p 269 | (expand-file-name argi command-line-default-directory))))) 270 | ;; always open the normal switch-to-buffe 271 | (global-set-key (kbd "C-x C-b") 'switch-to-buffer) 272 | (add-hook 'command-line-functions 'my-inhibit-startup-screen-file) 273 | ;; ignore warnings from native-comp 274 | ;; (setq native-comp-async-report-warnings-errors nil) 275 | ;; Relative line numbers, but only when relevant 276 | (setq-default display-line-numbers-type 'relative) 277 | (add-hook 'prog-mode-hook 'display-line-numbers-mode) 278 | ;; Olivetti mode when working with text 279 | ;; (add-hook 'text-mode-hook 'olivetti-mode) 280 | (global-olivetti-mode 1) 281 | ;; Nicer mouse scrolling 282 | (setq mouse-wheel-progressive-speed nil) 283 | (setq mouse-wheel-scroll-amount '(3)) 284 | ;; Configure the look of tabs 285 | (setq tab-bar-close-button-show nil 286 | tab-bar-new-button-show nil 287 | tab-bar-new-tab-choice "*scratch*") 288 | ;; Move to future C feature 289 | (setq c-default-style "linux") 290 | (add-hook 'c-mode-common-hook '(lambda () (setq indent-tabs-mode t))) 291 | ;; Delete whitespace from indentations immediately 292 | (setq backward-delete-char-untabify-method 'hungry) 293 | ;; Clean up white space 294 | (add-hook 'before-save-hook 'whitespace-cleanup) 295 | ;; Allow execution of src blocks without asking 296 | (setq org-confirm-babel-evaluate nil) 297 | ;; (Temporarily) suppress startup warning in perspective.el 298 | (setq persp-suppress-no-prefix-key-warning t) 299 | ;; TODO: set in rde evil feature 300 | (setq evil-want-minibuffer nil) 301 | ;; for some reason this must be added manually 302 | (vertico-mode))) 303 | (feature-emacs-appearance 304 | #:margin 5 305 | #:header-line-as-mode-line? #f) 306 | (feature-emacs-modus-themes 307 | #:deuteranopia? #f) 308 | (feature-emacs-engstrand-appearance) 309 | (feature-emacs-transparency) 310 | (feature-emacs-dashboard) 311 | (feature-emacs-evil 312 | #:hide-state-message? #t) 313 | (feature-emacs-monocle 314 | #:olivetti-body-width 100) 315 | (feature-emacs-dired) 316 | (feature-emacs-completion 317 | #:mini-frame? #f) 318 | (feature-emacs-corfu) 319 | (feature-emacs-corfu-dabbrev) 320 | (feature-emacs-vertico) 321 | (feature-emacs-project) 322 | (feature-emacs-perspective) 323 | (feature-emacs-which-key) 324 | (feature-emacs-git) 325 | (feature-emacs-keycast) 326 | (feature-emacs-pdf-tools) 327 | (feature-emacs-org) 328 | (feature-emacs-org-agenda) 329 | (feature-emacs-org-latex-preview) 330 | (feature-emacs-org-roam 331 | #:org-roam-directory "~/roam/"))) 332 | -------------------------------------------------------------------------------- /engstrand/features/laptop.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features laptop) 2 | #:use-module (rde features) 3 | #:use-module (rde features bluetooth) 4 | #:use-module (rde features predicates) 5 | #:use-module (guix gexp) 6 | #:use-module (gnu services) 7 | #:use-module (gnu home services) 8 | #:use-module (gnu services pm) 9 | #:use-module (gnu packages linux) 10 | #:use-module (dwl-guile utils) 11 | #:use-module (dwl-guile patches) 12 | #:use-module (dwl-guile home-service) 13 | #:use-module (dtao-guile home-service) 14 | #:use-module (engstrand utils) 15 | #:use-module (engstrand features bluetooth) 16 | #:export ( 17 | feature-laptop 18 | feature-laptop-tlp 19 | feature-laptop-natural-scrolling 20 | feature-laptop-statusbar-battery 21 | feature-laptop-monitor-brightness 22 | 23 | %engstrand-laptop-base-features)) 24 | 25 | (define* (feature-laptop) 26 | "Base laptop feature." 27 | 28 | (feature 29 | (name 'laptop) 30 | (values `((laptop . #t))))) 31 | 32 | (define* (feature-laptop-tlp 33 | #:key 34 | (tlp-config (tlp-configuration 35 | (cpu-scaling-governor-on-ac (list "performance")) 36 | (sched-powersave-on-bat? #t)))) 37 | "Setup TLP for power management on laptops." 38 | 39 | (define (get-system-services config) 40 | "Return a list of system services required by TLP" 41 | (list 42 | (simple-service 43 | 'add-tlp-system-packages-to-profile 44 | profile-service-type 45 | (pkgs '("tlp"))) 46 | (service tlp-service-type 47 | tlp-config))) 48 | 49 | (feature 50 | (name 'laptop-tlp) 51 | (system-services-getter get-system-services))) 52 | 53 | (define* (feature-laptop-natural-scrolling 54 | #:key 55 | (natural-scrolling? #t)) 56 | "Enable/disable natural scrolling in compositor." 57 | 58 | (ensure-pred boolean? natural-scrolling?) 59 | 60 | (define (get-home-services config) 61 | (make-service-list 62 | (when (get-value 'dwl-guile config) 63 | (simple-service 64 | 'set-natural-scrolling-in-dwl-guile 65 | home-dwl-guile-service-type 66 | `((setq natural-scrolling? ,natural-scrolling?)))))) 67 | 68 | (feature 69 | (name 'laptop-natural-scrolling) 70 | (home-services-getter get-home-services))) 71 | 72 | (define* (feature-laptop-statusbar-battery 73 | #:key 74 | (interface "BAT0")) 75 | "Add battery indicator to statusbar." 76 | 77 | (ensure-pred string? interface) 78 | 79 | (define read-path 80 | (string-append "/sys/class/power_supply/" 81 | interface 82 | "/capacity")) 83 | 84 | (lambda (_ palette) 85 | (define (get-home-services config) 86 | (throw-message 87 | (not (file-exists? read-path)) 88 | (string-append "Invalid battery interface name. No such file " read-path)) 89 | 90 | (make-service-list 91 | (when (get-value 'dtao-guile config) 92 | (simple-service 93 | 'add-dtao-guile-battery-block 94 | home-dtao-guile-service-type 95 | (list 96 | (dtao-block 97 | (position "right") 98 | (interval 10) 99 | (render 100 | `(let* ((port (open-input-file ,read-path)) 101 | (result (read-line port)) 102 | (percent (string->number result))) 103 | (close-port port) 104 | (string-append "^fg(" 105 | (cond 106 | ((<= percent 20) ,(palette 'red)) 107 | ((<= percent 50) ,(palette 'fg)) 108 | (else ,(palette 'green))) 109 | ")" result "%^fg()"))))))))) 110 | 111 | (feature 112 | (name 'laptop-statusbar-battery) 113 | (home-services-getter get-home-services)))) 114 | 115 | (define* (feature-laptop-monitor-brightness 116 | #:key 117 | (step 10) 118 | (decrease-brightness-key "") 119 | (increase-brightness-key "") 120 | (add-keybindings? #t)) 121 | "Install and configure brightnessctl for laptops" 122 | 123 | (ensure-pred number? step) 124 | (ensure-pred string? decrease-brightness-key) 125 | (ensure-pred string? increase-brightness-key) 126 | (ensure-pred boolean? add-keybindings?) 127 | 128 | (define (get-home-services config) 129 | (make-service-list 130 | (simple-service 131 | 'add-brightnessctl-home-packages-to-profile 132 | home-profile-service-type 133 | (list brightnessctl)) 134 | (when (and add-keybindings? 135 | (get-value 'dwl-guile config)) 136 | (let ((bin (file-append brightnessctl "/bin/brightnessctl")) 137 | (change (string-append (number->string step) "%"))) 138 | (simple-service 139 | 'add-dwl-guile-brightness-keys 140 | home-dwl-guile-service-type 141 | `((set-keys ,decrease-brightness-key 142 | (lambda () (dwl:shcmd ,bin "s" ,(string-append change "-"))) 143 | ,increase-brightness-key 144 | (lambda () (dwl:shcmd ,bin "s" ,(string-append "+" change)))))))))) 145 | 146 | (feature 147 | (name 'laptop-monitor-brightness) 148 | (home-services-getter get-home-services))) 149 | 150 | (define %engstrand-laptop-base-features 151 | (list 152 | (feature-laptop) 153 | (feature-laptop-tlp) 154 | (feature-laptop-natural-scrolling) 155 | (feature-laptop-statusbar-battery 156 | #:interface "BAT0") 157 | (feature-laptop-monitor-brightness) 158 | (feature-bluetooth) 159 | (feature-bluetooth-quick-connect))) 160 | -------------------------------------------------------------------------------- /engstrand/features/messaging.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features messaging) 2 | #:use-module (rde features) 3 | #:use-module (gnu services) 4 | #:use-module (gnu home services) 5 | #:use-module (nongnu packages messaging) 6 | #:export (feature-signal)) 7 | 8 | (define* (feature-signal) 9 | "Install the Signal desktop client." 10 | 11 | (define (get-home-services config) 12 | (list 13 | (simple-service 14 | 'add-signal-home-packages-to-profile 15 | home-profile-service-type 16 | (list signal-desktop)))) 17 | 18 | (feature 19 | (name 'signal) 20 | (home-services-getter get-home-services))) 21 | -------------------------------------------------------------------------------- /engstrand/features/neovim.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features neovim) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (gnu home services) 6 | #:use-module (engstrand utils) 7 | #:use-module (gnu packages vim) 8 | #:export (feature-neovim)) 9 | 10 | (define* (feature-neovim) 11 | "Install and setup Neovim." 12 | 13 | (define (get-home-services config) 14 | "Return a list of home services required for Neovim" 15 | (list 16 | (simple-service 17 | 'add-neovim-home-packages-to-profile 18 | home-profile-service-type 19 | (list neovim python-pynvim)))) 20 | 21 | (feature 22 | (name 'neovim) 23 | (home-services-getter get-home-services))) 24 | -------------------------------------------------------------------------------- /engstrand/features/networking.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features networking) 2 | #:use-module (rde features) 3 | #:use-module (gnu services) 4 | #:use-module (gnu services networking) 5 | #:export (feature-networking)) 6 | 7 | (define* (feature-networking) 8 | "Setup networking." 9 | 10 | (define (get-system-services config) 11 | (list 12 | (service network-manager-service-type) 13 | (service wpa-supplicant-service-type))) 14 | 15 | (feature 16 | (name 'engstrand-networking) 17 | (system-services-getter get-system-services))) 18 | -------------------------------------------------------------------------------- /engstrand/features/nix.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features nix) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (gnu services nix) 6 | #:use-module (gnu home services) 7 | #:use-module (engstrand utils) 8 | #:export (feature-nix)) 9 | 10 | (define* (feature-nix) 11 | "Setup the nix package manager." 12 | 13 | (define (get-system-services config) 14 | "Return a list of system services required by nix." 15 | (list 16 | (simple-service 17 | 'add-nix-system-packages-to-profile 18 | profile-service-type 19 | (pkgs '("nix"))) 20 | (service nix-service-type))) 21 | 22 | (define (get-home-services config) 23 | "Return a list of home services required by nix." 24 | (list 25 | ;; TODO: This is kindy of hacky and does not set all necessary variables. 26 | ;; The better solution is to source /run/current-system/profile/etc/profile.d/nix.sh, 27 | ;; but I am not sure how to source files in Guile. If we figure it out, we can probably 28 | ;; source it in the "startup-commands" field of dwl-guile. 29 | (simple-service 30 | 'add-nix-bin-to-path 31 | home-environment-variables-service-type 32 | `(("PATH" . ,(string-append "$HOME/.nix-profile/bin:" 33 | (getenv "PATH"))))))) 34 | 35 | (feature 36 | (name 'nix) 37 | (system-services-getter get-system-services) 38 | (home-services-getter get-home-services))) 39 | -------------------------------------------------------------------------------- /engstrand/features/publish.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features publish) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu packages package-management) 5 | #:use-module (gnu services base) 6 | #:use-module (gnu services) 7 | ;; #:use-module (gnu services shepherd) 8 | ;; #:use-module (gnu home services) 9 | ;; #:use-module (engstrand utils) 10 | #:export (feature-publish)) 11 | 12 | (define* (feature-publish 13 | #:key 14 | (guix guix) 15 | (port 80) 16 | (host "0.0.0.0") 17 | (advertise? #f) 18 | (compress? #t) 19 | (compression-methods '(("gzip" 3) ("zstd" 3))) 20 | (nar-path "nar") 21 | (cache #f) 22 | (workers #f) 23 | (cache-bypass-threshold 1000000) 24 | (ttl #f)) 25 | "Service to publish substitutes of Guix packages on the network." 26 | 27 | (ensure-pred number? port) 28 | (ensure-pred string? host) 29 | (ensure-pred boolean? advertise?) 30 | (ensure-pred boolean? compress?) 31 | (ensure-pred string? nar-path) 32 | ; (ensure-pred number? cache) 33 | ; (ensure-pred number? workers) 34 | (ensure-pred number? cache-bypass-threshold) 35 | 36 | (define (get-system-services config) 37 | (list 38 | (service guix-publish-service-type 39 | (guix-publish-configuration 40 | (guix guix) 41 | (port port) 42 | (host host) 43 | (advertise? advertise?) 44 | (compression (if compress? 45 | compression-methods 46 | '())) 47 | (nar-path nar-path) 48 | (cache cache) 49 | (workers workers) 50 | (cache-bypass-threshold cache-bypass-threshold))))) 51 | 52 | (feature 53 | (name 'publish) 54 | (system-services-getter get-system-services))) 55 | -------------------------------------------------------------------------------- /engstrand/features/radio.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features radio) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (rde system services accounts) 5 | #:use-module (gnu services) 6 | #:use-module (gnu services base) 7 | #:use-module (gnu services shepherd) 8 | #:use-module (gnu home services) 9 | #:use-module (gnu packages radio) 10 | #:use-module (engstrand utils) 11 | #:export (feature-radio)) 12 | 13 | (define* (feature-radio 14 | #:key 15 | (rtl-sdr? #t)) 16 | 17 | (define (system-sdr-services _) 18 | (list 19 | (simple-service 20 | 'sdr-add-user-groups 21 | rde-account-service-type 22 | (list "dialout")) 23 | (if rtl-sdr? 24 | (udev-rules-service 25 | 'rtl-sdr-add-udev-rules 26 | rtl-sdr)))) 27 | 28 | (feature 29 | (name 'radio) 30 | (values 31 | `((kernel-arguments-radio 32 | . ,(list 33 | (if rtl-sdr? "modprobe.blacklist=dvb_usb_rtl28xxu"))))) 34 | (system-services-getter system-sdr-services))) 35 | -------------------------------------------------------------------------------- /engstrand/features/shells.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features shells) 2 | #:use-module (rde gexp) 3 | #:use-module (rde features) 4 | #:use-module (rde packages) 5 | #:use-module (rde features predicates) 6 | #:use-module (guix gexp) 7 | #:use-module (gnu services) 8 | #:use-module (gnu packages shells) 9 | #:use-module (gnu packages shellutils) 10 | #:use-module (gnu home-services-utils) 11 | #:use-module (gnu home-services shells) 12 | #:use-module (gnu home-services shellutils) 13 | #:use-module (engstrand utils) 14 | #:export (feature-zsh)) 15 | 16 | (define* (feature-zsh) 17 | "Setup zsh." 18 | 19 | (define (get-home-services config) 20 | "Return a list of home services required by zsh" 21 | (list 22 | (service home-zsh-direnv-service-type) 23 | (simple-service 24 | 'setup-zsh-autosuggestions 25 | home-zsh-autosuggestions-service-type 26 | zsh-autosuggestions) 27 | (simple-service 28 | 'setup-zsh-config 29 | home-zsh-service-type 30 | (home-zsh-extension 31 | ;; TODO: Use absolute paths 32 | (zshrc `(,(slurp-file-like (local-file "../files/zshrc")))) 33 | (zprofile `(,(slurp-file-like (local-file "../files/shell-profile")))))))) 34 | 35 | (feature 36 | (name 'zsh) 37 | (values `((login-shell . ,(file-append zsh "/bin/zsh")))) 38 | (home-services-getter get-home-services))) 39 | -------------------------------------------------------------------------------- /engstrand/features/state.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features state) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (gnu services nix) 6 | #:use-module (gnu home services) 7 | #:use-module (engstrand utils) 8 | #:export ( 9 | feature-dotfiles)) 10 | ;; feature-state-git 11 | ;; feature-state-rsync)) 12 | 13 | (define* (feature-dotfiles 14 | #:key 15 | (dotfiles '())) 16 | "Symlink dotfiles to home." 17 | 18 | (ensure-pred list-of-dotfiles? dotfiles) 19 | 20 | (define (get-home-services config) 21 | "Return a list of home services required for adding dotfiles." 22 | (list 23 | (simple-service 24 | 'add-dotfiles-to-symlink 25 | home-files-service-type 26 | dotfiles))) 27 | 28 | (feature 29 | (name 'dotfiles) 30 | (home-services-getter get-home-services))) 31 | 32 | ;; The state home service seems to have been removed. 33 | ;; (define* (feature-state-git 34 | ;; #:key 35 | ;; (prefix (getenv "HOME")) 36 | ;; (repos '())) 37 | ;; "Add git repository states that can be synced using shepherd." 38 | ;; 39 | ;; (ensure-pred string? prefix) 40 | ;; (ensure-pred list-of-state-items? repos) 41 | ;; 42 | ;; (define (get-home-services config) 43 | ;; "Return a list of home services required for adding git states." 44 | ;; (list 45 | ;; (simple-service 46 | ;; 'add-state-git-repos 47 | ;; home-state-service-type 48 | ;; (map (lambda (repo) 49 | ;; (state-git 50 | ;; (string-append prefix "/" (car repo)) 51 | ;; (cdr repo))) 52 | ;; repos)))) 53 | ;; 54 | ;; (feature 55 | ;; (name 'state-git) 56 | ;; (home-services-getter get-home-services))) 57 | ;; 58 | ;; (define* (feature-state-rsync 59 | ;; #:key 60 | ;; (prefix (getenv "HOME")) 61 | ;; (hosts '())) 62 | ;; "Add rsync states that can be synces using shepherd." 63 | ;; 64 | ;; (ensure-pred string? prefix) 65 | ;; (ensure-pred list-of-state-items? hosts) 66 | ;; 67 | ;; (define (get-home-services config) 68 | ;; "Return a list of home services required for adding rsync states." 69 | ;; (list 70 | ;; (simple-service 71 | ;; 'add-state-rsync-hosts 72 | ;; home-state-service-type 73 | ;; (map (lambda (host) 74 | ;; (state-rsync 75 | ;; (string-append prefix "/" (car host)) 76 | ;; (cdr host))) 77 | ;; hosts)))) 78 | ;; 79 | ;; (feature 80 | ;; (name 'state-rsync) 81 | ;; (home-services-getter get-home-services))) 82 | -------------------------------------------------------------------------------- /engstrand/features/statusbar.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features statusbar) 2 | #:use-module (srfi srfi-1) 3 | #:use-module (guix gexp) 4 | #:use-module (gnu services) 5 | #:use-module (rde features) 6 | #:use-module (rde features predicates) 7 | #:use-module (engstrand utils) 8 | #:use-module (farg colors) 9 | #:use-module (dtao-guile home-service) 10 | #:export ( 11 | feature-statusbar-dtao-guile 12 | 13 | engstrand-dtao-guile-left-blocks 14 | engstrand-dtao-guile-center-blocks 15 | engstrand-dtao-guile-right-blocks 16 | 17 | %engstrand-dtao-guile-config)) 18 | 19 | (define (engstrand-dtao-guile-left-blocks palette) 20 | (append 21 | (map 22 | (lambda (tag) 23 | (let ((str (string-append "^p(8)" (number->string tag) "^p(8)")) 24 | (index (- tag 1))) 25 | (dtao-block 26 | (interval 0) 27 | (events? #t) 28 | (click `(match button 29 | (0 (dtao:view ,index)))) 30 | (render `(cond 31 | ((dtao:selected-tag? ,index) 32 | ,(format #f "^bg(~a)^fg(~a)~a^fg()^bg()" 33 | (palette 'accent-0) 34 | (farg:make-readable (palette 'accent-0) (palette 'accent-0)) 35 | str)) 36 | ((dtao:urgent-tag? ,index) 37 | ,(format #f "^bg(~a)^fg(~a)~a^fg()^bg()" 38 | (palette 'red) 39 | (palette 'bg) ;; TODO: Light/dark based on theme mode 40 | str)) 41 | ((dtao:active-tag? ,index) 42 | ,(format #f "^bg(~a)^fg(~a)~a^fg()^bg()" 43 | (farg:offset (palette 'bg) 10) 44 | (palette 'fg) 45 | str)) 46 | (else ,str)))))) 47 | (iota 9 1)) 48 | (list 49 | (dtao-block 50 | (events? #t) 51 | (click `(dtao:next-layout)) 52 | (render `(string-append "^p(4)" (dtao:get-layout))))))) 53 | 54 | (define (engstrand-dtao-guile-center-blocks palette) 55 | (list 56 | (dtao-block 57 | (events? #t) 58 | (render `(dtao:title))))) 59 | 60 | (define (engstrand-dtao-guile-right-blocks palette) 61 | (list 62 | (dtao-block 63 | (interval 1) 64 | (render `(strftime "%A, %d %b (w.%V) %T" (localtime (current-time))))))) 65 | 66 | ;; TODO: Add options for setting blocks, etc. 67 | (define* (feature-statusbar-dtao-guile) 68 | "Install and configure dtao-guile." 69 | 70 | ;; Statusbar height 71 | (define height 25) 72 | 73 | (lambda (_ palette) 74 | (define (get-home-services config) 75 | "Return a list of home services required by dtao-guile." 76 | (require-value 'font-monospace config) 77 | (list 78 | (service home-dtao-guile-service-type 79 | (home-dtao-guile-configuration 80 | (config 81 | (dtao-config 82 | (font (font->string 'fcft 'font-monospace config 83 | #:bold? #t)) 84 | (block-spacing 0) 85 | (background-color (palette 'bg)) 86 | (foreground-color (palette 'fg)) 87 | (border-color (palette 'bg)) 88 | (modules '((ice-9 match) 89 | (ice-9 popen) 90 | (ice-9 rdelim) 91 | (srfi srfi-1))) 92 | (padding-left 0) 93 | (padding-top 0) 94 | (padding-bottom 0) 95 | (height height) 96 | ;; Ensure that blocks have spacing between them 97 | (delimiter-right " ") 98 | (left-blocks (engstrand-dtao-guile-left-blocks palette)) 99 | (center-blocks (engstrand-dtao-guile-center-blocks palette)) 100 | (right-blocks (engstrand-dtao-guile-right-blocks palette)))))))) 101 | 102 | (feature 103 | (name 'statusbar-dtao-guile) 104 | (values `((statusbar? . #t) 105 | (statusbar-height . ,height) 106 | (dtao-guile . #t))) 107 | (home-services-getter get-home-services)))) 108 | -------------------------------------------------------------------------------- /engstrand/features/sync.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features sync) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (engstrand utils) 5 | #:use-module (guix gexp) 6 | #:use-module (guix packages) 7 | #:use-module (gnu packages kde) 8 | #:use-module (gnu services) 9 | #:use-module (gnu home services) 10 | #:use-module (gnu home services shepherd) 11 | #:export (feature-kdeconnect)) 12 | 13 | (define* (feature-kdeconnect 14 | #:key 15 | (device-id #f)) 16 | "Install and configure KDE Connect." 17 | 18 | (ensure-pred maybe-string? device-id) 19 | 20 | (define (get-home-services config) 21 | "Return a list of home services required by KDE Connect." 22 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 23 | (make-service-list 24 | (simple-service 25 | 'kdeconnect-add-home-packages-to-profile 26 | home-profile-service-type 27 | (list kdeconnect)) 28 | (simple-service 29 | 'kdeconnect-add-shepherd-daemons 30 | home-shepherd-service-type 31 | (list 32 | (shepherd-service 33 | (documentation "Run the KDE Connect daemon.") 34 | (requirement (append '(dbus) 35 | (if has-dwl-guile? '(dwl-guile) '()))) 36 | (provision '(kdeconnect)) 37 | (auto-start? #t) 38 | (respawn? #t) 39 | (start 40 | #~(make-forkexec-constructor 41 | (list 42 | #$(file-append kdeconnect "/libexec/kdeconnectd")) 43 | #:log-file #$(make-log-file "kdeconnect"))) 44 | (stop 45 | #~(make-kill-destructor)))))))) 46 | 47 | (feature 48 | (name 'kdeconnect) 49 | (values `((kdeconnect-device-id . ,device-id))) 50 | (home-services-getter get-home-services))) 51 | -------------------------------------------------------------------------------- /engstrand/features/theming.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features theming) 2 | #:use-module (ice-9 match) 3 | #:use-module (guix gexp) 4 | #:use-module (gnu services) 5 | #:use-module (gnu home services) 6 | #:use-module (rde features) 7 | #:use-module (farg home-service) 8 | #:export (feature-farg)) 9 | 10 | (define* (feature-farg) 11 | "Installs and configures farg, a system colorscheme manager for Guix." 12 | 13 | (lambda (fsource _) 14 | (define (get-home-services config) 15 | "Return a list of home services required by farg" 16 | (list 17 | (service home-farg-service-type 18 | (home-farg-configuration 19 | (source fsource))))) 20 | 21 | (feature 22 | (name 'farg) 23 | (values '(("farg" . #t))) 24 | (home-services-getter get-home-services)))) 25 | -------------------------------------------------------------------------------- /engstrand/features/utils.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features utils) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (guix gexp) 5 | #:use-module (gnu packages gnupg) 6 | #:use-module (gnu services) 7 | #:use-module (gnu services dbus) 8 | #:use-module (gnu packages gnome) 9 | #:use-module (gnu packages rust-apps) 10 | #:use-module (gnu home services) 11 | #:use-module (gnu home services shepherd) 12 | #:use-module (engstrand utils) 13 | #:use-module (engstrand packages utils) 14 | #:use-module (engstrand home-services qutebrowser) 15 | #:export (feature-imv 16 | feature-rbw 17 | feature-rbw-qutebrowser 18 | feature-piper)) 19 | 20 | (define* (feature-imv) 21 | "Setup imv, an image viewer for X11 and Wayland." 22 | 23 | ;; TODO: Add configuration in Guile 24 | 25 | (define (get-home-services config) 26 | "Return a list of home services required by imv" 27 | (list 28 | (simple-service 29 | 'add-imv-home-packages-to-profile 30 | home-profile-service-type 31 | (pkgs '("imv"))))) 32 | 33 | (feature 34 | (name 'imv) 35 | (home-services-getter get-home-services))) 36 | 37 | (define* (feature-piper) 38 | "Set up Piper, a configuration utility for gaming mice." 39 | 40 | (define (get-home-services config) 41 | "Return a list of home services required by Piper" 42 | (list 43 | (simple-service 44 | 'add-piper-home-packages-to-profile 45 | home-profile-service-type 46 | ;; seems like `python' is needed also 47 | (pkgs '("python" "piper"))))) 48 | 49 | (define (get-system-services config) 50 | "Return a list of system services required by Piper" 51 | (list 52 | (simple-service 53 | 'ratbagd 54 | dbus-root-service-type 55 | (list libratbag)))) 56 | 57 | (feature 58 | (name 'piper) 59 | (home-services-getter get-home-services) 60 | (system-services-getter get-system-services))) 61 | 62 | (define* (feature-rbw 63 | #:key 64 | (package rbw-latest) 65 | (email #f) 66 | ;; TODO: pinentry-bemenu does not work with rbw for some reason. 67 | (pinentry (file-append pinentry-gtk2 "/bin/pinentry-gtk-2")) 68 | (lock-timeout 300)) ;; 5 minutes 69 | "Setup rbw, the unofficial Bitwarden CLI." 70 | 71 | (ensure-pred package? package) 72 | (ensure-pred file-like? pinentry) 73 | (ensure-pred maybe-string? email) 74 | (ensure-pred number? lock-timeout) 75 | 76 | (define (get-home-services config) 77 | "Return a list of home services required by rbw" 78 | (list 79 | (simple-service 80 | 'add-rbw-home-packages-to-profile 81 | home-profile-service-type 82 | (list package)) 83 | ;; rbw mutates the configuration file to set a unique device-id 84 | ;; upon registering the device using your API key. 85 | ;; See https://github.com/doy/rbw/issues/74. 86 | ;; 87 | ;; To circumvent this, a separate config file is saved, allowing us 88 | ;; to listen for changes and mutate the real config file. 89 | (simple-service 90 | 'create-rbw-config 91 | home-files-service-type 92 | `((".config/rbw/immutable-config" 93 | ,(mixed-text-file 94 | "rbw-immutable-config" 95 | email (number->string lock-timeout) pinentry)))) 96 | (simple-service 97 | 'on-rbw-config-change 98 | home-run-on-change-service-type 99 | (let ((bin (file-append package "/bin/rbw"))) 100 | `(("files/.config/rbw/immutable-config" 101 | ,#~(begin 102 | (when #$email 103 | (system* #$bin "config" "set" "email" #$email)) 104 | (system* #$bin "config" "set" "pinentry" 105 | #$pinentry) 106 | (system* #$bin "config" "set" "lock_timeout" 107 | #$(number->string lock-timeout))))))))) 108 | 109 | (feature 110 | (name 'rbw) 111 | (home-services-getter get-home-services))) 112 | 113 | (define* (feature-rbw-qutebrowser) 114 | "Add a userscript to qutebrowser for adding auto-fill using rbw." 115 | 116 | (define (get-home-services config) 117 | (list 118 | (simple-service 119 | 'qutebrowser-rbw-autofill 120 | home-qutebrowser-service-type 121 | (home-qutebrowser-extension 122 | (bindings 123 | '(("" "spawn --userscript qute-rbw" "insert") 124 | ("" "spawn --userscript qute-rbw --password-only" "insert") 125 | ("" "spawn --userscript qute-rbw --username-only" "insert") 126 | ("" "spawn --userscript qute-rbw" "normal") 127 | ("" "spawn --userscript qute-rbw --password-only" "normal") 128 | ("" "spawn --userscript qute-rbw --username-only" "normal"))) 129 | (userscripts 130 | `(("qute-rbw" . ,(local-file "../files/qute-rbw")))))))) 131 | 132 | (feature 133 | (name 'rbw-qutebrowser) 134 | (home-services-getter get-home-services))) 135 | -------------------------------------------------------------------------------- /engstrand/features/version-control.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features version-control) 2 | #:use-module (rde features) 3 | #:use-module (gnu services) 4 | #:use-module (gnu home-services version-control) 5 | #:export (feature-git-colorscheme)) 6 | 7 | (define* (feature-git-colorscheme) 8 | "Changes the colorscheme of git in the terminal using farg." 9 | 10 | (define (get-home-services config) 11 | (list 12 | (simple-service 13 | 'update-git-colors 14 | home-git-service-type 15 | (home-git-extension 16 | (config 17 | `((color 18 | ((ui . auto))) 19 | ;; Special colors, see foot feature 20 | (,(string->symbol "color \"diff\"") 21 | ((old . ,(string->symbol "red dim")) 22 | (new . ,(string->symbol "green dim")))) 23 | (,(string->symbol "color \"status\"") 24 | ((added . ,(string->symbol "green dim")) 25 | (changed . ,(string->symbol "red dim")) 26 | (untracked . ,(string->symbol "red dim")))) 27 | (,(string->symbol "color \"\"") 28 | ((added . ,(string->symbol "green dim")) 29 | (changed . ,(string->symbol "red dim")) 30 | (untracked . ,(string->symbol "red dim")))))))))) 31 | 32 | (feature 33 | (name 'git-colorscheme) 34 | (home-services-getter get-home-services))) 35 | -------------------------------------------------------------------------------- /engstrand/features/video.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features video) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (gnu home services) 6 | #:use-module (gnu home-services video) ;; rde home-service 7 | #:use-module (engstrand utils) 8 | #:export ( 9 | feature-obs 10 | )) 11 | 12 | (define* (feature-obs 13 | #:key 14 | (wayland? #t)) 15 | "Setup OBS, the Open Broadcaster Software." 16 | 17 | (define (get-home-services config) 18 | "Return a list of home services required by OBS." 19 | (list 20 | (simple-service 21 | 'add-obs-home-packages-to-profile 22 | home-profile-service-type 23 | (let ((base-packages '("obs"))) 24 | (pkgs (if wayland? 25 | (cons "obs-wlrobs" base-packages) 26 | base-packages)))))) 27 | 28 | (feature 29 | (name 'obs) 30 | (home-services-getter get-home-services))) 31 | -------------------------------------------------------------------------------- /engstrand/features/virtualization.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features virtualization) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (gnu services) 5 | #:use-module (gnu services docker) 6 | #:use-module (gnu services virtualization) 7 | #:use-module (rde system services accounts) 8 | #:export (feature-virtualization feature-docker)) 9 | 10 | (define* (feature-virtualization 11 | #:key 12 | (unix-sock-group "libvirt")) 13 | "Setup system virtualization." 14 | 15 | (ensure-pred string? unix-sock-group) 16 | 17 | (define (get-system-services config) 18 | "Return a list of system services required for virtualization." 19 | (list 20 | (simple-service 21 | 'virtualization-add-user-groups 22 | rde-account-service-type 23 | (list "libvirt" "kvm")) 24 | (service virtlog-service-type) 25 | (service libvirt-service-type 26 | (libvirt-configuration 27 | (unix-sock-group unix-sock-group))))) 28 | 29 | (feature 30 | (name 'virtualization) 31 | (system-services-getter get-system-services))) 32 | 33 | (define* (feature-docker) 34 | "Setup docker." 35 | 36 | (define (get-system-services config) 37 | "Return a list of system services required for docker." 38 | (list 39 | (simple-service 40 | 'docker-add-user-groups 41 | rde-account-service-type 42 | (list "docker")) 43 | (service docker-service-type))) 44 | 45 | (feature 46 | (name 'docker) 47 | (system-services-getter get-system-services))) 48 | -------------------------------------------------------------------------------- /engstrand/features/wayland.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features wayland) 2 | #:use-module (rde features) 3 | #:use-module (rde features fontutils) 4 | #:use-module (rde features predicates) 5 | #:use-module (guix gexp) 6 | #:use-module (ice-9 match) 7 | #:use-module (srfi srfi-1) 8 | #:use-module (gnu services) 9 | #:use-module (gnu services xorg) 10 | #:use-module (gnu packages wm) 11 | #:use-module (gnu packages image) 12 | #:use-module (gnu packages admin) 13 | #:use-module (gnu packages xdisorg) 14 | #:use-module (gnu packages terminals) 15 | #:use-module (gnu packages freedesktop) 16 | #:use-module (gnu home services) 17 | #:use-module (gnu home services shepherd) 18 | #:use-module (engstrand utils) 19 | #:use-module (engstrand utils bemenu-prompt) 20 | #:use-module (engstrand systems) 21 | #:use-module (engstrand packages wayland) 22 | #:use-module (farg reload) 23 | #:use-module (farg colors) 24 | #:use-module (farg home-service) 25 | #:use-module (dwl-guile utils) 26 | #:use-module (dwl-guile patches) 27 | #:use-module (dwl-guile home-service) 28 | #:export ( 29 | feature-wayland-bemenu 30 | feature-wayland-bemenu-power 31 | feature-wayland-foot 32 | feature-wayland-mako 33 | feature-wayland-swaybg 34 | feature-wayland-wlsunset 35 | feature-wayland-screenshot 36 | feature-wayland-swaylock)) 37 | 38 | (define* (feature-wayland-mako 39 | #:key 40 | (dismiss-key "C-s-d") 41 | (dismiss-all-key "C-S-s-d") 42 | (add-keybindings? #t)) 43 | "Setup mako, a lightweight notification daemon for Wayland" 44 | 45 | (ensure-pred string? dismiss-key) 46 | (ensure-pred string? dismiss-all-key) 47 | (ensure-pred boolean? add-keybindings?) 48 | 49 | (lambda (_ palette) 50 | (define (get-home-services config) 51 | "Return a list of home services required by mako" 52 | (require-value 'font-monospace config) 53 | (make-service-list 54 | (simple-service 55 | 'add-mako-home-packages-to-profile 56 | home-profile-service-type 57 | (pkgs '("mako" "libnotify"))) 58 | (simple-service 59 | 'create-mako-config 60 | home-files-service-type 61 | `((".config/mako/config" 62 | ,(alist->ini "mako-config" 63 | `(("font" 64 | . ,(font->string 'pango 'font-sans config 65 | #:size 11)) 66 | ("background-color" . ,(palette 'bg)) 67 | ("text-color" . ,(palette 'fg)) 68 | ("width" . 370) 69 | ("height" . 100) 70 | ("border-color" . ,(farg:offset (palette 'bg) 25)) 71 | ("border-size" . 1) 72 | ("border-radius" . 0) 73 | ("margin" . 5) 74 | ("padding" . 10) 75 | ("default-timeout" . 15000) 76 | ("anchor" . "top-right") 77 | ("max-visible" . 2) 78 | ("format" . "%s (%a)\\n%b") 79 | ("[grouped=true]") 80 | ("format" . "%s (%a, %g)\\n%b") 81 | ("[hidden]") 82 | ("format" . "(%h more notifications)")))))) 83 | (simple-service 84 | 'reload-mako-config-on-farg-activation 85 | home-farg-service-type 86 | (list 87 | #~(begin 88 | (display "Reloading mako configuration...\n") 89 | (system* #$(file-append mako "/bin/makoctl") "reload")))) 90 | (when (and add-keybindings? (get-value 'dwl-guile config)) 91 | (simple-service 92 | 'add-mako-dwl-keybindings 93 | home-dwl-guile-service-type 94 | `((set-keys ,dismiss-key (lambda () (dwl:shcmd ,(file-append mako "/bin/makoctl") "dismiss")) 95 | ,dismiss-all-key (lambda () (dwl:shcmd ,(file-append mako "/bin/makoctl") 96 | "dismiss" "--all")))))))) 97 | 98 | (feature 99 | (name 'wayland-mako) 100 | (home-services-getter get-home-services)))) 101 | 102 | ;; TODO: Move to features/terminals.scm? 103 | (define* (feature-wayland-foot 104 | #:key 105 | (package foot) 106 | (open-key "s-") 107 | (set-default-terminal? #t) 108 | (swallow-clients? #t)) 109 | "Setup foot terminal." 110 | 111 | (ensure-pred package? package) 112 | (ensure-pred string? open-key) 113 | (ensure-pred boolean? set-default-terminal?) 114 | (ensure-pred boolean? swallow-clients?) 115 | 116 | (lambda (_ palette) 117 | (define (get-home-services config) 118 | "Return a list of home services required by foot." 119 | (require-value 'font-monospace config) 120 | 121 | ;; Terminal color overrides for the default pywal colors. 122 | (define color-overrides 123 | `((0 . ,(palette 'accent-0-text)) 124 | (1 . ,(palette 'accent-1-text)) 125 | (2 . ,(palette 'accent-2-text)) 126 | (3 . ,(palette 'accent-3-text)) 127 | (4 . ,(palette 'accent-4-text)) 128 | (5 . ,(palette 'accent-5-text)) 129 | (6 . ,(palette 'accent-6-text)) 130 | (7 . ,(palette 'accent-7-text)) 131 | (8 . ,(farg:brighten (palette 'accent-0-text) 10)) 132 | (9 . ,(farg:brighten (palette 'accent-1-text) 10)) 133 | (10 . ,(farg:brighten (palette 'accent-2-text) 10)) 134 | (11 . ,(farg:brighten (palette 'accent-3-text) 10)) 135 | (12 . ,(farg:brighten (palette 'accent-4-text) 10)) 136 | (13 . ,(farg:brighten (palette 'accent-5-text) 10)) 137 | (14 . ,(farg:brighten (palette 'accent-6-text) 10)) 138 | (15 . ,(farg:brighten (palette 'accent-7-text) 10)))) 139 | 140 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 141 | (make-service-list 142 | (simple-service 143 | 'add-foot-home-packages-to-profile 144 | home-profile-service-type 145 | (list package)) 146 | (simple-service 147 | 'create-foot-config 148 | home-files-service-type 149 | `((".config/foot/foot.ini" 150 | ,(alist->ini "foot-config" 151 | `(("pad" . "5x5") 152 | ("font" . ,(font->string 'fcft 'font-monospace config #:size 12)) 153 | ("dpi-aware" . "no") 154 | ;; nmtui does not like if term is set to foot 155 | ("term" . "xterm") 156 | 157 | ("[colors]") 158 | ("alpha" . ,(palette 'alpha)) 159 | ("foreground" . ,(strip-hex (palette 'fg))) 160 | ("background" . ,(strip-hex (palette 'bg))) 161 | ("regular0" . ,(strip-hex (assoc-ref color-overrides 0))) 162 | ("regular1" . ,(strip-hex (assoc-ref color-overrides 1))) 163 | ("regular2" . ,(strip-hex (assoc-ref color-overrides 2))) 164 | ("regular3" . ,(strip-hex (assoc-ref color-overrides 3))) 165 | ("regular4" . ,(strip-hex (assoc-ref color-overrides 4))) 166 | ("regular5" . ,(strip-hex (assoc-ref color-overrides 5))) 167 | ("regular6" . ,(strip-hex (assoc-ref color-overrides 6))) 168 | ("regular7" . ,(strip-hex (assoc-ref color-overrides 7))) 169 | ("bright0" . ,(strip-hex (assoc-ref color-overrides 8))) 170 | ("bright1" . ,(strip-hex (assoc-ref color-overrides 9))) 171 | ("bright2" . ,(strip-hex (assoc-ref color-overrides 10))) 172 | ("bright3" . ,(strip-hex (assoc-ref color-overrides 11))) 173 | ("bright4" . ,(strip-hex (assoc-ref color-overrides 12))) 174 | ("bright5" . ,(strip-hex (assoc-ref color-overrides 13))) 175 | ("bright6" . ,(strip-hex (assoc-ref color-overrides 14))) 176 | ("bright7" . ,(strip-hex (assoc-ref color-overrides 15))) 177 | ("dim1" . ,(strip-hex (palette 'red))) 178 | ("dim2" . ,(strip-hex (palette 'green))) 179 | 180 | ("[key-bindings]") 181 | ("scrollback-up-line" . "Mod1+k") 182 | ("scrollback-down-line" . "Mod1+j") 183 | ("scrollback-up-line" . "Page_Up") 184 | ("scrollback-down-line" . "Page_Down") 185 | ("clipboard-copy" . "Mod1+c") 186 | ("clipboard-paste" . "Mod1+v") 187 | ("search-start" . "Mod1+s") 188 | ("font-increase" . "Mod1+Control+k") 189 | ("font-decrease" . "Mod1+Control+j") 190 | ("font-reset" . "Mod1+Control+0") 191 | ;; This should be defined in dwl. 192 | ("spawn-terminal" . "Mod4+Shift+Return") 193 | ("show-urls-launch" . "Mod1+u") 194 | ("show-urls-copy" . "Mod1+Control+u") 195 | 196 | ("[search-bindings]") 197 | ("find-prev" . "Mod1+p") 198 | ("find-next" . "Mod1+n") 199 | ("cursor-left" . "Mod1+h") 200 | ("cursor-right" . "Mod1+l") 201 | ("cursor-left-word" . "Mod1+b") 202 | ("cursor-right-word" . "Mod1+w") 203 | ("cursor-home" . "Mod1+i") 204 | ("cursor-end" . "Mod1+a") 205 | ("clipboard-paste" . "Mod1+v") 206 | 207 | ("[mouse-bindings]") 208 | ("select-begin-block" . "none") 209 | ("select-word-whitespace" . "Mod1+BTN_LEFT-2")))))) 210 | (simple-service 211 | 'reload-open-foot-instances-on-farg-activation 212 | home-farg-service-type 213 | (list 214 | #~(begin 215 | (display "Reloading theme in open foot instances...\n") 216 | #$(reload-terminal-colors palette color-overrides)))) 217 | (when has-dwl-guile? 218 | (simple-service 219 | 'set-as-default-terminal-in-dwl-guile 220 | home-dwl-guile-service-type 221 | `((set-keys "s-" (lambda () (dwl:spawn ,(file-append foot "/bin/foot")))) 222 | (set-rules '((id . "foot") 223 | (alpha . ,(palette 'alpha)) 224 | (terminal? . ,swallow-clients?))))))))) 225 | 226 | (feature 227 | (name 'wayland-foot) 228 | (home-services-getter get-home-services)))) 229 | 230 | (define* (feature-wayland-swaybg 231 | #:key 232 | (path #f) 233 | (auto-start? #t)) 234 | "Setup swaybg for setting wallpaper in Wayland compositors." 235 | 236 | (ensure-pred maybe-string? path) 237 | (ensure-pred boolean? auto-start?) 238 | 239 | (lambda (_ palette) 240 | (define wallpaper-path (palette 'wallpaper)) 241 | (define user-wallpaper-path 242 | (string-append (getenv "HOME") "/.config/wallpaper.jpg")) 243 | 244 | (define (get-home-services config) 245 | "Return a list of home services required by swaybg" 246 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 247 | (make-service-list 248 | (simple-service 249 | 'add-wbg-home-packages-to-profile 250 | home-profile-service-type 251 | (list swaybg)) 252 | (when wallpaper-path 253 | (simple-service 254 | 'copy-wallpaper-to-profile 255 | home-files-service-type 256 | `((".config/wallpaper.jpg" ,(local-file wallpaper-path))))) 257 | (when wallpaper-path 258 | (simple-service 259 | 'reload-wallpaper-on-farg-activation 260 | home-farg-service-type 261 | (list 262 | #~(begin 263 | (display "Reloading swaybg to update wallpaper...\n") 264 | (with-output-to-file "/dev/null" 265 | (lambda () 266 | (system* #$(file-append shepherd "/bin/herd") "restart" "swaybg"))))))) 267 | (when wallpaper-path 268 | (simple-service 269 | 'add-swaybg-shepherd-service 270 | home-shepherd-service-type 271 | (list 272 | (shepherd-service 273 | (documentation "Run swaybg.") 274 | (provision '(swaybg)) 275 | (requirement (if has-dwl-guile? '(dwl-guile) '())) 276 | (auto-start? auto-start?) 277 | (respawn? #t) 278 | (start 279 | #~(make-forkexec-constructor 280 | (list #$(file-append swaybg "/bin/swaybg") 281 | "-i" #$user-wallpaper-path 282 | "--mode" "fill") 283 | #:log-file #$(make-log-file "swaybg"))) 284 | (stop #~(make-kill-destructor))))))))) 285 | 286 | (feature 287 | (name 'wayland-swaybg) 288 | (home-services-getter get-home-services)))) 289 | 290 | (define* (feature-wayland-wlsunset 291 | #:key 292 | (package wlsunset) 293 | (auto-start? #t) 294 | (toggle-key "s-") 295 | (latitude 59.8) 296 | (longitude 17.6) 297 | (gamma-low 2000) 298 | (gamma-high 6500) 299 | (add-keybindings? #t)) 300 | "Setup wlsunset for adjusting day/night gamma for Wayland compositors." 301 | 302 | (ensure-pred package? wlsunset) 303 | (ensure-pred boolean? auto-start?) 304 | (ensure-pred string? toggle-key) 305 | (ensure-pred number? latitude) 306 | (ensure-pred number? longitude) 307 | (ensure-pred number? gamma-low) 308 | (ensure-pred number? gamma-high) 309 | (ensure-pred boolean? add-keybindings?) 310 | 311 | (define (get-home-services config) 312 | "Return a list of home services required by wlsunset" 313 | (let ((has-dwl-guile? (get-value 'dwl-guile config))) 314 | (make-service-list 315 | (simple-service 316 | 'add-wlsunset-home-packages-to-profile 317 | home-profile-service-type 318 | (list package)) 319 | (simple-service 320 | 'add-wlsunset-shepherd-service 321 | home-shepherd-service-type 322 | (list 323 | (shepherd-service 324 | (documentation "Run wlsunset.") 325 | (provision '(wlsunset)) 326 | (requirement (if has-dwl-guile? '(dwl-guile) '())) 327 | (auto-start? auto-start?) 328 | (respawn? #t) 329 | (start 330 | #~(make-forkexec-constructor 331 | (list 332 | #$(file-append wlsunset "/bin/wlsunset") 333 | #$(string-append "-l" (number->string latitude)) 334 | #$(string-append "-L" (number->string longitude)) 335 | #$(string-append "-t" (number->string gamma-low)) 336 | #$(string-append "-T" (number->string gamma-high))) 337 | #:log-file #$(make-log-file "wlsunset"))) 338 | (actions 339 | (list 340 | (shepherd-action 341 | (name 'toggle) 342 | (documentation "Toggles the wlsunset service on/off.") 343 | (procedure #~(lambda (running?) 344 | (if running? 345 | (stop 'wlsunset) 346 | (start 'wlsunset)) 347 | #t))))) 348 | (stop #~(make-kill-destructor))))) 349 | (when (and add-keybindings? has-dwl-guile?) 350 | (simple-service 351 | 'add-wlsunset-dwl-keybindings 352 | home-dwl-guile-service-type 353 | `((set-keys ,toggle-key 354 | (lambda () (dwl:shcmd ,(file-append shepherd "/bin/herd") 355 | "toggle" "wlsunset"))))))))) 356 | 357 | (feature 358 | (name 'wayland-wlsunset) 359 | (home-services-getter get-home-services))) 360 | 361 | (define* (feature-wayland-screenshot 362 | #:key 363 | (output-filetype "png") 364 | (jpeg-quality 100) 365 | (png-compression-level 6) 366 | (include-cursors? #f) 367 | (screenshot-output-key "S-s-") 368 | (screenshot-select-key "s-") 369 | (screenshot-select-copy-key "") 370 | (add-keybindings? #t)) 371 | "Setup grim, slurp and wl-clipboard for taking screenshots in Wayland compositors." 372 | 373 | (ensure-pred string? output-filetype) 374 | (ensure-pred number? jpeg-quality) 375 | (ensure-pred number? png-compression-level) 376 | (ensure-pred boolean? include-cursors?) 377 | (ensure-pred string? screenshot-output-key) 378 | (ensure-pred string? screenshot-select-key) 379 | (ensure-pred string? screenshot-select-copy-key) 380 | (ensure-pred boolean? add-keybindings?) 381 | 382 | (define %grim-command 383 | `(,(file-append grim "/bin/grim") 384 | ,(if include-cursors? "-c" "") 385 | "-t" ,output-filetype 386 | ,@(if (eq? output-filetype "jpeg") 387 | (list "-q" (number->string jpeg-quality)) 388 | '()) 389 | ,@(if (eq? output-filetype "png") 390 | (list "-l" (number->string png-compression-level)) 391 | '()))) 392 | 393 | (define %grim-select-options 394 | `("-g" "\"$(" ,(file-append slurp "/bin/slurp" ")\""))) 395 | 396 | (define %grim-pipe-to-clipboard 397 | `("-" "|" ,(file-append wl-clipboard "/bin/wl-copy"))) 398 | 399 | ;; TODO: Cleanup this mess. A simple solution is to just use the executable name directly. 400 | ;; Another (better) solution is to allow multiple arguments to dwl:shcmd. 401 | ;; dwl:spawn does support n amount of arguments, but since shcmd runs the command 402 | ;; in a shell context ("/bin/sh" "-c" ), the last argument must be a single string. 403 | (define (make-screenshot-shcmd . params) 404 | `(dwl:shcmd (string-join (list ,@(fold-right append '() (cons %grim-command params)))))) 405 | 406 | (define (get-home-services config) 407 | "Return a list of home services required for screenshots." 408 | (make-service-list 409 | (simple-service 410 | 'add-screenshot-home-packages-to-profile 411 | home-profile-service-type 412 | (pkgs '("grim" "slurp" "wl-clipboard"))) 413 | (when (and add-keybindings? (get-value 'dwl-guile config)) 414 | (simple-service 415 | 'add-screenshot-dwl-keybindings 416 | home-dwl-guile-service-type 417 | `((set-keys ,screenshot-output-key 418 | (lambda () ,(make-screenshot-shcmd)) 419 | ,screenshot-select-key 420 | (lambda () ,(make-screenshot-shcmd %grim-select-options)) 421 | ,screenshot-select-copy-key 422 | (lambda () ,(make-screenshot-shcmd %grim-select-options 423 | %grim-pipe-to-clipboard)))))))) 424 | 425 | (feature 426 | (name 'wayland-screenshots) 427 | (home-services-getter get-home-services))) 428 | 429 | (define* (feature-wayland-bemenu 430 | #:key 431 | (open-key "s-d") 432 | (set-default-menu? #t)) 433 | "Setup bemenu." 434 | 435 | (ensure-pred string? open-key) 436 | (ensure-pred boolean? set-default-menu?) 437 | 438 | (lambda (_ palette) 439 | (define (get-home-services config) 440 | "Return a list of home services required by bemenu." 441 | (require-value 'font-monospace config) 442 | (make-service-list 443 | (simple-service 444 | 'add-bemenu-home-packages-to-profile 445 | home-profile-service-type 446 | (list bemenu)) 447 | (when (and set-default-menu? (get-value 'dwl-guile config)) 448 | (simple-service 449 | 'set-bemenu-as-default-menu-in-dwl-guile 450 | home-dwl-guile-service-type 451 | `((set-keys ,open-key 452 | (lambda () (dwl:spawn ,(file-append bemenu "/bin/bemenu-run"))))))) 453 | (simple-service 454 | 'bemenu-options 455 | home-environment-variables-service-type 456 | (alist->environment-variable 457 | "BEMENU_OPTS" 458 | `(("line-height" 459 | . ,(get-value 'statusbar-height config 25)) 460 | ("filter" . #f) 461 | ("wrap" . #f) 462 | ("list" . #f) 463 | ("prompt" . #f) 464 | ("prefix" . #f) 465 | ("index" . #f) 466 | ("password" . #f) 467 | ("scrollbar" . #f) 468 | ("ifne" . #f) 469 | ("fork" . #f) 470 | ("no-exec" . #f) 471 | ("bottom" . #f) 472 | ("grab" . #f) 473 | ("no-overlap" . #f) 474 | ("monitor" . #f) 475 | ("fn" 476 | . ,(font->string 'pango 'font-monospace config 477 | #:bold? #t 478 | #:size 11)) 479 | ("tb" . ,(palette 'accent-0)) 480 | ("tf" . ,(farg:make-readable (palette 'accent-0) 481 | (palette 'accent-0))) 482 | ("fb" . ,(palette 'bg)) 483 | ("ff" . ,(palette 'fg)) 484 | ("nb" . ,(palette 'bg)) 485 | ("nf" . ,(palette 'fg)) 486 | ("hb" . ,(farg:offset (palette 'bg) 10)) 487 | ("hf" . ,(palette 'accent-0-text)) 488 | ("sb" . #f) 489 | ("sf" . ,(palette 'accent-1-text)) 490 | ("scb" . #f) 491 | ("scf" . #f) 492 | ;; NOTE: pinentry-bemenu does not support this option, 493 | ;; so we need to keep it last in the list of options, 494 | ;; otherwise they will be ignored. 495 | ("ignorecase" . #t)))))) 496 | 497 | (feature 498 | (name 'wayland-bemenu) 499 | (home-services-getter get-home-services)))) 500 | 501 | (define* (feature-wayland-bemenu-power 502 | #:key 503 | (open-key "S-s-")) 504 | "Install and configure bemenu power prompt." 505 | 506 | (define actions 507 | (let ((loginctl (file-append elogind "/bin/loginctl"))) 508 | `(("suspend" . (system* ,loginctl "suspend")) 509 | ("restart dwl" . (system* ,(file-append shepherd "/bin/herd") "restart" "dwl-guile")) 510 | ("logout" . (system* ,loginctl "terminate-session" 511 | (getenv "XDG_SESSION_ID"))) 512 | ("reboot" . (system* ,loginctl "reboot")) 513 | ("shutdown" . (system* ,loginctl "poweroff"))))) 514 | 515 | (define (get-home-services config) 516 | (let ((executable 517 | (compute-bemenu-prompt 518 | "bemenu.scm" 519 | "What do you want to do?" 520 | actions))) 521 | (make-service-list 522 | (simple-service 523 | 'create-bemenu-power-executable 524 | home-files-service-type 525 | `((".config/bemenu.scm" ,executable))) 526 | (when (get-value 'dwl-guile config) 527 | (simple-service 528 | 'add-bemenu-power-dwl-keybinding 529 | home-dwl-guile-service-type 530 | `((set-keys ,open-key (lambda () (dwl:shcmd ,executable))))))))) 531 | 532 | (feature 533 | (name 'wayland-bemenu-power) 534 | (home-services-getter get-home-services))) 535 | 536 | ;; TODO: Add options? 537 | (define* (feature-wayland-swaylock 538 | #:key 539 | (lock-key "s-x") 540 | (add-keybindings? #t)) 541 | "Install and configure swaylock." 542 | 543 | (lambda (_ palette) 544 | (define (get-home-services config) 545 | (require-value 'font-monospace config) 546 | (list 547 | (simple-service 548 | 'create-swaylock-config 549 | home-files-service-type 550 | `((".config/swaylock/config" 551 | ,(alist->ini "swaylock-config" 552 | `(("daemonize") 553 | ("hide-keyboard-layout") 554 | ("line-uses-ring") 555 | ("color" . "00000000") 556 | ("font" 557 | . ,(font->string 'fcft 'font-monospace config 558 | #:bold? #t)) 559 | ("font-size" . 40) 560 | ("indicator-thickness" . 10) 561 | ("indicator-radius" . 80) 562 | ("key-hl-color" . ,(strip-hex (palette 'accent-0))) 563 | ("bs-hl-color" . ,(strip-hex (palette 'red))) 564 | ("inside-color" . "00000000") 565 | ("inside-clear-color" . "00000000") 566 | ("inside-ver-color" . "00000000") 567 | ("inside-wrong-color" . "00000000") 568 | ("ring-color" . ,(strip-hex (farg:offset (palette 'bg) 20))) 569 | ("ring-ver-color" . ,(strip-hex (palette 'green))) 570 | ("ring-wrong-color" . ,(strip-hex (palette 'red))) 571 | ("ring-clear-color" . ,(strip-hex (palette 'accent-0))) 572 | ("text-clear-color" . "00000000") 573 | ("text-ver-color" . "00000000") 574 | ("text-wrong-color" . "00000000") 575 | ("separator-color" . "00000000")))))) 576 | (when (and add-keybindings? (get-value 'dwl-guile config)) 577 | (simple-service 578 | 'add-swaylock-dwl-keybindings 579 | home-dwl-guile-service-type 580 | `((set-keys ,lock-key (lambda () (dwl:shcmd ,(file-append swaylock "/bin/swaylock"))))))))) 581 | 582 | (define (get-system-services config) 583 | (list 584 | (service screen-locker-service-type 585 | (screen-locker-configuration 586 | (name "swaylock") 587 | (program (file-append swaylock "/bin/swaylock")) 588 | (using-setuid? #f) 589 | (using-pam? #t))))) 590 | 591 | (feature 592 | (name 'wayland-swaylock) 593 | (home-services-getter get-home-services) 594 | (system-services-getter get-system-services)))) 595 | -------------------------------------------------------------------------------- /engstrand/features/web-browsers.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features web-browsers) 2 | #:use-module (ice-9 ftw) 3 | #:use-module (ice-9 match) 4 | #:use-module (srfi srfi-1) 5 | #:use-module (rde features) 6 | #:use-module (rde features predicates) 7 | #:use-module (guix gexp) 8 | #:use-module (gnu services) 9 | #:use-module (gnu home services) 10 | #:use-module (nongnu packages mozilla) 11 | #:use-module (dwl-guile utils) 12 | #:use-module (dwl-guile home-service) 13 | #:use-module (gnu packages web-browsers) 14 | #:use-module (farg colors) 15 | #:use-module (farg home-service) 16 | #:use-module (engstrand packages browsers) 17 | #:use-module (engstrand home-services qutebrowser) 18 | #:use-module (engstrand utils) 19 | #:export ( 20 | feature-qutebrowser 21 | feature-firefox)) 22 | 23 | (define* (feature-firefox 24 | #:key 25 | (package firefox) 26 | (open-key "S-s-w") 27 | (default-browser? #f)) 28 | "Setup Firefox." 29 | 30 | (ensure-pred string? open-key) 31 | (ensure-pred package? package) 32 | (ensure-pred boolean? default-browser?) 33 | 34 | (define (get-home-services config) 35 | "Return a list of home services required by Firefox." 36 | (make-service-list 37 | (if default-browser? 38 | (simple-service 39 | 'set-firefox-environment-variable 40 | home-environment-variables-service-type 41 | `(("BROWSER" . ,(file-append package "/bin/firefox"))))) 42 | (simple-service 43 | 'add-firefox-home-packages-to-profile 44 | home-profile-service-type 45 | (list package)) 46 | (when (and default-browser? (get-value 'dwl-guile config)) 47 | (simple-service 48 | 'add-firefox-dwl-keybindings 49 | home-dwl-guile-service-type 50 | `((set-keys ,open-key 51 | (lambda () 52 | (dwl:spawn ,(file-append package "/bin/firefox"))))))))) 53 | 54 | (feature 55 | (name 'firefox) 56 | (home-services-getter get-home-services))) 57 | 58 | (define* (feature-qutebrowser 59 | #:key 60 | (package qutebrowser/wayland) 61 | (open-key "S-s-w") 62 | (default-browser? #f)) 63 | "Setup qutebrowser, a keyboard-focused browser with a minimal GUI." 64 | 65 | (ensure-pred package? package) 66 | (ensure-pred string? open-key) 67 | (ensure-pred boolean? default-browser?) 68 | 69 | (lambda (_ palette) 70 | (define (get-home-services config) 71 | "Return a list of home services required by qutebrowser" 72 | (let* ((light? (palette 'light?)) 73 | (text (palette 'fg)) 74 | (cursor text) 75 | (background (palette 'bg)) 76 | (background-offset (palette 'bg-alt)) 77 | (primary (palette 'accent-0)) 78 | (primary-text (palette 'accent-0-text)) 79 | (primary-overlay-text 80 | (farg:make-readable primary primary)) 81 | (disabled-text 82 | (farg:make-readable background-offset background-offset)) 83 | (red (palette 'red)) 84 | (green (palette 'green)) 85 | (blue (palette 'blue)) 86 | (yellow (palette 'yellow)) 87 | (magenta (palette 'magenta)) 88 | (cyan (palette 'cyan)) 89 | (red-text (palette 'red-text)) 90 | (green-text (palette 'green-text)) 91 | (blue-text (palette 'blue-text)) 92 | (yellow-text (palette 'yellow-text)) 93 | (magenta-text (palette 'magenta-text)) 94 | (cyan-text (palette 'cyan-text))) 95 | (list 96 | (service 97 | home-qutebrowser-service-type 98 | (home-qutebrowser-configuration 99 | (package package) 100 | (default-browser? default-browser?) 101 | (properties 102 | `(("auto_save.session" . True) 103 | ("content.blocking.method" . "both") 104 | ("content.blocking.enabled" . True) 105 | ("content.headers.user_agent" 106 | . "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0") 107 | ("tabs.position" . ,"top") 108 | ("tabs.padding" 109 | . ,(string->symbol 110 | "{ \"bottom\": 5, \"top\": 5, \"left\": 5, \"right\": 5}")) 111 | ("tabs.favicons.scale" . 1.0) 112 | ("tabs.indicator.width" . 0) 113 | ("downloads.position" . "bottom") 114 | ("downloads.remove_finished" . ,(* 1000 5)) 115 | ("colors.completion.category.bg" . ,background) 116 | ("colors.completion.category.border.bottom" . ,background) 117 | ("colors.completion.category.border.top" . ,background) 118 | ("colors.completion.category.fg" . ,text) 119 | ("colors.completion.even.bg" . ,background) 120 | ("colors.completion.odd.bg" . ,background) 121 | ("colors.completion.fg" . ,text) 122 | ("colors.completion.item.selected.bg" . ,background-offset) 123 | ("colors.completion.item.selected.border.bottom" . ,background) 124 | ("colors.completion.item.selected.border.top" . ,background) 125 | ("colors.completion.item.selected.fg" . ,text) 126 | ("colors.completion.item.selected.match.fg" . ,primary-text) 127 | ("colors.completion.match.fg" . ,primary-text) 128 | ("colors.completion.scrollbar.bg" . ,background) 129 | ("colors.completion.scrollbar.fg" . ,text) 130 | ("colors.downloads.bar.bg" . ,background) 131 | ("colors.downloads.error.bg" . ,red) 132 | ("colors.downloads.error.fg" . ,red-text) 133 | ("colors.downloads.stop.bg" . ,cyan) 134 | ("colors.downloads.system.bg" . "none") 135 | ("colors.hints.bg" . ,primary) 136 | ("colors.hints.fg" . ,primary-overlay-text) 137 | ("colors.hints.match.fg" . ,blue) 138 | ("colors.keyhint.bg" . ,background) 139 | ("colors.keyhint.fg" . ,text) 140 | ("colors.keyhint.suffix.fg" . ,yellow) 141 | ("colors.messages.error.bg" . ,red) 142 | ("colors.messages.error.border" . ,red) 143 | ("colors.messages.error.fg" . ,red-text) 144 | ("colors.messages.info.bg" . ,blue) 145 | ("colors.messages.info.border" . ,blue) 146 | ("colors.messages.info.fg" . ,blue-text) 147 | ("colors.messages.warning.bg" . ,yellow) 148 | ("colors.messages.warning.border" . ,yellow) 149 | ("colors.messages.warning.fg" . ,yellow-text) 150 | ("colors.prompts.bg" . ,background) 151 | ("colors.prompts.border" . "none") 152 | ("colors.prompts.fg" . ,text) 153 | ("colors.prompts.selected.bg" . ,magenta) 154 | ("colors.statusbar.caret.bg" . ,cyan) 155 | ("colors.statusbar.caret.fg" . ,cyan-text) 156 | ("colors.statusbar.caret.selection.bg" . ,cyan) 157 | ("colors.statusbar.caret.selection.fg" . ,cyan-text) 158 | ("colors.statusbar.command.bg" . ,background) 159 | ("colors.statusbar.command.fg" . ,text) 160 | ("colors.statusbar.command.private.bg" . ,background) 161 | ("colors.statusbar.command.private.fg" . ,text) 162 | ("colors.statusbar.insert.bg" . ,green) 163 | ("colors.statusbar.insert.fg" . ,background) 164 | ("colors.statusbar.normal.bg" . ,background) 165 | ("colors.statusbar.normal.fg" . ,text) 166 | ("colors.statusbar.passthrough.bg" . ,blue) 167 | ("colors.statusbar.passthrough.fg" . ,blue-text) 168 | ("colors.statusbar.private.bg" . ,background) 169 | ("colors.statusbar.private.fg" . ,text) 170 | ("colors.statusbar.progress.bg" . ,text) 171 | ("colors.statusbar.url.error.fg" . ,red) 172 | ("colors.statusbar.url.fg" . ,text) 173 | ("colors.statusbar.url.hover.fg" . ,blue) 174 | ("colors.statusbar.url.success.http.fg" . ,text) 175 | ("colors.statusbar.url.success.https.fg" . ,green) 176 | ("colors.statusbar.url.warn.fg" . ,red) 177 | ("colors.tabs.bar.bg" . ,background-offset) 178 | ("colors.tabs.even.bg" . ,background-offset) 179 | ("colors.tabs.even.fg" . ,disabled-text) 180 | ("colors.tabs.indicator.error" . ,red) 181 | ("colors.tabs.indicator.system" . "none") 182 | ("colors.tabs.odd.bg" . ,background-offset) 183 | ("colors.tabs.odd.fg" . ,disabled-text) 184 | ("colors.tabs.selected.even.bg" . ,background) 185 | ("colors.tabs.selected.even.fg" . ,text) 186 | ("colors.tabs.selected.odd.bg" . ,background) 187 | ("colors.tabs.selected.odd.fg" . ,text) 188 | ("colors.contextmenu.disabled.bg" . ,background-offset) 189 | ("colors.contextmenu.disabled.fg" . ,disabled-text) 190 | ("colors.contextmenu.menu.bg" . ,background) 191 | ("colors.contextmenu.menu.fg" . ,text) 192 | ("colors.contextmenu.selected.bg" . ,primary) 193 | ("colors.contextmenu.selected.fg" . ,primary-overlay-text) 194 | ;; Websites that does not explicitly set the background color 195 | ;; will use this color instead. This is problematic since 196 | ;; they expect the default background to be white, thus resulting 197 | ;; in unreadable text. 198 | ("colors.webpage.bg" . "#ffffff") 199 | ("colors.webpage.preferred_color_scheme" 200 | . ,(if light? "light" "dark")))))) 201 | (when (and default-browser? (get-value 'dwl-guile config)) 202 | (simple-service 203 | 'add-qutebrowser-dwl-keybindings 204 | home-dwl-guile-service-type 205 | `((set-keys ,open-key 206 | (lambda () 207 | (dwl:spawn ,(file-append package "/bin/qutebrowser") 208 | "--qt-arg" "no-sandbox" "true"))))))))) 209 | 210 | (feature 211 | (name 'qutebrowser) 212 | (home-services-getter get-home-services)))) 213 | -------------------------------------------------------------------------------- /engstrand/features/xorg.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand features xorg) 2 | #:use-module (rde features) 3 | #:use-module (rde features predicates) 4 | #:use-module (engstrand utils) 5 | #:use-module (engstrand packages xorg) 6 | #:use-module (engstrand packages utils) 7 | #:use-module (guix gexp) 8 | #:use-module (gnu services) 9 | #:use-module (gnu services xorg) 10 | #:use-module (gnu services sddm) 11 | #:use-module (gnu home services) 12 | #:use-module (gnu packages display-managers) 13 | #:export (feature-xorg-dwm)) 14 | 15 | (define %xorg-libinput-config 16 | " 17 | Section \"InputClass\" 18 | Identifier \"Touchpads\" 19 | Driver \"libinput\" 20 | MatchDevicePath \"/dev/input/event*\" 21 | MatchIsTouchPad \"on\" 22 | Option \"DisableWhileTyping\" \"on\" 23 | Option \"NaturalScrolling\" \"true\" 24 | EndSection 25 | Section \"InputClass\" 26 | Identifier \"Keyboards\" 27 | Driver \"libinput\" 28 | MatchDevicePath \"/dev/input/event*\" 29 | MatchIsKeyboard \"on\" 30 | EndSection 31 | ") 32 | 33 | ;; TODO: This can be a general purpose config for amdgpu. 34 | ;; The backlight option should probably be removed, though. 35 | ;; Consider adding a keyword to feature-xorg-dwm to automatically 36 | ;; add the driver config. 37 | (define %xorg-amdgpu-config 38 | "Section \"Device\" 39 | Identifier \"AMD\" 40 | Driver \"amdgpu\" 41 | Option \"TearFree\" \"true\" 42 | Option \"Backlight\" \"amdgpu_bl0\" 43 | EndSection") 44 | 45 | (define %base-xorg-dwm-system-packages 46 | (list chili-sddm-theme engstrand-dwm)) 47 | 48 | (define %base-xorg-dwm-home-packages 49 | (list engstrand-dmenu engstrand-dsblocks engstrand-st engstrand-utils)) 50 | 51 | ;; TODO: Split into multiple features? 52 | (define* (feature-xorg-dwm 53 | #:key 54 | (sddm-theme "chili") 55 | (extra-config '()) 56 | (base-extra-config (list %xorg-libinput-config))) 57 | "Setup xorg with SDDM (display manager), dwm, dsblocks, dmenu and st." 58 | 59 | (ensure-pred string? sddm-theme) 60 | (ensure-pred list-of-strings? extra-config) 61 | (ensure-pred list-of-strings? base-extra-config) 62 | 63 | (define (get-home-services config) 64 | "Return a list of home-services required by xorg and dwm." 65 | (list 66 | (simple-service 67 | 'add-xorg-dwm-home-packages-to-profile 68 | home-profile-service-type 69 | %base-xorg-dwm-home-packages) 70 | ;; TODO: Consider making this script inline to skip the extra package depenendcy 71 | (simple-service 72 | 'xorg-dwm-bootstrap home-run-on-first-login-service-type 73 | #~(system* #$(file-append engstrand-utils "/bin/bootstrap"))))) 74 | 75 | (define (get-system-services config) 76 | "Return a list of system services required by xorg and dwm." 77 | (require-value 'desktop-services config) 78 | (require-value 'keyboard-layout config) 79 | (list 80 | (simple-service 81 | 'add-xorg-dwm-system-packages-to-profile 82 | profile-service-type 83 | %base-xorg-dwm-system-packages) 84 | (service sddm-service-type 85 | (sddm-configuration 86 | ;; TODO: This does not work? 87 | (theme sddm-theme) 88 | (xorg-configuration 89 | (xorg-configuration 90 | (keyboard-layout (get-value 'keyboard-layout config)) 91 | (extra-config (append extra-config 92 | base-extra-config)))))))) 93 | (feature 94 | (name 'xorg-dwm) 95 | (home-services-getter get-home-services) 96 | (system-services-getter get-system-services))) 97 | -------------------------------------------------------------------------------- /engstrand/files/aliasrc: -------------------------------------------------------------------------------- 1 | alias la='ls -a' 2 | alias ll='ls -l' 3 | alias ls='ls -p --color=auto' 4 | alias grep='grep --color=auto' 5 | alias vim='nvim' 6 | 7 | alias dots='~/engstrand-config/guix-dotfiles/; ls -a' 8 | 9 | alias sysrec='sudo RDE_USER=$USER RDE_TARGET=system guix system reconfigure ~/.config/guix/config.scm' 10 | alias homerec='RDE_USER=$USER RDE_TARGET=home guix home reconfigure ~/.config/guix/config.scm' 11 | 12 | alias gs='git status' 13 | alias gd='git diff' 14 | alias gdc='git diff --cached' 15 | alias ga='git add' 16 | alias gr='git restore' 17 | alias gc='git commit -m' 18 | alias gl='git log --show-signature' 19 | 20 | alias getsha='guix hash --hash=sha256 --format=nix-base32 -rx' 21 | -------------------------------------------------------------------------------- /engstrand/files/bashrc: -------------------------------------------------------------------------------- 1 | # Export 'SHELL' to child processes. Programs such as 'screen' 2 | # honor it and otherwise use /bin/sh. 3 | export SHELL 4 | 5 | # Source the system-wide file. 6 | source /etc/bashrc 7 | 8 | # Source aliases. 9 | [ -f "$HOME/.aliasrc" ] && . "$HOME/.aliasrc" 10 | 11 | if [[ $- != *i* ]] 12 | then 13 | # We are being invoked from a non-interactive shell. If this 14 | # is an SSH session (as in "ssh host command"), source 15 | # /etc/profile so we get PATH and other essential variables. 16 | [[ -n "$SSH_CLIENT" ]] && source /etc/profile 17 | 18 | # Don't do anything else. 19 | return 20 | fi 21 | 22 | export PASTEL_COLOR_MODE=8bit 23 | PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" 24 | 25 | # Infinite history 26 | HISTSIZE= HISTFILESIZE= 27 | 28 | #Allows you to cd into directory merely by typing the directory name. 29 | shopt -s autocd 30 | 31 | # Disable ctrl-s and ctrl-q. 32 | stty -ixon 33 | 34 | PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"' 35 | -------------------------------------------------------------------------------- /engstrand/files/config/nvim/init.vim: -------------------------------------------------------------------------------- 1 | "--------------------------------------- 2 | " Plugins 3 | " -------------------------------------- 4 | if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) 5 | echo "Downloading junegunn/vim-plug to manage plugins..." 6 | silent !mkdir -p ~/.config/nvim/autoload/ 7 | silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim 8 | endif 9 | 10 | call plug#begin(stdpath('data') . '/plugged') 11 | 12 | Plug 'mhinz/vim-startify' 13 | 14 | Plug 'dylanaraps/wal.vim' 15 | Plug 'itchyny/lightline.vim' 16 | Plug 'neoclide/coc.nvim' 17 | Plug 'junegunn/fzf' 18 | Plug 'junegunn/fzf.vim' 19 | 20 | Plug 'alvan/vim-closetag' 21 | Plug 'tpope/vim-surround' 22 | Plug 'tpope/vim-commentary' 23 | Plug 'Raimondi/delimitMate' 24 | Plug 'christoomey/vim-sort-motion' 25 | Plug 'honza/vim-snippets' 26 | Plug 'takac/vim-hardtime' 27 | 28 | " Language specific 29 | Plug 'lervag/vimtex' 30 | Plug 'heavenshell/vim-jsdoc', { 31 | \ 'for': ['javascript', 'javascript.jsx','typescript'], 32 | \ 'do': 'make install' 33 | \} 34 | Plug 'neovimhaskell/haskell-vim' 35 | Plug 'evanleck/vim-svelte', {'branch': 'main'} 36 | Plug 'elixir-editors/vim-elixir' 37 | Plug 'maxmellon/vim-jsx-pretty' 38 | Plug 'leafgarland/typescript-vim' 39 | Plug 'peitalin/vim-jsx-typescript' 40 | 41 | call plug#end() 42 | 43 | 44 | " -------------------------------------- 45 | " Vim config 46 | " -------------------------------------- 47 | colorscheme wal 48 | 49 | set bg=dark 50 | set go=a 51 | set mouse=a 52 | set nohlsearch 53 | set clipboard=unnamedplus 54 | set wildmenu 55 | set nocompatible 56 | set encoding=utf-8 57 | set number relativenumber 58 | set splitbelow splitright 59 | set title 60 | 61 | " No need to show '-- INSERT --' because of lightline 62 | set noshowmode 63 | 64 | set signcolumn=no 65 | set updatetime=300 66 | 67 | set softtabstop=4 68 | set shiftwidth=4 69 | set expandtab 70 | 71 | filetype plugin on 72 | filetype plugin indent on 73 | syntax on 74 | 75 | " -------------------------------------- 76 | " General config 77 | " -------------------------------------- 78 | let mapleader = "," 79 | let b:signcolumn_on=0 80 | let g:tex_flavor='latex' 81 | let g:hardtime_default_on = 1 82 | let g:list_of_normal_keys = ["h", "l", "-", "+", "", "", "", ""] 83 | let g:list_of_visual_keys = ["-", "+", "", "", "", ""] 84 | let g:vimtex_compiler_latexmk_engine='xelatex' 85 | let g:vimtex_compiler_method='latexmk' 86 | let g:vimtex_view_method='zathura' 87 | let g:svelte_preprocessor_tags = [ 88 | \ { 'name': 'ts', 'tag': 'script', 'as': 'typescript' } 89 | \ ] 90 | let g:svelte_preprocessors = ['ts'] 91 | let g:lightline = { 92 | \ 'colorscheme': 'wal', 93 | \ } 94 | let g:lightline.separator = { 95 | \ 'left': '', 'right': '' 96 | \} 97 | let g:lightline.subseparator = { 98 | \ 'left': '|', 'right': '|' 99 | \} 100 | let g:lightline.tabline = { 101 | \ 'left': [ [ 'tabs' ] ], 102 | \ 'right': [ ] } 103 | let g:lightline.tabline_separator = { 104 | \ 'left': '', 'right': '' 105 | \} 106 | let g:lightline.tabline_subseparator = { 107 | \ 'left': '', 'right': '' 108 | \} 109 | 110 | " Open in new tab by default 111 | let g:fzf_action = { 'enter': 'tab split' } 112 | 113 | " -------------------------------------- 114 | " Coc settings 115 | " -------------------------------------- 116 | " use for trigger completion and navigate to the next complete item 117 | function! s:check_back_space() abort 118 | let col = col('.') - 1 119 | return !col || getline('.')[col - 1] =~ '\s' 120 | endfunction 121 | 122 | " Start autocomplete/move down list 123 | inoremap 124 | \ pumvisible() ? "\" : 125 | \ check_back_space() ? "\" : 126 | \ coc#refresh() 127 | 128 | " Move up in autocomplete list 129 | inoremap 130 | \ pumvisible() ? "\" : 131 | \ check_back_space() ? "\" : 132 | \ coc#refresh() 133 | 134 | " GoTo code navigation. 135 | nmap gd (coc-definition) 136 | nmap gy (coc-type-definition) 137 | nmap gi (coc-implementation) 138 | nmap gr (coc-references) 139 | 140 | " Use K to show documentation in preview window. 141 | nnoremap d :call show_documentation() 142 | 143 | function! s:show_documentation() 144 | if (index(['vim','help'], &filetype) >= 0) 145 | execute 'h '.expand('') 146 | else 147 | call CocAction('doHover') 148 | endif 149 | endfunction 150 | 151 | " Expand snippet on enter 152 | inoremap pumvisible() ? coc#_select_confirm() : 153 | \"\u\\=coc#on_enter()\" 154 | 155 | " Use Alt+Tab to move forward in snippet 156 | let g:coc_snippet_next = '' 157 | 158 | 159 | " -------------------------------------- 160 | " Remaps 161 | " -------------------------------------- 162 | nnoremap c "_c 163 | 164 | " JsDoc 165 | nmap (jsdoc) 166 | 167 | " Fuzzy finder 168 | nnoremap o :GFiles 169 | 170 | " Replace all is aliased to S. 171 | nnoremap S :%s//g 172 | 173 | " Replace all occurences of word under cursor 174 | nnoremap s :%s/\<\>//g 175 | 176 | " Shortcut for finding a parenthesis and changing its content from anywhere on a line 177 | nnoremap p %ci( 178 | 179 | " Shortcut for formatting document 180 | nnoremap fi gg=G 181 | 182 | " Compile Haskell file using GHCi 183 | nnoremap hb :!ghci % 184 | 185 | " Toggles the workspace on/off 186 | nnoremap w :ToggleWorkspace 187 | 188 | " Toggle gutter 189 | function! ToggleSignColumn() 190 | if !exists("b:signcolumn_on") || b:signcolumn_on 191 | set signcolumn=no 192 | let b:signcolumn_on=0 193 | else 194 | set signcolumn=auto 195 | let b:signcolumn_on=1 196 | endif 197 | endfunction 198 | nnoremap gs :call ToggleSignColumn() 199 | 200 | " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): 201 | vnoremap "+y 202 | map "+P 203 | 204 | " Disable the arrow keys 205 | noremap 206 | noremap 207 | noremap 208 | noremap 209 | 210 | inoremap 211 | inoremap 212 | inoremap 213 | inoremap 214 | 215 | " -------------------------------------- 216 | " Color fixes 217 | " -------------------------------------- 218 | highlight Normal ctermbg=none 219 | highlight NonText ctermbg=none 220 | 221 | let s:palette = g:lightline#colorscheme#wal#palette 222 | let s:palette.tabline.tabsel = [ [ 'NONE', 'NONE', 'NONE', 'NONE', 'bold'] ] 223 | 224 | " Change the color of comments 225 | hi Comment ctermfg=9 226 | 227 | " Change color of line numbers 228 | hi LineNr ctermfg=1 229 | 230 | " Change color of selected line number 231 | hi CursorLineNr ctermfg=7 232 | 233 | " Change the background color of highlighted matching tags 234 | hi MatchParen ctermbg=2 ctermfg=0 235 | 236 | " Change the colors for the dropdown menu for autocomplete 237 | hi Pmenu ctermbg=0 ctermfg=3 238 | 239 | " Fix the coloring of ; and : in CSS-files 240 | hi CssNoise ctermfg=4 241 | 242 | " This line enables the true color support. 243 | let $NVIM_TUI_ENABLE_TRUE_COLOR=1 244 | 245 | let g:vimtex_compiler_latexmk = { 246 | \ 'options' : [ 247 | \ '-pdf', 248 | \ '-shell-escape', 249 | \ '-verbose', 250 | \ '-file-line-error', 251 | \ '-synctex=1', 252 | \ '-interaction=nonstopmode', 253 | \ ], 254 | \} 255 | 256 | let g:fzf_colors = 257 | \ { 'bg': ['bg', 'Normal'], 258 | \ 'border': ['bg', 'Normal'] } 259 | let g:fzf_layout = { 'down': '50%' } 260 | 261 | " -------------------------------------- 262 | " Autocommands 263 | " -------------------------------------- 264 | command Todo noautocmd vimgrep /TODO\|FIXME/j ** | cw 265 | 266 | " set filetypes as typescriptreact 267 | autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact 268 | 269 | " Automatically deletes all trailing whitespace on save. 270 | autocmd BufWritePre * %s/\s\+$//e 271 | 272 | " Disables automatic commenting on newline: 273 | autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o 274 | 275 | " Automatic line wrapping 276 | autocmd FileType tex setlocal formatoptions+=l tw=80 277 | autocmd FileType markdown setlocal formatoptions+=l tw=80 278 | autocmd FileType text setlocal formatoptions+=l tw=80 279 | 280 | autocmd! FileType fzf 281 | autocmd FileType fzf set laststatus=0 noshowmode noruler 282 | \| autocmd BufLeave set laststatus=2 showmode ruler 283 | 284 | -------------------------------------------------------------------------------- /engstrand/files/inputrc: -------------------------------------------------------------------------------- 1 | $include /etc/inputrc 2 | set editing-mode vi 3 | $if mode=vi 4 | 5 | set show-mode-in-prompt on 6 | set vi-ins-mode-string \1\e[6 q\2 7 | set vi-cmd-mode-string \1\e[2 q\2 8 | 9 | set keymap vi-command 10 | # these are for vi-command mode 11 | Control-l: clear-screen 12 | Control-a: beginning-of-line 13 | 14 | set keymap vi-insert 15 | # these are for vi-insert mode 16 | Control-l: clear-screen 17 | Control-a: beginning-of-line 18 | 19 | $endif 20 | -------------------------------------------------------------------------------- /engstrand/files/nix-channels: -------------------------------------------------------------------------------- 1 | https://nixos.org/channels/nixpkgs-unstable nixpkgs 2 | -------------------------------------------------------------------------------- /engstrand/files/nonguix-signing-key.pub: -------------------------------------------------------------------------------- 1 | (public-key 2 | (ecc 3 | (curve Ed25519) 4 | (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#) 5 | ) 6 | ) 7 | -------------------------------------------------------------------------------- /engstrand/files/qute-rbw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import argparse 5 | import subprocess 6 | 7 | argument_parser = argparse.ArgumentParser() 8 | 9 | group = argument_parser.add_mutually_exclusive_group() 10 | group.add_argument('--username-only', '-e', 11 | action='store_true', help='Only insert username') 12 | group.add_argument('--password-only', '-w', 13 | action='store_true', help='Only insert password') 14 | 15 | def trim(output): 16 | return output.decode("utf-8").replace("\n", "") 17 | 18 | def bemenu_prompt(): 19 | entries = [] 20 | try: 21 | entries = subprocess.check_output([ 22 | "rbw", "list", "--fields", "name", "user" 23 | ]) 24 | except subprocess.CalledProcessError: 25 | # Command failed 26 | return None 27 | 28 | entries = entries.decode("utf-8").split("\n") 29 | entries = list(map(lambda x: x.split("\t"), entries)) 30 | bemenu_options = "\n".join(list(map(lambda x: x[0], entries))) 31 | cmd = f"echo \"{bemenu_options}\" | bemenu" 32 | ps = subprocess.Popen( 33 | cmd, 34 | shell=True, 35 | stdout=subprocess.PIPE, 36 | stderr=subprocess.STDOUT 37 | ) 38 | raw = ps.communicate() 39 | if len(raw) == 0: 40 | return None 41 | 42 | name = trim(raw[0]) 43 | for entry in entries: 44 | if len(entry) < 2: 45 | continue 46 | 47 | if entry[0] == name: 48 | return { 49 | "name": entry[0], 50 | "username": entry[1], 51 | } 52 | return None 53 | 54 | def get_password(data): 55 | try: 56 | return trim(subprocess.check_output(["rbw", "get", data["name"]])) 57 | except subprocess.CalledProcessError: 58 | # Command failed 59 | return None 60 | 61 | def qute_command(command): 62 | with open(os.environ["QUTE_FIFO"], "w") as fifo: 63 | fifo.write(command + "\n") 64 | fifo.flush() 65 | 66 | def fake_key_raw(text): 67 | for character in text: 68 | # Escape all characters by default, space requires special handling 69 | sequence = '" "' if character == ' ' else r'\{}'.format(character) 70 | qute_command('fake-key {}'.format(sequence)) 71 | 72 | if __name__ == "__main__": 73 | args = argument_parser.parse_args() 74 | data = bemenu_prompt() 75 | if data is None: 76 | exit(0) 77 | 78 | password = get_password(data) 79 | 80 | if password is None: 81 | exit(0) 82 | 83 | if args.username_only: 84 | fake_key_raw(data["username"]) 85 | elif args.password_only: 86 | fake_key_raw(password) 87 | else: 88 | fake_key_raw(data["username"]) 89 | qute_command('fake-key ') 90 | fake_key_raw(password) 91 | -------------------------------------------------------------------------------- /engstrand/files/shell-profile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # less/man colors 4 | export LESS_TERMCAP_mb="$(printf '%b' '')"; a="${a%_}" 5 | export LESS_TERMCAP_md="$(printf '%b' '')"; a="${a%_}" 6 | export LESS_TERMCAP_me="$(printf '%b' '')"; a="${a%_}" 7 | export LESS_TERMCAP_so="$(printf '%b' '')"; a="${a%_}" 8 | export LESS_TERMCAP_se="$(printf '%b' '')"; a="${a%_}" 9 | export LESS_TERMCAP_us="$(printf '%b' '')"; a="${a%_}" 10 | export LESS_TERMCAP_ue="$(printf '%b' '')"; a="${a%_}" 11 | 12 | # less: raw control characters, mouse scrolling 13 | export LESS="-R --mouse --wheel-lines=1" 14 | export KEYTIMEOUT=1 15 | 16 | export npm_config_prefix=~/.node_modules 17 | 18 | # dmenupass does not exist atm 19 | # export SUDO_ASKPASS="$HOME/.local/bin/tools/dmenupass" 20 | export FZF_DEFAULT_OPTS="-m --height 25% --layout=reverse --color fg:7,bg:-1,hl:1,fg+:232,bg+:6,hl+:255,info:7,prompt:2,spinner:1,pointer:232,marker:1,border:3" 21 | 22 | # Export guix configuration 23 | export GUIX_PROFILE="$HOME/.guix-profile" 24 | . "$GUIX_PROFILE/etc/profile" 25 | 26 | # Source the nix profile and fonts. 27 | if [ -f /run/current-system/profile/etc/profile.d/nix.sh ]; then 28 | . /run/current-system/profile/etc/profile.d/nix.sh 29 | export FONTCONFIG_PATH="$(guix build fontconfig)/etc/fonts" 30 | 31 | # Some applications require this path instead 32 | # export FONTCONFIG_PATH="$GUIX_PROFILE/share/fonts" 33 | fi 34 | -------------------------------------------------------------------------------- /engstrand/files/zshrc: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | [[ -e "$HOME/.guix-profile/etc/profile" ]] && . $HOME/.guix-profile/etc/profile 4 | [[ -e "$HOME/.guix-home/profile/etc/profile" ]] && . $HOME/.guix-home/profile/etc/profile 5 | export PATH=/run/setuid-programs:$PATH 6 | 7 | zmodload zsh/complist 8 | 9 | setopt autocd 10 | setopt interactive_comments 11 | setopt no_sharehistory 12 | unsetopt share_history 13 | setopt histignorespace 14 | 15 | # Disable ctrl-s to freeze terminal. 16 | stty stop undef 17 | 18 | autoload -Uz compinit 19 | autoload edit-command-line 20 | autoload -U colors && colors 21 | 22 | # Source aliases. 23 | [ -f "$HOME/.aliasrc" ] && . "$HOME/.aliasrc" 24 | 25 | HISTSIZE=5000 26 | SAVEHIST=$HISTSIZE 27 | HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/.zhistory 28 | 29 | # Set autosuggestions highlight 30 | ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=4" 31 | 32 | for dump in ${ZDOTDIR}/.zcompdump(N.mh+24); do 33 | compinit 34 | done 35 | 36 | compinit -C 37 | 38 | # Prompt 39 | PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " 40 | 41 | zstyle ':completion:*' menu select 42 | zstyle ':completion:*' insert-tab false 43 | zstyle ':completion:*' matcher-list '' \ 44 | 'm:{a-z\-}={A-Z\_}' \ 45 | 'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \ 46 | 'r:|?=** m:{a-z\-}={A-Z\_}' 47 | zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,args -w -" 48 | 49 | # Colored completion 50 | hash dircolors 2> /dev/null && eval $(dircolors --sh) && \ 51 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 52 | 53 | # Include hidden files. 54 | _comp_options+=(globdots) 55 | 56 | # Use vim keys in tab complete menu: 57 | bindkey -M menuselect 'h' vi-backward-char 58 | bindkey -M menuselect 'k' vi-up-line-or-history 59 | bindkey -M menuselect 'l' vi-forward-char 60 | bindkey -M menuselect 'j' vi-down-line-or-history 61 | bindkey -v 62 | bindkey -v '^?' backward-delete-char 63 | bindkey "^[[1;5C" forward-word 64 | bindkey "^[[1;5D" backward-word 65 | bindkey '^e' edit-command-line 66 | 67 | # Add support for OSC 7 escape sequence. 68 | # This is used to spawn new terminals with the same working directory in foot. 69 | function _urlencode() { 70 | local length="${#1}" 71 | for (( i = 0; i < length; i++ )); do 72 | local c="${1:$i:1}" 73 | case $c in 74 | %) printf '%%%02X' "'$c" ;; 75 | *) printf "%s" "$c" ;; 76 | esac 77 | done 78 | } 79 | 80 | function osc7_cwd() { 81 | printf '\e]7;file://%s%s\e\\' "$HOSTNAME" "$(_urlencode "$PWD")" 82 | } 83 | 84 | autoload -Uz add-zsh-hook 85 | add-zsh-hook -Uz chpwd osc7_cwd 86 | 87 | # Change cursor shape for different vi modes. 88 | function zle-keymap-select() { 89 | case $KEYMAP in 90 | # block 91 | vicmd) echo -ne '\e[1 q';; 92 | 93 | # beam 94 | viins|main) echo -ne '\e[5 q';; 95 | esac 96 | } 97 | 98 | zle -N zle-keymap-select 99 | zle -N edit-command-line 100 | 101 | # Use beam shape cursor on startup. 102 | echo -ne '\e[5 q' 103 | 104 | # Display current directory in title bar 105 | precmd() { echo -ne "\033]0;${PWD}\007" } 106 | -------------------------------------------------------------------------------- /engstrand/home-services/qutebrowser.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand home-services qutebrowser) 2 | #:use-module (gnu home services) 3 | #:use-module (gnu home services xdg) 4 | #:use-module (gnu home-services-utils) 5 | #:use-module (gnu services configuration) 6 | #:use-module (gnu packages web-browsers) 7 | #:use-module (guix packages) 8 | #:use-module (guix gexp) 9 | #:use-module (guix diagnostics) 10 | #:use-module (rde features predicates) 11 | #:use-module (engstrand serializers qutebrowser) 12 | #:use-module (ice-9 match) 13 | #:use-module (srfi srfi-1) 14 | #:export (home-qutebrowser-service-type 15 | home-qutebrowser-configuration 16 | home-qutebrowser-configuration? 17 | home-qutebrowser-configuration-package 18 | home-qutebrowser-configuration-properties 19 | home-qutebrowser-configuration-bindings 20 | home-qutebrowser-configuration-userscripts 21 | home-qutebrowser-configuration-reload-config-on-change? 22 | home-qutebrowser-configuration-default-browser? 23 | 24 | home-qutebrowser-extension 25 | home-qutebrowser-extension? 26 | home-qutebrowser-extension-properties 27 | home-qutebrowser-extension-bindings 28 | home-qutebrowser-extension-userscripts)) 29 | 30 | (define-configuration home-qutebrowser-configuration 31 | (package 32 | (package qutebrowser) 33 | "Which qutebrowser package to use.") 34 | (properties 35 | (alist '()) 36 | "Properties to set for qutebrowser. The contents will be 37 | serialized into a python file. Key bindings should be placed in the 38 | @code{bindings} field, not here.") 39 | (bindings 40 | (alist '()) 41 | "Additional keybindings to add to qutebrowser.") 42 | (userscripts 43 | (alist '()) 44 | "List of additional userscripts to install. Each userscript will 45 | be installed into $XDG_CONFIG_HOME/qutebrowser/userscripts/, and 46 | the appropriate execution permissions will be set. 47 | 48 | The alist should contain entries with two values, the first being the 49 | name of the userscript, and the second a file-like gexp.") 50 | (reload-config-on-change? 51 | (boolean #t) 52 | "If the config should be automatically reloaded in any running 53 | qutebrowser instances after running a home reconfigure.") 54 | (default-browser? 55 | (boolean #f) 56 | "If qutebrowser should be used as the default web browser.") 57 | (no-serialization)) 58 | 59 | (define-configuration home-qutebrowser-extension 60 | (properties 61 | (alist '()) 62 | "Properties to set for qutebrowser. The contents will be 63 | serialized into a python file. Key bindings should be placed in the 64 | @code{bindings} field, not here.") 65 | (bindings 66 | (alist '()) 67 | "Additional keybindings to add to qutebrowser.") 68 | (userscripts 69 | (alist '()) 70 | "List of additional userscripts to install. Each userscript will 71 | be installed into $XDG_CONFIG_HOME/qutebrowser/userscripts/, and 72 | the appropriate execution permissions will be set. 73 | 74 | The alist should contain entries with two values, the first being the 75 | name of the userscript, and the second a file-like gexp.") 76 | (no-serialization)) 77 | 78 | (define (home-qutebrowser-profile-service config) 79 | (list (home-qutebrowser-configuration-package config))) 80 | 81 | (define (home-qutebrowser-environment-variables-service config) 82 | (if (home-qutebrowser-configuration-default-browser? config) 83 | `(("BROWSER" . ,(file-append (home-qutebrowser-configuration-package config) 84 | "/bin/qutebrowser"))) 85 | '())) 86 | 87 | (define (home-qutebrowser-xdg-mime-applications-service config) 88 | (home-xdg-mime-applications-configuration 89 | (default 90 | '((x-scheme-handler/http . org.qutebrowser.qutebrowser.desktop) 91 | (x-scheme-handler/https . org.qutebrowser.qutebrowser.desktop) 92 | (x-scheme-handler/about . org.qutebrowser.qutebrowser.desktop) 93 | (text/html . org.qutebrowser.qutebrowser.desktop))))) 94 | 95 | (define (home-qutebrowser-xdg-configuration-files-service config) 96 | `(("qutebrowser/config.py" 97 | ,(mixed-text-file 98 | "qutebrowser-config.py" 99 | (serialize-qutebrowser-config (home-qutebrowser-configuration-properties config) 100 | (home-qutebrowser-configuration-bindings config)))) 101 | ,@(map (lambda (script) 102 | `(,(string-append "qutebrowser/userscripts/" (car script)) 103 | ,(computed-file 104 | (car script) 105 | (with-imported-modules 106 | '((guix build utils)) 107 | #~(begin 108 | (use-modules (guix build utils)) 109 | (copy-file #$(cdr script) #$output) 110 | (chmod #$output #o555)))))) 111 | (home-qutebrowser-configuration-userscripts config)))) 112 | 113 | (define (home-qutebrowser-on-change-service config) 114 | (let ((pkg (home-qutebrowser-configuration-package config))) 115 | (if (home-qutebrowser-configuration-reload-config-on-change? config) 116 | `(("files/.config/qutebrowser/config.py" 117 | ;; TODO: This one sometimes reloads qutebrowser even though it shouldnt 118 | ,#~(begin 119 | (use-modules (ice-9 popen)) 120 | (display "Reloading qutebrowser config...\n") 121 | (let* ((dir (getenv "XDG_RUNTIME_DIR")) 122 | (qutefiles (scandir (string-append dir "/qutebrowser"))) 123 | (files (if qutefiles (length qutefiles) 0))) 124 | (when (> files 2) ; FIFO file is available, instance is running 125 | (system* #$(file-append pkg "/bin/qutebrowser") 126 | ":config-source" 127 | ;; Only output potential errors 128 | "-l=critical")))))) 129 | '()))) 130 | 131 | (define (home-qutebrowser-extensions original-config extensions) 132 | (let ((extensions (reverse extensions))) 133 | (home-qutebrowser-configuration 134 | (inherit original-config) 135 | (properties 136 | (append (home-qutebrowser-configuration-properties original-config) 137 | (append-map home-qutebrowser-extension-properties extensions))) 138 | (bindings 139 | (append (home-qutebrowser-configuration-bindings original-config) 140 | (append-map home-qutebrowser-extension-bindings extensions))) 141 | (userscripts 142 | (append (home-qutebrowser-configuration-userscripts original-config) 143 | (append-map home-qutebrowser-extension-userscripts extensions)))))) 144 | 145 | (define home-qutebrowser-service-type 146 | (service-type 147 | (name 'home-qutebrowser) 148 | (extensions 149 | (list 150 | (service-extension 151 | home-profile-service-type 152 | home-qutebrowser-profile-service) 153 | (service-extension 154 | home-environment-variables-service-type 155 | home-qutebrowser-environment-variables-service) 156 | (service-extension 157 | home-xdg-mime-applications-service-type 158 | home-qutebrowser-xdg-mime-applications-service) 159 | (service-extension 160 | home-xdg-configuration-files-service-type 161 | home-qutebrowser-xdg-configuration-files-service) 162 | (service-extension 163 | home-run-on-change-service-type 164 | home-qutebrowser-on-change-service))) 165 | (compose identity) 166 | (extend home-qutebrowser-extensions) 167 | (default-value (home-qutebrowser-configuration)) 168 | (description "Configure and install qutebrowser"))) 169 | -------------------------------------------------------------------------------- /engstrand/installer.scm: -------------------------------------------------------------------------------- 1 | ;;; Copyright © 2019 Alex Griffin 2 | ;;; Copyright © 2019 Pierre Neidhardt 3 | ;;; Copyright © 2019 David Wilson 4 | ;;; 5 | ;;; This program is free software: you can redistribute it and/or modify 6 | ;;; it under the terms of the GNU General Public License as published by 7 | ;;; the Free Software Foundation, either version 3 of the License, or 8 | ;;; (at your option) any later version. 9 | ;;; 10 | ;;; This program is distributed in the hope that it will be useful, 11 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;;; GNU General Public License for more details. 14 | ;;; 15 | ;;; You should have received a copy of the GNU General Public License 16 | ;;; along with this program. If not, see . 17 | 18 | ;; Based on https://github.com/systemcrafters/guix-install. 19 | ;; 20 | ;; Generate a bootable image (e.g. for USB sticks, etc.) with: 21 | ;; $ guix system image -t iso9660 installer.scm 22 | 23 | (define-module (engstrand installer) 24 | #:use-module (gnu) ;; guix-service-type 25 | #:use-module (gnu services) 26 | #:use-module (gnu services base) 27 | #:use-module (gnu system) 28 | #:use-module (gnu system install) 29 | #:use-module (gnu packages version-control) 30 | #:use-module (gnu packages vim) 31 | #:use-module (gnu packages curl) 32 | #:use-module (gnu packages emacs) 33 | #:use-module (gnu packages linux) 34 | #:use-module (gnu packages mtools) 35 | #:use-module (gnu packages package-management) 36 | #:use-module (nongnu packages linux) 37 | #:use-module (guix gexp) 38 | #:use-module (guix packages) 39 | #:use-module (engstrand systems) 40 | ;; #:use-module (engstrand installer program) 41 | #:export (installation-os-nonfree)) 42 | 43 | (define installation-os-nonfree 44 | (operating-system 45 | (inherit installation-os) 46 | (kernel linux) 47 | (firmware (list linux-firmware)) 48 | 49 | ;; Using vim or Emacs without Caps mapped to Escape is absolute hell. 50 | (keyboard-layout %engstrand-keyboard-layout) 51 | 52 | ;; Add the 'net.ifnames' argument to prevent network interfaces 53 | ;; from having really long names. This can cause an issue with 54 | ;; wpa_supplicant when you try to connect to a wifi network. 55 | (kernel-arguments '("quiet" "modprobe.blacklist=radeon" "net.ifnames=0")) 56 | 57 | (services 58 | (append 59 | (list 60 | (simple-service 61 | 'channel-file 62 | etc-service-type 63 | (list 64 | ;; Include the channel file so that it can be used during installation 65 | `("channels.scm" ,(local-file "channels.scm")) 66 | ;; Include entire repo since it contains everything we need. 67 | ;; If reinstalling, the previous system defintion can simply 68 | ;; by updated with the new file system. 69 | `("guix-dotfiles" ,(local-file "../../guix-dotfiles" #:recursive? #t))))) 70 | (modify-services 71 | ;; Use nonguix substitutes. 72 | (operating-system-user-services installation-os) 73 | ;; (kmscon-service-type config => (kmscon-configuration 74 | ;; (inherit config) 75 | ;; (login-program (engstrand-installer-program)))) 76 | (guix-service-type config => (guix-configuration 77 | (inherit config) 78 | (substitute-urls 79 | (append 80 | (list "https://substitutes.nonguix.org") 81 | %default-substitute-urls)) 82 | (authorized-keys 83 | (append 84 | (list (local-file "./files/nonguix-signing-key.pub")) 85 | %default-authorized-guix-keys))))))) 86 | 87 | ;; Add some extra packages useful for the installation process 88 | (packages 89 | (append (list git curl stow vim emacs-no-x-toolkit) 90 | (operating-system-packages installation-os))))) 91 | 92 | installation-os-nonfree 93 | -------------------------------------------------------------------------------- /engstrand/packages/browsers.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages browsers) 2 | #:use-module (guix gexp) 3 | #:use-module (guix utils) 4 | #:use-module (guix download) 5 | #:use-module (guix packages) 6 | #:use-module (gnu packages qt) 7 | #:use-module (gnu packages web-browsers)) 8 | 9 | ;; Until https://issues.guix.gnu.org/63558 is merged. 10 | (define-public qutebrowser/wayland 11 | (package/inherit 12 | qutebrowser 13 | (name "qutebrowser-wayland") 14 | (inputs 15 | (modify-inputs (package-inputs qutebrowser) 16 | (prepend qtwayland))) 17 | (arguments 18 | (substitute-keyword-arguments 19 | (package-arguments qutebrowser) 20 | ((#:phases phases) 21 | #~(modify-phases 22 | #$phases 23 | (add-after 'wrap-qt-process-path 'wrap-qtwebengine-path 24 | (lambda* (#:key inputs outputs #:allow-other-keys) 25 | (wrap-program (search-input-file outputs "bin/qutebrowser") 26 | `("QT_PLUGIN_PATH" = 27 | (,(string-append (assoc-ref inputs "qtwayland") 28 | "/lib/qt6/plugins/")))))))))))) 29 | -------------------------------------------------------------------------------- /engstrand/packages/documents.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages documents) 2 | #:use-module (guix gexp) 3 | #:use-module (guix packages) 4 | #:use-module (guix git-download) 5 | #:use-module (guix build-system qt) 6 | #:use-module ((guix licenses) #:prefix license:) 7 | #:use-module (gnu packages qt) 8 | #:use-module (gnu packages web) 9 | #:use-module (gnu packages gtk) 10 | #:use-module (gnu packages pdf) 11 | #:use-module (gnu packages image) 12 | #:use-module (gnu packages fontutils) 13 | #:use-module (gnu packages javascript)) 14 | 15 | (define-public sioyek 16 | (package 17 | (name "sioyek") 18 | (version "2.0.0") 19 | (source 20 | (origin 21 | (method git-fetch) 22 | (uri (git-reference 23 | (url "https://github.com/ahrm/sioyek") 24 | (commit (string-append "v" version)))) 25 | (file-name (git-file-name name version)) 26 | (sha256 27 | (base32 "1vmmp2s032ygh1byz77pg9aljmp8hx745fr7mmz11831f96mlmhq")))) 28 | (inputs 29 | (list gumbo-parser 30 | freetype 31 | harfbuzz 32 | jbig2dec 33 | mujs 34 | mupdf 35 | openjpeg 36 | libjpeg-turbo 37 | qt3d-5 38 | qtbase-5)) 39 | (build-system qt-build-system) 40 | (arguments 41 | (list 42 | #:tests? #f 43 | #:phases 44 | #~(modify-phases 45 | %standard-phases 46 | (replace 'configure 47 | (lambda* (#:key outputs #:allow-other-keys) 48 | (let ((out (assoc-ref outputs "out"))) 49 | (invoke "qmake" (string-append "PREFIX=" out))))) 50 | (add-after 'unpack 'patch-source-files 51 | (lambda* (#:key inputs outputs #:allow-other-keys) 52 | (let* ((out (assoc-ref outputs "out")) 53 | (share (string-append out "/share/sioyek")) 54 | (etc (string-append out "/etc/sioyek"))) 55 | (substitute* "pdf_viewer/main.cpp" 56 | (("/usr/share/sioyek") share) 57 | (("/etc/sioyek") etc)) 58 | (substitute* "pdf_viewer_build_config.pro" 59 | (("-lmupdf-third ") "")) 60 | #t)))))) 61 | (home-page "https://sioyek.info") 62 | (synopsis "A PDF viewer designed for research papers and technical books") 63 | (description "Sioyek is a PDF viewer with a focus on technical books and research papers.") 64 | (license license:gpl3))) 65 | 66 | (define-public sioyek/wayland 67 | (package 68 | (inherit sioyek) 69 | (name "sioyek-wayland") 70 | (inputs 71 | (modify-inputs (package-inputs sioyek) 72 | (append qtwayland-5))))) 73 | -------------------------------------------------------------------------------- /engstrand/packages/linux.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages linux) 2 | #:use-module (gnu packages tls) 3 | #:use-module (guix gexp) 4 | #:use-module (guix utils) 5 | #:use-module (guix packages) 6 | #:use-module (guix download) 7 | #:use-module (guix git-download) 8 | #:use-module (guix build-system trivial) 9 | #:use-module (guix build-system linux-module) 10 | #:use-module ((guix licenses) #:prefix license:)) 11 | 12 | (define-public (tuxedo-keyboard-module kernel) 13 | (package 14 | (name "tuxedo-keyboard-module") 15 | (version "3.2.1") 16 | (source (origin 17 | (method git-fetch) 18 | (uri 19 | (git-reference 20 | (url "https://github.com/tuxedocomputers/tuxedo-keyboard.git") 21 | (commit (string-append "v" version)))) 22 | (file-name (git-file-name name version)) 23 | (sha256 24 | (base32 25 | "13fncirqcci46zxmsrawsxpazip5k46i849dwkhkqlg0mg4vxxw5")))) 26 | (build-system linux-module-build-system) 27 | (arguments 28 | `(#:tests? #f 29 | #:linux ,kernel)) 30 | (home-page "https://github.com/tuxedocomputers/tuxedo-keyboard") 31 | (synopsis "Tuxedo computers kernel module for keyboard 32 | backlighting") 33 | (description "Tuxedo computer kernel module for keyboard 34 | backlighting.") 35 | (license license:gpl2))) 36 | -------------------------------------------------------------------------------- /engstrand/packages/python.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages python) 2 | #:use-module (gnu packages libffi) 3 | #:use-module (gnu packages python-xyz) 4 | #:use-module (guix packages) 5 | #:use-module (guix download) 6 | #:use-module (guix build-system python) 7 | #:use-module ((guix licenses) #:prefix license:)) 8 | 9 | (define-public 10 | python-pywalfox 11 | (package 12 | (name "python-pywalfox") 13 | (version "2.7.3") 14 | (source 15 | (origin 16 | (method url-fetch) 17 | (uri (pypi-uri "pywalfox" version)) 18 | (sha256 19 | (base32 20 | "1gkxcnysygvcpfhinaxaa6lf7b7194x7vi928i0qpdw962ck1zsi")))) 21 | (build-system python-build-system) 22 | (home-page 23 | "https://github.com/frewacom/pywalfox") 24 | (synopsis 25 | "Native app used alongside the Pywalfox browser extension") 26 | (description 27 | "Native app used alongside the Pywalfox browser extension") 28 | (license #f))) 29 | 30 | (define-public 31 | python-soundfile 32 | (package 33 | (name "python-soundfile") 34 | (version "0.10.3.post1") 35 | (source 36 | (origin 37 | (method url-fetch) 38 | (uri (pypi-uri "SoundFile" version)) 39 | (sha256 40 | (base32 "0yqhrfz7xkvqrwdxdx2ydy4h467sk7z3gf984y1x2cq7cm1gy329")))) 41 | (build-system python-build-system) 42 | (propagated-inputs (list python-cffi)) 43 | (home-page "https://github.com/bastibe/PySoundFile") 44 | (synopsis "An audio library based on libsndfile, CFFI and NumPy") 45 | (description "An audio library based on libsndfile, CFFI and NumPy") 46 | (license #f))) 47 | 48 | (define-public 49 | python-sounddevice 50 | (package 51 | (name "python-sounddevice") 52 | (version "0.4.3") 53 | (source 54 | (origin 55 | (method url-fetch) 56 | (uri (pypi-uri "sounddevice" version)) 57 | (sha256 58 | (base32 "083crfkrx0y9gqybqcixzhrp7swqjr78nrmz9r6aqpxncxs7lrpi")))) 59 | (build-system python-build-system) 60 | (propagated-inputs (list python-cffi)) 61 | (home-page "http://python-sounddevice.readthedocs.io/") 62 | (synopsis "Play and Record Sound with Python") 63 | (description "Play and Record Sound with Python") 64 | (license license:expat))) 65 | 66 | (define-public 67 | python-tikzplotlib 68 | (package 69 | (name "python-tikzplotlib") 70 | (version "0.9.15") 71 | (source 72 | (origin 73 | (method url-fetch) 74 | (uri (pypi-uri "tikzplotlib" version)) 75 | (sha256 76 | (base32 "0f6cwnb51fnds2x9cycjk5gw5xnp0g3bdv8439xij8y0hijfwjcl")))) 77 | (build-system python-build-system) 78 | (propagated-inputs 79 | (list python-importlib-metadata python-matplotlib python-numpy 80 | python-pillow)) 81 | (home-page "https://github.com/nschloe/tikzplotlib") 82 | (synopsis "Convert matplotlib figures into TikZ/PGFPlots") 83 | (description "Convert matplotlib figures into TikZ/PGFPlots") 84 | (license license:expat))) 85 | -------------------------------------------------------------------------------- /engstrand/packages/utils.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages utils) 2 | #:use-module (guix utils) 3 | #:use-module (guix packages) 4 | #:use-module (guix download) 5 | #:use-module (guix git-download) 6 | #:use-module (guix build-system copy) 7 | #:use-module (guix build-system cargo) 8 | #:use-module ((guix licenses) #:prefix license:) 9 | #:use-module (gnu packages xorg) 10 | #:use-module (gnu packages perl) 11 | #:use-module (gnu packages crates-io) 12 | #:use-module (gnu packages xdisorg)) 13 | 14 | (define-public rust-sha2-0.9.9 15 | (package 16 | (name "rust-sha2") 17 | (version "0.9.9") 18 | (source (origin 19 | (method url-fetch) 20 | (uri (crate-uri "sha2" version)) 21 | (file-name (string-append name "-" version ".tar.gz")) 22 | (sha256 23 | (base32 24 | "006q2f0ar26xcjxqz8zsncfgz86zqa5dkwlwv03rhx1rpzhs2n2d")))) 25 | (build-system cargo-build-system) 26 | (arguments 27 | `(#:cargo-inputs (("rust-block-buffer" ,rust-block-buffer-0.9) 28 | ("rust-cfg-if" ,rust-cfg-if-1) 29 | ("rust-cpufeatures" ,rust-cpufeatures-0.2) 30 | ("rust-digest" ,rust-digest-0.9) 31 | ("rust-opaque-debug" ,rust-opaque-debug-0.3) 32 | ("rust-sha2-asm" ,rust-sha2-asm-0.6)) 33 | #:cargo-development-inputs (("rust-digest" ,rust-digest-0.9) 34 | ("rust-hex-literal" ,rust-hex-literal-0.2)))) 35 | (home-page "https://github.com/RustCrypto/hashes") 36 | (synopsis "Pure Rust implementation of the SHA-2 hash function family 37 | including SHA-224, SHA-256, SHA-384, and SHA-512. 38 | ") 39 | (description 40 | "Pure Rust implementation of the SHA-2 hash function family including SHA-224, 41 | SHA-256, SHA-384, and SHA-512.") 42 | (license (list license:expat license:asl2.0)))) 43 | 44 | (define-public rust-block-padding-0.2.1 45 | (package 46 | (name "rust-block-padding") 47 | (version "0.2.1") 48 | (source (origin 49 | (method url-fetch) 50 | (uri (crate-uri "block-padding" version)) 51 | (file-name (string-append name "-" version ".tar.gz")) 52 | (sha256 53 | (base32 54 | "1bickjlmfw9iv63dp781n589rfybw879mik1va59833m1hvnqscd")))) 55 | (build-system cargo-build-system) 56 | (home-page "https://github.com/RustCrypto/utils") 57 | (synopsis "Padding and unpadding of messages divided into blocks.") 58 | (description "Padding and unpadding of messages divided into blocks.") 59 | (license (list license:expat license:asl2.0)))) 60 | 61 | (define-public rbw-latest 62 | (package 63 | (name "rbw") 64 | (version "1.4.2") 65 | (source 66 | (origin 67 | (method url-fetch) 68 | (uri (crate-uri "rbw" version)) 69 | (file-name (string-append name "-" version ".tar.gz")) 70 | (sha256 71 | (base32 "0mzmzr06rx9yc4ll99l6lbz48ix57awfrgq4q1p26a17rd7x5qxw")))) 72 | (build-system cargo-build-system) 73 | (arguments 74 | `(#:phases 75 | (modify-phases %standard-phases 76 | (add-after 'configure 'relax-requirements 77 | (lambda _ 78 | (substitute* 79 | "guix-vendor/rust-password-hash-0.3.2.tar.gz/Cargo.toml" 80 | (("version = \">=1, <1.1.0\"") "version = \">=1\"")) 81 | (substitute* 82 | "guix-vendor/rust-rsa-0.5.0.tar.gz/Cargo.toml" 83 | (("version = \">=1, <1.5\"") "version = \"^1\"")) 84 | (substitute* 85 | "Cargo.toml" 86 | (("version = \"1.4\"") "version = \"^1\""))))) 87 | #:cargo-inputs 88 | (("rust-aes" ,rust-aes-0.7) 89 | ("rust-anyhow" ,rust-anyhow-1) 90 | ("rust-arrayvec" ,rust-arrayvec-0.7) 91 | ("rust-async-trait" ,rust-async-trait-0.1) 92 | ("rust-base32" ,rust-base32-0.4) 93 | ("rust-base64" ,rust-base64-0.13) 94 | ("rust-block-modes" ,rust-block-modes-0.8) 95 | ("rust-block-padding" ,rust-block-padding-0.2.1) 96 | ("rust-daemonize" ,rust-daemonize-0.4) 97 | ("rust-directories" ,rust-directories-4) 98 | ("rust-env-logger" ,rust-env-logger-0.9) 99 | ("rust-hkdf" ,rust-hkdf-0.11) 100 | ("rust-hmac" ,rust-hmac-0.11) 101 | ("rust-humantime" ,rust-humantime-2) 102 | ("rust-libc" ,rust-libc-0.2) 103 | ("rust-log" ,rust-log-0.4) 104 | ("rust-nix" ,rust-nix-0.23) 105 | ("rust-paw" ,rust-paw-1) 106 | ("rust-pbkdf2" ,rust-pbkdf2-0.9) 107 | ("rust-percent-encoding" ,rust-percent-encoding-2) 108 | ("rust-rand" ,rust-rand-0.8) 109 | ("rust-region" ,rust-region-3) 110 | ("rust-reqwest" ,rust-reqwest-0.11) 111 | ("rust-rsa" ,rust-rsa-0.5) 112 | ("rust-serde" ,rust-serde-1) 113 | ("rust-serde-json" ,rust-serde-json-1) 114 | ("rust-serde-path-to-error" ,rust-serde-path-to-error-0.1) 115 | ("rust-serde-repr" ,rust-serde-repr-0.1) 116 | ("rust-sha-1" ,rust-sha-1-0.9) 117 | ("rust-sha2" ,rust-sha2-0.9.9) 118 | ("rust-structopt" ,rust-structopt-0.3) 119 | ("rust-tempfile" ,rust-tempfile-3) 120 | ("rust-term-size" ,rust-term-size-0.3) 121 | ("rust-textwrap" ,rust-textwrap-0.11) 122 | ("rust-thiserror" ,rust-thiserror-1) 123 | ("rust-tokio" ,rust-tokio-1) 124 | ("rust-totp-lite" ,rust-totp-lite-1) 125 | ("rust-url" ,rust-url-2) 126 | ("rust-uuid" ,rust-uuid-0.8) 127 | ("rust-zeroize" ,rust-zeroize-1)))) 128 | (native-inputs 129 | (list perl)) 130 | (home-page "https://git.tozt.net/rbw") 131 | (synopsis "Unofficial Bitwarden CLI") 132 | (description "This package is an unofficial command line client for 133 | Bitwarden. Although Bitwarden ships with a command line client, but 134 | it's limited by being stateless, which makes it very difficult to use. This 135 | client avoids that problem by maintaining a background process which is able 136 | to hold the keys in memory, similar to the way that ssh-agent or gpg-agent 137 | work. This allows the client to be used in a much simpler way, with the 138 | background agent taking care of maintaining the necessary state.") 139 | (license license:expat))) 140 | 141 | (define-public engstrand-utils 142 | (package 143 | (name "engstrand-utils") 144 | (version "1.0.0") 145 | (description "Engstrand utilities and scripts") 146 | (source 147 | (origin 148 | (method git-fetch) 149 | (uri (git-reference 150 | (url "https://github.com/engstrand-config/utils.git") 151 | (commit "066f7f0034af3e908b45ac92124f10f78f1d1417"))) 152 | (sha256 153 | (base32 "14xg4zw90axcqdwrl5l3ixk044f4rsvnk8rd8vgl6mmi0iviq28z")))) 154 | (build-system copy-build-system) 155 | (propagated-inputs 156 | (list xcape 157 | setxkbmap 158 | xprop 159 | xset 160 | xclip 161 | xdotool 162 | maim 163 | xwallpaper 164 | xrdb)) 165 | (home-page "https://github.com/engstrand-config/utils") 166 | (synopsis "Engstrand utilities and scripts") 167 | (license license:gpl3))) 168 | -------------------------------------------------------------------------------- /engstrand/packages/wayland.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages wayland) 2 | #:use-module (guix packages) 3 | #:use-module (guix git-download) 4 | #:use-module (guix build-system meson) 5 | #:use-module (gnu packages) 6 | #:use-module (gnu packages wm) 7 | #:use-module (gnu packages gcc) 8 | #:use-module (gnu packages man) 9 | #:use-module (gnu packages image) 10 | #:use-module (gnu packages xdisorg) 11 | #:use-module (gnu packages terminals) 12 | #:use-module (gnu packages pkg-config) 13 | #:use-module (gnu packages build-tools) 14 | #:use-module (gnu packages freedesktop) 15 | #:use-module (gnu packages datastructures) 16 | #:use-module ((guix licenses) #:prefix license:)) 17 | 18 | (define-public wbg 19 | (package 20 | (name "wbg") 21 | (version "1.0.2") 22 | (source 23 | (origin 24 | (method git-fetch) 25 | (uri (git-reference 26 | (url "https://codeberg.org/dnkl/wbg") 27 | (commit version))) 28 | (file-name (git-file-name name version)) 29 | (sha256 30 | (base32 31 | "182cyp97lxwxl5r6f25irvm62ii0j1knmpwlpwa1w00j2xchx89w")))) 32 | (build-system meson-build-system) 33 | (arguments 34 | `(#:build-type "release")) 35 | (native-inputs 36 | (list pkg-config wayland-protocols gcc-10 tllist)) 37 | (inputs 38 | (list wlroots wayland pixman libpng libjpeg-turbo)) 39 | (license license:expat) 40 | (home-page "https://codeberg.org/dnkl/wbg") 41 | (synopsis "Super simple wallpaper application for Wayland compositors") 42 | (description "Super simple wallpaper application for 43 | Wayland compositors implementing the layer-shell protocol."))) 44 | -------------------------------------------------------------------------------- /engstrand/packages/xorg.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand packages xorg) 2 | #:use-module (guix utils) 3 | #:use-module (guix packages) 4 | #:use-module (guix download) 5 | #:use-module (guix git-download) 6 | #:use-module (guix build-system gnu) 7 | #:use-module (guix build-system glib-or-gtk) 8 | #:use-module (gnu packages) 9 | #:use-module (gnu packages gtk) 10 | #:use-module (gnu packages glib) 11 | #:use-module (gnu packages fonts) 12 | #:use-module (gnu packages fontutils) 13 | #:use-module (gnu packages mpd) 14 | #:use-module (gnu packages kde) 15 | #:use-module (gnu packages xorg) 16 | #:use-module (gnu packages xdisorg) 17 | #:use-module (gnu packages compton) 18 | #:use-module (gnu packages suckless) 19 | #:use-module (gnu packages pkg-config)) 20 | 21 | (define-public engstrand-dwm 22 | (package 23 | (inherit dwm) 24 | (name "engstrand-dwm") 25 | (source 26 | (origin 27 | (method git-fetch) 28 | (uri (git-reference 29 | (url "https://github.com/engstrand-config/dwm.git") 30 | (commit "86f0361d987dd50f9d85300172920fe556295c6e"))) 31 | (sha256 32 | (base32 "07clvwvwjxs1gwhnmbd3gq6rzyr0cphxk3ibkzmd53xikrighlm9")))) 33 | (propagated-inputs 34 | (list xrdb 35 | maim 36 | xclip 37 | xprop 38 | xsetroot 39 | font-awesome 40 | font-jetbrains-mono 41 | picom 42 | xwallpaper)) 43 | (home-page "https://github.com/engstrand-config/dwm") 44 | (synopsis "Engstrand dwm"))) 45 | 46 | (define-public engstrand-dmenu 47 | (package 48 | (inherit dmenu) 49 | (name "engstrand-dmenu") 50 | (source 51 | (origin 52 | (method git-fetch) 53 | (uri (git-reference 54 | (url "https://github.com/engstrand-config/dmenu.git") 55 | (commit "eeb3448e0a76d55b75882bd633adf2b6a4ac2412"))) 56 | (sha256 57 | (base32 "0lyvrvrllq2k7y21n9hh1dn7vj9iv9682hynvs6kn71lcz0aakga")))) 58 | (arguments 59 | `(#:validate-runpath? #f ; skip validation 60 | #:tests? #f ; no tests 61 | #:make-flags 62 | (list (string-append "CC=" ,(cc-for-target)) 63 | (string-append "PREFIX=" %output) 64 | (string-append "FREETYPEINC=" 65 | (assoc-ref %build-inputs "freetype") 66 | "/include/freetype2")) 67 | #:phases 68 | (modify-phases %standard-phases (delete 'configure)))) 69 | (propagated-inputs 70 | (list engstrand-dwm)) 71 | (home-page "https://github.com/engstrand-config/dmenu") 72 | (synopsis "Engstrand dmenu"))) 73 | 74 | (define-public engstrand-dsblocks 75 | (package 76 | (inherit slstatus) 77 | (name "engstrand-dsblocks") 78 | (source 79 | (origin 80 | (method git-fetch) 81 | (uri (git-reference 82 | (url "https://github.com/engstrand-config/dsblocks.git") 83 | (commit "404d436455f8ab1de058d7c94363556dbdada0d6"))) 84 | (sha256 85 | (base32 "1kb9an9bmfg9vms4jkz8z400ydrs72plz6rqaakrrfh3in6msjyc")))) 86 | (arguments 87 | `(#:tests? #f ; no tests 88 | #:make-flags 89 | (list (string-append "CC=" ,(cc-for-target)) 90 | (string-append "PREFIX=" %output) 91 | (string-append "FREETYPEINC=" 92 | (assoc-ref %build-inputs "freetype") 93 | "/include/freetype2")) 94 | #:phases 95 | (modify-phases %standard-phases (delete 'configure)))) 96 | (native-inputs 97 | (list pkg-config)) 98 | (inputs 99 | (list libx11 libxft libxinerama freetype)) 100 | (propagated-inputs 101 | (list mpd glib kdeconnect engstrand-dwm libmpdclient)) 102 | (home-page "https://github.com/engstrand-config/dsblocks") 103 | (description "Custom statusbar for dwm with blocks written in C. Based on dwmblocks") 104 | (synopsis "Engstrand dsblocks"))) 105 | 106 | (define-public engstrand-st 107 | (package 108 | (inherit st) 109 | (name "engstrand-st") 110 | (source 111 | (origin 112 | (method git-fetch) 113 | (uri (git-reference 114 | (url "https://github.com/engstrand-config/st.git") 115 | (commit "ff7964bbf74e249d7c2f2325fc2fcc103fc8db3b"))) 116 | (sha256 117 | (base32 "127wxailsfqjlycjad7jaxx1ib4655k3w6c03fc7q3q8y9fd7j4x")))) 118 | (home-page "https://github.com/engstrand-config/st") 119 | (inputs 120 | (list libx11 libxft freetype harfbuzz)) 121 | (propagated-inputs 122 | (list engstrand-dwm)) 123 | (synopsis "Engstrand st"))) 124 | -------------------------------------------------------------------------------- /engstrand/reconfigure.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand reconfigure) 2 | #:use-module (ice-9 match) 3 | #:use-module (ice-9 exceptions) 4 | #:use-module (ice-9 pretty-print) 5 | #:use-module (gnu system) 6 | #:use-module (gnu system accounts) 7 | #:use-module (rde features) 8 | #:use-module (rde features predicates) 9 | #:use-module (farg provider) 10 | #:use-module (engstrand themes) 11 | #:use-module (engstrand systems) 12 | #:use-module (engstrand wallpapers) ;; get-wallpaper-path 13 | #:export (make-config)) 14 | 15 | ;; Allows dynamic loading of configuration modules based on file name. 16 | (define* (dynamic-load sub mod var-name #:key (throw? #t)) 17 | (let ((var (module-variable 18 | (resolve-module `(engstrand ,sub ,(string->symbol mod))) var-name))) 19 | (if (or (not var) (not (variable-bound? var))) 20 | (when throw? 21 | (raise-exception 22 | (make-exception-with-message 23 | (string-append "reconfigure: could not load module '" mod "'")))) 24 | (variable-ref var)))) 25 | 26 | ;; Finds a list of needed user supplementary groups for feature with 27 | ;; a value of name. Returns an empty list if no groups are found. 28 | (define (get-feature-kernel-arguments name config) 29 | (let ((arguments (get-value name config))) 30 | (if arguments arguments '()))) 31 | 32 | ;; Create a system or home configuration based on some parameters. 33 | ;; Generally, you want to call this procedure with no arguments. 34 | (define* (make-config 35 | #:key 36 | (user (getenv "RDE_USER")) 37 | (system (gethostname)) 38 | (target (getenv "RDE_TARGET")) 39 | (initial-os %engstrand-initial-os)) 40 | 41 | (ensure-pred string? user) 42 | (ensure-pred string? system) 43 | (ensure-pred operating-system? initial-os) 44 | 45 | (define %user-features (dynamic-load 'configs user '%user-features)) 46 | (define %user-theme (dynamic-load 'configs user '%user-theme #:throw? #f)) 47 | (define %system-features (dynamic-load 'systems system '%system-features)) 48 | 49 | ;; All is good, create the configuration 50 | (define %generated-config 51 | (rde-config 52 | (initial-os initial-os) 53 | (features 54 | (farg:theme-provider 55 | (if (unspecified? %user-theme) 56 | engstrand-theme-dark 57 | %user-theme) 58 | (append %user-features %engstrand-system-base-features %system-features) 59 | #:palette-extension engstrand-farg-palette)))) 60 | 61 | (define %engstrand-he 62 | (rde-config-home-environment %generated-config)) 63 | 64 | (define %engstrand-system 65 | (operating-system 66 | (inherit (rde-config-operating-system %generated-config)) 67 | (kernel-arguments 68 | (append 69 | (get-value 70 | 'kernel-arguments %generated-config 71 | (operating-system-user-kernel-arguments initial-os)) 72 | (get-feature-kernel-arguments 'kernel-arguments-radios %generated-config))) 73 | (issue (operating-system-issue initial-os)))) 74 | 75 | (match target 76 | ("home" %engstrand-he) 77 | ("system" %engstrand-system) 78 | (_ %engstrand-system))) 79 | -------------------------------------------------------------------------------- /engstrand/serializers/qutebrowser.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand serializers qutebrowser) 2 | #:use-module (ice-9 match) 3 | #:use-module (srfi srfi-1) 4 | #:use-module (engstrand utils) 5 | #:export (serialize-qutebrowser-config)) 6 | 7 | (define (serialize-qutebrowser-value value) 8 | (cond 9 | ((symbol? value) (symbol->string value)) 10 | ((number? value) (number->string value)) 11 | ((string? value) (str-escape value)) 12 | ((list? value) (fold 13 | (lambda (x acc) 14 | (if (eq? acc "") 15 | (str-escape x) 16 | (string-append acc ", " (str-escape x)))) 17 | "" 18 | value)) 19 | (else value))) 20 | 21 | (define (serialize-qutebrowser-bindings bindings) 22 | (fold 23 | (lambda (entry acc) 24 | (let ((str-value (serialize-qutebrowser-value entry))) 25 | (string-append acc "config.bind(" str-value ")\n"))) 26 | "" 27 | bindings)) 28 | 29 | (define (serialize-qutebrowser-properties properties) 30 | (fold 31 | (lambda (entry acc) 32 | (let ((str-value (serialize-qutebrowser-value (cdr entry)))) 33 | (string-append acc "c." (car entry) " = " str-value "\n"))) 34 | "" 35 | properties)) 36 | 37 | (define* (serialize-qutebrowser-config properties bindings) 38 | "Serializes qutebrowser properties and keybindings into a config.py." 39 | (string-append 40 | "config.load_autoconfig()\n" 41 | (serialize-qutebrowser-properties properties) 42 | (serialize-qutebrowser-bindings bindings))) 43 | -------------------------------------------------------------------------------- /engstrand/systems.scm: -------------------------------------------------------------------------------- 1 | ;; This module is responsible for configuring an operating system, 2 | ;; i.e. kernel, microcode, hostname, keyboard layout, etc. 3 | ;; 4 | ;; Base packages, services and other features should be defined in 5 | ;; engstrand/configs, or in one of the custom configs at engstrand/configs/. 6 | (define-module (engstrand systems) 7 | #:use-module (rde features) 8 | #:use-module (rde features base) 9 | #:use-module (rde features system) 10 | #:use-module (rde features keyboard) 11 | #:use-module (gnu system) 12 | #:use-module (gnu system keyboard) 13 | #:use-module (gnu system file-systems) 14 | #:use-module (gnu bootloader) 15 | #:use-module (gnu bootloader grub) 16 | #:use-module (nongnu packages linux) 17 | #:use-module (nongnu system linux-initrd) 18 | #:export ( 19 | %engstrand-timezone 20 | %engstrand-locale 21 | %engstrand-kernel-arguments 22 | %engstrand-keyboard-layout 23 | %engstrand-initial-os 24 | %engstrand-system-base-features)) 25 | 26 | (define-public %engstrand-timezone "Europe/Stockholm") 27 | (define-public %engstrand-locale "en_US.utf8") 28 | 29 | (define-public %engstrand-kernel-arguments 30 | (list "modprobe.blacklist=pcspkr,snd_pcsp" 31 | "quiet")) 32 | 33 | (define-public %engstrand-keyboard-layout 34 | (keyboard-layout "us,se" 35 | #:options 36 | '("grp:alt_shift_toggle" "grp_led:caps" "caps:escape"))) 37 | 38 | (define-public %engstrand-initial-os 39 | (operating-system 40 | (host-name "engstrand") 41 | (locale %engstrand-locale) 42 | (timezone %engstrand-timezone) 43 | (kernel linux) 44 | (firmware (list linux-firmware)) 45 | (initrd microcode-initrd) 46 | (kernel-arguments %engstrand-kernel-arguments) 47 | (keyboard-layout %engstrand-keyboard-layout) 48 | (bootloader (bootloader-configuration 49 | (bootloader grub-efi-bootloader) 50 | (targets '("/boot/efi")))) 51 | (services '()) 52 | (file-systems %base-file-systems) 53 | (sudoers-file #f) 54 | (issue "This is the GNU/Engstrand system. Welcome.\n"))) 55 | 56 | (define-public %engstrand-system-base-features 57 | (list 58 | (feature-keyboard 59 | #:keyboard-layout %engstrand-keyboard-layout))) 60 | -------------------------------------------------------------------------------- /engstrand/systems/fractal.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems fractal) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand features display) 5 | #:use-module (engstrand features dwl-guile) 6 | #:use-module (engstrand features bluetooth) 7 | #:use-module (rde features system) 8 | #:use-module (rde features bluetooth) 9 | #:use-module (guix gexp) 10 | #:use-module (dwl-guile home-service) 11 | #:use-module (gnu bootloader) 12 | #:use-module (gnu bootloader grub) 13 | #:use-module (gnu system file-systems) 14 | #:use-module (gnu system mapped-devices)) 15 | 16 | (define %mapped-devices 17 | (list 18 | (mapped-device 19 | (source 20 | (uuid "367c5fe8-0388-49ad-9c88-04bcfe62c7b9")) 21 | (target "cryptroot") 22 | (type luks-device-mapping)))) 23 | 24 | (define-public %system-features 25 | (list 26 | (feature-host-info 27 | #:host-name "fractal" 28 | #:timezone %engstrand-timezone 29 | #:locale %engstrand-locale) 30 | (feature-bootloader 31 | #:bootloader-configuration 32 | (bootloader-configuration 33 | (bootloader grub-efi-bootloader) 34 | (targets '("/boot/efi")) 35 | (keyboard-layout %engstrand-keyboard-layout))) 36 | (feature-file-systems 37 | #:mapped-devices %mapped-devices 38 | #:file-systems 39 | (list 40 | (file-system 41 | (mount-point "/boot/efi") 42 | (device (uuid "1A1B-7B25" 'fat32)) 43 | (type "vfat")) 44 | (file-system 45 | (mount-point "/") 46 | (device "/dev/mapper/cryptroot") 47 | (type "ext4") 48 | (dependencies %mapped-devices)))) 49 | (feature-bluetooth) 50 | (feature-bluetooth-quick-connect) 51 | (feature-display-control 52 | #:decrease-brightness-key "s-" 53 | #:increase-brightness-key "s-") 54 | (feature-dwl-guile-custom-config 55 | #:config 56 | `((setq accel-speed -0.7) 57 | (set-monitor-rules 58 | '((name "DP-3") 59 | (width . 1920) 60 | (height . 1080) 61 | (refresh-rate . 144) 62 | ;; Adaptive sync is broken on this display. 63 | ;; Enabling it will result in a black screen. 64 | (adaptive-sync? . #f))))))) 65 | -------------------------------------------------------------------------------- /engstrand/systems/ghost.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems ghost) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand features display) 5 | #:use-module (engstrand features dwl-guile) 6 | #:use-module (guix gexp) 7 | #:use-module (rde features bluetooth) 8 | #:use-module (rde features system) 9 | #:use-module (gnu bootloader) 10 | #:use-module (gnu bootloader grub) 11 | #:use-module (dwl-guile home-service) 12 | #:use-module (gnu system file-systems) 13 | #:use-module (gnu system mapped-devices)) 14 | 15 | (define %mapped-devices 16 | (list 17 | (mapped-device 18 | (source 19 | (uuid "baeef44b-6ca9-4fbb-ad80-f45f35724d32")) 20 | (target "cryptroot") 21 | (type luks-device-mapping)))) 22 | 23 | (define-public %system-features 24 | (list 25 | (feature-host-info 26 | #:host-name "ghost" 27 | #:timezone %engstrand-timezone 28 | #:locale %engstrand-locale) 29 | (feature-bootloader 30 | #:bootloader-configuration 31 | (bootloader-configuration 32 | (bootloader grub-bootloader) 33 | (targets '("/dev/nvme0n1")) 34 | (keyboard-layout %engstrand-keyboard-layout))) 35 | (feature-bluetooth) 36 | (feature-display-control 37 | #:decrease-brightness-key "s-" 38 | #:increase-brightness-key "s-") 39 | (feature-file-systems 40 | #:mapped-devices %mapped-devices 41 | #:file-systems 42 | (list 43 | (file-system 44 | (mount-point "/boot/efi") 45 | (device (uuid "F6B6-B394" 'fat32)) 46 | (type "vfat")) 47 | (file-system 48 | (mount-point "/") 49 | (device "/dev/mapper/cryptroot") 50 | (type "ext4") 51 | (dependencies %mapped-devices)))) 52 | (feature-dwl-guile-custom-config 53 | #:config 54 | `((set-monitor-rules 55 | '((name . "DP-1") 56 | (x . 1920) 57 | (y . 0) 58 | (width . 2560) 59 | (height . 1440) 60 | (refresh-rate . 144) 61 | (adaptive-sync? . #t)) 62 | '((name "DP-2") 63 | (x . 0) 64 | (y . 200) 65 | (width . 1920) 66 | (height . 1080) 67 | (refresh-rate . 144) 68 | (adaptive-sync? . #t))))))) 69 | -------------------------------------------------------------------------------- /engstrand/systems/kommunbook.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems kommunbook) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand features laptop) 5 | #:use-module (engstrand features radio) 6 | #:use-module (engstrand features dwl-guile) 7 | #:use-module (dwl-guile home-service) 8 | #:use-module (rde features base) 9 | #:use-module (rde features system) 10 | #:use-module (guix gexp) 11 | #:use-module (gnu system file-systems) 12 | #:use-module (gnu services) 13 | #:use-module (gnu bootloader) 14 | #:use-module (gnu bootloader grub) 15 | #:use-module (gnu system mapped-devices) 16 | #:use-module (nongnu packages linux)) 17 | 18 | (define-public %system-features 19 | (append 20 | (list 21 | (feature-kernel 22 | #:kernel linux 23 | #:firmware (list linux-firmware) 24 | #:kernel-arguments %engstrand-kernel-arguments) 25 | (feature-host-info 26 | #:host-name "kommunbook" 27 | #:timezone %engstrand-timezone 28 | #:locale %engstrand-locale) 29 | (feature-bootloader 30 | #:bootloader-configuration 31 | (bootloader-configuration 32 | (bootloader grub-bootloader) 33 | (targets (list "/dev/sda")))) 34 | (feature-file-systems 35 | #:file-systems 36 | (list 37 | (file-system 38 | (mount-point "/") 39 | (device 40 | (uuid "84ed6452-d8c9-4649-bfd4-c3171a7985cf" 41 | 'btrfs)) 42 | (type "btrfs"))) 43 | #:swap-devices 44 | (list 45 | (swap-space 46 | (target (uuid "4ea38741-230c-47c4-97d6-132f2002d9fb"))))) 47 | (feature-radio 48 | #:rtl-sdr? #t) 49 | (feature-dwl-guile-custom-config 50 | #:config 51 | `((setq gaps-oh 0 52 | gaps-ov 0 53 | gaps-ih 0 54 | gaps-iv 0 55 | border-px 3)))) 56 | %engstrand-laptop-base-features)) 57 | -------------------------------------------------------------------------------- /engstrand/systems/p400s.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems p400s) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand features bluetooth) 5 | #:use-module (engstrand features display) 6 | #:use-module (engstrand features dwl-guile) 7 | #:use-module (guix gexp) 8 | #:use-module (gnu services) 9 | #:use-module (rde features base) 10 | #:use-module (rde features bluetooth) 11 | #:use-module (rde features system) 12 | #:use-module (dwl-guile home-service) 13 | #:use-module (gnu system file-systems) 14 | #:use-module (gnu system mapped-devices)) 15 | 16 | (define-public %system-features 17 | (list 18 | (feature-host-info 19 | #:host-name "p400s" 20 | #:timezone %engstrand-timezone 21 | #:locale %engstrand-locale) 22 | (feature-bootloader) 23 | (feature-file-systems 24 | #:file-systems 25 | (list (file-system 26 | (mount-point "/boot/efi") 27 | (device (uuid "8396-F2E9" 'fat32)) 28 | (type "vfat")) 29 | (file-system 30 | (mount-point "/") 31 | (device 32 | (uuid "104e5086-1795-4a28-b3eb-f563ef06fc52" 33 | 'ext4)) 34 | (type "ext4"))) 35 | #:swap-devices 36 | (list (swap-space 37 | (target (uuid "5fdc125b-0a5f-4706-8b8f-82b783979d03"))))) 38 | (feature-bluetooth) 39 | (feature-bluetooth-quick-connect) 40 | (feature-display-control 41 | #:decrease-brightness-key "s-" 42 | #:increase-brightness-key "s-") 43 | (feature-dwl-guile-custom-config 44 | #:config 45 | `((setq smart-gaps? #f 46 | smart-borders? #f 47 | gaps-oh 30 48 | gaps-ov 30 49 | gaps-ih 20 50 | gaps-iv 10 51 | border-px 3) 52 | (set-monitor-rules 53 | '((name . "DP-1") 54 | (width . 2560) 55 | (height . 1440) 56 | (refresh-rate . 60) 57 | (adaptive-sync? . #f))))))) 58 | -------------------------------------------------------------------------------- /engstrand/systems/pavilion.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems pavilion) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand features laptop) 5 | #:use-module (guix gexp) 6 | #:use-module (rde features system) 7 | #:use-module (gnu system file-systems) 8 | #:use-module (gnu system mapped-devices)) 9 | 10 | (define-public %system-features 11 | (append 12 | (list 13 | (feature-host-info 14 | #:host-name "pavilion" 15 | #:timezone %engstrand-timezone 16 | #:locale %engstrand-locale) 17 | (feature-bootloader) 18 | (feature-file-systems 19 | #:file-systems 20 | (list 21 | (file-system 22 | (mount-point "/boot/efi") 23 | (device (uuid "1ADC-28E8" 'fat32)) 24 | (type "vfat")) 25 | (file-system 26 | (mount-point "/") 27 | (device 28 | (uuid "6c3ee1c8-6ee6-4142-b2bf-a370854f63e7" 29 | 'ext4)) 30 | (type "ext4"))) 31 | #:swap-devices 32 | (list 33 | (swap-space 34 | (target (uuid "62f47965-ad3e-40a9-bb5e-46e4387fa449")))))) 35 | %engstrand-laptop-base-features)) 36 | -------------------------------------------------------------------------------- /engstrand/systems/silverstone.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems silverstone) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (nongnu packages linux) 5 | #:use-module (gnu packages linux) 6 | #:use-module (engstrand features dwl-guile) 7 | #:use-module (engstrand features bluetooth) 8 | #:use-module (engstrand features display) 9 | #:use-module (engstrand features audio) 10 | #:use-module (rde features base) 11 | #:use-module (rde features bluetooth) 12 | #:use-module (rde features system) 13 | #:use-module (guix gexp) 14 | #:use-module (guix utils) 15 | #:use-module (gnu bootloader) 16 | #:use-module (gnu bootloader grub) 17 | #:use-module (gnu services) 18 | #:use-module (dwl-guile home-service) 19 | #:use-module (gnu system file-systems) 20 | #:use-module (gnu system mapped-devices)) 21 | 22 | (define %mapped-devices 23 | (list 24 | (mapped-device 25 | (source 26 | (uuid "96cfdf5b-2b0b-4e10-adc0-d94cff2bc0b8")) 27 | (target "cryptroot") 28 | (type luks-device-mapping)))) 29 | 30 | (define-public %system-features 31 | (list 32 | (feature-kernel 33 | #:kernel linux ;; (corrupt-linux linux-libre #:configs '("CONFIG_MT7921E=m")) 34 | #:firmware (list linux-firmware) 35 | #:kernel-arguments %engstrand-kernel-arguments) 36 | (feature-host-info 37 | #:host-name "silverstone" 38 | #:timezone %engstrand-timezone 39 | #:locale %engstrand-locale) 40 | (feature-bootloader 41 | #:bootloader-configuration 42 | (bootloader-configuration 43 | (bootloader grub-efi-bootloader) 44 | (targets '("/boot/efi")) 45 | (keyboard-layout %engstrand-keyboard-layout))) 46 | (feature-bluetooth) 47 | (feature-bluetooth-quick-connect) 48 | (feature-display-control 49 | #:decrease-brightness-key "s-" 50 | #:increase-brightness-key "s-") 51 | (feature-ardour) 52 | (feature-calf-plugins) 53 | ;; (feature-sfz) 54 | (feature-file-systems 55 | #:mapped-devices %mapped-devices 56 | #:file-systems 57 | (list 58 | (file-system 59 | (mount-point "/boot/efi") 60 | (device (uuid "4CCA-4361" 'fat32)) 61 | (type "vfat")) 62 | (file-system 63 | (mount-point "/") 64 | (device "/dev/mapper/cryptroot") 65 | (type "ext4") 66 | (dependencies %mapped-devices)))) 67 | (feature-dwl-guile-custom-config 68 | #:config 69 | `((setq smart-gaps? #f 70 | smart-borders? #f 71 | gaps-oh 30 72 | gaps-ov 30 73 | gaps-ih 20 74 | gaps-iv 10 75 | border-px 3) 76 | (set-monitor-rules 77 | '((name . "DP-2") 78 | (width . 2560) 79 | (height . 1440) 80 | (refresh-rate . 240) 81 | (adaptive-sync? . #t))))))) 82 | -------------------------------------------------------------------------------- /engstrand/systems/tuxedo.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand systems tuxedo) 2 | #:use-module (engstrand utils) 3 | #:use-module (engstrand systems) 4 | #:use-module (engstrand packages linux) 5 | #:use-module (engstrand features laptop) 6 | #:use-module (engstrand features display) 7 | #:use-module (engstrand features dwl-guile) 8 | #:use-module (guix gexp) 9 | #:use-module (dwl-guile home-service) 10 | #:use-module (rde features system) 11 | #:use-module (nongnu packages linux) 12 | #:use-module (nongnu system linux-initrd) 13 | #:use-module (gnu packages linux) 14 | #:use-module (gnu system file-systems) 15 | #:use-module (gnu system mapped-devices)) 16 | 17 | (define-public %system-features 18 | (append 19 | (list 20 | ;; TODO: Changing a single value in this feature requires 21 | ;; you to define the entire feature again. Perhaps add a helper for this? 22 | (feature-kernel 23 | #:kernel linux 24 | #:firmware (list linux-firmware) 25 | #:kernel-arguments %engstrand-kernel-arguments 26 | #:kernel-loadable-modules 27 | (append (list v4l2loopback-linux-module) 28 | (kernel-modules->list (list tuxedo-keyboard-module) 29 | linux))) 30 | (feature-host-info 31 | #:host-name "tuxedo" 32 | #:timezone %engstrand-timezone 33 | #:locale %engstrand-locale) 34 | (feature-bootloader) 35 | (feature-file-systems 36 | #:file-systems 37 | (list 38 | (file-system 39 | (mount-point "/boot/efi") 40 | (device (uuid "7E51-6BDB" 'fat32)) 41 | (type "vfat")) 42 | (file-system 43 | (mount-point "/") 44 | (device 45 | (uuid "4484aa6c-d5ff-4964-b62d-c2572c701e66" 'ext4)) 46 | (type "ext4"))) 47 | #:swap-devices 48 | (list 49 | (swap-space 50 | (target (uuid "40c98866-74b1-4e99-9c32-24d584fe0617"))))) 51 | (feature-dwl-guile-custom-config 52 | #:config 53 | `((set-monitor-rules 54 | '((name . "eDP-1") 55 | (width . 1920) 56 | (height . 1080) 57 | (refresh-rate . 60) 58 | (adaptive-sync? . #f))))) 59 | (feature-kanshi-autorandr 60 | #:profiles 61 | '((("Ancor Communications Inc MG248 G6LMQS123017" . 62 | (("mode" . "1920x1080") 63 | ("position" . "0,0"))) 64 | (eDP-1 . (("position" . "0,1080"))))))) 65 | %engstrand-laptop-base-features)) 66 | -------------------------------------------------------------------------------- /engstrand/themes.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand themes) 2 | #:use-module (ice-9 match) 3 | #:use-module (guix gexp) 4 | #:use-module (farg theme) 5 | #:use-module (farg colors) 6 | #:use-module (farg source) 7 | #:use-module (engstrand wallpapers) 8 | #:export ( 9 | engstrand-theme-light 10 | engstrand-theme-dark 11 | engstrand-farg-palette)) 12 | 13 | (define* (engstrand-theme-light 14 | #:key (wallpaper #f)) 15 | (farg-source 16 | (theme 17 | (farg-theme 18 | (wallpaper wallpaper) 19 | (light? #t) 20 | (alpha 0.98) 21 | (fg "#000000") 22 | (bg "#FFFFFF") 23 | (bg-alt "#F0F0F0") 24 | (accent-0 "#531AB6") 25 | (accent-1 "#721045") 26 | (accent-2 "#005F5F") 27 | (accent-3 "#0000B0") 28 | (accent-4 "#A0132F") 29 | (accent-5 "#8F0075") 30 | (accent-6 "#3548CF") 31 | (accent-7 "#2A5045"))))) 32 | 33 | (define* (engstrand-theme-dark 34 | #:key (wallpaper #f)) 35 | (farg-source 36 | (theme 37 | (farg-theme 38 | (wallpaper wallpaper) 39 | (light? #f) 40 | (alpha 0.96) 41 | (fg "#FFFFFF") 42 | (bg "#000000") 43 | (bg-alt "#1E1E1E") 44 | (accent-0 "#B6A0FF") 45 | (accent-1 "#FEACD0") 46 | (accent-2 "#6AE4B9") 47 | (accent-3 "#00BCFF") 48 | (accent-4 "#FF7F9F") 49 | (accent-5 "#F78FE7") 50 | (accent-6 "#79A8FF") 51 | (accent-7 "#9AC8E0"))))) 52 | 53 | (define (engstrand-farg-palette palette) 54 | (define red 55 | (farg:make-readable (farg:blend "#FF0000" (palette 'accent-0) 0.7) 56 | (palette 'bg) 57 | 5)) 58 | (define green 59 | (farg:make-readable (farg:blend "#00FF00" (palette 'accent-0) 0.7) 60 | (palette 'bg) 61 | 5)) 62 | (define blue 63 | (farg:make-readable (farg:blend "#0000FF" (palette 'accent-0) 0.7) 64 | (palette 'bg) 65 | 5)) 66 | (define yellow 67 | (farg:make-readable (farg:blend "#FFFF00" (palette 'accent-0) 0.7) 68 | (palette 'bg) 69 | 5)) 70 | (define magenta 71 | (farg:make-readable (farg:blend "#FF00FF" (palette 'accent-0) 0.7) 72 | (palette 'bg) 73 | 5)) 74 | (define cyan 75 | (farg:make-readable (farg:blend "#00FFFF" (palette 'accent-0) 0.7) 76 | (palette 'bg) 77 | 5)) 78 | 79 | (define red-text (farg:make-readable red red)) 80 | (define green-text (farg:make-readable green green)) 81 | (define blue-text (farg:make-readable blue blue)) 82 | (define yellow-text (farg:make-readable yellow yellow)) 83 | (define magenta-text (farg:make-readable magenta magenta)) 84 | (define cyan-text (farg:make-readable cyan cyan)) 85 | 86 | (define accent-0-text 87 | (farg:make-readable (palette 'accent-0) (palette 'bg))) 88 | (define accent-1-text 89 | (farg:make-readable (palette 'accent-1) (palette 'bg))) 90 | (define accent-2-text 91 | (farg:make-readable (palette 'accent-2) (palette 'bg))) 92 | (define accent-3-text 93 | (farg:make-readable (palette 'accent-3) (palette 'bg))) 94 | (define accent-4-text 95 | (farg:make-readable (palette 'accent-4) (palette 'bg))) 96 | (define accent-5-text 97 | (farg:make-readable (palette 'accent-5) (palette 'bg))) 98 | (define accent-6-text 99 | (farg:make-readable (palette 'accent-6) (palette 'bg))) 100 | (define accent-7-text 101 | (farg:make-readable (palette 'accent-7) (palette 'bg))) 102 | 103 | (lambda (name) 104 | (match name 105 | ('red red) 106 | ('green green) 107 | ('blue blue) 108 | ('yellow yellow) 109 | ('magenta magenta) 110 | ('cyan cyan) 111 | ('red-text red-text) 112 | ('green-text green-text) 113 | ('blue-text blue-text) 114 | ('yellow-text yellow-text) 115 | ('magenta-text magenta-text) 116 | ('cyan-text cyan-text) 117 | ('accent-0-text accent-0-text) 118 | ('accent-1-text accent-1-text) 119 | ('accent-2-text accent-2-text) 120 | ('accent-3-text accent-3-text) 121 | ('accent-4-text accent-4-text) 122 | ('accent-5-text accent-5-text) 123 | ('accent-6-text accent-6-text) 124 | ('accent-7-text accent-7-text) 125 | ;; Redirect any other lookups to the default palette 126 | (_ (palette name))))) 127 | -------------------------------------------------------------------------------- /engstrand/utils.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand utils) 2 | #:use-module (ice-9 match) 3 | #:use-module (srfi srfi-1) 4 | #:use-module (guix gexp) 5 | #:use-module (gnu packages) 6 | #:use-module (rde features) 7 | #:use-module (rde features fontutils) 8 | #:use-module (rde features predicates) 9 | #:use-module (engstrand themes) 10 | #:export ( 11 | modify-features 12 | font->string)) 13 | 14 | ;; Converts a list of kernel modules into a list of packages. 15 | ;; Each kernel module should accept the current system kernel 16 | ;; as a single argument. The kernel module should then dynamically 17 | ;; create a valid kernel module package based on the specified kernel. 18 | (define-public (kernel-modules->list modules kernel) 19 | (map (lambda (mod) (mod kernel)) modules)) 20 | 21 | ;; Converts a list of package names into the actual package definitions. 22 | (define-public (pkgs lst) 23 | (map specification->package lst)) 24 | 25 | ;; Helper for removing # from a list. 26 | ;; This means that we easily can conditionally add services to the list: 27 | ;; 28 | ;; @example 29 | ;; (list 30 | ;; (simple-service ...) 31 | ;; (simple-service ...) 32 | ;; (when add-keybindings? (simple-service ...))) 33 | ;; @end example 34 | (define-public (make-service-list . services) 35 | (filter (lambda (v) (not (unspecified? v))) services)) 36 | 37 | ;; Predicates 38 | (define-public (dotfile? x) 39 | (and (string? (car x)) 40 | (or (file-like? (cadr x)) (gexp? (cadr x))))) 41 | 42 | (define-public (state-item? x) 43 | (and (string? (car x)) (string? (cdr x)))) 44 | 45 | (define-public (list-of-dotfiles? x) 46 | (every dotfile? x)) 47 | 48 | (define-public (list-of-state-items? x) 49 | (every state-item? x)) 50 | 51 | (define-public (list-of-list? x) 52 | (every list? x)) 53 | 54 | (define-syntax %modify-feature 55 | (syntax-rules () 56 | ((_ feature (delete kind) clauses ...) 57 | ;; HACK: Unwrap features that uses the farg provider. 58 | (let ((feature-struct (if (procedure? feature) 59 | (feature engstrand-theme-dark 60 | (lambda (name) name)) 61 | feature))) 62 | (if (eq? (feature-name feature-struct) kind) 63 | #f 64 | (%modify-feature feature clauses ...)))) 65 | ((_ feature) 66 | feature))) 67 | 68 | (define-syntax modify-features 69 | (syntax-rules () 70 | "Modify the features listed in FEATURES according to CLAUSES and return 71 | the resulting list of features Each clause must have the form: (delete FEATURE-NAME)" 72 | ((_ features clauses ...) 73 | (filter-map (lambda (feature) 74 | (%modify-feature feature clauses ...)) 75 | features)))) 76 | 77 | ;; Serializes an alist with key-value pairs into an ini configuration file. 78 | ;; If no value is specified, only the key will be returned. 79 | ;; 80 | ;; @example 81 | ;; (serialize-ini-config 82 | ;; `(("foo" . "bar") 83 | ;; ("key-with-no-value"))) 84 | ;; @end 85 | ;; yields a string containing newlines: 86 | ;; foo=bar 87 | ;; key-with-no-value 88 | (define-public (alist->ini filename alist) 89 | (plain-file filename 90 | (fold-right 91 | (lambda (entry acc) 92 | (let ((key (car entry)) 93 | (value (cdr entry))) 94 | (string-append 95 | key 96 | (if (null? value) 97 | "" 98 | (string-append "=" 99 | (if (number? value) 100 | (number->string value) 101 | value))) 102 | "\n" acc))) 103 | "" 104 | alist))) 105 | 106 | (define-public (alist->environment-variable var alist) 107 | (define (add-arg acc key value) 108 | (string-append acc " --" key 109 | (if (not value) "" (string-append " " value)))) 110 | 111 | ;; Join arguments into a single string, with each key prefixed 112 | ;; with "--" and the key and value separated with a space. 113 | ;; Values that has no value (or #t) will only add the prefixed key. 114 | ;; If the value is #f, the key will not be included at all. 115 | (define str 116 | (fold 117 | (lambda (arg acc) 118 | (let ((key (car arg)) (value (cdr arg))) 119 | (cond 120 | ((string? value) (add-arg acc key (string-append "'" value "'"))) 121 | ((number? value) (add-arg acc key (number->string value))) 122 | ((eq? value #t) (add-arg acc key #f)) 123 | (else acc)))) 124 | "" alist)) 125 | 126 | ;; Return an alist containing the environment variable name VAR 127 | ;; and its value as the result of serializing ALIST. 128 | `((,var . ,str ))) 129 | 130 | (define-public (make-log-file name) 131 | (string-append (or (getenv "XDG_LOG_HOME") 132 | (getenv "HOME")) 133 | "/" name ".log")) 134 | 135 | ;; Convert a font into a pango or fcft string that can be used in 136 | ;; configuration files. 137 | (define* (font->string fmt type config 138 | #:key 139 | (bold? '()) 140 | (size '())) 141 | (define (weight->string weight) 142 | (let ((str (symbol->string weight))) 143 | (match fmt 144 | ('pango (string-capitalize str)) 145 | ('fcft str) 146 | (_ str)))) 147 | 148 | (define (get-weight font) 149 | (let ((weight (cond 150 | ((null? bold?) 151 | (if (font-weight font) 152 | (font-weight font) 153 | 'normal)) 154 | ((eq? bold? #t) 'bold) 155 | ((eq? bold? #f) 'normal)))) 156 | (weight->string weight))) 157 | 158 | (let ((font (get-value type config)) 159 | (fmt-string (if (eq? fmt 'pango) "~a ~a ~a" "~a:style=~a:size=~a"))) 160 | (format #f fmt-string 161 | (font-name font) 162 | (get-weight font) 163 | (if (null? size) (font-size font) size)))) 164 | 165 | (define-public (str-escape str) 166 | (string-append "\"" str "\"")) 167 | 168 | (define-public (strip-hex hex) 169 | (if (equal? (string-take hex 1) "#") 170 | (substring hex 1) 171 | hex)) 172 | -------------------------------------------------------------------------------- /engstrand/utils/bemenu-prompt.scm: -------------------------------------------------------------------------------- 1 | (define-module (engstrand utils bemenu-prompt) 2 | #:use-module (guix gexp) 3 | #:use-module (srfi srfi-1) 4 | #:use-module (ice-9 popen) 5 | #:use-module (ice-9 match) 6 | #:use-module (ice-9 rdelim) 7 | #:use-module (gnu packages xdisorg) 8 | #:export (compute-bemenu-prompt)) 9 | 10 | (define* (serialize-actions actions) 11 | "Serializes ACTIONS containing option and command key-value pairs 12 | into a string, separated by new line characters." 13 | (string-join 14 | (map (lambda (action) (car action)) actions) 15 | "\n")) 16 | 17 | (define* (compute-bemenu-prompt filename prompt actions #:optional package) 18 | "Compute a Guile script file named FILENAME containing the necessary code 19 | for launching bemenu with PROMPT and ACTIONS." 20 | (define (get-exec-args pkg prompt) 21 | (list (file-append pkg "/bin/bemenu") "-i" "-p" prompt)) 22 | 23 | ;; Fallback to upstreamed bemenu package if no package is specified. 24 | (let ((pkg (if package package bemenu))) 25 | ;; TODO: Use with-imported-modules? 26 | (program-file 27 | filename 28 | #~(begin 29 | (use-modules (ice-9 popen) 30 | (ice-9 rdelim) 31 | (ice-9 match) 32 | (srfi srfi-1)) 33 | (call-with-values 34 | (lambda () 35 | (pipeline `(#$(get-exec-args pkg prompt)))) 36 | (lambda (from to pids) 37 | (display #$(serialize-actions actions) to) 38 | (close-port to) 39 | (let ((result (read-line from))) 40 | (close-port from) 41 | (match-let* (((pid) pids) 42 | ((_ . status) (waitpid pid))) 43 | (when (zero? (status:exit-val status)) 44 | (primitive-eval (assoc-ref `#$actions result))))))))))) 45 | -------------------------------------------------------------------------------- /images/apps.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engstrand-config/guix-dotfiles/06ecbc501932141ba0cfc24703d44a8c7a407a0a/images/apps.jpeg -------------------------------------------------------------------------------- /images/desktop.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engstrand-config/guix-dotfiles/06ecbc501932141ba0cfc24703d44a8c7a407a0a/images/desktop.jpeg --------------------------------------------------------------------------------