From b673fb12c17b70f17f2c94e22d71646059c9d128 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Sat, 10 Jun 2023 10:34:14 +0200 Subject: [PATCH] Clean out the repository Signed-off-by: Magic_RB --- .envrc | 5 - .gitignore | 10 - .gitmodules | 6 - 0001-Allow-null-in-authMountTuneSchema.patch | 73 - COPYING | 674 --------- COPYING.LESSER | 165 --- LICENSES/LGPL-3.0-or-later.txt | 304 ---- README.md | 25 - README.org | 26 - default.nix | 9 - emacs-lisp/.gitignore | 1 - emacs-lisp/avy.org | 18 - emacs-lisp/c_language_support.org | 12 - emacs-lisp/corfu.org | 101 -- emacs-lisp/cosult.org | 63 - emacs-lisp/daylies.org | 25 - emacs-lisp/dired.org | 14 - emacs-lisp/dirvish.org | 15 - emacs-lisp/display_settings.org | 82 -- emacs-lisp/el_secretario.org | 33 - emacs-lisp/elixir.org | 21 - emacs-lisp/emacs_rofi.org | 61 - emacs-lisp/email.org | 78 - emacs-lisp/embark.org | 24 - emacs-lisp/ement_el.org | 65 - .../filling_and_unfilling_paragraphs.org | 23 - emacs-lisp/flycheck.org | 66 - emacs-lisp/general_el.org | 20 - emacs-lisp/go.org | 16 - emacs-lisp/keybindings.org | 78 - emacs-lisp/lsp.org | 142 -- emacs-lisp/magit.org | 28 - emacs-lisp/marginalia.org | 22 - emacs-lisp/meow.org | 130 -- emacs-lisp/native_compilation.org | 12 - emacs-lisp/orderless.org | 21 - emacs-lisp/org_agenda.org | 168 --- emacs-lisp/org_gtd.org | 294 ---- emacs-lisp/org_habit.org | 23 - emacs-lisp/org_mode.org | 211 --- emacs-lisp/org_roam.org | 186 --- emacs-lisp/org_variable_pitch.org | 20 - emacs-lisp/popper.org | 76 - emacs-lisp/racket.org | 14 - emacs-lisp/setupfiles/latex-base.org | 16 - emacs-lisp/tempel.org | 167 --- emacs-lisp/tempel_templates.org | 225 --- emacs-lisp/templates.lisp | 174 --- emacs-lisp/treemacs.org | 25 - emacs-lisp/vertico.org | 14 - emacs-lisp/vterm.org | 19 - emacs-lisp/vulpea.org | 19 - emacs-lisp/whitespace_el.org | 26 - flake.lock | 1280 ----------------- flake.nix | 213 --- home-manager/modules/3d-printing.nix | 39 - home-manager/modules/alacritty/alacritty.yaml | 565 -------- home-manager/modules/alacritty/default.nix | 26 - home-manager/modules/bash/bash_profile | 7 - home-manager/modules/bash/bashrc | 141 -- home-manager/modules/bash/default.nix | 53 - home-manager/modules/cmdline-utils.nix | 64 - home-manager/modules/default.nix | 22 - home-manager/modules/emacs/.emacs | 136 -- home-manager/modules/emacs/.emacs.d/.keep | 0 .../modules/emacs/.emacs.d/lisp/.keep | 0 .../emacs/.emacs.d/lisp/man-preview.el | 305 ---- .../modules/emacs/.emacs.d/lisp/org-alert.el | 125 -- .../emacs/.emacs.d/lisp/org-task-dump/COPYING | 341 ----- .../org-task-dump-logs-as-csv.el | 26 - .../lisp/org-task-dump/org-task-dump-logs.el | 52 - .../org-task-generate-calendar-view.el | 103 -- .../lisp/org-task-dump/org-task-svg.el | 42 - .../modules/emacs/.emacs.d/lisp/ytplay.el | 107 -- .../modules/emacs/.emacs.d/org/base.org | 414 ------ .../emacs/.emacs.d/org/emacs-webkit.org | 35 - .../modules/emacs/.emacs.d/org/exwm.org | 77 - .../modules/emacs/.emacs.d/org/treemacs.org | 26 - .../emacs/.emacs.d/snippets/org-mode/box | 6 - .../emacs/.emacs.d/snippets/org-mode/cubed | 4 - .../.emacs.d/snippets/org-mode/display-math | 6 - .../.emacs.d/snippets/org-mode/inline-math | 4 - .../emacs/.emacs.d/snippets/org-mode/r | 7 - .../emacs/.emacs.d/snippets/org-mode/square | 4 - home-manager/modules/emacs/default.nix | 155 -- .../modules/emacs/straight-versions.el | 104 -- home-manager/modules/gpg.nix | 57 - home-manager/modules/graphical-programs.nix | 39 - home-manager/modules/multimc.nix | 22 - home-manager/modules/optimisation.nix | 1 - home-manager/modules/pantalaimon.nix | 50 - home-manager/modules/pulseaudio/daemon.conf | 19 - home-manager/modules/pulseaudio/default.nix | 13 - home-manager/modules/ssh/config | 14 - home-manager/modules/ssh/default.nix | 35 - home-manager/modules/webdev.nix | 27 - home-manager/modules/wine.nix | 36 - home-manager/modules/xmonad/default.nix | 147 -- home-manager/modules/xmonad/dunstrc | 464 ------ home-manager/modules/xmonad/keynavrc | 32 - home-manager/modules/xmonad/picom.conf | 238 --- home-manager/modules/xmonad/polybar.ini | 184 --- home-manager/modules/xmonad/xmobarrc | 114 -- home-manager/modules/xmonad/xmonad.hs | 349 ----- lefthook.yaml | 7 - modules/apps.nix | 19 - modules/default.nix | 13 - modules/devShells.nix | 26 - modules/nixos_modules.nix | 9 - modules/overlays.nix | 80 -- modules/qmk/config.h | 2 - modules/qmk/default.nix | 100 -- modules/qmk/keymap.c | 167 --- modules/qmk/rules.mk | 24 - modules/systems.nix | 84 -- nix/dyn.redalder.org.crt | 27 - nix/extra/qmk/sp84.nix | 134 -- nixos/hardware/blowhole.nix | 84 -- nixos/hardware/deck.nix | 72 - nixos/hardware/default.nix | 50 - nixos/hardware/gooseberry.nix | 90 -- nixos/hardware/heater.nix | 116 -- nixos/hardware/mark.nix | 79 - nixos/hardware/oci-nixos.nix | 58 - nixos/hardware/omen.nix | 153 -- nixos/hardware/recovery-usb.nix | 18 - nixos/hardware/toothpick.nix | 33 - nixos/modules/default.nix | 28 - nixos/modules/efi-grub.nix | 45 - nixos/modules/erase-my-darlings.nix | 84 -- nixos/modules/gaming.nix | 40 - nixos/modules/hashicorp.nix | 174 --- nixos/modules/home-manager.nix | 18 - nixos/modules/hostapd.nix | 219 --- nixos/modules/main.nix | 32 - nixos/modules/networking.nix | 22 - nixos/modules/nix-flakes.nix | 30 - nixos/modules/optimisation.nix | 24 - nixos/modules/public/grafana.nix | 181 --- nixos/modules/public/hashicorp-envoy.nix | 173 --- nixos/modules/public/telegraf.nix | 72 - nixos/modules/pulseaudio.nix | 29 - nixos/modules/serokell.nix | 31 - nixos/modules/sshd-emacs.nix | 24 - nixos/modules/template-files.nix | 98 -- nixos/modules/vault-agent.nix | 149 -- nixos/modules/vps-remote-access.nix | 35 - nixos/modules/xserver/default.nix | 135 -- nixos/modules/xserver/mine.xkb | 81 -- nixos/modules/xserver/qwerty_neo.xkb | 265 ---- nixos/profiles/iso-image.nix | 820 ----------- nixos/profiles/oracle-cloud.nix | 25 - nixos/profiles/vps.nix | 43 - nixos/profiles/workstation.nix | 100 -- nixos/secret-lib/default.nix | 46 - nixos/secret-lib/emacs.nix | 24 - nixos/secret-lib/ical2org.nix | 28 - nixos/secret-lib/mounts.nix | 20 - nixos/secret-lib/network.nix | 63 - nixos/secret-lib/password-hashes.nix | 24 - nixos/secret-lib/wireguard.nix | 118 -- nixos/systems/0001-Add-Nix-integration.patch | 287 ---- ...-Change-consul-SI-tokens-to-be-local.patch | 25 - .../blowhole/999-hostapd-2.10-lar.patch | 106 -- nixos/systems/blowhole/bind.nix | 174 --- nixos/systems/blowhole/consul.nix | 83 -- nixos/systems/blowhole/default.nix | 180 --- nixos/systems/blowhole/firewall.nix | 323 ----- nixos/systems/blowhole/hostapd.nix | 623 -------- nixos/systems/blowhole/ical2org.nix | 28 - nixos/systems/blowhole/klipper.nix | 535 ------- nixos/systems/blowhole/monitoring.nix | 558 ------- nixos/systems/blowhole/nas.nix | 167 --- nixos/systems/blowhole/nomad.nix | 180 --- nixos/systems/blowhole/uterranix.nix | 71 - nixos/systems/blowhole/vault-agent.nix | 74 - nixos/systems/blowhole/vault.nix | 85 -- nixos/systems/blowhole/zones/blocked.zone | 15 - .../blowhole/zones/hosts.in.redalder.org.zone | 16 - .../blowhole/zones/in.redalder.org.zone | 26 - nixos/systems/deck.nix | 86 -- nixos/systems/heater.nix | 86 -- nixos/systems/mark.nix | 32 - nixos/systems/omen.nix | 198 --- nixos/systems/recovery-usb.nix | 53 - nixos/systems/toothpick/consul.nix | 56 - nixos/systems/toothpick/default.nix | 195 --- nixos/systems/toothpick/nomad.nix | 133 -- nixos/systems/toothpick/u2t.nix | 18 - nixos/systems/toothpick/vault-agent.nix | 95 -- nixos/systems/tweedledee.nix | 40 - nixos/systems/tweedledum.nix | 40 - nixos/systems/zfs-installation.nix | 51 - org | 1 - overlays/bootloadHID.nix | 24 - overlays/bwrap-x.nix | 139 -- overlays/emacs-ng.nix | 236 --- overlays/emacs-rofi/default.nix | 10 - overlays/emacs-rofi/emacs-rofi | 9 - overlays/emacsclient-remote/default.nix | 17 - .../emacsclient-remote/emacsclient-remote | 49 - overlays/gpg-key/default.nix | 16 - overlays/gpg-key/gpg-key | 44 - overlays/hidapitester.nix | 42 - overlays/ical2org.nix | 74 - overlays/mainsail/default.nix | 9 - overlays/mainsail/mainsail.nix | 20 - overlays/nil.nix | 8 - overlays/nixng.nix | 7 - overlays/nomad-driver-containerd-nix.nix | 15 - overlays/screenshot/default.nix | 21 - overlays/screenshot/screenshot | 20 - overlays/slovensko-eid.nix | 126 -- overlays/uboot-clara-hd.nix | 28 - overlays/udp-over-tcp.nix | 24 - overlays/zfs-relmount.nix | 11 - overlays/zfs-relmount.sh | 82 -- redalder.org.crt | 33 - redalder.org.crt.license | 3 - secret | 1 - terranix/blowhole.nix | 105 -- terranix/default.nix | 147 -- terranix/modules/consul_agent.nix | 228 --- terranix/modules/nomad_server.nix | 256 ---- terranix/modules/push_approles.nix | 109 -- terranix/pki.nix | 41 - terranix/toothpick.nix | 73 - 227 files changed, 21887 deletions(-) delete mode 100644 .envrc delete mode 100644 .gitignore delete mode 100644 .gitmodules delete mode 100644 0001-Allow-null-in-authMountTuneSchema.patch delete mode 100644 COPYING delete mode 100644 COPYING.LESSER delete mode 100644 LICENSES/LGPL-3.0-or-later.txt delete mode 100644 README.md delete mode 100644 README.org delete mode 100644 default.nix delete mode 100644 emacs-lisp/.gitignore delete mode 100644 emacs-lisp/avy.org delete mode 100644 emacs-lisp/c_language_support.org delete mode 100644 emacs-lisp/corfu.org delete mode 100644 emacs-lisp/cosult.org delete mode 100644 emacs-lisp/daylies.org delete mode 100644 emacs-lisp/dired.org delete mode 100644 emacs-lisp/dirvish.org delete mode 100644 emacs-lisp/display_settings.org delete mode 100644 emacs-lisp/el_secretario.org delete mode 100644 emacs-lisp/elixir.org delete mode 100644 emacs-lisp/emacs_rofi.org delete mode 100644 emacs-lisp/email.org delete mode 100644 emacs-lisp/embark.org delete mode 100644 emacs-lisp/ement_el.org delete mode 100644 emacs-lisp/filling_and_unfilling_paragraphs.org delete mode 100644 emacs-lisp/flycheck.org delete mode 100644 emacs-lisp/general_el.org delete mode 100644 emacs-lisp/go.org delete mode 100644 emacs-lisp/keybindings.org delete mode 100644 emacs-lisp/lsp.org delete mode 100644 emacs-lisp/magit.org delete mode 100644 emacs-lisp/marginalia.org delete mode 100644 emacs-lisp/meow.org delete mode 100644 emacs-lisp/native_compilation.org delete mode 100644 emacs-lisp/orderless.org delete mode 100644 emacs-lisp/org_agenda.org delete mode 100644 emacs-lisp/org_gtd.org delete mode 100644 emacs-lisp/org_habit.org delete mode 100644 emacs-lisp/org_mode.org delete mode 100644 emacs-lisp/org_roam.org delete mode 100644 emacs-lisp/org_variable_pitch.org delete mode 100644 emacs-lisp/popper.org delete mode 100644 emacs-lisp/racket.org delete mode 100644 emacs-lisp/setupfiles/latex-base.org delete mode 100644 emacs-lisp/tempel.org delete mode 100644 emacs-lisp/tempel_templates.org delete mode 100644 emacs-lisp/templates.lisp delete mode 100644 emacs-lisp/treemacs.org delete mode 100644 emacs-lisp/vertico.org delete mode 100644 emacs-lisp/vterm.org delete mode 100644 emacs-lisp/vulpea.org delete mode 100644 emacs-lisp/whitespace_el.org delete mode 100644 flake.lock delete mode 100644 flake.nix delete mode 100644 home-manager/modules/3d-printing.nix delete mode 100644 home-manager/modules/alacritty/alacritty.yaml delete mode 100644 home-manager/modules/alacritty/default.nix delete mode 100644 home-manager/modules/bash/bash_profile delete mode 100644 home-manager/modules/bash/bashrc delete mode 100644 home-manager/modules/bash/default.nix delete mode 100644 home-manager/modules/cmdline-utils.nix delete mode 100644 home-manager/modules/default.nix delete mode 100755 home-manager/modules/emacs/.emacs delete mode 100644 home-manager/modules/emacs/.emacs.d/.keep delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/.keep delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/man-preview.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-alert.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/COPYING delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs-as-csv.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-generate-calendar-view.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-svg.el delete mode 100644 home-manager/modules/emacs/.emacs.d/lisp/ytplay.el delete mode 100644 home-manager/modules/emacs/.emacs.d/org/base.org delete mode 100644 home-manager/modules/emacs/.emacs.d/org/emacs-webkit.org delete mode 100644 home-manager/modules/emacs/.emacs.d/org/exwm.org delete mode 100644 home-manager/modules/emacs/.emacs.d/org/treemacs.org delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/box delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/cubed delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/display-math delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/inline-math delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/r delete mode 100644 home-manager/modules/emacs/.emacs.d/snippets/org-mode/square delete mode 100644 home-manager/modules/emacs/default.nix delete mode 100644 home-manager/modules/emacs/straight-versions.el delete mode 100644 home-manager/modules/gpg.nix delete mode 100644 home-manager/modules/graphical-programs.nix delete mode 100644 home-manager/modules/multimc.nix delete mode 120000 home-manager/modules/optimisation.nix delete mode 100644 home-manager/modules/pantalaimon.nix delete mode 100644 home-manager/modules/pulseaudio/daemon.conf delete mode 100644 home-manager/modules/pulseaudio/default.nix delete mode 100644 home-manager/modules/ssh/config delete mode 100644 home-manager/modules/ssh/default.nix delete mode 100644 home-manager/modules/webdev.nix delete mode 100644 home-manager/modules/wine.nix delete mode 100644 home-manager/modules/xmonad/default.nix delete mode 100644 home-manager/modules/xmonad/dunstrc delete mode 100644 home-manager/modules/xmonad/keynavrc delete mode 100644 home-manager/modules/xmonad/picom.conf delete mode 100644 home-manager/modules/xmonad/polybar.ini delete mode 100644 home-manager/modules/xmonad/xmobarrc delete mode 100644 home-manager/modules/xmonad/xmonad.hs delete mode 100644 lefthook.yaml delete mode 100644 modules/apps.nix delete mode 100644 modules/default.nix delete mode 100644 modules/devShells.nix delete mode 100644 modules/nixos_modules.nix delete mode 100644 modules/overlays.nix delete mode 100644 modules/qmk/config.h delete mode 100644 modules/qmk/default.nix delete mode 100644 modules/qmk/keymap.c delete mode 100644 modules/qmk/rules.mk delete mode 100644 modules/systems.nix delete mode 100644 nix/dyn.redalder.org.crt delete mode 100644 nix/extra/qmk/sp84.nix delete mode 100644 nixos/hardware/blowhole.nix delete mode 100644 nixos/hardware/deck.nix delete mode 100644 nixos/hardware/default.nix delete mode 100644 nixos/hardware/gooseberry.nix delete mode 100644 nixos/hardware/heater.nix delete mode 100644 nixos/hardware/mark.nix delete mode 100644 nixos/hardware/oci-nixos.nix delete mode 100644 nixos/hardware/omen.nix delete mode 100644 nixos/hardware/recovery-usb.nix delete mode 100644 nixos/hardware/toothpick.nix delete mode 100644 nixos/modules/default.nix delete mode 100644 nixos/modules/efi-grub.nix delete mode 100644 nixos/modules/erase-my-darlings.nix delete mode 100644 nixos/modules/gaming.nix delete mode 100644 nixos/modules/hashicorp.nix delete mode 100644 nixos/modules/home-manager.nix delete mode 100644 nixos/modules/hostapd.nix delete mode 100644 nixos/modules/main.nix delete mode 100644 nixos/modules/networking.nix delete mode 100644 nixos/modules/nix-flakes.nix delete mode 100644 nixos/modules/optimisation.nix delete mode 100644 nixos/modules/public/grafana.nix delete mode 100644 nixos/modules/public/hashicorp-envoy.nix delete mode 100644 nixos/modules/public/telegraf.nix delete mode 100644 nixos/modules/pulseaudio.nix delete mode 100644 nixos/modules/serokell.nix delete mode 100644 nixos/modules/sshd-emacs.nix delete mode 100644 nixos/modules/template-files.nix delete mode 100644 nixos/modules/vault-agent.nix delete mode 100644 nixos/modules/vps-remote-access.nix delete mode 100644 nixos/modules/xserver/default.nix delete mode 100644 nixos/modules/xserver/mine.xkb delete mode 100644 nixos/modules/xserver/qwerty_neo.xkb delete mode 100644 nixos/profiles/iso-image.nix delete mode 100644 nixos/profiles/oracle-cloud.nix delete mode 100644 nixos/profiles/vps.nix delete mode 100644 nixos/profiles/workstation.nix delete mode 100644 nixos/secret-lib/default.nix delete mode 100644 nixos/secret-lib/emacs.nix delete mode 100644 nixos/secret-lib/ical2org.nix delete mode 100644 nixos/secret-lib/mounts.nix delete mode 100644 nixos/secret-lib/network.nix delete mode 100644 nixos/secret-lib/password-hashes.nix delete mode 100644 nixos/secret-lib/wireguard.nix delete mode 100644 nixos/systems/0001-Add-Nix-integration.patch delete mode 100644 nixos/systems/0001-Revert-Change-consul-SI-tokens-to-be-local.patch delete mode 100644 nixos/systems/blowhole/999-hostapd-2.10-lar.patch delete mode 100644 nixos/systems/blowhole/bind.nix delete mode 100644 nixos/systems/blowhole/consul.nix delete mode 100644 nixos/systems/blowhole/default.nix delete mode 100644 nixos/systems/blowhole/firewall.nix delete mode 100644 nixos/systems/blowhole/hostapd.nix delete mode 100644 nixos/systems/blowhole/ical2org.nix delete mode 100644 nixos/systems/blowhole/klipper.nix delete mode 100644 nixos/systems/blowhole/monitoring.nix delete mode 100644 nixos/systems/blowhole/nas.nix delete mode 100644 nixos/systems/blowhole/nomad.nix delete mode 100644 nixos/systems/blowhole/uterranix.nix delete mode 100644 nixos/systems/blowhole/vault-agent.nix delete mode 100644 nixos/systems/blowhole/vault.nix delete mode 100644 nixos/systems/blowhole/zones/blocked.zone delete mode 100644 nixos/systems/blowhole/zones/hosts.in.redalder.org.zone delete mode 100644 nixos/systems/blowhole/zones/in.redalder.org.zone delete mode 100644 nixos/systems/deck.nix delete mode 100644 nixos/systems/heater.nix delete mode 100644 nixos/systems/mark.nix delete mode 100644 nixos/systems/omen.nix delete mode 100644 nixos/systems/recovery-usb.nix delete mode 100644 nixos/systems/toothpick/consul.nix delete mode 100644 nixos/systems/toothpick/default.nix delete mode 100644 nixos/systems/toothpick/nomad.nix delete mode 100644 nixos/systems/toothpick/u2t.nix delete mode 100644 nixos/systems/toothpick/vault-agent.nix delete mode 100644 nixos/systems/tweedledee.nix delete mode 100644 nixos/systems/tweedledum.nix delete mode 100644 nixos/systems/zfs-installation.nix delete mode 160000 org delete mode 100644 overlays/bootloadHID.nix delete mode 100644 overlays/bwrap-x.nix delete mode 100644 overlays/emacs-ng.nix delete mode 100644 overlays/emacs-rofi/default.nix delete mode 100644 overlays/emacs-rofi/emacs-rofi delete mode 100644 overlays/emacsclient-remote/default.nix delete mode 100644 overlays/emacsclient-remote/emacsclient-remote delete mode 100644 overlays/gpg-key/default.nix delete mode 100644 overlays/gpg-key/gpg-key delete mode 100644 overlays/hidapitester.nix delete mode 100644 overlays/ical2org.nix delete mode 100644 overlays/mainsail/default.nix delete mode 100644 overlays/mainsail/mainsail.nix delete mode 100644 overlays/nil.nix delete mode 100644 overlays/nixng.nix delete mode 100644 overlays/nomad-driver-containerd-nix.nix delete mode 100644 overlays/screenshot/default.nix delete mode 100644 overlays/screenshot/screenshot delete mode 100644 overlays/slovensko-eid.nix delete mode 100644 overlays/uboot-clara-hd.nix delete mode 100644 overlays/udp-over-tcp.nix delete mode 100644 overlays/zfs-relmount.nix delete mode 100644 overlays/zfs-relmount.sh delete mode 100644 redalder.org.crt delete mode 100644 redalder.org.crt.license delete mode 160000 secret delete mode 100644 terranix/blowhole.nix delete mode 100644 terranix/default.nix delete mode 100644 terranix/modules/consul_agent.nix delete mode 100644 terranix/modules/nomad_server.nix delete mode 100644 terranix/modules/push_approles.nix delete mode 100644 terranix/pki.nix delete mode 100644 terranix/toothpick.nix diff --git a/.envrc b/.envrc deleted file mode 100644 index 1670a3b..0000000 --- a/.envrc +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -use flake diff --git a/.gitignore b/.gitignore deleted file mode 100644 index bd9dcdf..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -result -result-* -.direnv/ - -.terraform -.terraform.lock.hcl diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1c76abc..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "org"] - path = org - url = https://gitea.redalder.org/Magic_RB/org -[submodule "secret"] - path = secret - url = git@github:MagicRB/dotfiles-secret diff --git a/0001-Allow-null-in-authMountTuneSchema.patch b/0001-Allow-null-in-authMountTuneSchema.patch deleted file mode 100644 index ee179e1..0000000 --- a/0001-Allow-null-in-authMountTuneSchema.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 1bc15c644e6e39f268b1d06c343d8a9a4fceab2d Mon Sep 17 00:00:00 2001 -From: Magic_RB -Date: Fri, 31 Mar 2023 23:23:41 +0200 -Subject: [PATCH] Allow null in authMountTuneSchema - -Signed-off-by: Magic_RB ---- - internal/provider/validators.go | 10 ++++++++++ - vault/auth_mount.go | 8 ++++---- - 2 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/internal/provider/validators.go b/internal/provider/validators.go -index 15e23212..89a9d7e1 100644 ---- a/internal/provider/validators.go -+++ b/internal/provider/validators.go -@@ -39,6 +39,16 @@ func ValidateStringSlug(i interface{}, k string) (s []string, es []error) { - return - } - -+func ValidateAllowNull(f func(interface{}, string) ([]string, []error)) (func(interface{}, string) ([]string, []error)) { -+ return func(i interface{}, k string) (s []string, es []error) { -+ if i == nil { -+ return -+ } else { -+ return f(i, k) -+ } -+ }; -+} -+ - func ValidateDuration(i interface{}, k string) (s []string, es []error) { - v, ok := i.(string) - if !ok { -diff --git a/vault/auth_mount.go b/vault/auth_mount.go -index 2e1854f8..9bb77bc2 100644 ---- a/vault/auth_mount.go -+++ b/vault/auth_mount.go -@@ -28,13 +28,13 @@ func authMountTuneSchema() *schema.Schema { - Type: schema.TypeString, - Optional: true, - Description: "Specifies the default time-to-live duration. This overrides the global default. A value of 0 is equivalent to the system default TTL", -- ValidateFunc: provider.ValidateDuration, -+ ValidateFunc: provider.ValidateAllowNull(provider.ValidateDuration), - }, - "max_lease_ttl": { - Type: schema.TypeString, - Optional: true, - Description: "Specifies the maximum time-to-live duration. This overrides the global default. A value of 0 are equivalent and set to the system max TTL.", -- ValidateFunc: provider.ValidateDuration, -+ ValidateFunc: provider.ValidateAllowNull(provider.ValidateDuration), - }, - "audit_non_hmac_request_keys": { - Type: schema.TypeList, -@@ -52,7 +52,7 @@ func authMountTuneSchema() *schema.Schema { - Type: schema.TypeString, - Optional: true, - Description: "Specifies whether to show this mount in the UI-specific listing endpoint. Valid values are \"unauth\" or \"hidden\". If not set, behaves like \"hidden\".", -- ValidateFunc: validation.StringInSlice([]string{"unauth", "hidden"}, false), -+ ValidateFunc: provider.ValidateAllowNull(validation.StringInSlice([]string{"unauth", "hidden"}, false)), - }, - "passthrough_request_headers": { - Type: schema.TypeList, -@@ -70,7 +70,7 @@ func authMountTuneSchema() *schema.Schema { - Type: schema.TypeString, - Optional: true, - Description: "Specifies the type of tokens that should be returned by the mount.", -- ValidateFunc: validation.StringInSlice([]string{"default-service", "default-batch", "service", "batch"}, false), -+ ValidateFunc: provider.ValidateAllowNull(validation.StringInSlice([]string{"default-service", "default-batch", "service", "batch"}, false)), - }, - }, - }, --- -2.39.1 - diff --git a/COPYING b/COPYING deleted file mode 100644 index f288702..0000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/COPYING.LESSER b/COPYING.LESSER deleted file mode 100644 index 0a04128..0000000 --- a/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/LICENSES/LGPL-3.0-or-later.txt b/LICENSES/LGPL-3.0-or-later.txt deleted file mode 100644 index 513d1c0..0000000 --- a/LICENSES/LGPL-3.0-or-later.txt +++ /dev/null @@ -1,304 +0,0 @@ -GNU LESSER GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. - -0. Additional Definitions. - -As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. - -"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. - -An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. - -A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". - -The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. - -The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. - -1. Exception to Section 3 of the GNU GPL. -You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. - -2. Conveying Modified Versions. -If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: - - a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. - -3. Object Code Incorporating Material from Library Header Files. -The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license document. - -4. Combined Works. -You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: - - a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license document. - - c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. - - e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) - -5. Combined Libraries. -You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. - -6. Revised Versions of the GNU Lesser General Public License. -The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. - -GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright © 2007 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -Preamble - -The GNU General Public License is a free, copyleft license for software and other kinds of works. - -The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS - -0. Definitions. - -“This License” refers to version 3 of the GNU General Public License. - -“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - -“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. - -To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. - -A “covered work” means either the unmodified Program or a work based on the Program. - -To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - -To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - -An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - -1. Source Code. -The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. - -A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - -The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - -The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -2. Basic Permissions. -All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - -3. Protecting Users' Legal Rights From Anti-Circumvention Law. -No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - -4. Conveying Verbatim Copies. -You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - -5. Conveying Modified Source Versions. -You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. - - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. - -A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - -6. Conveying Non-Source Forms. -You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - -A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - -“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - -The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - -7. Additional Terms. -“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. - -All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - -8. Termination. -You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - -9. Acceptance Not Required for Having Copies. -You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - -10. Automatic Licensing of Downstream Recipients. -Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - -An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - -11. Patents. -A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. - -A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - -In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - -A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - -12. No Surrender of Others' Freedom. -If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - -13. Use with the GNU Affero General Public License. -Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. - -14. Revised Versions of this License. -The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - -Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - -15. Disclaimer of Warranty. -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. Limitation of Liability. -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -17. Interpretation of Sections 15 and 16. -If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. - -You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . - -The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/README.md b/README.md deleted file mode 100644 index 8dde83d..0000000 --- a/README.md +++ /dev/null @@ -1,25 +0,0 @@ -This repo contains my dotfiles, you'll find the NixOS configurations for all my machines that are running NixOS and home-manager configs for those that are not. Next you'll find my Emacs configuration and the Hashicorp stack. Lastly there are a few random thingies that aren't big enough to mention, but still cool if you're interested in them. - - -# Structure - -- [nixos/](nixos) - configuration files related to [NixOS](https://nixos.org/) itself - - [hardware/](nixos/hardware) - configuration files specific to the hardware of my physical machines - - [modules/](nixos/modules/) - reusable [NixOS](https://nixos.org/) modules of varying quality - - [profiles/](nixos/profiles) - machine profiles, like `vps` or `workstation`, they apply settings to a group of machines - - [secret-lib/](nixos/secret-lib) - a library bridging the gap between my public and public configuration - - [systems/](nixos/systems) - the actual system configurations -- [nix/](nix) - legacy junk I need to clean up -- [home-manager/](home-manager) - configration files related to [home-manager](https://github.com/nix-community/home-manager) - - [modules/](home-manager/modules) - reusable [home-manager](https://github.com/nix-community/home-manager) modules of varying quality -- [modules/](modules) - [flake-parts](https://github.com/hercules-ci/flake-parts) modules that drive this flake -- [overlays/](overlays) - [nixpkgs](https://github.com/NixOS/nixpkgs) overlays, some are just imports and slight modifications of externals overlays -- [org/](org) - once again legacy junk I need to clean up -- [secret/](secret) - submodule containing the secret parts of my dotfiles -- [terraform/](terraform) - the [Terraform](https://www.terraform.io/) configuration driving the mostly [HashiCorp](https://www.hashicorp.com/) infrastructure in my configuration - - -# License - -This project follows [REUSE](https://reuse.software/) so all files have their own specific license. But as of writing this, the only license in use is `LGPLv3.0`. The project root contains a [COPYING](COPYING) and [COPYING.LESSER](COPYING.LESSER) as required for the proper use of the LGPL license. - diff --git a/README.org b/README.org deleted file mode 100644 index 05bd731..0000000 --- a/README.org +++ /dev/null @@ -1,26 +0,0 @@ -# -*- eval: (add-hook 'after-save-hook (lambda () (org-md-export-to-markdown nil)) nil t)-*- -#+OPTIONS: toc:nil ^:{} -#+TITLE: magic_rb's dotfiles - - -This repo contains my dotfiles, you'll find the NixOS configurations for all my machines that are running NixOS and home-manager configs for those that are not. Next you'll find my Emacs configuration and the Hashicorp stack. Lastly there are a few random thingies that aren't big enough to mention, but still cool if you're interested in them. - -* Structure -- [[file:nixos][nixos/]] - configuration files related to [[https://nixos.org/][NixOS]] itself - + [[file:nixos/hardware][hardware/]] - configuration files specific to the hardware of my physical machines - + [[file:nixos/modules/][modules/]] - reusable [[https://nixos.org/][NixOS]] modules of varying quality - + [[file:nixos/profiles][profiles/]] - machine profiles, like ~vps~ or ~workstation~, they apply settings to a group of machines - + [[file:nixos/secret-lib][secret-lib/]] - a library bridging the gap between my public and public configuration - + [[file:nixos/systems][systems/]] - the actual system configurations -- [[file:nix][nix/]] - legacy junk I need to clean up -- [[file:home-manager][home-manager/]] - configration files related to [[https://github.com/nix-community/home-manager][home-manager]] - + [[file:home-manager/modules][modules/]] - reusable [[https://github.com/nix-community/home-manager][home-manager]] modules of varying quality -- [[file:modules][modules/]] - [[https://github.com/hercules-ci/flake-parts][flake-parts]] modules that drive this flake -- [[file:overlays][overlays/]] - [[https://github.com/NixOS/nixpkgs][nixpkgs]] overlays, some are just imports and slight modifications of externals overlays -- [[file:org][org/]] - once again legacy junk I need to clean up -- [[file:secret][secret/]] - submodule containing the secret parts of my dotfiles -- [[file:terraform][terraform/]] - the [[https://www.terraform.io/][Terraform]] configuration driving the mostly [[https://www.hashicorp.com/][HashiCorp]] infrastructure in my configuration - -* License -This project follows [[https://reuse.software/][REUSE]] so all files have their own specific license. But as of writing this, the only license in use is ~LGPLv3.0~. The project root contains a [[file:COPYING][COPYING]] and [[file:COPYING.LESSER][COPYING.LESSER]] as required for the proper use of the LGPL license. - diff --git a/default.nix b/default.nix deleted file mode 100644 index a26e67c..0000000 --- a/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -(import ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) { - src = ./.; - }) -.defaultNix diff --git a/emacs-lisp/.gitignore b/emacs-lisp/.gitignore deleted file mode 100644 index abf136d..0000000 --- a/emacs-lisp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.el diff --git a/emacs-lisp/avy.org b/emacs-lisp/avy.org deleted file mode 100644 index ff864e4..0000000 --- a/emacs-lisp/avy.org +++ /dev/null @@ -1,18 +0,0 @@ -:PROPERTIES: -:ID: e93571d6-ae50-4aca-8b2f-6ada70655be3 -:END: -#+title: Avy -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -~avy~ is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also ~ace-jump-mode~ and ~vim-easymotion~ - ~avy~ uses the same idea. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package avy - :straight t) -#+END_SRC diff --git a/emacs-lisp/c_language_support.org b/emacs-lisp/c_language_support.org deleted file mode 100644 index bb55ccc..0000000 --- a/emacs-lisp/c_language_support.org +++ /dev/null @@ -1,12 +0,0 @@ -:PROPERTIES: -:header-args:emacs-lisp: :comments link :results none -:ID: d4ebe1b8-db78-42af-a1d8-70060fee6c89 -:END: -#+title: C++ Language Support -#+filetags: emacs-load - -#+begin_src elisp - (use-package clang-format - :straight t) -#+end_src - diff --git a/emacs-lisp/corfu.org b/emacs-lisp/corfu.org deleted file mode 100644 index 0e06f08..0000000 --- a/emacs-lisp/corfu.org +++ /dev/null @@ -1,101 +0,0 @@ -:PROPERTIES: -:ID: a4eab1d7-8928-438e-9ccc-1e3a65765534 -:END: -#+title: Corfu -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+begin_quote -Corfu enhances completion at point with a small completion popup. The current candidates are shown in a popup below or above the point. Corfu is the minimalistic completion-in-region counterpart of the Vertico minibuffer UI. -#+end_quote - -#+begin_src emacs-lisp - (use-package corfu - :straight t - :custom - (corfu-separator ?\s) ;; M-SPC - :general - ("C-c c" 'completion-at-point) - :init - (global-corfu-mode)) -#+end_src - -* Company - -#+begin_src emacs-lisp :noweb yes :exports none - (use-package company - :defer t - :init - <>) -#+end_src - -Disable ~company~ globally, because company enables itself... - -#+name: company-init -#+begin_src emacs-lisp - (setq company-global-modes nil) -#+end_src - -* LSP Mode - -#+begin_src emacs-lisp :noweb yes :exports none - (use-package corfu-lsp-mode - :no-require t - :after (lsp-mode corfu) - :init - <>) -#+end_src - -Make ~lsp-mode~ not turn on ~company~ first thing after start, so annoying. - -#+name: lsp-completion-provider -#+begin_src emacs-lisp :tangle no - (setq lsp-completion-provider :none) -#+end_src - -* Cape - -~cape~ provides useful ~capfs~, such as file and ispell completion, stuff that ~company~ has built-in. - -#+begin_src emacs-lisp :noweb yes :exports none - (use-package cape - :straight t - :after (corfu) - :init - <>) -#+end_src - -Hook ~cape~ onto both ~text-mode~ and ~prog-mode~. - -#+name: cape-hooks -#+begin_src emacs-lisp :tangle no - (defun cape-setup-capf-prog () - "Setup cape completions for prog-mode" - (cape-setup-capf)) - - (defun cape-setup-capf-text () - "Setup cape completions for text-mode" - (add-hook 'completion-at-point-functions #'cape-ispell) - (cape-setup-capf)) - - (defun cape-setup-capf () - "Setup cape completions" - (add-hook 'completion-at-point-functions #'cape-file) - (add-hook 'completion-at-point-functions #'cape-tex)) - :hook - ((prog-mode . cape-setup-capf-prog) - (text-mode . cape-setup-capf-text)) -#+end_src - -~lsp-mode~ completely wipes ~completion-at-point-functions~, so we need re-add ~cape~ after it removes everything. - -#+begin_src emacs-lisp - (use-package cape-lsp-mode - :no-require t - :after (cape lsp-mode) - :hook - ((lsp-mode . #'cape-setup-capf))) -#+end_src diff --git a/emacs-lisp/cosult.org b/emacs-lisp/cosult.org deleted file mode 100644 index a44ff1c..0000000 --- a/emacs-lisp/cosult.org +++ /dev/null @@ -1,63 +0,0 @@ -:PROPERTIES: -:ID: db1d0122-58d6-4dec-84f6-afcb52937fc7 -:END: -#+title: Consult -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -Consult provides practical commands based on the Emacs completion function completing-read. Completion allows you to quickly select an item from a list of candidates. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp :results none - (use-package consult - :straight t - :bind (("C-x b" . consult-buffer) - ("C-x 4 b" . consult-buffer-other-window) - ("C-x 5 b" . consult-buffer-other-frame) - ;; M-s bindings (search-map) - ("M-s r" . consult-ripgrep) - ("M-s f" . consult-find)) - :init - (defun compat-string-width (&rest args) - (apply #'string-width args)) - (setq - consult-project-root-function #'projectile-project-root - consult-ripgrep-args "rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --line-number --hidden ." - consult-find-args "find .")) -#+END_SRC - -Also enable ~fd~ support, as that ignores paths listed in .gitignore unlike ~find~.. - -#+begin_src emacs-lisp - (use-package consult-fd - :no-require t - :after (consult) - :init - (defvar consult--fd-command "fd") - (defun consult--fd-builder (input) - (unless consult--fd-command - (setq consult--fd-command - (if (eq 0 (call-process-shell-command "fdfind")) - "fdfind" - "fd"))) - (pcase-let* ((`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (funcall consult--regexp-compiler - arg 'extended t))) - (when re - (list :command (append - (list consult--fd-command - "--color=never" "--full-path" - (consult--join-regexps re 'extended)) - opts) - :highlight hl)))) - - (defun consult-fd (&optional dir initial) - (interactive "P") - (let* ((prompt-dir (consult--directory-prompt "Fd" dir)) - (default-directory (cdr prompt-dir))) - (find-file (consult--find (car prompt-dir) #'consult--fd-builder initial))))) -#+end_src diff --git a/emacs-lisp/daylies.org b/emacs-lisp/daylies.org deleted file mode 100644 index e346aa4..0000000 --- a/emacs-lisp/daylies.org +++ /dev/null @@ -1,25 +0,0 @@ -:PROPERTIES: -:ID: f4a10ea3-a1df-42cc-b436-08d859272679 -:END: -#+title: Daylies -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Daylies, are like scratch buffers, but they are saved. So I can shove stuff in them and they are nicely kept for later reference. Kind of INBOX. - -#+begin_src emacs-lisp - (defun point-scratch-to-daylies () - (save-excursion - (with-current-buffer "*scratch*" - (org-mode) - (set-visited-file-name - (format "~/roam/daylies/%s.org" - (format-time-string "%Y-%m-%d"))) - (rename-buffer "*scratch*")))) - - (add-hook 'emacs-startup-hook 'point-scratch-to-daylies) -#+end_src - diff --git a/emacs-lisp/dired.org b/emacs-lisp/dired.org deleted file mode 100644 index 4e7109b..0000000 --- a/emacs-lisp/dired.org +++ /dev/null @@ -1,14 +0,0 @@ -:PROPERTIES: -:ID: 484fd154-6f7c-4313-8f79-7b502b7a1c56 -:END: -#+title: Dired -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Dired is inclueded with Emacs since forever, I use a wrapper called [[id:67919dd9-2aa0-4b89-8c96-0441a54e7b03][dirvish]]. - -#+begin_src emacs-lisp -#+end_src diff --git a/emacs-lisp/dirvish.org b/emacs-lisp/dirvish.org deleted file mode 100644 index b68ff95..0000000 --- a/emacs-lisp/dirvish.org +++ /dev/null @@ -1,15 +0,0 @@ -:PROPERTIES: -:ID: 67919dd9-2aa0-4b89-8c96-0441a54e7b03 -:END: -#+title: Dirvish -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+begin_src emacs-lisp - (use-package dirvish - :straight t) -#+end_src - diff --git a/emacs-lisp/display_settings.org b/emacs-lisp/display_settings.org deleted file mode 100644 index 7003821..0000000 --- a/emacs-lisp/display_settings.org +++ /dev/null @@ -1,82 +0,0 @@ -:PROPERTIES: -:ID: a26802fe-8bc3-458e-8f06-7cb856fef2cd -:END: -#+title: Display Settings -#+filetags: emacs-load - -Adjust the font, based on the specific host. - -#+begin_src emacs-lisp - (use-package isoevka-font - :no-require t - :init - (defvar magic_rb/fixed-width-font "Iosevka Term Extended" - "The font used for fixed width text.") - (defvar magic_rb/variable-pitch-font "Iosevka Aile" - "The font used for variable pitch text.") - - (defun magic_rb/apply-fonts () - (interactive) - (pcase (system-name) - ("heater" (set-face-attribute 'default nil :family magic_rb/fixed-width-font :slant 'normal :height 105)) - ("omen" (set-face-attribute 'default nil :family magic_rb/fixed-width-font :slant 'normal :height 105))) - (set-face-attribute 'fixed-pitch nil :family magic_rb/fixed-width-font :slant 'normal :height 1.0) - (set-face-attribute 'variable-pitch nil :family magic_rb/variable-pitch-font :height 1.0)) - :config - (magic_rb/apply-fonts)) -#+end_src - -Load Modus Vivendi, but change the background color to not-black, it's a bit less depressing and in my opinion nicer -on the eyes. - -#+BEGIN_SRC emacs-lisp - (use-package modus-vivendi-semi-black - :no-require t - :init - (setq modus-vivendi-theme-override-colors-alist - '(("bg-main" . "#111519"))) - :config - (load-theme 'modus-vivendi t)) -#+END_SRC - -Enable ~doom-modeline~, much better than the default and unlike ~powerline~ it's usable with TRAMP, so that's great. - -#+BEGIN_SRC emacs-lisp - (use-package doom-modeline - :straight t - :config - (doom-modeline-mode)) -#+END_SRC - -Only show buffer encoding conditionally, there's no reason to have ~LF UTF-8~ down there, rather only show when the -encoding is something we don't expect, like ~CRLF~ or ~UTF-16~. Inspired by [[https://tecosaur.github.io/emacs-config/config.html#theme-modeline][tecosaur]]. - -#+BEGIN_SRC emacs-lisp - (use-package doom-modeline-conditional-buffer-encoding - :no-require t - :init - (defun tecosaur/doom-modeline-conditional-buffer-encoding () - "We expect the encoding to be LF UTF-8, so only show the modeline when this is not the case" - (setq-local doom-modeline-buffer-encoding - (unless (or (eq buffer-file-coding-system 'utf-8-unix) - (eq buffer-file-coding-system 'utf-8))))) - - :hook - (after-change-major-mode-hook . tecosaur/doom-modeline-conditional-buffer-encoding)) -#+END_SRC - -Disable GTK decorations, they're not that great looking and I don't really want to have Emacs affected by GTK themes. - -#+BEGIN_SRC emacs-lisp - (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) - (menu-bar-mode -1) - (scroll-bar-mode -1) -#+END_SRC - -Load ~all-the-icons~, it's required used by ~treemacs~ and ~doom-modeline~. You also must run -~all-the-icons-install-fonts~ if you haven't already. - -#+BEGIN_SRC emacs-lisp - (use-package all-the-icons - :straight t) -#+END_SRC diff --git a/emacs-lisp/el_secretario.org b/emacs-lisp/el_secretario.org deleted file mode 100644 index 2e93679..0000000 --- a/emacs-lisp/el_secretario.org +++ /dev/null @@ -1,33 +0,0 @@ -:PROPERTIES: -:header-args: emacs-lisp: :comments link :results none -:ID: 3ed6a2d6-c84e-439c-aca6-6978dd82bd51 -:END: -#+title: El Secretario -#+filetags: emacs-load - -#+begin_src emacs-lisp :noweb yes - (use-package el-secretario - :straight (el-secretario :type git :host nil :repo "https://git.sr.ht/~magic_rb/el-secretario") - :defer t - :config - (setq el-secretario-session-end-hook nil) - (setq el-secretario-session-start-hook nil)) -#+end_src - -#+begin_src emacs-lisp - (defun el-secretario-emacs-lisp-review () - "Review all Org-Roam nodes tagged as 'emacs-lisp'." - (interactive) - (el-secretario-start-session - (el-secretario-files-make-source - (seq-map #'car - (org-roam-db-query - [:select [nodes:file] - :from tags - :left-join nodes - :on (= tags:node-id nodes:id) - :where (like tag (quote "%\"emacs-load\""))])) - ))) -#+end_src - - diff --git a/emacs-lisp/elixir.org b/emacs-lisp/elixir.org deleted file mode 100644 index b7cce07..0000000 --- a/emacs-lisp/elixir.org +++ /dev/null @@ -1,21 +0,0 @@ -:PROPERTIES: -:ID: 9879bd30-7f42-433a-aaa4-269f5ef110fb -:END: -#+title: Elixir -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -Elixir is a dynamic, functional language for building scalable and maintainable applications. -#+END_QUOTE - -First we need a Elixir major mode. - -#+BEGIN_SRC emacs-lisp - (use-package elixir-mode - :straight t - :hook (elixir-mode-hook . lsp-deferred)) -#+END_SRC diff --git a/emacs-lisp/emacs_rofi.org b/emacs-lisp/emacs_rofi.org deleted file mode 100644 index fa574bc..0000000 --- a/emacs-lisp/emacs_rofi.org +++ /dev/null @@ -1,61 +0,0 @@ -:PROPERTIES: -:header-args:emacs-lisp: :comments link :results none -:ID: 0d92c672-5ac7-44dc-b021-cc58544f8eea -:END: -#+title: Emacs Rofi -#+filetags: emacs-load -It is possible to make a fake rofi, from emacs ~completing-read~. This file facilitates that. First we define some LISP functions. - -#+begin_src emacs-lisp - (defun completing-read-frame-popup-file (prompt file width height &rest args) - "" - (with-temp-buffer - (insert-file-contents file) - (message "%s" (string-lines (buffer-string))) - (apply #'completing-read-frame-popup prompt (string-lines (substring-no-properties (buffer-string))) args))) -#+end_src - -#+begin_src emacs-lisp - (defvar completing-read-frame nil) - - (defun completing-read-frame-popup (prompt collection &rest args) - "" - (unless completing-read-frame - (setq completing-read-frame - (make-frame `((minibuffer . only) - (name . "emacs-completing-read-float") - (unsplittable . t) - (no-other-frame . t) - (width . ,width) - (height . ,height) - (left . 0.5) - (top . 0.5)))) - (make-frame-invisible completing-read-frame)) - (make-frame-visible completing-read-frame) - (raise-frame completing-read-frame) - (with-selected-frame completing-read-frame - (unwind-protect - (let ((selection (apply #'completing-read prompt collection args))) - (make-frame-invisible completing-read-frame) - selection) - (make-frame-invisible completing-read-frame)))) -#+end_src - -Next a bash helper is needed. - -#+begin_src shell - function emacs-rofi() - { - tmp=$(mktemp) - tee > $tmp - emacs -Q --batch --eval $"(progn (require 'server) (princ (format \"%s\\n\" (server-eval-at \"server\" '(completing-read-frame-popup-file \"$1\" \"$tmp\" $2 $3)))))" - rm $tmp - } -#+end_src - -Which then ought to be used like so. - -#+begin_src shell - echo -e "test1\ntest2\ntest3" | emacs-rofi "test" -#+end_src - diff --git a/emacs-lisp/email.org b/emacs-lisp/email.org deleted file mode 100644 index 2d35860..0000000 --- a/emacs-lisp/email.org +++ /dev/null @@ -1,78 +0,0 @@ -:PROPERTIES: -:ID: b9c06fb0-a985-4649-8133-14eeeaa708bc -:ROAM_REFS: https://jherrlin.github.io/posts/emacs-mu4e/ -:END: -#+title: Email -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Email is a complicated beast, I decided to use *mu4e* and *mbsync*. - -* smtpmail - -#+BEGIN_SRC emacs-lisp :results none - (require 'smtpmail) - - (with-eval-after-load 'smtpmail - (setq smtpmail-debug-info t - message-send-mail-function 'smtpmail-send-it - smtpmail-stream-type 'starttls)) -#+END_SRC - -* mu4e -:PROPERTIES: -:ID: 9958efaf-51b2-4cee-bf37-c363d1c56055 -:END: - -#+BEGIN_SRC emacs-lisp :results none - (let* - ((mu-path - (file-name-directory (directory-file-name (file-name-directory (executable-find "mu"))))) - (mu-load-path (concat mu-path "share/emacs/site-lisp/mu4e/"))) - (add-to-list 'load-path mu-load-path)) - (require 'mu4e) - - (setq auth-sources '((:source "~/.password-store/.authinfo.gpg"))) - (setq auth-source-debug t) - - (with-eval-after-load 'mu4e - (setq mu4e-get-mail-command "usbs=$(for dev in /sys/bus/usb/devices/* ; do [ -f ${dev}/idVendor ] && [ -f ${dev}/idProduct ] && ( env cat ${dev}/idVendor | tr -d [:space:] ; printf : ; env cat ${dev}/idProduct ); done) ; yubi=0 ; for usb in $usbs ; do [ $usb = \"1050:0407\" ] && yubi=1 ; done ; [ $yubi = 1 ] && mbsync -a || exit 1" - mu4e-update-interval 300 - message-kill-buffer-on-exit t) - - (defun magic_rb/eval-file (file) - "Execute FILE and return the result of the last expression." - (eval - (ignore-errors - (read-from-whole-string - (with-temp-buffer - (insert-file-contents file) - (buffer-string)))))) - - (setq mu4e-contexts (magic_rb/eval-file "~/.emacs.d/mu4e-contexts") - ;; When Emacs is loading, mu4e will ask for which context to use. Set a default. - mu4e-context-policy 'pick-first) - (add-hook 'after-init-hook (lambda () (mu4e t)))) -#+END_SRC - -By default, when mu4e is asking for messages (be it unread or inbox) it'll ask for related as well, which means if you have a very long thread in your emails, say 100 message long, then that thread will eat up a 100 message spots in the 500 fetched from the mailbox, that is quite annoying. Change the behavior. - -#+begin_src emacs-lisp - (setq mu4e-headers-include-related nil) -#+end_src - - -* mu4e-alert - -#+BEGIN_SRC emacs-lisp - (use-package mu4e-alert - :straight t - :after mu4e - :config - (mu4e-alert-set-default-style 'notifications) - (mu4e-alert-enable-mode-line-display) - (mu4e-alert-enable-notifications)) -#+END_SRC diff --git a/emacs-lisp/embark.org b/emacs-lisp/embark.org deleted file mode 100644 index d52e634..0000000 --- a/emacs-lisp/embark.org +++ /dev/null @@ -1,24 +0,0 @@ -:PROPERTIES: -:ID: d8339d6a-8b2f-43d8-bb08-a1b89db76b02 -:END: -#+title: Embark -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -This package provides a sort of right-click contextual menu for Emacs, accessed through the embark-act command (which you should bind to a convenient key), offering you relevant actions to use on a target determined by the context: -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package embark - :straight t - :bind - (("C-." . embark-act) - ("C-;" . embark-dwim) - ("C-h B" . embark-bindings)) - :init - (setq embark-indicators '(embark-minimal-indicator))) -#+END_SRC diff --git a/emacs-lisp/ement_el.org b/emacs-lisp/ement_el.org deleted file mode 100644 index 217e6f5..0000000 --- a/emacs-lisp/ement_el.org +++ /dev/null @@ -1,65 +0,0 @@ -:PROPERTIES: -:ID: cfb02bea-f9a2-4c7c-8971-d082feedab22 -:END: -#+title: ement.el -#+filetags: emacs-load - -#+begin_src emacs-lisp - (use-package password-store - :straight t) - - (defun ement-connect-sentinel (process msg) - (when (memq (process-status process) '(exit signal)) - (with-current-buffer " *ement-pass*" - (ement-connect - :uri-prefix "http://localhost:8008" - :password (string-trim (substring-no-properties (buffer-string))) - :user-id "@magic_rb:matrix.redalder.org") - (kill-buffer)))) - - (defun after-init-ement-connect () - (set-process-sentinel (start-process "ement-pass" " *ement-pass*" "pass" "Matrix/@magic_rb:matrix.redalder.org") #'ement-connect-sentinel)) - - (use-package ement - :straight '(ement :type git :host github :repo "alphapapa/ement.el") - :after (password-store) - :custom - (ement-save-sessions t) - :config - (remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync) - (add-hook 'after-init-hook #'after-init-ement-connect)) -#+end_src - -#+begin_src emacs-lisp - (defun ement-send-anyways () - (interactive) - (when (ement-room-p ement-room) - (let ((ement-room- ement-room) - (ement-session- ement-session)) - (save-excursion - (panctl "*panctl-temp-send-anyway*") - (vterm-insert "send-anyways " (ement-user-id (ement-session-user ement-session-)) " " (ement-room-id ement-room-)) - (vterm-send-return) - (vterm-send-C-c))))) -#+end_src - - Enable message composition in [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] by default. - -#+begin_src emacs-lisp - (setq ement-room-send-message-filter #'ement-room-send-org-filter) -#+end_src - -Define an interactive command to open [[https://github.com/matrix-org/pantalaimon][pantalaimon]] in Emacs. - -#+begin_src emacs-lisp - (defun panctl (&optional name) - (interactive) - (let* ((name- (or name "panctl")) - (buffer (get-buffer name-)) - (vterm-shell "panctl")) - (if buffer - (switch-to-buffer buffer) - (vterm name-) - (whitespace-mode -1)))) -#+end_src - diff --git a/emacs-lisp/filling_and_unfilling_paragraphs.org b/emacs-lisp/filling_and_unfilling_paragraphs.org deleted file mode 100644 index aa811f1..0000000 --- a/emacs-lisp/filling_and_unfilling_paragraphs.org +++ /dev/null @@ -1,23 +0,0 @@ -:PROPERTIES: -:ID: 50d451b0-eddf-4192-afc4-c505a5bb3b20 -:END: -#+title: Filling and unfilling paragraphs -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+begin_src emacs-lisp - ;;; Stefan Monnier . It is the opposite of fill-paragraph - (defun unfill-paragraph (&optional region) - "Takes a multi-line paragraph and makes it into a single line of text." - (interactive (progn (barf-if-buffer-read-only) '(t))) - (let ((fill-column (point-max)) - ;; This would override `fill-column' if it's an integer. - (emacs-lisp-docstring-fill-column t)) - (fill-paragraph nil region))) - - ;; Handy key definition - (define-key global-map "\M-Q" 'unfill-paragraph) -#+end_src diff --git a/emacs-lisp/flycheck.org b/emacs-lisp/flycheck.org deleted file mode 100644 index b1f6bcf..0000000 --- a/emacs-lisp/flycheck.org +++ /dev/null @@ -1,66 +0,0 @@ -:PROPERTIES: -:ID: 334a4188-93e6-4378-b22d-b0c302fc26a1 -:END: -#+title: Flycheck -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -* Flycheck Posframe - -Display flycheck messages in a posframe. - -#+begin_src emacs-lisp :noweb yes - (use-package flycheck-posframe - :straight t - :config - (setq flycheck-posframe-position 'frame-bottom-right-corner) - <> - <> - :hook (flycheck-mode . flycheck-posframe-mode)) -#+end_src - -Flycheck calls ~flycheck-display-errors-function~ every ~flycheck-display-errors-delay~. - -#+name: flycheck-display-errors-delay -#+begin_src emacs-lisp - (setq flycheck-display-errors-delay 0.1) -#+end_src - -Since we get errors and such in a posframe, we don't need them in the sideline. - -#+name: lsp-ui-sideline-show-diagnostics -#+begin_src emacs-lisp - (setq lsp-ui-sideline-show-diagnostics nil) -#+end_src - -Since flycheck recalls ~flycheck-display-errors-function~ on every point movement, it creates this really ugly flicker and also lags a bit, so if the diagnostic message didn't change, filter out the call. - -#+name: flycheck-posframe-change-filter -#+begin_src emacs-lisp - (defvar flycheck-posframe-last-error-list '()) - - (advice-add - 'flycheck-posframe-hidehandler - :override - (lambda (info) - (if (not (equal - (flycheck-overlay-errors-at (point)) - flycheck-posframe-last-error-list)) - (progn - (setq flycheck-posframe-last-error-list nil) - t) - nil)) - '((name . "flycheck-error-display-filter"))) - - (advice-add - 'flycheck-posframe-show-posframe - :before-while - (lambda (diagnostic) - (let ((last-list flycheck-posframe-last-error-list)) - (setq flycheck-posframe-last-error-list diagnostic) - (if (equal diagnostic last-list) nil t))) - '((name . "flycheck-error-display-filter"))) -#+end_src diff --git a/emacs-lisp/general_el.org b/emacs-lisp/general_el.org deleted file mode 100644 index 0b4ed6d..0000000 --- a/emacs-lisp/general_el.org +++ /dev/null @@ -1,20 +0,0 @@ -:PROPERTIES: -:ID: 1c6981a5-4371-4657-b4ea-435497a80010 -:END: -#+title: general.el -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -~general.el~ provides a more convenient method for binding keys in emacs (for both evil and non-evil users). Like -use-package, which provides a convenient, unified interface for managing packages, general.el is intended to provide a -convenient, unified interface for key definitions. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package general - :straight t) -#+END_SRC diff --git a/emacs-lisp/go.org b/emacs-lisp/go.org deleted file mode 100644 index 8996116..0000000 --- a/emacs-lisp/go.org +++ /dev/null @@ -1,16 +0,0 @@ -:PROPERTIES: -:ID: efc50bb2-7197-4225-b4d2-66aed96a5104 -:END: -#+title: Go -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Go is a horrible language, but for some reason all the DevOps things are written in it. - -#+begin_src emacs-lisp - (use-package go-mode - :straight t) -#+end_src diff --git a/emacs-lisp/keybindings.org b/emacs-lisp/keybindings.org deleted file mode 100644 index 18ec23d..0000000 --- a/emacs-lisp/keybindings.org +++ /dev/null @@ -1,78 +0,0 @@ -:PROPERTIES: -:ID: 22a6cb0e-5466-4edf-b0da-a8b76d879cf9 -:END: -#+title: Keybindings -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -This file contains all keybindings of my Emacs configuration. I chose to put them all into one file for easy reference and also cross package consistency is easier to ensure when you have everything on one screen. - -First we need to define a new minor mode. - -#+begin_src emacs-lisp - (define-minor-mode magic_rb/userbind-mode - "Minor mode for user keybindings of Magic_RB." - :lighter " userbind." - :global t - :keymap (make-sparse-keymap)) -#+end_src - -Then we hook our minor mode on ~meow-mode-hook~, but only after ~meow-mode~ is loaded. - -#+begin_src emacs-lisp - (add-hook 'after-init-hook 'magic_rb/userbind-mode) -#+end_src - -#+begin_src emacs-lisp - (general-def - :keymaps '(magic_rb/userbind-mode-map) - :prefix "C-c" - "o f" 'org-roam-node-find - "o i" 'org-roam-node-insert - "o t" 'org-roam-tag-add - "o T" 'org-roam-tag-remove - "o r" 'org-roam-ref-add - "o R" 'org-roam-ref-remove - "o c" 'org-roam-capture - "o b" 'org-roam-buffer-toggle - "o a" 'org-agenda - - - "j f" 'consult-fd - "j r" 'consult-ripgrep - "j l" 'consult-line - "j b" 'consult-project-buffer - - "p v" 'projectile-run-vterm - "p m" 'projectile-vc - "p s" 'projectile-switch-project - - "r c" 'popper-cycle - "r p" 'popper-toggle-latest - "r t" 'popper-toggle-type - - "w t" 'windmove-left - "w r" 'windmove-up - "w n" 'windmove-down - "w s" 'windmove-right - "w a" 'ace-window - - "b i" 'indent-region - "b c" 'comment-dwim - - "l l" 'lsp - "l r" 'lsp-workspace-restart - "l e" 'lsp-execute-code-action - - "e l" 'ement-list-rooms - "e v" 'ement-view-room - - "M-c" 'tempel-insert - :keymaps '(special-mode-map) - :prefix "" - "q" 'nil - "k" 'quit-window) -#+end_src diff --git a/emacs-lisp/lsp.org b/emacs-lisp/lsp.org deleted file mode 100644 index 565bc7c..0000000 --- a/emacs-lisp/lsp.org +++ /dev/null @@ -1,142 +0,0 @@ -:PROPERTIES: -:ID: cc668372-8d95-461b-a7c6-3e2b51de3f40 -:END: -#+title: LSP -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Disable server downloading suggestions, and other features. - -#+begin_src emacs-lisp - (setq lsp-enable-suggest-server-download nil - lsp-enable-snippet nil - lsp-enable-dap-auto-configure nil - lsp-enable-on-type-formatting nil) -#+end_src - -* Python - -Using the Microsoft language server as it's the best afaik. It's weird because it doesn't lookup the path to itself via PATH but has to be statically set. - -#+BEGIN_SRC emacs-lisp - (defun magic_rb/locate-python-executable-lsp-deffered () - "Locates the python executable available to the current buffer and only then calls `lsp-deferred'." - (lambda () - (require 'lsp-python-ms) - (envrc-mode) - (setq-local lsp-python-ms-executable (executable-find "python-language-server")) - (lsp-deferred))) - - (use-package lsp-python-ms - :straight t - :after (lsp-mode) - :hook (python-mode . magic_rb/locate-python-executable-lsp-deffered) - :config - (defvar-local lsp-python-ms-executable "")) -#+END_SRC - -* C/C++ - -This just requires hooking lsp onto ~c-mode~ and ~c++-mode~. - -#+BEGIN_SRC emacs-lisp - (use-package lsp-c++-c - :no-require t - :after (lsp-mode) - :hook ((c-mode-hook c++-mode-hook) . lsp-deferred)) -#+END_SRC - -* Haskell - -Enable ~haskell-mode~, and ~lsp-haskell~ - -#+BEGIN_SRC emacs-lisp - (use-package haskell-mode - :straight t - :hook - (((haskell-mode haskell-literate-mode) . interactive-haskell-mode) - ((heskell-mode haskell-literate-mode) . haskell-indentation-mode)) - :config - (setq lsp-haskell-plugin-ghcide-type-lenses-global-on nil - lsp-haskell-plugin-import-lens-code-lens-on nil)) - (use-package lsp-haskell - :straight t - :after (haskell-mode lsp-mode) - :hook ((haskell-mode haskell-literate-mode) . lsp-deferred)) -#+END_SRC - -Disable the ~haskell-stack-ghc~ flycheck checker, it's not used when lsp starts, but it does get loaded just before it. Loading and unloading it is slow and causes Emacs to freeze for a few seconds, so just disable it. - -#+BEGIN_SRC emacs-lisp - (with-eval-after-load "flycheck" - (add-to-list 'flycheck-disabled-checkers 'haskell-stack-ghc)) -#+END_SRC - -* Javascript - -Enable ~rjsx-mode~ instead of ~javascript-mode~ or ~js2-mode~ as it properly handles inline HTML. - -#+BEGIN_SRC emacs-lisp - (use-package rjsx-mode - :straight t - :config - :mode ("\\.js\\'" . rjsx-mode) - :mode ("\\.jsx\\'" . rjsx-mode) - :hook (rjsx-mode . lsp-deferred) - :init - ;; Originally this function exits with a call to `error`, which causes the simple "PATH lookup" - ;; scheme to not be tried - (cl-defun lsp--npm-dependency-path (&key package path &allow-other-keys) - "Return npm dependency PATH for PACKAGE." - (let ((path (executable-find - (f-join lsp-server-install-dir "npm" package - (cond ((eq system-type 'windows-nt) "") - (t "bin")) - path)))) - (unless (and path (f-exists? path)) - nil) - path))) -#+END_SRC - -* Typescript - -Enable ~typescript-mode~ for =.ts=, =.tsx= and hook ~lsp-mode~ on it. It doesn't specifically support inline HTML, -but aside from minor indentation issues it works fine. - -#+BEGIN_SRC emacs-lisp - (use-package typescript-mode - :straight t - :config - :mode ("\\.ts\\'" . typescript-mode) - :mode ("\\.tsx\\'" . typescript-mode) - :hook (typescript-mode . lsp-deferred)) -#+END_SRC - -* HTML Markup Language - -Enable ~web-mode~ for =.html=, =.xhtml= and hook ~lsp-mode~ on it. - -#+BEGIN_SRC emacs-lisp - (use-package web-mode - :straight t - :mode ("\\.html\\'" . web-mode) - :mode ("\\.xhtml\\'" . web-mode) - :hook (web-mode . lsp-deferred)) -#+END_SRC - -* CSS Style Sheet Language - -Enable ~css-mode~ for =.css=, =.scss= and hook ~lsp-mode~ on it. Also make ~flycheck~ happy. - -#+BEGIN_SRC emacs-lisp - (use-package css-mode - :mode ("\\.css\\'" . css-mode) - :mode ("\\.scss\\'". css-mode) - :hook (css-mode . lsp-deferred) - :config - (with-eval-after-load "flycheck" - (flycheck-add-mode 'javascript-eslint 'web-mode))) -#+END_SRC diff --git a/emacs-lisp/magit.org b/emacs-lisp/magit.org deleted file mode 100644 index eab2bbc..0000000 --- a/emacs-lisp/magit.org +++ /dev/null @@ -1,28 +0,0 @@ -:PROPERTIES: -:ID: aa25248c-197c-4bf5-8fc1-aea93008e194 -:END: -#+title: Magit -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -~magit~ is literally the best package right after OrgMode of course. Therefore enable it. - -#+BEGIN_SRC emacs-lisp - (defun magit-reset-visibility-indicators (frame) - (with-selected-frame frame - (when (display-graphic-p) - (setq magit-section-visibility-indicator - (if (window-system) - '(magit-fringe-bitmap> . magit-fringe-bitmapv) - (cons (if (char-displayable-p ?…) "…" "...") - t))) - (remove-hook 'after-make-frame-functions #'magit-reset-visibility-indicators)))) - - (use-package magit - :straight t - :config - (add-hook 'after-make-frame-functions #'magit-reset-visibility-indicators)) -#+END_SRC diff --git a/emacs-lisp/marginalia.org b/emacs-lisp/marginalia.org deleted file mode 100644 index e5c0a3b..0000000 --- a/emacs-lisp/marginalia.org +++ /dev/null @@ -1,22 +0,0 @@ -:PROPERTIES: -:ID: 921e105a-01ff-4ab3-9478-4d967a61ff3f -:ROAM_REFS: https://github.com/minad/marginalia -:END: -#+title: Marginalia -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -This package provides marginalia-mode which adds marginalia to the minibuffer completions. Marginalia are marks or annotations placed at the margin of the page of a book or in this case helpful colorful annotations placed at the margin of the minibuffer for your completion candidates. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package marginalia - :straight t - :init - (marginalia-mode)) -#+END_SRC - diff --git a/emacs-lisp/meow.org b/emacs-lisp/meow.org deleted file mode 100644 index df9da53..0000000 --- a/emacs-lisp/meow.org +++ /dev/null @@ -1,130 +0,0 @@ -:PROPERTIES: -:ID: b88618f2-258f-4f3a-93f7-46fd45bc833f -:END: -#+title: Meow -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Meow is a modal editing framework, it's a bit like evil but also very different. This keymap is setup for KOY. - -#+begin_src emacs-lisp - (defun magic_rb/meow-prev (arg) - "Runs meow-prev except for some specific cases" - (interactive "P") - (pcase major-mode - ('ement-room-list-mode (forward-button (* (or arg 1) -1))) - (mode (meow-prev arg)))) - - (defun magic_rb/meow-next (arg) - "Runs meow-prev except for some specific cases" - (interactive "P") - (pcase major-mode - ('ement-room-list-mode (forward-button (or arg 1))) - (mode (meow-next arg)))) - - ;; (add-hook #'ement-room-list-mode-hook (lambda () (unless (button-at (point)) (forward-button 1)))) - - (defun meow-setup () - (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) - (general-def - :keymaps 'meow-insert-state-keymap - "j" (general-key-dispatch 'self-insert-command - :timeout 0.25 - "j" 'meow-insert-exit)) - (meow-motion-overwrite-define-key - '("r" . magic_rb/meow-prev) - '("n" . magic_rb/meow-next) - '("" . ignore)) - (meow-leader-define-key - ;; SPC r/n will run the original command in MOTION state. - '("r" . "H-r") - '("n" . "H-n") - ;; Use SPC (0-9) for digit arguments. - '("1" . meow-digit-argument) - '("2" . meow-digit-argument) - '("3" . meow-digit-argument) - '("4" . meow-digit-argument) - '("5" . meow-digit-argument) - '("6" . meow-digit-argument) - '("7" . meow-digit-argument) - '("8" . meow-digit-argument) - '("9" . meow-digit-argument) - '("0" . meow-digit-argument) - '("/" . meow-keypad-describe-key) - '("?" . meow-cheatsheet)) - (meow-normal-define-key - '("0" . meow-expand-0) - '("9" . meow-expand-9) - '("8" . meow-expand-8) - '("7" . meow-expand-7) - '("6" . meow-expand-6) - '("5" . meow-expand-5) - '("4" . meow-expand-4) - '("3" . meow-expand-3) - '("2" . meow-expand-2) - '("1" . meow-expand-1) - '("-" . negative-argument) - '("d" . meow-reverse) - '("w" . meow-inner-of-thing) - '("m" . meow-bounds-of-thing) - '("z" . meow-beginning-of-thing) - '("f" . meow-end-of-thing) - '("h" . meow-append) - '("H" . meow-open-below) - '("ö" . meow-back-word) - '("Ö" . meow-back-symbol) - '("ä" . meow-change) - '("e" . meow-delete) - '("E" . meow-backward-delete) - '("o" . meow-next-word) - '("O" . meow-next-symbol) - '("i" . meow-find) - '("u" . meow-cancel-selection) - '("U" . meow-grab) - '("c" . meow-insert) - '("C" . meow-open-above) - - '("t" . meow-left) - '("T" . meow-left-expand) - '("r" . meow-prev) - '("R" . meow-prev-expand) - '("n" . meow-next) - '("N" . meow-next-expand) - '("s" . meow-right) - '("S" . meow-right-expand) - - '("p" . meow-join) - '("b" . meow-search) - '("l" . meow-block) - '("L" . meow-to-block) - '("ß" . meow-clipboard-yank) - '("k" . meow-quit) - '("K" . meow-goto-line) - '("," . meow-replace) - '("–" . meow-swap-grab) - '("a" . meow-clipboard-kill) - '("y" . meow-till) - '("g" . meow-undo) - '("G" . meow-undo-in-selection) - '("ü" . avy-goto-char-2) - '("." . meow-mark-word) - '("•" . meow-mark-symbol) - '("q" . meow-line) - '("Q" . meow-goto-line) - '("v" . meow-clipboard-save) - '("V" . meow-sync-grab) - '("x" . meow-pop-selection) - '("D" . repeat) - '("" . ignore))) -#+end_src - -#+begin_src emacs-lisp - (use-package meow - :straight t - :config - (meow-setup) - (meow-global-mode 1)) -#+end_src diff --git a/emacs-lisp/native_compilation.org b/emacs-lisp/native_compilation.org deleted file mode 100644 index ea8b4b2..0000000 --- a/emacs-lisp/native_compilation.org +++ /dev/null @@ -1,12 +0,0 @@ -:PROPERTIES: -:header-args:emacs-lisp: :comments link :results none -:ID: 9f801382-e771-4929-8eb3-f76afde9aba2 -:END: -#+title: Native Compilation -#+filetags: emacs-load - -When Emacs is native compiling, it'll constantly raised the warning buffer on every message, of which there are a lot. As far as I know, they are harmless and can be safely ignored. Therefore raised the minimum raising level to ~error~. - -#+begin_src emacs-lisp - (setq warning-minimum-level :error) -#+end_src diff --git a/emacs-lisp/orderless.org b/emacs-lisp/orderless.org deleted file mode 100644 index 0af4b8a..0000000 --- a/emacs-lisp/orderless.org +++ /dev/null @@ -1,21 +0,0 @@ -:PROPERTIES: -:ID: 6bbcf471-95ee-4cd5-abee-d412a1eba068 -:ROAM_REFS: https://github.com/oantolin/orderless -:END: -#+title: Orderless -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -This package provides an orderless completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order. Each component can match in any one of several ways: literally, as a regexp, as an initialism, in the flex style, or as multiple word prefixes. By default, regexp and literal matches are enabled. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package orderless - :straight t - :config - (setq completion-styles '(orderless))) -#+END_SRC diff --git a/emacs-lisp/org_agenda.org b/emacs-lisp/org_agenda.org deleted file mode 100644 index 96996e2..0000000 --- a/emacs-lisp/org_agenda.org +++ /dev/null @@ -1,168 +0,0 @@ -:PROPERTIES: -:ID: 22d678ce-7a3a-486c-abfb-f6cebdd77f90 -:END: -#+title: Org Agenda -#+filetags: :emacs-load: - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Put state changes into the ~LOGBOOK~ section and not into a random spot. - -#+BEGIN_SRC emacs-lisp - (setq org-log-into-drawer t) -#+END_SRC - -Set priority levels to A, B, and C. - -#+BEGIN_SRC emacs-lisp :resutls none - (setq org-highest-priority ?A) - (setq org-default-priority ?B) - (setq org-lowest-priority ?C) -#+END_SRC - -* Dynamic Org Agenda using Org Roam DB -#+BEGIN_NOTE -This whole system depends on [[id:a56794cf-b8f9-4537-a390-bd7ee6bb35ae][Vulpea]] -#+END_NOTE - -#+BEGIN_SRC emacs-lisp :results none - (with-eval-after-load "vulpea" -#+END_SRC - -First we have to exclude the =agenda= tag from inheritance. - -#+BEGIN_SRC emacs-lisp :results none - (add-to-list 'org-tags-exclude-from-inheritance "project") -#+END_SRC - -Then we need a function to check whether a buffer contains any todo entry. - -#+BEGIN_SRC emacs-lisp :results none - (defun vulpea-project-p () - "Return non-nil if current buffer has any todo entry. - - TODO entries marked as done are ignored, meaning the this - function returns nil if current buffer contains only completed - tasks." - (when (eq major-mode 'org-mode) - (org-element-map - (org-element-parse-buffer 'headline) - 'headline - (lambda (h) - (eq (org-element-property :todo-type h) - 'todo)) - nil 'first-match))) -#+END_SRC - -Then we need a function which will check whether the current buffer contains any TODOs and if so, then add a roam tag to that file, so that we can easily get a list of all files with TODOs. - -#+BEGIN_SRC emacs-lisp :results none - (add-hook 'find-file-hook #'vulpea-project-update-tag) - (add-hook 'before-save-hook #'vulpea-project-update-tag) - - (defun vulpea-project-update-tag () - "Update PROJECT tag in the current buffer." - (when (and (not (active-minibuffer-window)) - (vulpea-buffer-p)) - (save-excursion - (goto-char (point-min)) - (let* ((tags (vulpea-buffer-tags-get)) - (original-tags tags)) - (if (vulpea-project-p) - (setq tags (cons "project" tags)) - (setq tags (remove "project" tags))) - - ;; cleanup duplicates - (setq tags (seq-uniq tags)) - - ;; update tags if changed - (when (or (seq-difference tags original-tags) - (seq-difference original-tags tags)) - (apply #'vulpea-buffer-tags-set tags)))))) - - (defun vulpea-buffer-p () - "Return non-nil if the currently visited buffer is a note." - (and buffer-file-name - (or (string-prefix-p - (expand-file-name (file-name-as-directory org-roam-directory)) - (file-name-directory buffer-file-name)) - (string-prefix-p - (expand-file-name (file-name-as-directory "~/dotfiles/emacs-lisp")) - (file-name-directory buffer-file-name))))) -#+END_SRC - -Now for the second last function, we need to actually return the list of files containing the =project= tag, to be consumed by org-agenda. - -#+BEGIN_SRC emacs-lisp :results none - (defun vulpea-project-files () - "Return a list of note files containing 'project' tag." ; - (seq-uniq - (seq-map - #'car - (org-roam-db-query - [:select [nodes:file] - :from tags - :left-join nodes - :on (= tags:node-id nodes:id) - :where (or (like tag '"%project%") (like tag '"%project-forced%"))])))) -#+END_SRC - -Finally we can update the list of project files before every =org-agenda= invocation. - -#+BEGIN_SRC emacs-lisp :results none - (defun vulpea-agenda-files-update (&rest _) - "Update the value of `org-agenda-files'." - (setq org-agenda-files (vulpea-project-files))) - - (advice-add 'org-agenda :before #'vulpea-agenda-files-update) -#+END_SRC - -** Migration - -To migrate existing org-roam files to this new system, run this elisp code. - -#+BEGIN_SRC emacs-lisp :results none :tangle no - (dolist (file (org-roam-list-files)) - (message "processing %s" file) - (with-current-buffer (or (find-buffer-visiting file) - (find-file-noselect file)) - (vulpea-project-update-tag) - (save-buffer))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp :results none :exports none - ) -#+END_SRC - -* Custom Tags - -Define a number of custom tags to ease organisation. - -#+BEGIN_SRC emacs-lisp :results none - (defun my/org-match-at-point-p (match) - "Return non-nil if headline at point matches MATCH. - Here MATCH is a match string of the same format used by - `org-tags-view'." - (funcall (cdr (org-make-tags-matcher match)) - (org-get-todo-state) - (org-get-tags-at) - (org-reduced-level (org-current-level)))) - - (defun my/org-agenda-skip-without-match (match) - "Skip current headline unless it matches MATCH. - - Return nil if headline containing point matches MATCH (which - should be a match string of the same format used by - `org-tags-view'). If headline does not match, return the - position of the next headline in current buffer. - - Intended for use with `org-agenda-skip-function', where this will - skip exactly those headlines that do not match." - (save-excursion - (unless (org-at-heading-p) (org-back-to-heading)) - (let ((next-headline (save-excursion - (or (outline-next-heading) (point-max))))) - (if (my/org-match-at-point-p match) nil next-headline)))) -#+END_SRC diff --git a/emacs-lisp/org_gtd.org b/emacs-lisp/org_gtd.org deleted file mode 100644 index d091372..0000000 --- a/emacs-lisp/org_gtd.org +++ /dev/null @@ -1,294 +0,0 @@ -:PROPERTIES: -:ID: 07d8e392-19ab-44d3-b4dc-cf68d73f64b6 -:header-args:emacs-lisp: :comments link :results none -:END: -#+title: Org GTD -#+filetags: emacs-load - -So let me preface this file with a little... preface. When I began this file, it was a few hours after I decided it's time to finally take up GTD and step my game up when it comes to organisation. So this file, along with [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] and [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] are the culmination of my efforts. - -* End Goal - -What I've very quickly, that GTD is only working properly when at no point, you stop to think "What did I want to/was supposed to do", if that ever happens to you, you're doing GTD wrong. With that in mind and me starting university in.. 5 days.. I want to ensure that forgetting an appointment, assignment, homework and forgetting to call a friend or reply to an email are all things of the past. To that end, I'll from now on, capture everything, be it on my phone or at one of my workstations. - -** The Phone Thing - -What I've learned after crafting my own workflows and using Emacs and Linux for almost 4 years now (WOW!) is that if a workflow isn't reliable, annoyance-free and convenient, I won't succeed in using it long term. Therefore any new workflow I adopt, must fill all those checkboxes or it won't stick. That's why I'm on the look out for [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][handheld computers]] or [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][linux phones]] which would enable me to use Emacs conveniently on the go. I've yet to find any which would be pocket sized or cheap enough that I could afford them. One requirement i have except for the Linux thing is that they must have a physical keyboard if I'm to lug around a second device. - -For now, I've decided to make due with Emacs installed in Termux with [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][home-manager]]. - -* Implementation - -So let's start with the entry point to the whole thing. Those would be the ~org-roam-capture-templates~ and ~org-roam-capture-ref-templates~. I've gone with more than just what was shown in [[id:c3b7951f-b8f2-41dc-856d-07373724ef99][Get Things Done with Emacs]] to remove some burden from me when I'm refiling each day. The cognitive overhead created by having to decide on what you're capturing isn't big enough for me to just capture everything into one disorganized heading. At least that's what I think now, we'll see how it goes. - -I've split the capturing process into 7 different templates, first we have the resource templates, of which I have 2 currently, one for automatic capturing from a web browser and one for capturing manually from Emacs. Then we have a special ~event~ template, which can be quickly used to capture events and have them immediately show up in you agenda. Next up is a special template for capturing Emacs LISP code, that's mostly used when adding new packages and playing with the configuration. Second to last is a catch all email capturing template and lastly a catch all generic capturing template. - -So the process for capturing is to trigger the capture with ~C-c o c~ and then quickly decide between one of the categories, simple enough hopefully. - -#+begin_src emacs-lisp - (require 'org-roam-protocol) - (setq org-roam-capture-ref-templates - `(("rw" "Web resource" entry - ,(concat "* ${title} :resource:inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ROAM_REFS: ${ref}\n" - ":ID: %(org-id-uuid)\n" - ":END:\n\n" - "${body}") - :target (file+olp "inbox.org" ("Resources"))) - ("s" "Shopping list" entry - ,(concat "* ${title} :inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":END:\n\n" - "\n" - "${ref}\n\n" - "${body}") - :target (file+olp "inbox.org" ("Shopping list"))))) - - (setq org-roam-capture-templates - `(("i" "Inbox" entry - ,(concat "* ${title} :inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ID: %(org-id-uuid)\n" - ":END:\n" - "#+setupfile: ~/roam/emacs-lisp/setupfiles/latex-base.org\n\n" - "%?") - :target (file+olp "inbox.org" ("Shopping list"))) - ("f" "File" plain "%?" - :target (file+head "${slug}.org" - ,(concat ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ID: %(org-id-uuid)\n" - ":END:\n" - "#+setupfile: ~/roam/emacs-lisp/setupfiles/latex-base.org\n\n" - "#+title: ${title}\n" - ""))) - ("@" "Inbox [mu4e]" entry - ,(concat "* Process \"%a\" %? :inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ID: %(org-id-uuid)\n" - ":END:\n\n" - "%?") - :target (file+olp "inbox.org" ("All"))) - ("t" "TODO" entry - ,(concat "* TODO ${title} :inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ID: %(org-id-uuid)\n" - ":END:\n\n" - "%?") - :target (file+olp "inbox.org" ("Todo"))) - ("r" "Resource") - ("rw" "Web resource" entry - ,(concat "* ${title} :resource:inbox:\n" - ":PROPERTIES:\n" - ":CREATED: %U\n" - ":ROAM_REFS: %(completing-read \"URL for resource: \" nil nil nil nil nil (or (substring-no-properties (car kill-ring)) nil))\n" - ":ID: %(org-id-uuid)\n" - ":END:\n\n") - :target (file+olp "inbox.org" ("Resources" "Web"))) - ("E" "Event" entry - ,(concat "* ${title} :event:inbox:\n" - ":PROPERTIES:\n" - ":DATE: %(org-time-stamp nil)\n" - ":CREATED: %U\n" - ":ID: %(org-id-uuid)\n" - ":END:\n\n" - "%?") - :target (file+olp "inbox.org" ("Events"))) - ("e" "Emacs Lisp" plain "%?" - :target (file+head "emacs-lisp/${slug}.org" - ,(concat ":PROPERTIES:\n" - ":header-args:emacs-lisp: :comments link :results none\n" - ":END:\n" - "#+title: ${title}\n" - "#+filetags: emacs-load" - ""))))) -#+end_src - -A special version of ~org-refile~ follows. What makes it special is that it first asks you for which [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] node you want to refile to and only then refiles. This eases the workflow quite a lot and also makes refiling snappy is it only needs to parse one file not a few thousand. - -#+begin_src emacs-lisp - ;; Make the refile completing read prompt also list the file itself in case it's empty - ;; and also not require multiple consecutive selections in case of nested headings. - (setq org-refile-use-outline-path 'file) - (setq org-outline-path-complete-in-steps nil) - - (defun org-roam-refile-incremental () - (interactive) - (let* ((node (org-roam-node-read)) - (org-refile-target-verify-function nil) - (org-refile-targets `((,(org-roam-node-file node) :maxlevel . 9)))) - (org-refile-cache-clear) - (call-interactively 'org-refile))) -#+end_src - -Please ignore this next block, this is some code that took me way too long to figure out and even longer to realize it's already been implemented upstream. - -#+begin_src emacs-lisp :tangle no - (element (org-element-at-point)) - (while (not (eq (car element) 'headline)) - (setq element (plist-get (car (cdr element)) :parent))) - (setq element (car (cdr element))) - - (let ((properties (org-entry-properties - (plist-get element :begin) - 'standard))) - (message "%s" properties)) - - (delete-region - (plist-get element :begin) - (plist-get element :end)) - - (if (org-roam-node-file node) - (progn) - (org-roam-capture- - :node node - :templates `() - :info `() - :keys "" - :props '(:finalize ))) -#+end_src - -This little advice cleans up after the ~org-roam-promote-entire-buffer~ function a bit. It leaves the buffer in a state that isn't quite what I want formatting and structure wise, so this just quickly fixes that. - -#+begin_src emacs-lisp - (defun magic_rb/org-roam-promote-buffer-cleanup () - (goto-char 1) - (org-roam-end-of-meta-data) - (delete-region (point) (progn (skip-chars-forward " \t") (point))) - (org-next-visible-heading 1) - (unless (eq (point) (point-max)) (insert "\n\n")) - (whitespace-cleanup) - (org-roam-db-update-file) - (org-roam-tag-remove '(inbox))) - (advice-add 'org-roam-promote-entire-buffer :after #'magic_rb/org-roam-promote-buffer-cleanup) - - (defun magic_rb/org-roam-promote-buffer-prepare () - (org-with-point-at 1 - (org-next-visible-heading 1) - ;; (when (and (not (org-roam--buffer-promotable-p)) - ;; (org-roam-get-keyword "filetags") - ;; (not (org-get-tags nil t))) - ;; ) - (org-todo "") - )) - (advice-add 'org-roam-promote-entire-buffer :before #'magic_rb/org-roam-promote-buffer-prepare) -#+end_src - -Next this function actually fixes a bug and cleans up after the ref capture. As of now [2022-08-31] the ~org-ref-capture~ protocol has a few minor issues: - -1. you can't tell it not not create a ~ROAM_REFS~ property -2. it always creates the ~ROAM_REFS~ property at the root of the [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] node it's capturing into so if you're capturing into a heading for later refilling without an ID, it'll create a ~ROAM_REFS~ property but at the wrong place -3. when you capture into a buffer that already has a ~ROAM_REFS~ it'll break completely, so we must remove it after it adds it - -#+begin_src emacs-lisp - (defun magic_rb/clear-roam-refs-if-in-inbox () - (with-current-buffer (org-capture-get :buffer) - (let* ((target-file (file-name-nondirectory (buffer-file-name)))) - (when (and (org-roam-capture-p) - (string-equal target-file "inbox.org")) - (save-excursion - (goto-char (point-min)) - (org-entry-delete nil "ROAM_REFS")))))) - (add-hook 'org-capture-after-finalize-hook #'magic_rb/clear-roam-refs-if-in-inbox) -#+end_src - -** Agenda - -First we define a few functions, which I got from [[https://stackoverflow.com/questions/10074016/org-mode-filter-on-tag-in-agenda-view][Stack Overflow]]. They allow you to filter in [[id:22d678ce-7a3a-486c-abfb-f6cebdd77f90][Org Agenda]] views with the syntax as described in [[info:org#Matching tags and properties][Matching tags and properties]]. They're not used currently, but may come in handy so I just keep them here. - -#+BEGIN_SRC emacs-lisp :results none - (defun my/org-match-at-point-p (match) - "Return non-nil if headline at point matches MATCH. - Here MATCH is a match string of the same format used by - `org-tags-view'." - (funcall (cdr (org-make-tags-matcher match)) - (org-get-todo-state) - (org-get-tags-at) - (org-reduced-level (org-current-level)))) - - (defun my/org-agenda-skip-without-match (match) - "Skip current headline unless it matches MATCH. - - Return nil if headline containing point matches MATCH (which - should be a match string of the same format used by - `org-tags-view'). If headline does not match, return the - position of the next headline in current buffer. - - Intended for use with `org-agenda-skip-function', where this will - skip exactly those headlines that do not match." - (save-excursion - (unless (org-at-heading-p) (org-back-to-heading)) - (let ((next-headline (save-excursion - (or (outline-next-heading) (point-max))))) - (if (my/org-match-at-point-p match) nil next-headline)))) -#+END_SRC - -Now the fun part. I only define one unified agenda view for now. It allows - -#+BEGIN_SRC emacs-lisp :results none - (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "INPROGRESS(i)" "STUCK(s)" "|" "DONE(d)" "CANCELLED(c)")) - org-use-fast-todo-selection t) - - (setq org-agenda-custom-commands - '(("g" "Get Things Done (GTD)" - ((agenda "" - ((org-agenda-skip-function - '(org-agenda-skip-entry-if 'deadline)) - (org-deadline-warning-days 0))) - (todo "INPROGRESS" - ((org-agenda-skip-function - '(org-agenda-skip-entry-if 'deadline)) - (org-agenda-prefix-format " %i %-12:c [%e] ") - (org-agenda-overriding-header "\nTasks started\n"))) - (todo "NEXT" - ((org-agenda-skip-function - '(org-agenda-skip-entry-if 'deadline)) - (org-agenda-prefix-format " %i %-12:c [%e] ") - (org-agenda-overriding-header "\nTasks planned\n"))) - (agenda nil - ((org-agenda-entry-types '(:deadline)) - (org-agenda-format-date "") - (org-deadline-warning-days 21) - (org-agenda-skip-function - '(org-agenda-skip-entry-if 'notregexp "\\* NEXT")) - (org-agenda-overriding-header "\nDeadlines"))) - (todo "TODO" - ((org-agenda-prefix-format " %?-12t% s") - (org-agenda-skip-function - '(my/org-agenda-skip-without-match "-inbox")) - (org-agenda-overriding-header "\nTo be done\n"))) - (tags "inbox" - ((org-agenda-prefix-format " %?-12t% s") - (org-agenda-overriding-header "\nInbox\n"))) - (tags "CLOSED>=\"\"" - ((org-agenda-overriding-header "\nCompleted today\n"))))))) -#+END_SRC - -** Keybindings - -#+begin_src emacs-lisp - (defun org-capture-inbox () - (interactive) - (call-interactively 'org-store-link) - (org-roam-capture nil "i")) - - (defun org-capture-mail () - (interactive) - (call-interactively 'org-store-link) - (org-roam-capture nil "@")) - - (setq org-agenda-hide-tags-regexp (regexp-opt '("project" "inbox"))) - - (general-define-key - :keymaps 'global - "C-c i" 'org-capture-inbox) - (general-define-key - :keymaps '(mu4e-headers-mode-map mu4e-view-mode-map) - "C-c i" 'org-capture-mail) -#+end_src diff --git a/emacs-lisp/org_habit.org b/emacs-lisp/org_habit.org deleted file mode 100644 index e0f0473..0000000 --- a/emacs-lisp/org_habit.org +++ /dev/null @@ -1,23 +0,0 @@ -:PROPERTIES: -:ID: 28f65a55-f6b4-4c42-8b15-3e3a353c7c0a -:ROAM_REFS: https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats -:END: -#+title: Org Habit -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_SRC emacs-lisp :results none - (require 'org-habit) -#+END_SRC - -Setup a function which resets any checkboxes under a ~TODO~ which changes state to ~DONE~. Many thanks to [[https://www.reddit.com/user/davidglasser][davidglasser]], who had this exact same issue and solved it on [[https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats/cv9gbj6?utm_source=share&utm_medium=web2x&context=3][Reddit]]. - -#+BEGIN_SRC emacs-lisp - (defun glasser-org-reset-check-on-repeat () - (when (and (org-get-repeat) (member org-state org-done-keywords)) - (org-reset-checkbox-state-subtree))) - (add-hook 'org-after-todo-state-change-hook 'glasser-org-reset-check-on-repeat) -#+END_SRC diff --git a/emacs-lisp/org_mode.org b/emacs-lisp/org_mode.org deleted file mode 100644 index c1cbae4..0000000 --- a/emacs-lisp/org_mode.org +++ /dev/null @@ -1,211 +0,0 @@ -:PROPERTIES: -:ID: 986ca7a5-d225-49bb-9e35-f2dffafe8aee -:END: -#+title: Org Mode -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -I used to respect the 80 column limit, but why waste all the space when it can be dynamic. In this way all of the available screen space is utilized. - -#+BEGIN_SRC emacs-lisp :results none - (add-hook 'org-mode-hook 'visual-line-mode) -#+END_SRC - -Enable /"fake"/ indentation in =org-mode=, in other words, add indentation using overlays, but on disk the buffer is not indented. - -#+BEGIN_SRC emacs-lisp :results none - (add-hook 'org-mode-hook 'org-indent-mode) -#+END_SRC - -Increase the size of headings, in my personal opinion this makes the headings stand out a bit more and therefore easier to read. - -#+BEGIN_SRC emacs-lisp :results none - (custom-set-faces - '(org-level-1 ((t (:inherit outline-1 :height 1.25)))) - '(org-level-2 ((t (:inherit outline-2 :height 1.2)))) - '(org-level-3 ((t (:inherit outline-3 :height 1.15)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.10)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.05))))) -#+END_SRC - -Disable element cache for now, it freaks out all the damn time. God forbid I make a tiny syntax error... - -#+begin_src emacs-lisp - (setq org-element-use-cache nil) -#+end_src - -#+begin_src emacs-lisp - (setf org-blank-before-new-entry '((heading . t) (plain-list-item . nil))) -#+end_src - -#+begin_src emacs-lisp - (setq org-src-window-setup 'current-window) -#+end_src - - -* Org Mark Ring - -To go back to the previous mark, very useful with [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]]. - -#+BEGIN_SRC emacs-lisp :results none - (general-def org-mode-map "C-c b" 'org-mark-ring-goto) -#+END_SRC - -* Babel - -Enable =tangle on save=, big thanks to Diego Zamboni for his amazing booklet about /[[https://leanpub.com/lit-config/read][Literate Configuration]]/. - -#+BEGIN_SRC emacs-lisp :results none - (add-hook 'org-mode-hook - (lambda () (add-hook 'after-save-hook #'org-babel-tangle :append :local))) -#+END_SRC - -After executing a source code block with =org-babel=, redisplay inline images, this speeds up the REPL-like workflow a lot. - -#+BEGIN_SRC emacs-lisp :results none - (add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images) -#+END_SRC - -Enable additional babel languages. - -#+BEGIN_SRC emacs-lisp :results none - (org-babel-do-load-languages - 'org-babel-load-languages - (cl-map 'list (lambda (lang) `(,lang . t)) - '(python R shell dot latex plantuml))) -#+END_SRC - -* Latex - -For previews, create SVGs and not PNGs or something, use the ~dvisvgm-lua~ command. - -#+BEGIN_SRC emacs-lisp :results none - (setq org-preview-latex-default-process 'dvisvgm) -#+END_SRC - -Actually define ~dvisvgm-lua~. - -#+begin_src emacs-lisp :results none - (add-to-list - 'org-preview-latex-process-alist - '(dvisvgm-lua - :programs ("dvilualatex" "dvisvgm") - :description "dvi > svg" - :message "you need to install the programs: latex and dvisvgm." - :image-input-type "dvi" - :image-output-type "svg" - :image-size-adjust (1.7 . 1.5) - :latex-compiler ("dvilualatex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))) -#+end_src - -Adjust size of LaTeX previews. - -#+BEGIN_SRC emacs-lisp :results none - (pcase (system-name) - ("heater" (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.75))) - ("omen" (setq org-format-latex-options (plist-put org-format-latex-options :scale 0.8)))) -#+END_SRC - -To support non-breakable whitespace, create a new ~org-entity~. - -#+begin_src emacs-lisp - (add-to-list 'org-entities - '("space" "~" nil " " " " " " " ")) -#+end_src - -Enable fontification for inline LaTeX blocks which convieniently also makes in fixed-width. - -#+begin_src emacs-lisp - (setq org-highlight-latex-and-related '(native entities)) -#+end_src - - -** Sliced Previews - -Normally a LaTeX preview is just one huge image which makes Emacs really jumpy and makes writing prose a really unpleasant experience. With these two functions, that's fixed. They work using mainly text properties (overlays are still involved but only one per preview, max two) so it should be fast still. - -#+begin_src emacs-lisp - ;;; -*- lexical-binding: t; -*- - - (plist-put org-format-latex-options :background "Transparent") - - (defadvice org-clear-latex-preview (after org-prop-img--org-clear-later-preview (beg end) activate) - (save-excursion - (goto-char beg) - (with-silent-modifications - (put-text-property beg end 'read-only nil) - (put-text-property beg end 'display nil) - (put-text-property beg end 'line-height nil)) - (font-lock-fontify-region beg end))) - - (defun org--make-preview-overlay (beg end image &optional imagetype) - "Build an overlay between BEG and END using IMAGE file. - Argument IMAGETYPE is the extension of the displayed image, - as a string. It defaults to \"png\"." - (let* ((imagetype (or (intern imagetype) 'png)) - (image-spec (list 'image :type imagetype :file image :ascent 'center)) - (ov (make-overlay beg end))) - (overlay-put ov 'org-overlay-type 'org-latex-overlay) - (overlay-put ov - 'modification-hooks - (list (lambda (ov after &rest args) - (when (not after) - (org-clear-latex-preview (overlay-start ov) (overlay-end ov)))))) - (if (> (count-lines beg end) 1) - (let ((image-height (cdr (image-size image-spec t))) - - (y 0) - (endm (make-marker))) - (set-marker endm end) - (save-excursion - (goto-char beg) - (while (and (<= (point) endm) (< y image-height)) - (let* ((dy (line-pixel-height))) - - ;; loop through and check for empty lines, those will break rendering - (when (= (line-beginning-position) (line-end-position)) - (goto-char (line-beginning-position)) - (insert "%") - (forward-char -1)) - - (when (> (* dy 2) (- image-height y)) - (setq dy (- image-height y))) - - (with-silent-modifications - ;; place the image property on the current line - (put-text-property - (line-beginning-position) (line-end-position) - 'display - (list - (list 'slice - 0 y 1.0 dy) - image-spec)) - ;; ;; remove any fontification face so the images don't get colored - ;; (put-text-property (line-beginning-position) (line-end-position) - ;; 'face - ;; nil) - ) - - (forward-line 1) - (setq y (+ y dy)))) - (if (not (> (point) endm)) - (let ((ov (make-overlay (- (point) 1) endm))) - - (overlay-put ov 'org-overlay-type 'org-latex-overlay) - (overlay-put ov 'evaporate t) - (overlay-put ov 'invisible t)))) - (set-marker endm nil)) - (with-silent-modifications - (put-text-property beg end - 'display - (list image-spec)))) - (font-lock-fontify-region beg end) - (with-silent-modifications - (put-text-property beg end 'line-height t)))) -#+end_src - - diff --git a/emacs-lisp/org_roam.org b/emacs-lisp/org_roam.org deleted file mode 100644 index fa144f0..0000000 --- a/emacs-lisp/org_roam.org +++ /dev/null @@ -1,186 +0,0 @@ -:PROPERTIES: -:ID: 18476d68-cccb-48f4-aa77-caefe213d8bd -:END: -#+title: Org Roam -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_NOTE -When exporting, running ~(org-id-update-id-locations (directory-files-recursively org-roam-directory ".org"))~ -#+END_NOTE - -#+BEGIN_SRC emacs-lisp :tangle no :results none -(defun replace-in-string (what with in) - (replace-regexp-in-string (regexp-quote what) with in nil 'literal)) - -(defun org-html--format-image (source attributes info) - (progn - (setq source (replace-in-string "%20" " " source)) - (format "" - (or (file-name-extension source) "") - (base64-encode-string - (with-temp-buffer - (insert-file-contents-literally source) - (buffer-string))) - (file-name-nondirectory source)))) -#+END_SRC - -#+BEGIN_QUOTE -Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem. -#+END_QUOTE - -#+BEGIN_WARNING -SQLite3 must be on Emacs' PATH! -#+END_WARNING - -#+BEGIN_SRC emacs-lisp :results none - (use-package org-roam - :straight - (org-roam - :type git - :host github - :repo "org-roam/org-roam" - :branch "main") - :init - (setq org-roam-v2-ack t) - :config - (add-hook 'after-init-hook 'org-roam-setup) - - ;; Add ignore for SyncThing - (setq org-roam-file-exclude-regexp (regexp-opt '(".stversions" ".sync-conflict-" "logseq"))) - - (setq org-roam-directory "~/roam") - ;; Add more informative completion interface - (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:30}" 'face 'org-tag))) - - (defun magic_rb/org-roam-buffer-hook () - (when (org-roam-buffer-p) - (make-local-variable 'org-link-frame-setup) - (add-to-list 'org-link-frame-setup '(file . find-file)))) - (add-hook 'org-mode-hook 'magic_rb/org-roam-buffer-hook) - - (defun magic_rb/org-roam-hook () - (visual-line-mode)) - (add-hook 'org-roam-mode-hook 'magic_rb/org-roam-hook)) - - (use-package shackle - :straight t - :init - (shackle-mode)) - - (setq shackle-rules - '((org-roam-mode - :align right - :size 0.25 - :popup t))) -#+END_SRC - -* Ref Capture - -Using ~org-protocol~, one can capture a website from their browser directly into Org Roam. - -#+BEGIN_SRC emacs-lisp :tangle no - (with-eval-after-load "org-roam" - (require 'org-roam-protocol) - (setq org-roam-capture-ref-templates - `(("r" "ref" plain "%?" - :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n${body}") - :unnarrowed t)))) -#+END_SRC - -Then you need a desktop entry for ~org-protocol~. Such as: - -#+BEGIN_SRC conf-desktop - [Desktop Entry] - Name=org-protocol - Exec=emacsclient %u - Type=Application - Terminal=false - Categories=System; - MimeType=x-scheme-handler/org-protocol; -#+END_SRC - -or in Nix form: - -#+BEGIN_SRC nix - makeDesktopItem { - name = "Org-Protocol"; - exec = "emacsclient %u"; - comment = "Org protocol"; - desktopName = "org-protocol"; - type = "Application"; - mimeType = "x-scheme-handler/org-protocol"; - } -#+END_SRC - -Lastly a bookmarklet in Firefox. - -#+BEGIN_SRC javascript - javascript:location.href ='org-protocol://roam-ref?template=rw&ref=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title) + '&body=' + encodeURIComponent(window.getSelection()) -#+END_SRC - -* Export -#+begin_src emacs-lisp :tangle no :results none - (require 'org-roam-export) - - (require 'nxml-mode) - - (defun magic_rb/org-html-publish-to-html-continue (plist filename pub-dir) - (org-html-publish-to-html plist filename pub-dir)) - - (defcustom org+-html-embed-svg nil - "Embed SVG images. - You can set this variable in Org files with - ,#+HTML_EMBED_SVG: t - or - ,#+OPTIONS: html-embed-svg:t" - :type 'boolean - :group 'org-export-html) - - (cl-pushnew - '(:html-embed-svg "HTML_EMBED_SVG" "html-embed-svg" org+-html-embed-svg) - (org-export-backend-options (org-export-get-backend 'html))) - - (defun org+-html-svg-image-embed (fun source attributes info) - "Make embedding of SVG images possible in org HTML export. - SVG images are embedded if :html-embed-svg is non-nil in the plist INFO. - Otherwise FUN called with SOURCE, ATTRIBUTES, and INFO as arguments. - SOURCE is the file name of the SVG file. - This is an around advice for `org-html--svg-image' as FUN." - (if (and - (member (plist-get info :html-embed-svg) '("yes" "t" t)) - (string-equal "svg" (file-name-extension source))) - (with-temp-buffer - (message "embedding svg: %s" source) - (insert-file-contents source) - (with-syntax-table nxml-mode-syntax-table - (while (and (search-forward " -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Enable ~org-variable-pitch~, it makes ~org-mode~ feel like a proper writing instrument. - -#+BEGIN_SRC emacs-lisp - (use-package org-variable-pitch - :straight t - :config - (set-face-attribute 'org-variable-pitch-fixed-face nil - :inherit 'variable-pitch) - :hook (org-mode . org-variable-pitch--enable)) -#+END_SRC diff --git a/emacs-lisp/popper.org b/emacs-lisp/popper.org deleted file mode 100644 index c559f39..0000000 --- a/emacs-lisp/popper.org +++ /dev/null @@ -1,76 +0,0 @@ -:PROPERTIES: -:ID: 45da0115-42c7-4a9a-9288-c5d840a69b92 -:END: -#+title: Popper -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Enable ~popper~, a better version of ~popwin~, which might actually work. It groups popups by context and allows you to specify their exact positioning, or even a custom display function. It also seems to be better at restoring the previous layout. - -#+NAME: popper -#+BEGIN_SRC emacs-lisp - (use-package popper - :straight (popper :type git :host github :repo "karthink/popper") - :config - (setq popper-reference-buffers - '("\\*Messages\\*" - "\\*Warnings\\*" - "\\*Error\\*" - "Output\\*$" - "\\*HS-Error\\*" - "\\*lsp-help\\*" - "^\\*Ement compose.*\\*$" - haskell-interactive-mode - help-mode - compilation-mode - rustic-compilation-mode - tex-shell)) - (popper-mode +1)) -#+END_SRC - -Add a [[id:db1d0122-58d6-4dec-84f6-afcb52937fc7][consult]] source for popped buffers. - -#+begin_src emacs-lisp - (with-eval-after-load 'consult - (setq magic_rb/consult-source-popper - `(:name "popper" - :narrow ?P - :category buffer - :face consult-buffer - :history buffer-name-history - :state consult--buffer-state - :items - (lambda () - (let ((group-name (when popper-group-function - (with-current-buffer buf (funcall popper-group-function))))) - (mapcar #'buffer-name - (append - (mapcar #'cdr (alist-get group-name popper-buried-popup-alist)) - (mapcar #'cdr (alist-get group-name popper-open-popup-alist)))))))) - - (add-to-list 'consult-buffer-sources 'magic_rb/consult-source-popper 'append)) -#+end_src - -Force user buffer switching to also obey ~display-buffer-alist~. - -#+begin_src emacs-lisp - (setq switch-to-buffer-obey-display-actions t) -#+end_src - -Set almost all popups to ~meow-motion-mode~, except for [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] popups and [[id:8fbb19be-bb8d-4fef-8a6a-9d5a3f5d06ec][Vterm]]. - -#+begin_src emacs-lisp :tangle no - (defun magic_rb/popper-meow-motion (buf &optional _act) - (with-current-buffer buf - (when - (and (popper-popup-p buf) - (not (equal major-mode 'vterm-mode)) - (not ement-room-compose-buffer)) - (meow-normal-mode) (meow-motion-mode)))) - - (advice-add 'popper-display-control-p :after 'magic_rb/popper-meow-motion) -#+end_src - diff --git a/emacs-lisp/racket.org b/emacs-lisp/racket.org deleted file mode 100644 index 24f69a3..0000000 --- a/emacs-lisp/racket.org +++ /dev/null @@ -1,14 +0,0 @@ -:PROPERTIES: -:ID: 3709b269-1b66-44c9-b282-c97f48716c52 -:END: -#+title: Racket -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_SRC emacs-lisp - (use-package racket-mode - :straight t) -#+END_SRC diff --git a/emacs-lisp/setupfiles/latex-base.org b/emacs-lisp/setupfiles/latex-base.org deleted file mode 100644 index 8f97abe..0000000 --- a/emacs-lisp/setupfiles/latex-base.org +++ /dev/null @@ -1,16 +0,0 @@ -#+latex_header: \usepackage{xcolor} -#+latex_header: \usepackage{algorithm2e} -#+latex_header: \SetKwProg{Fn}{Function}{:}{end} -#+latex_header: \usepackage{cmbright} -#+latex_header: \usepackage{textcomp} -#+latex_header: \usepackage{tikz} -#+latex_header: \usetikzlibrary{shapes.geometric} -#+latex_header: \usepackage{mathtools} -#+latex_header: \usepackage{circuitikz} -#+latex_header: \usepackage{fancyvrb} -#+latex_header: \usepackage{blkarray} -#+latex_header: \usepackage{ifthen} -#+latex_header: \usepackage{array} -#+latex_header: \newenvironment*{dummyenv}{}{} -#+latex_header: \newcommand{\BlankLineEm}{\vskip 1em} -#+startup: latexpreview diff --git a/emacs-lisp/tempel.org b/emacs-lisp/tempel.org deleted file mode 100644 index 475322f..0000000 --- a/emacs-lisp/tempel.org +++ /dev/null @@ -1,167 +0,0 @@ -:PROPERTIES: -:ID: a0514202-b2ef-41a4-9d77-01efaa7e8d64 -:END: -#+title: Tempel -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+begin_quote -Tempel is a tiny template package for Emacs, which uses the syntax of the Emacs Tempo library. Tempo is an ancient -temple of the church of Emacs. It is 27 years old, but still in good shape since it successfully resisted change over -the decades. However it may look a bit dusty here and there. Therefore we present to you, Tempel, a modernized -implementation of Tempo, in the form of three commands. -#+end_quote - -#+begin_src emacs-lisp :noweb yes - (use-package tempel - :straight '(tempel :type git :host github :repo "minad/tempel") - :config - <> - :init - <> - <>) -#+END_SRC - -Set the template file to the result of tangling [[id:3e8f0e02-dbfe-4f34-9b00-8b7ecd0a238d][Tempel - Templates]]. - -#+name: tempel-path -#+begin_src emacs-lisp - (setq tempel-path (expand-file-name "~/roam/emacs-lisp/templates.lisp")) -#+end_src - -Hook ~tempel-capf~ on both ~prog-mode~ and ~text-mode~. - -#+name: tempel-hooks -#+begin_src emacs-lisp - (defun tempel-setup-capf () - (add-hook 'completion-at-point-functions #'tempel-complete -100 'local)) - - (add-hook 'prog-mode-hook 'tempel-setup-capf) - (add-hook 'text-mode-hook 'tempel-setup-capf) - (add-hook 'lsp-mode-hook 'tempel-setup-capf) -#+end_src - -Define keymaps, the defaults are unnecessarily hard to trigger. - -#+name: tempel-keymaps -#+begin_src emacs-lisp - (general-define-key - :keymaps '(insert normal) - "C-n" 'nil - "C-p" 'nil) - (general-define-key - :keymaps 'tempel-map - "M-{" nil - "M-}" nil - "C-n" 'tempel-next - "C-p" 'tempel-previous) -#+end_src - -Fix LSP not getting notified about changes, can be fixed by notifying it at the end of template expansion. - -#+begin_src emacs-lisp - (advice-add - 'tempel--disable - :before - (lambda (&rest r) - (when lsp-mode - (let* ((region-start (tempel--beginning)) - (region-end (tempel--end))) - (lsp-on-change region-start region-end (- region-end region-start)))))) -#+end_src - -To setup a post template return point, use ~(tempel-retpoint-here)~ in a template. - -#+begin_src emacs-lisp - (defun org-edit-special-latex-preview (&rest _) - (let ((datum (org-element-context))) - (when (and (memq (org-element-type datum) '(latex-environment latex-fragment)) - (let ((beg (org-element-property :begin datum)) - (end (org-element-property :end datum))) - (when (org-clear-latex-preview beg end) - (setq-local tempel-latex-preview t))))))) - - (advice-add - 'org-edit-special - :before - #'org-edit-special-latex-preview) -#+end_src - -#+begin_src emacs-lisp - (defvar-local tempel-retpoint (make-marker)) - (defvar-local tempel-latex-preview nil) - - (defun tempel-retpoint-here () - "Place a marker at `point' to allow for return on tempel exit." - (set-marker tempel-retpoint (point)) - "") - - (defun tempel-retpoint-goto () - "Move `point' to `tempel-retpoint'." - (when (marker-position tempel-retpoint) - (goto-char (marker-position tempel-retpoint)) - (set-marker tempel-retpoint nil))) - - (add-hook - 'tempel--disable - #'tempel-retpoint-goto) - - (defvar org-src-mode-exit-hook nil) - - (defun org-edit-src-exit-run-hooks (&rest _) - "Run hooks from `org-edit-src-exit-hook' upon exiting org-src edit buffer." - (run-hooks 'org-src-mode-exit-hook)) - - (advice-add - 'org-edit-src-exit - :after - #'org-edit-src-exit-run-hooks) - - (defun org-edit-src-exit-tempel-retpoint () - "Return to `tempel-retpoint' if set." - (tempel-retpoint-goto)) - - (defun org-edit-src-exit-tempel-latex-preview () - "Toggle LaTeX preview of templated LaTeX fragment." - (when tempel-latex-preview - (org-latex-preview) - (setq-local tempel-latex-preview nil))) - - (add-hook - 'org-src-mode-exit-hook - #'org-edit-src-exit-tempel-latex-preview) - - (add-hook - 'org-src-mode-exit-hook - #'org-edit-src-exit-tempel-retpoint) - - (defun tempel-post-edit-latex (&optional preview move-back) - "Move `point' back and run `org-edit-special'. - If PREVIEW is non-nil then `org-latex-preview' will be called on - the resulting LaTeX block. Move point that MOVE-BACK lines back to - reach a good spot in the LaTeX block, defaults to `-2'." - (forward-line (or move-back -2)) - (end-of-line) - (setq-local tempel-latex-preview preview) - (org-edit-special)) -#+end_src - -To allow for ~=>~ as template keys, ~'symbol~ won't work, but ~'evil-word~ will. - -#+begin_src emacs-lisp - (defun tempel--prefix-bounds () - "Return prefix bounds." - (if tempel-trigger-prefix - (let ((end (point)) - (beg (save-excursion - (search-backward tempel-trigger-prefix - (line-beginning-position) 'noerror)))) - (when (and beg (save-excursion - (not (re-search-backward "\\s-" beg 'noerror)))) - (cons (+ beg (length tempel-trigger-prefix)) end))) - (bounds-of-thing-at-point 'symbol))) -#+end_src - diff --git a/emacs-lisp/tempel_templates.org b/emacs-lisp/tempel_templates.org deleted file mode 100644 index 4a714ec..0000000 --- a/emacs-lisp/tempel_templates.org +++ /dev/null @@ -1,225 +0,0 @@ -:PROPERTIES: -:ID: 3e8f0e02-dbfe-4f34-9b00-8b7ecd0a238d -:header-args: :tangle ./templates.lisp -:END: -#+title: Tempel - Templates - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - - -* Fundamental Mode - -#+BEGIN_SRC lisp - fundamental-mode ;; Available everywhere - - (today (format-time-string "%Y-%m-%d")) - (heredoc "< n> r> "\\end{" (s env) "}") - (frac "\\frac{" p "}{" p "}") - (enumerate "\\begin{enumerate}\n\\item " r> n> "\\end{enumerate}") - (itemize "\\begin{itemize}\n\\item " r> n> "\\end{itemize}") -#+END_SRC - -* Emacs List Mode - -#+BEGIN_SRC lisp - emacs-lisp-mode - - (lambda "(lambda (" p ")" n> r> ")") - (var "(defvar " p "\n \"" p "\")") - (const "(defconst " p "\n \"" p "\")") - (custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")") - (face "(defface " p " '((t :inherit " p "))\n \"" p "\")") - (group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")") - (macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")") - (fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")") - (let "(let (" p ")" n> r> ")") - (star "(let* (" p ")" n> r> ")") - (rec "(letrec (" p ")" n> r> ")") - (command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive)" n> r> ")") -#+END_SRC - -* Text Mode - -#+BEGIN_SRC lisp - text-mode - - (cut "--8<---------------cut here---------------start------------->8---" n r n - "--8<---------------cut here---------------end--------------->8---" n) - (asciibox "+-" (make-string (length str) ?-) "-+" n - "| " (s str) " |" n - "+-" (make-string (length str) ?-) "-+" n) - (rot13 (p "plain text" text) n "----" n (rot13 text)) - (calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula))) -#+END_SRC - -* Rst Mode - -#+BEGIN_SRC lisp - rst-mode - - (title (make-string (length title) ?=) n (p "Title: " title) n (make-string (length title) ?=) n) -#+END_SRC - -* Java Mode - -#+BEGIN_SRC lisp - java-mode - - (class "public class " (p (file-name-base (or (buffer-file-name) (buffer-name)))) " {" n> r> n "}") -#+END_SRC - -* C Mode - -#+BEGIN_SRC lisp - c-mode :condition (re-search-backward "^\\w*$" (line-beginning-position) 'noerror) - - (inc "#include <" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) ">") - (incc "#include \"" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) "\"") -#+END_SRC - -* Org Mode - -#+BEGIN_SRC lisp - org-mode - - (title "#+title: " p n "#+author: Richard Brežák" n "#+language: en" n n) - (quote "#+begin_quote" n> r> n> "#+end_quote" n) - (example "#+begin_example" n> r> n> "#+end_example" n) - (center "#+begin_center" n> r> n> "#+end_center" n) - (comment "#+begin_comment" n> r> n> "#+end_comment" n) - (verse "#+begin_verse" n> r> n> "#+end_verse" n) - (src "#+begin_src " p n> r> n> "#+end_src" n - :post (org-edit-src-code)) - (export "#+begin_export " p n - n - "#+end_export" n - :post (progn (previous-line) (org-edit-special))) - (elisp "#+begin_src emacs-lisp" n> r> n "#+end_src" n - :post (progn (org-edit-src-code))) - (abs "\\begin{abstract}" n> r> n> "\\end{abstract}" n) - (align "\\begin{align}" n - " " n - "\\end{align}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (align* "\\begin{align*}" n - " " n - "\\end{align*}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (arr "\\begin{array}" n - n - "\\end{array}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (begin "\\begin{" (p "environment" env) "}" - n n - "\\end{" env "}" n - (tempel-retpoint-here) q - :post (tempel-post-edit-latex t)) - (bib "\\bibliographystyle{plain}" n "\\bibliography{" s "}" n) - (dm "\\[" n - " ." n - "\\]" q - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (mm "$" p "$ " q - :post (org-latex-preview)) - (mmc "$\\textcolor{" p "}{" p "}$ " q - :post (org-latex-preview)) - (item "\\begin{itemize}" n p n "\\end{itemize}" n) - (it "\\item " r) - (itd "\\item[" (p "label") "] " r) - (fig "\\begin{figure}[htbp]" n "\\centering" n p n "\\caption{" p "}" n "\\label{" p "}" n "\\end{figure}" n) - (minipage "\\begin{minipage}[" (p "htbp") "]{" (p "1.0") (p "\\linewidth") "}" n - " " n - "\\end{minipage}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (frame "\\begin{frame}{" (p "Frame Title") "}"h n - " " n - "\\end{frame}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (package "#+LATEX_HEADER: \\usepackage[" p "]{" p "}" n) - (ref "\\ref{" p "}") - (table "\\begin{tabular}{" p "}" n - " " n - "\\end{tabular}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (algorithm "\\begin{algorithm}" n - " \\DontPrintSemicolon\\;" n - " " n - "\\end{algorithm}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) - (function "\\begin{dummyenv}" n - " \\DontPrintSemicolon\\;" n - " \\SetKwFunction{" (p "" function) "}{" function "}" n - " \\begin{algorithm}" n - " \\Fn{\\" function "{" p "}}{"n - " " n - " }" n - " \\end{algorithm}" n - "\\end{dummyenv}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t -4)) - - org-mode :condition (org-inside-LaTeX-fragment-p) - - (frac "\\frac{" p "}{" p "}") - (larrow "\\leftarrow") - (rarrow "\\rightarrow") - (bigo "\\mathcal{O}(" p ")") -#+END_SRC - -* Haskell Mode - -#+BEGIN_SRC lisp - haskell-mode - - (case - "case " (p "x") " of " n> - (p "Data") " -> " (p "undefined") n> - (p "Data") " -> " (p "undefined")) - ({-} "{- " p " -}") - (=> (p "Class") " " (p "m") " => ") - (idata "data " (p "Type" ndata) " = " (s ndata) " " (p "Int") n> - "deriving (" (p "Show, Eq") ")") - (newtype "newtype " (p "Type" ndata) " = " (s ndata) " " (p "Int") n> - "deriving (" (p "Show, Eq") ")") - (data "data " (p "Type" ndata) " = " (s ndata) n> - "{ " (p "field") " :: " (p "Type") n> - ", " (p "field") " :: " (p "Type") (tempel-retpoint-here) n> - "}" n> - "deriving (" (p "Show, Eq") ")") - (fn (p "f" fname) " :: " (p "a") " -> " (p "b") n - (s fname) " " (p "x") " = " (p "undefined")) - (fnc (p "f" fname) " :: " (p "a") " -> " (p "b") n - (s fname) " " (p "pattern") " = " (p "undefined") n - (s fname) " " (p "pattern") " = " (p "undefined")) - ; guarded fn - (<- (p "x") " <- " (p "undefined")) -#+END_SRC diff --git a/emacs-lisp/templates.lisp b/emacs-lisp/templates.lisp deleted file mode 100644 index a6b3c3d..0000000 --- a/emacs-lisp/templates.lisp +++ /dev/null @@ -1,174 +0,0 @@ -fundamental-mode ;; Available everywhere - -(today (format-time-string "%Y-%m-%d")) -(heredoc "< n> r> "\\end{" (s env) "}") -(frac "\\frac{" p "}{" p "}") -(enumerate "\\begin{enumerate}\n\\item " r> n> "\\end{enumerate}") -(itemize "\\begin{itemize}\n\\item " r> n> "\\end{itemize}") - -emacs-lisp-mode - -(lambda "(lambda (" p ")" n> r> ")") -(var "(defvar " p "\n \"" p "\")") -(const "(defconst " p "\n \"" p "\")") -(custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")") -(face "(defface " p " '((t :inherit " p "))\n \"" p "\")") -(group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")") -(macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")") -(fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")") -(let "(let (" p ")" n> r> ")") -(star "(let* (" p ")" n> r> ")") -(rec "(letrec (" p ")" n> r> ")") -(command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive)" n> r> ")") - -text-mode - -(cut "--8<---------------cut here---------------start------------->8---" n r n - "--8<---------------cut here---------------end--------------->8---" n) -(asciibox "+-" (make-string (length str) ?-) "-+" n - "| " (s str) " |" n - "+-" (make-string (length str) ?-) "-+" n) -(rot13 (p "plain text" text) n "----" n (rot13 text)) -(calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula))) - -rst-mode - -(title (make-string (length title) ?=) n (p "Title: " title) n (make-string (length title) ?=) n) - -java-mode - -(class "public class " (p (file-name-base (or (buffer-file-name) (buffer-name)))) " {" n> r> n "}") - -c-mode :condition (re-search-backward "^\\w*$" (line-beginning-position) 'noerror) - -(inc "#include <" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) ">") -(incc "#include \"" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) "\"") - -org-mode - -(title "#+title: " p n "#+author: Richard Brežák" n "#+language: en" n n) -(quote "#+begin_quote" n> r> n> "#+end_quote" n) -(example "#+begin_example" n> r> n> "#+end_example" n) -(center "#+begin_center" n> r> n> "#+end_center" n) -(comment "#+begin_comment" n> r> n> "#+end_comment" n) -(verse "#+begin_verse" n> r> n> "#+end_verse" n) -(src "#+begin_src " p n> r> n> "#+end_src" n - :post (org-edit-src-code)) -(export "#+begin_export " p n - n - "#+end_export" n - :post (progn (previous-line) (org-edit-special))) -(elisp "#+begin_src emacs-lisp" n> r> n "#+end_src" n - :post (progn (org-edit-src-code))) -(abs "\\begin{abstract}" n> r> n> "\\end{abstract}" n) -(align "\\begin{align}" n - " " n - "\\end{align}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(align* "\\begin{align*}" n - " " n - "\\end{align*}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(arr "\\begin{array}" n - n - "\\end{array}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(begin "\\begin{" (p "environment" env) "}" - n n - "\\end{" env "}" n - (tempel-retpoint-here) q - :post (tempel-post-edit-latex t)) -(bib "\\bibliographystyle{plain}" n "\\bibliography{" s "}" n) -(dm "\\[" n - " ." n - "\\]" q - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(mm "$" p "$ " q - :post (org-latex-preview)) -(mmc "$\\textcolor{" p "}{" p "}$ " q - :post (org-latex-preview)) -(item "\\begin{itemize}" n p n "\\end{itemize}" n) -(it "\\item " r) -(itd "\\item[" (p "label") "] " r) -(fig "\\begin{figure}[htbp]" n "\\centering" n p n "\\caption{" p "}" n "\\label{" p "}" n "\\end{figure}" n) -(minipage "\\begin{minipage}[" (p "htbp") "]{" (p "1.0") (p "\\linewidth") "}" n - " " n - "\\end{minipage}\n" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(frame "\\begin{frame}{" (p "Frame Title") "}"h n - " " n - "\\end{frame}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(package "#+LATEX_HEADER: \\usepackage[" p "]{" p "}" n) -(ref "\\ref{" p "}") -(table "\\begin{tabular}{" p "}" n - " " n - "\\end{tabular}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(algorithm "\\begin{algorithm}" n - " \\DontPrintSemicolon\\;" n - " " n - "\\end{algorithm}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t)) -(function "\\begin{dummyenv}" n - " \\DontPrintSemicolon\\;" n - " \\SetKwFunction{" (p "" function) "}{" function "}" n - " \\begin{algorithm}" n - " \\Fn{\\" function "{" p "}}{"n - " " n - " }" n - " \\end{algorithm}" n - "\\end{dummyenv}" n - (tempel-retpoint-here) - :post (tempel-post-edit-latex t -4)) - -org-mode :condition (org-inside-LaTeX-fragment-p) - -(frac "\\frac{" p "}{" p "}") -(larrow "\\leftarrow") -(rarrow "\\rightarrow") -(bigo "\\mathcal{O}(" p ")") - -haskell-mode - -(case - "case " (p "x") " of " n> - (p "Data") " -> " (p "undefined") n> - (p "Data") " -> " (p "undefined")) -({-} "{- " p " -}") -(=> (p "Class") " " (p "m") " => ") -(idata "data " (p "Type" ndata) " = " (s ndata) " " (p "Int") n> - "deriving (" (p "Show, Eq") ")") -(newtype "newtype " (p "Type" ndata) " = " (s ndata) " " (p "Int") n> - "deriving (" (p "Show, Eq") ")") -(data "data " (p "Type" ndata) " = " (s ndata) n> - "{ " (p "field") " :: " (p "Type") n> - ", " (p "field") " :: " (p "Type") (tempel-retpoint-here) n> - "}" n> - "deriving (" (p "Show, Eq") ")") -(fn (p "f" fname) " :: " (p "a") " -> " (p "b") n - (s fname) " " (p "x") " = " (p "undefined")) -(fnc (p "f" fname) " :: " (p "a") " -> " (p "b") n - (s fname) " " (p "pattern") " = " (p "undefined") n - (s fname) " " (p "pattern") " = " (p "undefined")) -; guarded fn -(<- (p "x") " <- " (p "undefined")) diff --git a/emacs-lisp/treemacs.org b/emacs-lisp/treemacs.org deleted file mode 100644 index e7e4f65..0000000 --- a/emacs-lisp/treemacs.org +++ /dev/null @@ -1,25 +0,0 @@ -:PROPERTIES: -:ID: ee891758-1259-4af4-aabc-418a1c644d2f -:ROAM_REFS: https://github.com/Alexander-Miller/treemacs -:END: -#+title: Treemacs -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -Treemacs is a file and project explorer similar to NeoTree or vim’s NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities. -#+END_QUOTE - -Treemacs is really cool. - -#+BEGIN_SRC emacs-lisp - (use-package treemacs - :straight t - :after (doom-themes) - :config - ;; read input from a minibuffer not a child frame. - (setq treemacs-read-string-input 'from-minibuffer)) -#+END_SRC diff --git a/emacs-lisp/vertico.org b/emacs-lisp/vertico.org deleted file mode 100644 index 452cef9..0000000 --- a/emacs-lisp/vertico.org +++ /dev/null @@ -1,14 +0,0 @@ -:PROPERTIES: -:header-args:emacs-lisp: :comments link :results none -:ID: fe60a97d-9dd8-4279-b953-32616158a644 -:END: -#+title: Vertico -#+filetags: emacs-load - -#+begin_src elisp - (use-package vertico - :straight t - :init - (vertico-mode)) -#+end_src - diff --git a/emacs-lisp/vterm.org b/emacs-lisp/vterm.org deleted file mode 100644 index 8be9109..0000000 --- a/emacs-lisp/vterm.org +++ /dev/null @@ -1,19 +0,0 @@ -:PROPERTIES: -:ID: 8fbb19be-bb8d-4fef-8a6a-9d5a3f5d06ec -:ROAM_REFS: https://github.com/akermu/emacs-libvterm -:END: -#+title: Vterm -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -Emacs-libvterm (vterm) is fully-fledged terminal emulator inside GNU Emacs based on libvterm, a C library. As a result of using compiled code (instead of elisp), emacs-libvterm is fully capable, fast, and it can seamlessly handle large outputs. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp - (use-package vterm - :straight t) -#+END_SRC diff --git a/emacs-lisp/vulpea.org b/emacs-lisp/vulpea.org deleted file mode 100644 index c5ed33d..0000000 --- a/emacs-lisp/vulpea.org +++ /dev/null @@ -1,19 +0,0 @@ -:PROPERTIES: -:ID: a56794cf-b8f9-4537-a390-bd7ee6bb35ae -:END: -#+title: Vulpea -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+BEGIN_QUOTE -A collection of functions for note taking based on org and org-roam. This repository primary goal is to be a tested library for other applications and utilities around note taking. -#+END_QUOTE - -#+BEGIN_SRC emacs-lisp :results none - (use-package vulpea - :straight t) -#+END_SRC - diff --git a/emacs-lisp/whitespace_el.org b/emacs-lisp/whitespace_el.org deleted file mode 100644 index fdcf4e2..0000000 --- a/emacs-lisp/whitespace_el.org +++ /dev/null @@ -1,26 +0,0 @@ -:PROPERTIES: -:ID: 8cfa2b1a-9004-4fa0-8ca4-72876ece7d70 -:END: -#+title: whitespace.el -#+filetags: emacs-load - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -Highlight trailing whitespace. - -#+begin_src emacs-lisp - (use-package whitespace - :config - (setq whitespace-style '(face tabs trailing)) - (face-spec-set - 'whitespace-tabs - '((t :background "red")) - 'face-defface-spec) - (face-spec-set - 'whitespace-trailing - '((t :background "red")) - 'face-defface-spec) - (global-whitespace-mode)) -#+end_src diff --git a/flake.lock b/flake.lock deleted file mode 100644 index d45c298..0000000 --- a/flake.lock +++ /dev/null @@ -1,1280 +0,0 @@ -{ - "nodes": { - "alejandra": { - "inputs": { - "fenix": [ - "fenix" - ], - "flakeCompat": [ - "flake-compat" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1668317688, - "narHash": "sha256-wC04cwcKyV2TUYXqMibFWkq7WOMIXHw5DrfAJrWHzgI=", - "owner": "kamadorueda", - "repo": "alejandra", - "rev": "378cde949be70caea431682756b36552a58e965d", - "type": "github" - }, - "original": { - "owner": "kamadorueda", - "repo": "alejandra", - "type": "github" - } - }, - "all-cabal-json": { - "flake": false, - "locked": { - "lastModified": 1665552503, - "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=", - "owner": "nix-community", - "repo": "all-cabal-json", - "rev": "d7c0434eebffb305071404edcf9d5cd99703878e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "hackage", - "repo": "all-cabal-json", - "type": "github" - } - }, - "bootloadHID": { - "flake": false, - "locked": { - "lastModified": 1393653083, - "narHash": "sha256-JPcnPwgSFJE88YDGNTq6OsUjZjKx561pfnjxvyp2+1M=", - "owner": "whiteneon", - "repo": "bootloadHID", - "rev": "42c6f246b79949892268d2212e0347f27e01bd53", - "type": "github" - }, - "original": { - "owner": "whiteneon", - "repo": "bootloadHID", - "type": "github" - } - }, - "crane": { - "flake": false, - "locked": { - "lastModified": 1669605882, - "narHash": "sha256-TiQtL5sUI5rp28S63v+VX25qNjcrc8Xeu+shf3g7Tj4=", - "owner": "ipetkov", - "repo": "crane", - "rev": "24591d5f8cc979f7b243b88a2d39da09976970ad", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "crane_2": { - "flake": false, - "locked": { - "lastModified": 1661875961, - "narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=", - "owner": "ipetkov", - "repo": "crane", - "rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "deploy-rs": { - "inputs": { - "flake-compat": [ - "flake-compat" - ], - "nixpkgs": [ - "nixpkgs" - ], - "utils": [ - "flake-utils" - ] - }, - "locked": { - "lastModified": 1668797197, - "narHash": "sha256-0w6iD3GSSQbIeSFVDzAAQZB+hDq670ZTms3d9XI+BtM=", - "owner": "serokell", - "repo": "deploy-rs", - "rev": "2a3c5f70eee04a465aa534d8bd4fcc9bb3c4a8ce", - "type": "github" - }, - "original": { - "owner": "serokell", - "repo": "deploy-rs", - "type": "github" - } - }, - "deploy-rs_2": { - "inputs": { - "flake-compat": "flake-compat_3", - "nixpkgs": "nixpkgs_2", - "utils": "utils" - }, - "locked": { - "lastModified": 1648475189, - "narHash": "sha256-gAGAS6IagwoUr1B0ohE3iR6sZ8hP4LSqzYLC8Mq3WGU=", - "owner": "serokell", - "repo": "deploy-rs", - "rev": "83e0c78291cd08cb827ba0d553ad9158ae5a95c3", - "type": "github" - }, - "original": { - "id": "deploy-rs", - "type": "indirect" - } - }, - "devshell": { - "flake": false, - "locked": { - "lastModified": 1667210711, - "narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=", - "owner": "numtide", - "repo": "devshell", - "rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "devshell_2": { - "flake": false, - "locked": { - "lastModified": 1663445644, - "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", - "owner": "numtide", - "repo": "devshell", - "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "dream2nix": { - "inputs": { - "alejandra": [ - "alejandra" - ], - "all-cabal-json": "all-cabal-json", - "crane": "crane_2", - "devshell": "devshell_2", - "flake-parts": "flake-parts", - "flake-utils-pre-commit": [ - "flake-utils" - ], - "ghc-utils": "ghc-utils", - "gomod2nix": "gomod2nix", - "mach-nix": "mach-nix", - "nix-pypi-fetcher": "nix-pypi-fetcher", - "nixpkgs": [ - "nixpkgs" - ], - "poetry2nix": "poetry2nix", - "pre-commit-hooks": [ - "pre-commit-hooks" - ] - }, - "locked": { - "lastModified": 1669743839, - "narHash": "sha256-zxnaRaWfCJxy0JlORD4Kmtzd0pfpcGLnyaCIJY8OlIo=", - "owner": "nix-community", - "repo": "dream2nix", - "rev": "b6af93946130748f72671dfd2ab84a5aeaf1f191", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "dream2nix", - "type": "github" - } - }, - "emacs": { - "flake": false, - "locked": { - "lastModified": 1683396233, - "narHash": "sha256-VzEk0WxSyjcQuLbTHKqLFxpuokKQ8vj07h56GZoRhoE=", - "owner": "~magic_rb", - "repo": "emacs", - "rev": "ec8eac076be23e42828e3a95cead31f1a6fbac33", - "type": "sourcehut" - }, - "original": { - "owner": "~magic_rb", - "repo": "emacs", - "type": "sourcehut" - } - }, - "emacs-overlay": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669801362, - "narHash": "sha256-kwrejUngReIv3M926D/SRQkJVCiaBuBcj7t3RmIXc4U=", - "owner": "nix-community", - "repo": "emacs-overlay", - "rev": "a686fa48a89b0cba053143ba155506c93718037f", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "emacs-overlay", - "type": "github" - } - }, - "fenix": { - "flake": false, - "locked": { - "lastModified": 1669789565, - "narHash": "sha256-9fBxYzp0cnkHygZOY5HTM7QMYr1WsC062Yc8glQNIgM=", - "owner": "nix-community", - "repo": "fenix", - "rev": "bba229a06ca03938a1abd4ce6361bf9bf4f651cd", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1648199409, - "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1668450977, - "narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1678379998, - "narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "c13d60b89adea3dc20704c045ec4d50dd964d447", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "locked": { - "lastModified": 1631561581, - "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", - "type": "github" - }, - "original": { - "id": "flake-utils", - "type": "indirect" - } - }, - "fufexan-dotfiles": { - "flake": false, - "locked": { - "lastModified": 1669831455, - "narHash": "sha256-Myjgtb5ZZV+AqS6SrHjT1KjQ0XkP8dc2+FrI2Cbcmik=", - "owner": "fufexan", - "repo": "dotfiles", - "rev": "03cad4f80630c581d41a764f0d65bbde5868a089", - "type": "github" - }, - "original": { - "owner": "fufexan", - "repo": "dotfiles", - "type": "github" - } - }, - "ghc-utils": { - "flake": false, - "locked": { - "lastModified": 1662774800, - "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=", - "ref": "refs/heads/master", - "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea", - "revCount": 1072, - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - }, - "original": { - "type": "git", - "url": "https://gitlab.haskell.org/bgamari/ghc-utils" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "gitignore-nix": { - "flake": false, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "gomod2nix": { - "flake": false, - "locked": { - "lastModified": 1627572165, - "narHash": "sha256-MFpwnkvQpauj799b4QTBJQFEddbD02+Ln5k92QyHOSk=", - "owner": "tweag", - "repo": "gomod2nix", - "rev": "67f22dd738d092c6ba88e420350ada0ed4992ae8", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "gomod2nix", - "type": "github" - } - }, - "gomod2nix_2": { - "flake": false, - "locked": { - "lastModified": 1662501203, - "narHash": "sha256-4BKeqCX2zwgBiTdlc2DjGQ0CttKm0vSw0r/bdFdM/PQ=", - "owner": "tweag", - "repo": "gomod2nix", - "rev": "89cd0675b96775aa3ee86e7c0cf5bc238dd27976", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "gomod2nix", - "type": "github" - } - }, - "hidapitester": { - "flake": false, - "locked": { - "lastModified": 1653353943, - "narHash": "sha256-WA2Loh6xTZCVxQJXNwQ6VoC2Q0p9U4hgm9zLx3RBSgo=", - "owner": "todbot", - "repo": "hidapitester", - "rev": "90e4bae5f5390ddaefb3b6d1b951bc5034cce430", - "type": "github" - }, - "original": { - "owner": "todbot", - "repo": "hidapitester", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": [ - "flake-utils" - ] - }, - "locked": { - "lastModified": 1669825171, - "narHash": "sha256-HxlZHSiRGXnWAFbIJMeujqBe2KgACYx5XDRY0EA9P+4=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "478610aa37c8339eacabfa03f07dacf5574edd47", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "master", - "repo": "home-manager", - "type": "github" - } - }, - "ical2org": { - "flake": false, - "locked": { - "lastModified": 1663312032, - "narHash": "sha256-EjfvyYicmF1dNL2sDaldha/G1bZCb9s+HP83hCTvpI8=", - "ref": "refs/heads/master", - "rev": "fa262ef8e763c745fa11acacddf1c79ade0127c2", - "revCount": 89, - "type": "git", - "url": "https://git.sr.ht/~magic_rb/ical2orgpy" - }, - "original": { - "type": "git", - "url": "https://git.sr.ht/~magic_rb/ical2orgpy" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "lowdown-src_2": { - "flake": false, - "locked": { - "lastModified": 1632468475, - "narHash": "sha256-NNOm9CbdA8cuwbvaBHslGbPTiU6bh1Ao+MpEPx4rSGo=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "6bd668af3fd098bdd07a1bedd399564141e275da", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "mach-nix": { - "flake": false, - "locked": { - "lastModified": 1634711045, - "narHash": "sha256-m5A2Ty88NChLyFhXucECj6+AuiMZPHXNbw+9Kcs7F6Y=", - "owner": "DavHau", - "repo": "mach-nix", - "rev": "4433f74a97b94b596fa6cd9b9c0402104aceef5d", - "type": "github" - }, - "original": { - "id": "mach-nix", - "type": "indirect" - } - }, - "mach-nix_2": { - "flake": false, - "locked": { - "lastModified": 1667918925, - "narHash": "sha256-jCZ4iI4UCOC+T5SEgoCbUzqaeMo5WT3DcFwqwvn2fEs=", - "owner": "DavHau", - "repo": "mach-nix", - "rev": "913e6c16f986746ba5507878ef7ff992804d1fa8", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "mach-nix", - "type": "github" - } - }, - "nil": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1669568240, - "narHash": "sha256-xarHQnV7XCvioDxoAhOI+KsDzPNeWZ3F1OCPJVWS5S4=", - "owner": "oxalica", - "repo": "nil", - "rev": "8f8a5d2cffb1a92b1b4b5001239ca9138675c3f4", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "nil", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1669814715, - "narHash": "sha256-LBsuMjZ0PIA1mTPhE4v+/Ur/ejAajQTPqWXMYPns7Gc=", - "owner": "NixOS", - "repo": "nix", - "rev": "f91dc023f27ea17362274fcdf30e362423b080f8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nix", - "type": "github" - } - }, - "nix-gaming": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669128192, - "narHash": "sha256-iBkK3E/S4XfQDi+2hr8WWitiIUZ5EWsmfTcR4jbIPNA=", - "owner": "fufexan", - "repo": "nix-gaming", - "rev": "9f96bd578ee5c1511535adccd295383d79fb791d", - "type": "github" - }, - "original": { - "owner": "fufexan", - "repo": "nix-gaming", - "type": "github" - } - }, - "nix-pypi-fetcher": { - "flake": false, - "locked": { - "lastModified": 1669065297, - "narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=", - "owner": "DavHau", - "repo": "nix-pypi-fetcher", - "rev": "a9885ac6a091576b5195d547ac743d45a2a615ac", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "nix-pypi-fetcher", - "type": "github" - } - }, - "nix_2": { - "inputs": { - "lowdown-src": "lowdown-src_2", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1633098935, - "narHash": "sha256-UtuBczommNLwUNEnfRI7822z4vPA7OoRKsgAZ8zsHQI=", - "owner": "nixos", - "repo": "nix", - "rev": "4f496150eb4e0012914c11f0a3ff4df2412b1d09", - "type": "github" - }, - "original": { - "id": "nix", - "type": "indirect" - } - }, - "nixinate": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1682599469, - "narHash": "sha256-BXptkIWvU6RyNb9V0FWK64hpXp+s7UqEUALkZLQZWyk=", - "owner": "MagicRB", - "repo": "nixinate", - "rev": "dedba33b205866e620424db58842900cb5afae2c", - "type": "github" - }, - "original": { - "owner": "MagicRB", - "repo": "nixinate", - "type": "github" - } - }, - "nixng": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669067138, - "narHash": "sha256-xdsDPf3zFBayh7NepE2RXuBWNBGJHfN3QEQ7haOFR5A=", - "owner": "nix-community", - "repo": "NixNG", - "rev": "c78ee7e38b693f26233547cec26624a28bb70041", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NixNG", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1676569297, - "narHash": "sha256-2n4C4H3/U+3YbDrQB6xIw7AaLdFISCCFwOkcETAigqU=", - "owner": "~magic_rb", - "repo": "nixpkgs", - "rev": "ac1f5b72a9e95873d1de0233fddcb56f99884b37", - "type": "sourcehut" - }, - "original": { - "owner": "~magic_rb", - "repo": "nixpkgs", - "type": "sourcehut" - } - }, - "nixpkgs-discord": { - "locked": { - "lastModified": 1681465517, - "narHash": "sha256-EasJh15/jcJNAHtq2SGbiADRXteURAnQbj1NqBoKkzU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "abe7316dd51a313ce528972b104f4f04f56eefc4", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-firefox": { - "locked": { - "lastModified": 1680213900, - "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-hashicorp": { - "locked": { - "lastModified": 1681635962, - "narHash": "sha256-cRoieDmJoT2O2u7TWDDGyGew+Z+bZ3n/GMHOXIpjPWM=", - "owner": "~magic_rb", - "repo": "nixpkgs", - "rev": "11c39a5eb9d943ab5557de1af08d7e7153e8e9b3", - "type": "sourcehut" - }, - "original": { - "owner": "~magic_rb", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "sourcehut" - } - }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1665349835, - "narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib_2": { - "locked": { - "dir": "lib", - "lastModified": 1678375444, - "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-master": { - "locked": { - "lastModified": 1682609660, - "narHash": "sha256-Q2lncLCbUpFAs22n4NKjxt8hDsF4lCXq4lDjixjL0us=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "76a85de7a731a037f44f1fcc81165c934c66b0a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1676636606, - "narHash": "sha256-Hahkda+Amu3RQE0C6UIxLo1x8tkDmu8jkFRa8JujFos=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "de5448dab588ad41aef40f8c7c0c230981656698", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable_2": { - "locked": { - "lastModified": 1668984258, - "narHash": "sha256-0gDMJ2T3qf58xgcSbYoXiRGUkPWmKyr5C3vcathWhKs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "cf63ade6f74bbc9d2a017290f1b2e33e8fbfa70a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1648219316, - "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1632864508, - "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-21.05-small", - "type": "indirect" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1632495107, - "narHash": "sha256-4NGE56r+FJGBaCYu3CTH4O83Ys4TrtnEPXrvdwg1TDs=", - "owner": "serokell", - "repo": "nixpkgs", - "rev": "be220b2dc47092c1e739bf6aaf630f29e71fe1c4", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nomad-driver-containerd-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1659899649, - "narHash": "sha256-jE+lDHwZCaZBxV98yzRNxgwJUPNkfoZAjoMvkTwl4Bc=", - "owner": "MagicRB", - "repo": "nomad-driver-containerd-nix", - "rev": "3d9c1be4444db47cb86679387cf06a7cbfb2bce3", - "type": "github" - }, - "original": { - "owner": "MagicRB", - "repo": "nomad-driver-containerd-nix", - "type": "github" - } - }, - "poetry2nix": { - "flake": false, - "locked": { - "lastModified": 1666918719, - "narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "289efb187123656a116b915206e66852f038720e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "1.36.0", - "repo": "poetry2nix", - "type": "github" - } - }, - "poetry2nix_2": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669801469, - "narHash": "sha256-GZYef2/AgSsHlM6LddKungUfDB7DMU1su/CRSowIa9o=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "956e730a8357e150d5ce6a293175360e37b51c76", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": [ - "flake-utils" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable_2" - }, - "locked": { - "lastModified": 1669829516, - "narHash": "sha256-laWMD/TZzyrulu8xLNoSPertXOxjRD7BrcAVwKl+NyQ=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "471c7f1ecace25e39099206431300322632d25c4", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "qmk": { - "flake": false, - "locked": { - "lastModified": 1669830503, - "narHash": "sha256-NfblbmzxFz6PJKa1rrI81cU/FyQyWhydpyyuyPxb+Uk=", - "ref": "master", - "rev": "a5c2eea6c16696773796b3c1df678c9cf20900b1", - "revCount": 23226, - "submodules": true, - "type": "git", - "url": "https://github.com/qmk/qmk_firmware" - }, - "original": { - "ref": "master", - "submodules": true, - "type": "git", - "url": "https://github.com/qmk/qmk_firmware" - } - }, - "root": { - "inputs": { - "alejandra": "alejandra", - "bootloadHID": "bootloadHID", - "crane": "crane", - "deploy-rs": "deploy-rs", - "devshell": "devshell", - "dream2nix": "dream2nix", - "emacs": "emacs", - "emacs-overlay": "emacs-overlay", - "fenix": "fenix", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", - "flake-utils": "flake-utils", - "fufexan-dotfiles": "fufexan-dotfiles", - "gitignore-nix": "gitignore-nix", - "gomod2nix": "gomod2nix_2", - "hidapitester": "hidapitester", - "home-manager": "home-manager", - "ical2org": "ical2org", - "mach-nix": "mach-nix_2", - "nil": "nil", - "nix": "nix", - "nix-gaming": "nix-gaming", - "nixinate": "nixinate", - "nixng": "nixng", - "nixpkgs": "nixpkgs", - "nixpkgs-discord": "nixpkgs-discord", - "nixpkgs-firefox": "nixpkgs-firefox", - "nixpkgs-hashicorp": "nixpkgs-hashicorp", - "nixpkgs-master": "nixpkgs-master", - "nixpkgs-stable": "nixpkgs-stable", - "nomad-driver-containerd-nix": "nomad-driver-containerd-nix", - "poetry2nix": "poetry2nix_2", - "pre-commit-hooks": "pre-commit-hooks", - "qmk": "qmk", - "secret": "secret", - "serokell-nix": "serokell-nix", - "udp-over-tcp": "udp-over-tcp", - "uterranix": "uterranix", - "vtermModule": "vtermModule", - "webcord": "webcord", - "yusdacra-dotfiles": "yusdacra-dotfiles" - } - }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "nil", - "flake-utils" - ], - "nixpkgs": [ - "nil", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669170936, - "narHash": "sha256-TKPH4Pzkjw5gAPo9hejs3O4mWJW6V/RSiOj8UuSFRTs=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "c90c223c4aef334356029b89c72bb65e26f7efe6", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "secret": { - "flake": false, - "locked": { - "lastModified": 1636145225, - "narHash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=", - "path": "/var/empty", - "type": "path" - }, - "original": { - "path": "/var/empty", - "type": "path" - } - }, - "serokell-nix": { - "inputs": { - "deploy-rs": "deploy-rs_2", - "flake-compat": [ - "flake-compat" - ], - "flake-utils": "flake-utils_2", - "gitignore-nix": [ - "gitignore-nix" - ], - "nix": "nix_2", - "nixpkgs": "nixpkgs_4" - }, - "locked": { - "lastModified": 1665438610, - "narHash": "sha256-s8/jYo5qseJ4ilyAM2sz1mD5DBybSTrkfd4b9pkgdcU=", - "owner": "serokell", - "repo": "serokell.nix", - "rev": "a4def0b297a0ec69066747df909251a6a7555b1d", - "type": "github" - }, - "original": { - "owner": "serokell", - "ref": "magicrb-allow-wildcards-with-no-main", - "repo": "serokell.nix", - "type": "github" - } - }, - "terranix": { - "flake": false, - "locked": { - "lastModified": 1676043131, - "narHash": "sha256-xA3vUk86nFoDkYmW+bOgX/hTWWDdgumsJMlYE7iumgQ=", - "owner": "terranix", - "repo": "terranix", - "rev": "ac98723a6c66fce3f91b0e8cbf8911430736f130", - "type": "github" - }, - "original": { - "owner": "terranix", - "repo": "terranix", - "type": "github" - } - }, - "udp-over-tcp": { - "flake": false, - "locked": { - "lastModified": 1669211752, - "narHash": "sha256-h44xrmRAlfy1Br0PAtZAzOwSMptaUatjXysA/l2Kff8=", - "owner": "mullvad", - "repo": "udp-over-tcp", - "rev": "4d52f93cd9962562cb52d66e36771d5f5c70e25a", - "type": "github" - }, - "original": { - "owner": "mullvad", - "repo": "udp-over-tcp", - "type": "github" - } - }, - "uterranix": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ], - "terranix": "terranix" - }, - "locked": { - "lastModified": 1680122738, - "narHash": "sha256-Dvb6ZpRSPt5G6VkHzNOqCNRyHD7J9AdFYgPfHEHi7BU=", - "path": "/home/main/uterranix", - "type": "path" - }, - "original": { - "path": "/home/main/uterranix", - "type": "path" - } - }, - "utils": { - "locked": { - "lastModified": 1648297722, - "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "vtermModule": { - "flake": false, - "locked": { - "lastModified": 1668779692, - "narHash": "sha256-dNW3eXgFgah7eIug+MqXTl59HfSbM5HLKwHdp1CAmyo=", - "owner": "akermu", - "repo": "emacs-libvterm", - "rev": "f14d113ee4618f052879509ec378feb9766b871b", - "type": "github" - }, - "original": { - "owner": "akermu", - "repo": "emacs-libvterm", - "type": "github" - } - }, - "webcord": { - "flake": false, - "locked": { - "lastModified": 1669766230, - "narHash": "sha256-0+c66wAiSemk6WKaUjkfYBM/xPV739Ljs83qR//dh+M=", - "owner": "SpacingBat3", - "repo": "WebCord", - "rev": "338ef34d5196932be1605c2c2eede45442076b3b", - "type": "github" - }, - "original": { - "owner": "SpacingBat3", - "repo": "WebCord", - "type": "github" - } - }, - "yusdacra-dotfiles": { - "flake": false, - "locked": { - "lastModified": 1667679031, - "narHash": "sha256-bui/3iYI0NfxbzvMOLdZvHzxxkCsojq5lMWCICPOAt4=", - "owner": "yusdacra", - "repo": "nixos-config", - "rev": "01f77180019f7526bf6e1d23481eb606f4efd43c", - "type": "github" - }, - "original": { - "owner": "yusdacra", - "repo": "nixos-config", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index a4c1f0b..0000000 --- a/flake.nix +++ /dev/null @@ -1,213 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - inputs = { - nixpkgs-stable.url = "github:NixOS/nixpkgs?ref=nixos-22.11"; - nixpkgs.url = "sourcehut:~magic_rb/nixpkgs"; - nixpkgs-master.url = "github:NixOS/nixpkgs?ref=master"; - nixpkgs-hashicorp.url = "sourcehut:~magic_rb/nixpkgs?ref=nixos-unstable"; - nixpkgs-firefox.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; - nixpkgs-discord.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; - - nixinate.url = "github:MagicRB/nixinate"; - nixinate.inputs.nixpkgs.follows = "nixpkgs"; - - home-manager.url = "github:nix-community/home-manager?ref=master"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - home-manager.inputs.utils.follows = "flake-utils"; - - nixng.url = "github:nix-community/NixNG"; - nixng.inputs.nixpkgs.follows = "nixpkgs"; - - poetry2nix.url = "github:nix-community/poetry2nix"; - poetry2nix.inputs.nixpkgs.follows = "nixpkgs"; - poetry2nix.inputs.flake-utils.follows = "flake-utils"; - - nix.url = "github:NixOS/nix"; - nix.inputs.nixpkgs.follows = "nixpkgs"; - - deploy-rs.url = "github:serokell/deploy-rs"; - deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; - deploy-rs.inputs.utils.follows = "flake-utils"; - deploy-rs.inputs.flake-compat.follows = "flake-compat"; - - nomad-driver-containerd-nix.url = "github:MagicRB/nomad-driver-containerd-nix"; # "git+https://gitea.redalder.org/Magic_RB/nomad-driver-containerd-nix"; - nomad-driver-containerd-nix.inputs.nixpkgs.follows = "nixpkgs"; - - nix-gaming.url = "github:fufexan/nix-gaming"; - nix-gaming.inputs.nixpkgs.follows = "nixpkgs"; - - emacs-overlay.url = "github:nix-community/emacs-overlay"; - emacs-overlay.inputs.nixpkgs.follows = "nixpkgs"; - emacs-overlay.inputs.flake-utils.follows = "flake-utils"; - - flake-parts.url = "github:hercules-ci/flake-parts"; - - flake-utils.url = "github:numtide/flake-utils"; - - dream2nix.url = "github:nix-community/dream2nix"; - dream2nix.inputs.nixpkgs.follows = "nixpkgs"; - dream2nix.inputs.alejandra.follows = "alejandra"; - dream2nix.inputs.pre-commit-hooks.follows = "pre-commit-hooks"; - dream2nix.inputs.flake-utils-pre-commit.follows = "flake-utils"; - - alejandra.url = "github:kamadorueda/alejandra"; - alejandra.inputs.nixpkgs.follows = "nixpkgs"; - alejandra.inputs.fenix.follows = "fenix"; - alejandra.inputs.flakeCompat.follows = "flake-compat"; - - pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; - pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; - pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; - - nil.url = "github:oxalica/nil"; - nil.inputs.nixpkgs.follows = "nixpkgs"; - nil.inputs.flake-utils.follows = "flake-utils"; - - serokell-nix.url = "github:serokell/serokell.nix?ref=magicrb-allow-wildcards-with-no-main"; - serokell-nix.inputs.flake-compat.follows = "flake-compat"; - serokell-nix.inputs.gitignore-nix.follows = "gitignore-nix"; - - webcord.url = "github:SpacingBat3/WebCord"; - webcord.flake = false; - - fenix.url = "github:nix-community/fenix"; - fenix.flake = false; - - devshell.url = "github:numtide/devshell"; - devshell.flake = false; - - gomod2nix.url = "github:tweag/gomod2nix"; - gomod2nix.flake = false; - - mach-nix.url = "github:DavHau/mach-nix"; - mach-nix.flake = false; - - crane.url = "github:ipetkov/crane"; - crane.flake = false; - - flake-compat.url = "github:edolstra/flake-compat"; - flake-compat.flake = false; - - emacs.url = "sourcehut:~magic_rb/emacs"; - emacs.flake = false; - - vtermModule.url = "github:akermu/emacs-libvterm"; - vtermModule.flake = false; - - secret.url = "path:///var/empty"; - secret.flake = false; - - qmk.url = "https://github.com/qmk/qmk_firmware"; - qmk.flake = false; - qmk.type = "git"; - qmk.ref = "master"; - qmk.submodules = true; - - bootloadHID.url = "github:whiteneon/bootloadHID"; - bootloadHID.flake = false; - - hidapitester.url = "github:todbot/hidapitester"; - hidapitester.flake = false; - - yusdacra-dotfiles.url = "github:yusdacra/nixos-config"; - yusdacra-dotfiles.flake = false; - - fufexan-dotfiles.url = "github:fufexan/dotfiles"; - fufexan-dotfiles.flake = false; - - ical2org.url = "git+https://git.sr.ht/~magic_rb/ical2orgpy"; - ical2org.flake = false; - - udp-over-tcp.url = "github:mullvad/udp-over-tcp"; - udp-over-tcp.flake = false; - - gitignore-nix.url = "github:hercules-ci/gitignore.nix"; - gitignore-nix.flake = false; - - uterranix.url = "path:///home/main/uterranix"; - uterranix.inputs.flake-parts.follows = "flake-parts"; - uterranix.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = inputs@{ - self, - flake-parts, - nixpkgs, - nixinate, - ... - }: - let - systems = ["x86_64-linux" "aarch64-linux"]; - flake = - flake-parts.lib.mkFlake - { - inherit inputs; - specialArgs = { - roots.nixos = ./. + "/nixos"; - roots.flake = ./.; - roots.home-manager = ./. + "/home-manager"; - }; - } - { - inherit systems; - - imports = [ - inputs.uterranix.flakeModule - ./modules - ]; - - uterranix.config = ./terranix/default.nix; - uterranix.terraform = pkgs: - let - hpkgs = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}; - in - hpkgs.terraform.withPlugins (p: - [ - p.consul - ((p.nomad.override { - hash = "sha256-oHY+jM4JQgLlE1wd+/H9H8H2g0e9ZuxI6OMlz3Izfjg="; - vendorHash = "sha256-zVU7zhKfWmFLdhsK9oQkSxCW7B7ctzD/B0DvzU+Wnyg="; - mkProviderGoModule = - (args: - hpkgs.buildGoModule (args // { - overrideModAttrs = old: { - preBuild = '' - go get github.com/hashicorp/nomad - go get github.com/hashicorp/nomad/api - ''; - postInstall = '' - cp go.mod go.sum $out/ - ''; - }; - })); - }).overrideAttrs (old: { - postConfigure = '' - cp vendor/{go.mod,go.sum} . - ''; - })) - p.local - (p.vault.overrideAttrs (old: { patches = [ ./0001-Allow-null-in-authMountTuneSchema.patch ]; })) - p.random - p.null - (hpkgs.terraform.plugins.mkProvider { - owner = "MagicRB"; - repo = "terraform-provider-influxdb-v2"; - rev = "4f10e465f9526b47d1ef97a8f2e109aa85a7d647"; - version = "0.4.6"; - hash = "sha256-/IQoA1CwYIafHbHKSZq7pZKFxefgd09fm0lnBW3r11Q="; - vendorHash = "sha256-g7Njs7psHFFSWk44CiV+blLrzpnB+L9HgMTx3lLMA8Q="; - provider-source-address = "registry.terraform.io/MagicRB/influxdb-v2"; - }) - ] - ); - }; - in - flake // { - apps = nixpkgs.lib.genAttrs systems (system: - (nixinate.nixinate.${system} self) - // flake.apps.${system} - ); - }; -} diff --git a/home-manager/modules/3d-printing.nix b/home-manager/modules/3d-printing.nix deleted file mode 100644 index 98786d1..0000000 --- a/home-manager/modules/3d-printing.nix +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.packageCollections."3dPrinting"; -in { - options.magic_rb.packageCollections."3dPrinting" = { - enable = - mkEnableOption - '' - Enable 3D printing package collection, contains Prusa Slicer, - Cura, OpenSCAD, and inkscape." - ''; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - openscad - cura - inkscape - super-slicer - freecad - ]; - - home.file.".local/share/OpenSCAD/libraries/BOSL2".source = - pkgs.fetchFromGitHub { - owner = "revarbat"; - repo = "BOSL2"; - rev = "85e6dcd4835d019c8b582c03cf6e41bf83199cd1"; - sha256 = "sha256-fuOBp8231ODF4mRzilBfb/JePG+8ANdxkiHbA6a4wts="; - }; - }; -} diff --git a/home-manager/modules/alacritty/alacritty.yaml b/home-manager/modules/alacritty/alacritty.yaml deleted file mode 100644 index 799b8c6..0000000 --- a/home-manager/modules/alacritty/alacritty.yaml +++ /dev/null @@ -1,565 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -# Configuration for Alacritty, the GPU enhanced terminal emulator. - -# Any items in the `env` entry below will be added as -# environment variables. Some entries may override variables -# set by alacritty itself. -env: - # TERM variable - # - # This value is used to set the `$TERM` environment variable for - # each instance of Alacritty. If it is not present, alacritty will - # check the local terminfo database and use `alacritty` if it is - # available, otherwise `xterm-256color` is used. - # TERM: rxvt-unicode-256color - TERM: xterm-256color - -#window: - # Window dimensions (changes require restart) - # - # Specified in number of columns/lines, not pixels. - # If both are `0`, this setting is ignored. - #dimensions: - # columns: 0 - # lines: 0 - - # Window position (changes require restart) - # - # Specified in number of pixels. - # If the position is not set, the window manager will handle the placement. - #position: - # x: 0 - # y: 0 - - # Window padding (changes require restart) - # - # Blank space added around the window in pixels. This padding is scaled - # by DPI and the specified value is always added at both opposing sides. - #padding: - # x: 0 - # y: 0 - - # Spread additional padding evenly around the terminal content. - #dynamic_padding: false - - # Window decorations - # - # Values for `decorations`: - # - full: Borders and title bar - # - none: Neither borders nor title bar - # - # Values for `decorations` (macOS only): - # - transparent: Title bar, transparent background and title bar buttons - # - buttonless: Title bar, transparent background, but no title bar buttons - #decorations: full - - # Startup Mode (changes require restart) - # - # Values for `startup_mode`: - # - Windowed - # - Maximized - # - Fullscreen - # - # Values for `startup_mode` (macOS only): - # - SimpleFullscreen - #startup_mode: Windowed - - # Window title - #title: Alacritty - - # Window class (Linux/BSD only): - #class: - # Application instance name - #instance: Alacritty - # General application class - #general: Alacritty - - # GTK theme variant (Linux/BSD only) - # - # Override the variant of the GTK theme. Commonly supported values are `dark` and `light`. - # Set this to `None` to use the default theme variant. - #gtk_theme_variant: None - -#scrolling: - # Maximum number of lines in the scrollback buffer. - # Specifying '0' will disable scrolling. - #history: 10000 - - # Number of lines the viewport will move for every line scrolled when - # scrollback is enabled (history > 0). - #multiplier: 3 - -# Font configuration -font: - # Normal (roman) font face - normal: - # Font family - # - # Default: - # - (macOS) Menlo - # - (Linux/BSD) monospace - # - (Windows) Consolas - family: SourceCodePro - - # The `style` can be specified to pick a specific face. - style: Regular - - # Bold font face - bold: - # Font family - # - # If the bold family is not specified, it will fall back to the - # value specified for the normal font. - family: SourceCodePro - - # The `style` can be specified to pick a specific face. - style: Bold - - # Italic font face - italic: - # Font family - # - # If the italic family is not specified, it will fall back to the - # value specified for the normal font. - family: SourceCodePro - - # The `style` can be specified to pick a specific face. - style: Italic - - # Bold italic font face - bold_italic: - # Font family - # - # If the bold italic family is not specified, it will fall back to the - # value specified for the normal font. - family: SourceCodePro - - # The `style` can be specified to pick a specific face. - style: Bold Italic - - # Point size - size: 10.0 - - # Offset is the extra space around each character. `offset.y` can be thought of - # as modifying the line spacing, and `offset.x` as modifying the letter spacing. - #offset: - # x: 0 - # y: 0 - - # Glyph offset determines the locations of the glyphs within their cells with - # the default being at the bottom. Increasing `x` moves the glyph to the right, - # increasing `y` moves the glyph upwards. - #glyph_offset: - # x: 0 - # y: 0 - - # Thin stroke font rendering (macOS only) - # - # Thin strokes are suitable for retina displays, but for non-retina screens - # it is recommended to set `use_thin_strokes` to `false` - # - # macOS >= 10.14.x: - # - # If the font quality on non-retina display looks bad then set - # `use_thin_strokes` to `true` and enable font smoothing by running the - # following command: - # `defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO` - # - # This is a global setting and will require a log out or restart to take - # effect. - #use_thin_strokes: true - -# If `true`, bold text is drawn using the bright color variants. -#draw_bold_text_with_bright_colors: false - -# Colors (Tomorrow Night Bright) -colors: - # Default colors - primary: - background: '#171717' - foreground: '#aaaaaa' - - # Bright and dim foreground colors - # - # The dimmed foreground color is calculated automatically if it is not present. - # If the bright foreground color is not set, or `draw_bold_text_with_bright_colors` - # is `false`, the normal foreground color will be used. - #dim_foreground: '#9a9a9a' - #bright_foreground: '#ffffff' - - # Cursor colors - # - # Colors which should be used to draw the terminal cursor. If these are unset, - # the cursor color will be the inverse of the cell color. - cursor: - # text: '#000000' - cursor: '#cccccc' - - # Selection colors - # - # Colors which should be used to draw the selection area. If selection - # background is unset, selection color will be the inverse of the cell colors. - # If only text is unset the cell text color will remain the same. - #selection: - # text: '#eaeaea' - # background: '#404040' - - # Normal colors - normal: - black: '#282a2e' - red: '#c53030' - green: '#b7c52c' - yellow: '#e17a33' - blue: '#4292d4' - magenta: '#aa4aca' - cyan: '#50cebe' - white: '#cccccc' - - # Bright colors - bright: - black: '#373b41' - red: '#d14e4e' - green: '#b8c34f' - yellow: '#f4bc4e' - blue: '#6e9cc2' - magenta: '#b37ec3' - cyan: '#72c1b6' - white: '#aaaaaa' - - # Dim colors - # - # If the dim colors are not set, they will be calculated automatically based - # on the `normal` colors. - #dim: - # black: '#000000' - # red: '#8c3336' - # green: '#7a8530' - # yellow: '#97822e' - # blue: '#506d8f' - # magenta: '#80638e' - # cyan: '#497e7a' - # white: '#9a9a9a' - - # Indexed Colors - # - # The indexed colors include all colors from 16 to 256. - # When these are not set, they're filled with sensible defaults. - # - # Example: - # `- { index: 16, color: '#ff00ff' }` - # - #indexed_colors: [] - -# Visual Bell -# -# Any time the BEL code is received, Alacritty "rings" the visual bell. Once -# rung, the terminal background will be set to white and transition back to the -# default background color. You can control the rate of this transition by -# setting the `duration` property (represented in milliseconds). You can also -# configure the transition function by setting the `animation` property. -# -# Values for `animation`: -# - Ease -# - EaseOut -# - EaseOutSine -# - EaseOutQuad -# - EaseOutCubic -# - EaseOutQuart -# - EaseOutQuint -# - EaseOutExpo -# - EaseOutCirc -# - Linear -# -# Specifying a `duration` of `0` will disable the visual bell. -#visual_bell: -# animation: EaseOutExpo -# duration: 0 -# color: '#ffffff' - -# Background opacity -# -# Window opacity as a floating point number from `0.0` to `1.0`. -# The value `0.0` is completely transparent and `1.0` is opaque. -background_opacity: 0.9 - -#selection: - #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" - - # When set to `true`, selected text will be copied to the primary clipboard. - #save_to_clipboard: false - -# Allow terminal applications to change Alacritty's window title. -#dynamic_title: true - -#cursor: - # Cursor style - # - # Values for `style`: - # - ▇ Block - # - _ Underline - # - | Beam - #style: Block - - # If this is `true`, the cursor will be rendered as a hollow box when the - # window is not focused. - #unfocused_hollow: true - -# Live config reload (changes require restart) -#live_config_reload: true - -# Shell -# -# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`. -# Entries in `shell.args` are passed unmodified as arguments to the shell. -# -# Default: -# - (macOS) /bin/bash --login -# - (Linux/BSD) user login shell -# - (Windows) powershell -#shell: -# program: /bin/bash -# args: -# - --login - -# Startup directory -# -# Directory the shell is started in. If this is unset, or `None`, the working -# directory of the parent process will be used. -#working_directory: None - -# WinPTY backend (Windows only) -# -# Alacritty defaults to using the newer ConPTY backend if it is available, -# since it resolves a lot of bugs and is quite a bit faster. If it is not -# available, the the WinPTY backend will be used instead. -# -# Setting this option to `true` makes Alacritty use the legacy WinPTY backend, -# even if the ConPTY backend is available. -#winpty_backend: false - -# Send ESC (\x1b) before characters when alt is pressed. -#alt_send_esc: true - -#mouse: - # Click settings - # - # The `double_click` and `triple_click` settings control the time - # alacritty should wait for accepting multiple clicks as one double - # or triple click. - #double_click: { threshold: 300 } - #triple_click: { threshold: 300 } - - # If this is `true`, the cursor is temporarily hidden when typing. - #hide_when_typing: false - - #url: - # URL launcher - # - # This program is executed when clicking on a text which is recognized as a URL. - # The URL is always added to the command as the last parameter. - # - # When set to `None`, URL launching will be disabled completely. - # - # Default: - # - (macOS) open - # - (Linux/BSD) xdg-open - # - (Windows) explorer - #launcher: - # program: xdg-open - # args: [] - - # URL modifiers - # - # These are the modifiers that need to be held down for opening URLs when clicking - # on them. The available modifiers are documented in the key binding section. - #modifiers: None - -# Mouse bindings -# -# Mouse bindings are specified as a list of objects, much like the key -# bindings further below. -# -# To trigger mouse bindings when an application running within Alacritty captures the mouse, the -# `Shift` modifier is automatically added as a requirement. -# -# Each mouse binding will specify a: -# -# - `mouse`: -# -# - Middle -# - Left -# - Right -# - Numeric identifier such as `5` -# -# - `action` (see key bindings) -# -# And optionally: -# -# - `mods` (see key bindings) -#mouse_bindings: -# - { mouse: Middle, action: PasteSelection } - -# Key bindings -# -# Key bindings are specified as a list of objects. For example, this is the -# default paste binding: -# -# `- { key: V, mods: Control|Shift, action: Paste }` -# -# Each key binding will specify a: -# -# - `key`: Identifier of the key pressed -# -# - A-Z -# - F1-F24 -# - Key0-Key9 -# -# A full list with available key codes can be found here: -# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants -# -# Instead of using the name of the keys, the `key` field also supports using -# the scancode of the desired key. Scancodes have to be specified as a -# decimal number. This command will allow you to display the hex scancodes -# for certain keys: -# -# `showkey --scancodes`. -# -# Then exactly one of: -# -# - `chars`: Send a byte sequence to the running application -# -# The `chars` field writes the specified string to the terminal. This makes -# it possible to pass escape sequences. To find escape codes for bindings -# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside -# of tmux. Note that applications use terminfo to map escape sequences back -# to keys. It is therefore required to update the terminfo when changing an -# escape sequence. -# -# - `action`: Execute a predefined action -# -# - Copy -# - Paste -# - PasteSelection -# - IncreaseFontSize -# - DecreaseFontSize -# - ResetFontSize -# - ScrollPageUp -# - ScrollPageDown -# - ScrollLineUp -# - ScrollLineDown -# - ScrollToTop -# - ScrollToBottom -# - ClearHistory -# - Hide -# - Minimize -# - Quit -# - ToggleFullscreen -# - SpawnNewInstance -# - ClearLogNotice -# - ReceiveChar -# - None -# -# (macOS only): -# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space -# -# - `command`: Fork and execute a specified command plus arguments -# -# The `command` field must be a map containing a `program` string and an -# `args` array of command line parameter strings. For example: -# `{ program: "alacritty", args: ["-e", "vttest"] }` -# -# And optionally: -# -# - `mods`: Key modifiers to filter binding actions -# -# - Command -# - Control -# - Option -# - Super -# - Shift -# - Alt -# -# Multiple `mods` can be combined using `|` like this: -# `mods: Control|Shift`. -# Whitespace and capitalization are relevant and must match the example. -# -# - `mode`: Indicate a binding for only specific terminal reported modes -# -# This is mainly used to send applications the correct escape sequences -# when in different modes. -# -# - AppCursor -# - AppKeypad -# - Alt -# -# A `~` operator can be used before a mode to apply the binding whenever -# the mode is *not* active, e.g. `~Alt`. -# -# Bindings are always filled by default, but will be replaced when a new -# binding with the same triggers is defined. To unset a default binding, it can -# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for -# a no-op if you do not wish to receive input characters for that binding. -# -# If the same trigger is assigned to multiple actions, all of them are executed -# at once. -#key_bindings: - # (Windows, Linux, and BSD only) - #- { key: V, mods: Control|Shift, action: Paste } - #- { key: C, mods: Control|Shift, action: Copy } - #- { key: Insert, mods: Shift, action: PasteSelection } - #- { key: Key0, mods: Control, action: ResetFontSize } - #- { key: Equals, mods: Control, action: IncreaseFontSize } - #- { key: Add, mods: Control, action: IncreaseFontSize } - #- { key: Subtract, mods: Control, action: DecreaseFontSize } - #- { key: Minus, mods: Control, action: DecreaseFontSize } - - # (Windows only) - #- { key: Return, mods: Alt, action: ToggleFullscreen } - - # (macOS only) - #- { key: Key0, mods: Command, action: ResetFontSize } - #- { key: Equals, mods: Command, action: IncreaseFontSize } - #- { key: Add, mods: Command, action: IncreaseFontSize } - #- { key: Minus, mods: Command, action: DecreaseFontSize } - #- { key: K, mods: Command, action: ClearHistory } - #- { key: K, mods: Command, chars: "\x0c" } - #- { key: V, mods: Command, action: Paste } - #- { key: C, mods: Command, action: Copy } - #- { key: H, mods: Command, action: Hide } - #- { key: M, mods: Command, action: Minimize } - #- { key: Q, mods: Command, action: Quit } - #- { key: W, mods: Command, action: Quit } - #- { key: F, mods: Command|Control, action: ToggleFullscreen } - - #- { key: Paste, action: Paste } - #- { key: Copy, action: Copy } - #- { key: L, mods: Control, action: ClearLogNotice } - #- { key: L, mods: Control, chars: "\x0c" } - #- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt } - #- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt } - #- { key: Home, mods: Shift, action: ScrollToTop, mode: ~Alt } - #- { key: End, mods: Shift, action: ScrollToBottom, mode: ~Alt } - -#debug: - # Display the time it takes to redraw each frame. - #render_timer: false - - # Keep the log file after quitting Alacritty. - #persistent_logging: false - - # Log level - # - # Values for `log_level`: - # - None - # - Error - # - Warn - # - Info - # - Debug - # - Trace - #log_level: Warn - - # Print all received window events. - #print_events: false diff --git a/home-manager/modules/alacritty/default.nix b/home-manager/modules/alacritty/default.nix deleted file mode 100644 index c397b0c..0000000 --- a/home-manager/modules/alacritty/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.programs.alacritty; -in { - options.magic_rb.programs.alacritty = { - enable = mkEnableOption "Enable the alacritty terminal emulator"; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - alacritty - ]; - - home.file = { - ".config/alacritty/alacritty.yaml".source = ./alacritty.yaml; - }; - }; -} diff --git a/home-manager/modules/bash/bash_profile b/home-manager/modules/bash/bash_profile deleted file mode 100644 index 9f2d5cf..0000000 --- a/home-manager/modules/bash/bash_profile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -source $HOME/.bashrc diff --git a/home-manager/modules/bash/bashrc b/home-manager/modules/bash/bashrc deleted file mode 100644 index aac45f2..0000000 --- a/home-manager/modules/bash/bashrc +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -[[ -e /etc/profile.d/nix.sh ]] && . /etc/profile.d/nix.sh - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -[[ $DISPLAY ]] && shopt -s checkwinsize - -[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion - -## Enable color on grep -alias grep='grep --color=auto' - -## Replace ls and cat with exa and bat respectively -alias ls='@exa@/bin/exa' -alias cat='@bat@/bin/bat' - -if [ -z "${SHLVL_INIT+x}" ]; then - export SHLVL_INIT=1 SHLVL=1 -fi - - -if [ "$SHLVL" = 1 ]; then - export PS1="\u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] " -else - export PS1="$SHLVL: \u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] " -fi - -emacsclient() { - if [[ -e "$HOME/.ssh/emacs-server" ]] && \ - nc -Uz "$HOME/.ssh/emacs-server" >/dev/null 2>&1 && \ - [[ ! -z ${INSIDE_EMACS+x} ]] ; then - params=() - sudo=0 - nowait=0 - - host=$(echo $SSH_CONNECTION | cut -d' ' -f3) - port=$(echo $SSH_CONNECTION | cut -d' ' -f4) - - for p in "${@}"; do - if [[ "${p}" == "-s" || "${p}" == "--sudo" ]]; then - sudo=1 - elif [[ "${p}" == "-n" || "${p}" == "--no-wait" ]]; then - params+=( "-nowait" ) - else - if [[ ${sudo} -eq 1 ]]; then - params+=( "-file /ssh:${USER}@${host}#${port}|sudo::"$(realpath -m "${p}") ) - else - params+=( "-file /ssh:${USER}@${host}#${port}:"$(realpath "${p}") ) - fi - fi - done - - if [[ ${nowait} -eq 0 ]] ; then - printf 'Waiting for Emacs...\n' - fi - - echo "${params[@]}" | nc -U "$HOME/.ssh/emacs-server" >/dev/null 2>&1 - else - sudo=0 - args=() - for p in "${@}"; do - if [[ "${p}" == "-s" || "${p}" == "--sudo" ]]; then - sudo=1 - else - args+=( "${p}" ) - fi - done - - if [[ ${sudo} -eq 1 ]]; then - echo env emacsclient "/sudo::${args[0]}" "${args[@]:1}" - env emacsclient "/sudo::${args[0]}" "${args[@]:1}" - else - env emacsclient "${@}" - fi - fi -} - -alias e='emacsclient' -alias E='emacsclient -s' - - -## Set prompt - -export EDITOR="emacsclient" -export BROWSER="firefox-nightly" - -## Clear scrollback for vterm -if [[ "$INSIDE_EMACS" = 'vterm' ]]; then - function clear(){ - vterm_printf "51;Evterm-clear-scrollback"; - tput clear; - } -fi - -if [[ "$INSIDE_EMACS" = 'vterm' ]] \ - && [[ -n ${EMACS_VTERM_PATH} ]] \ - && [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then - source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh -fi - -if [[ "@direnvEnabled@" == "true" ]] ; then - eval "$(direnv hook bash)" -fi - - -alias zlist="zfs list -r -o name,used,avail,refer,compression,compressratio,recordsize,snapdir,sharenfs,mountpoint" - -function loadenv() -{ - function passhead() - { - pass $1 | tail -n +2 - } - - export \ - $(passhead Infrastructure/Nomad) \ - $(passhead Infrastructure/Vault) \ - $(passhead Infrastructure/Consul) \ - $(passhead Infrastructure/Influx) -} - -function yaml2nix() -{ - input_file="$1" - output_file="$2" - - if [ "${input_file}" = "${output_file}" ] ; then - remarshal -if yaml -of json -i "${input_file}" -o /dev/stdout | nix eval --impure --expr 'builtins.fromJSON (builtins.readFile "/dev/stdin")' > "${input_file}.tmp" - mv "${input_file}.tmp" "${output_file}" - else - remarshal -if yaml -of json -i "${input_file}" -o /dev/stdout | nix eval --impure --expr 'builtins.fromJSON (builtins.readFile "/dev/stdin")' > "${output_file}" - fi - - nixfmt "${output_file}" -} diff --git a/home-manager/modules/bash/default.nix b/home-manager/modules/bash/default.nix deleted file mode 100644 index 4cc26e7..0000000 --- a/home-manager/modules/bash/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.programs.bash; -in { - options.magic_rb.programs.bash = { - enable = mkEnableOption "Enable bash, the shell"; - emacsclient-remote = mkOption { - description = "Enable emacsclient-remote and associated aliases"; - type = types.bool; - default = true; - }; - - enableDirenv = mkEnableOption "Enable direnv"; - }; - - config = mkIf cfg.enable { - home.packages = mkMerge [ - (mkIf cfg.emacsclient-remote [ - pkgs.magic_rb.emacsclient-remote - ]) - (mkIf cfg.enableDirenv [ - pkgs.direnv - ]) - ]; - - programs.direnv.enable = mkIf cfg.enableDirenv true; - programs.direnv.nix-direnv.enable = mkIf cfg.enableDirenv true; - - home.file = { - ".bash_profile".source = ./bash_profile; - ".bashrc".source = pkgs.writeSubstitutedFile { - name = ".bashrc"; - file = ./bashrc; - substitutes = { - "exa" = "${pkgs.exa}"; - "bat" = "${pkgs.bat}"; - "direnvEnabled" = - if cfg.enableDirenv - then "true" - else "false"; - }; - }; - }; - }; -} diff --git a/home-manager/modules/cmdline-utils.nix b/home-manager/modules/cmdline-utils.nix deleted file mode 100644 index fdafee5..0000000 --- a/home-manager/modules/cmdline-utils.nix +++ /dev/null @@ -1,64 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.packageCollections.cmdline; - - ffmpegSpecial = - pkgs.ffmpeg_5-full.override - { - svt-av1 = - pkgs.svt-av1.overrideAttrs - (old: rec - { - version = "1.1.0"; - - src = pkgs.fetchFromGitHub { - owner = "AOMediaCodec"; - repo = "SVT-AV1"; - rev = "v${version}"; - sha256 = "sha256-A8PVrPQcsCx+cY0DKuvQ5g//1Iqk9+1Uvz6cN+Jc2E8="; - }; - }); - # ffmpeg = pkgs.ffmpeg_5.overrideAttrs - # (old: rec - # { version = "5.1.0"; - - # src = pkgs.fetchFromGitHub { - # owner = "FFmpeg"; - # repo = "FFmpeg"; - # rev = "9222965fdd9594ff9e921d4ad25beac4eefa2373"; - # sha256 = "sha256-MVCRynpG03pTDfSw7vhCxjDErSh84a7V5iM+zqr7P94="; - # }; - # }); - }; -in { - options.magic_rb.packageCollections.cmdline = { - enable = - mkEnableOption - '' - A package collection containing command line programs, specifically zip, unzip, unrar (unfree), git, and htop. - ''; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - obs-studio - zip - unzip - unrar - git - htop - # ffmpegSpecial - lm_sensors - cryptsetup - emacs-rofi - ]; - }; -} diff --git a/home-manager/modules/default.nix b/home-manager/modules/default.nix deleted file mode 100644 index bd30289..0000000 --- a/home-manager/modules/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{roots, ...}: { - imports = [ - ./alacritty - ./bash - ./ssh - ./emacs - ./xmonad - ./3d-printing.nix - ./cmdline-utils.nix - ./gpg.nix - ./graphical-programs.nix - ./multimc.nix - ./optimisation.nix - ./pantalaimon.nix - ./webdev.nix - ./wine.nix - (roots.flake + "/nixos/secret-lib") - ]; -} diff --git a/home-manager/modules/emacs/.emacs b/home-manager/modules/emacs/.emacs deleted file mode 100755 index 2a185fe..0000000 --- a/home-manager/modules/emacs/.emacs +++ /dev/null @@ -1,136 +0,0 @@ -; SPDX-FileCopyrightText: 2022 Richard Brežák -; -; SPDX-License-Identifier: LGPL-3.0-or-later - -;;; package --- Summary - -;;; Commentary: - - -;;; Code: - -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(auth-source-save-behavior nil) - '(custom-enabled-themes '()) - '(custom-safe-themes - '("2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" default)) - '(package-selected-packages - '())) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) - -(setq backup-directory-alist `(("." . "~/.emacs.d/saves"))) -(setq vc-follow-symlinks t) - -(add-to-list 'load-path "~/.emacs.d/lisp/") -(add-to-list 'load-path "~/.emacs.d/lisp/org-task-dump") - -(straight-use-package 'use-package) -(straight-thaw-versions) - -;; load general early for now -(use-package general - :straight t) - -(use-package org - :straight t) - -(defun magic_rb/org-transclusion-babel-load (&optional narrowed) - "Call `org-babel-load-file` on all transcludes in the current file." - (interactive "P") - (save-restriction - (let ((marker (move-marker (make-marker) (point))) - (load-link (lambda () - (let* ((keyword-plist (org-transclusion-keyword-string-to-plist)) - (link (org-transclusion-wrap-path-to-link - (plist-get keyword-plist :link))) - - (link-raw (org-element-property :raw-link link)) - (link-type (org-element-property :type link))) - (when (string-equal link-type "id") - (message "RB Loading: %s" (org-id-find-id-file link-raw)) - (org-babel-load-file (org-id-find-id-file link-raw))))))) - (unless narrowed (widen)) - (goto-char (point-min)) - - ;; Handle inactive transclusions - (let ((regexp "^[ \t]*#\\+TRANSCLUDE:")) - (while (re-search-forward regexp nil t) - ;; Don't transclude if within a transclusion to avoid infinite - ;; recursion - (unless (or (org-transclusion-within-transclusion-p) - (plist-get (org-transclusion-keyword-string-to-plist) - :disable-auto)) - (funcall load-link)))) - - ;; Handle active transclusions - (while (setq match (text-property-search-forward 'org-transclusion-type)) - (goto-char (prop-match-beginning match)) - (org-transclusion-remove) - (funcall load-link) - (org-transclusion-add)) - - (goto-char marker) - (move-marker marker nil) ; point nowhere for GC - t))) - -(require 'cl-lib) - -(use-package org-roam - :straight t - :demand t - :init - (setq org-roam-v2-ack t - org-roam-directory "~/roam")) - -(defvar magic_rb/org-init-files - (cl-concatenate - 'list - (directory-files "~/.emacs.d/org" t "\\.org$") - (seq-map #'car - (org-roam-db-query - [:select [nodes:file] - :from tags - :left-join nodes - :on (= tags:node-id nodes:id) - :where (like tag (quote "%\"emacs-load\""))]))) - "List of org files, which should be tangled and loaded.") - -(defvar magic_rb/org-el-init-files - (cl-map 'list - (lambda (file) (concat (file-name-sans-extension file) ".el")) - magic_rb/org-init-files) - "List of generated elisp files from magic_rb/org-init-files.") - -(defun magic_rb/delete-file-maybe (file) - "If FILE exists, delete it." - (when (file-exists-p file) - (delete-file file))) - -(mapc #'magic_rb/delete-file-maybe magic_rb/org-el-init-files) -(mapc #'org-babel-load-file magic_rb/org-init-files) - - -(provide '.emacs) -;;; .emacs ends here diff --git a/home-manager/modules/emacs/.emacs.d/.keep b/home-manager/modules/emacs/.emacs.d/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/home-manager/modules/emacs/.emacs.d/lisp/.keep b/home-manager/modules/emacs/.emacs.d/lisp/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/home-manager/modules/emacs/.emacs.d/lisp/man-preview.el b/home-manager/modules/emacs/.emacs.d/lisp/man-preview.el deleted file mode 100644 index 05f1835..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/man-preview.el +++ /dev/null @@ -1,305 +0,0 @@ -;;; man-preview.el --- preview nroff man file source - -; Copyright 2008, 2009, 2010, 2011, 2013, 2015 Kevin Ryde -; SPDX-FileCopyrightText: 2022 Richard Brežák -; -; SPDX-License-Identifier: LGPL-3.0-or-later - -;; man-preview.el is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by the -;; Free Software Foundation; either version 3, or (at your option) any later -;; version. -;; -;; man-preview.el is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -;; Public License for more details. -;; -;; You can get a copy of the GNU General Public License online at -;; . - - -;;; Commentary: - -;; M-x man-preview displays a formatted preview of man nroff source using -;; "man -l". The best feature is that when re-previewing the same file or -;; buffer the existing position in the preview is preserved, so if you've -;; changed the source only a little you should still be quite close to where -;; you were in the preview, to see how the change has come out. -;; -;; M-x man with "-l filename" does almost the same as this, but depends on -;; having a disk copy of a buffer, so can't work out of tar-mode members -;; etc. - -;;; Emacsen: -;; -;; Designed for Emacs 21 and up. Works in XEmacs 21. - -;;; Install: -;; -;; Put man-preview.el in one of your `load-path' directories, and to make -;; M-x man-preview available add to your .emacs -;; -;; (autoload 'man-preview "man-preview" nil t) -;; -;; You can also bind it to a key, for example f8 in nroff-mode, -;; -;; (eval-after-load "nroff-mode" -;; '(define-key nroff-mode-map [f8] 'man-preview)) -;; -;; There's an autoload cookie for `man-preview' if you install via -;; `M-x package-install' or know `update-file-autoloads'. Then bind it to a -;; key as desired. - -;;; History: -;; -;; Version 1 - the first version -;; Version 2 - break out the save-display and errorfile bits for clarity -;; Version 3 - xemacs21 switch-to-buffer-other-window only takes one arg -;; Version 4 - tighter compilation-find-file hack -;; Version 5 - use pipe rather than pty for subprocess -;; Version 6 - delete errors window when no errors -;; Version 7 - undo defadvice on unload-feature -;; Version 8 - express dependency on 'advice -;; Version 9 - compilation-find-file args by number, so not depend on names -;; Version 10 - macros not needed after byte compiling - -;;; Code: - -(require 'man) - -;; Explicit dependency on advice.el since `man-preview-unload-function' -;; needs `ad-find-advice' macro when running not byte compiled, and that -;; macro is not autoloaded. -(require 'advice) - -;; xemacs compatibility -(eval-and-compile - (defalias 'man-preview--make-temp-file - (if (eval-when-compile (fboundp 'make-temp-file)) - 'make-temp-file ;; emacs - ;; xemacs21 - (autoload 'mm-make-temp-file "mm-util") ;; from gnus - 'mm-make-temp-file))) - - -(defconst man-preview-buffer "*man-preview*" - "The name of the buffer for `man-preview' output.") - -(defconst man-preview-error-buffer "*man-preview-errors*" - "The name of the buffer for `man-preview' error messages.") - -(defvar man-preview-origin nil - "The name of the input buffer being displayed in `man-preview-buffer'.") - -(eval-when-compile - (defmacro man-preview--with-saved-display-position (&rest body) - "An internal part of man-preview.el. -This macro does not exist when running byte compiled. - -Save `window-start' and point positions as line/column. -The use of line/column means BODY can erase and rewrite the -buffer contents." - ;; (declare (debug t)) ;; emacs22,xemacs21, or 'cl - `(let ((point-column (current-column)) - (point-line (count-lines (point-min) (line-beginning-position))) - (window-line (count-lines (point-min) (window-start)))) - ,@body - - (goto-char (point-min)) (forward-line window-line) - ;; Don't let window-start be the very end of the buffer, since that - ;; would leave it completely blank. - (if (= (point) (point-max)) - (forward-line -1)) - (set-window-start (selected-window) (point)) - (goto-char (point-min)) (forward-line point-line) - (move-to-column point-column)))) - -(eval-when-compile - (defmacro man-preview--with-errorfile (&rest body) - "An internal part of man-preview.el. -This macro does not exist when running byte compiled. -Create an `errorfile' for use by the BODY forms. -An `unwind-protect' ensures the file is removed no matter what -BODY does." - ;; (declare (debug t)) ;; emacs22,xemacs21, or 'cl - `(let ((errorfile (man-preview--make-temp-file "man-preview-"))) - (unwind-protect - (progn ,@body) - (delete-file errorfile))))) - -;;;###autoload -(defun man-preview () - "Preview man page nroff source in the current buffer. -The buffer is put through \"man -l\" and the formatted result -displayed in a buffer. - -Errors from man or nroff are shown in a `compilation-mode' buffer -and `next-error' (\\[next-error]) can step through them to see -the offending parts of the source. - ------- -For reference, the non-ascii situation is roughly as follows. - -Traditionally roff input is supposed to be ascii with various -escape directives for further characters and inked accenting to -be rendered on the phototypesetter. Groff (version 1.18) takes -8-bit input, as latin-1 by default but in principle configurable. -It doesn't, however, have a utf8 input mode, so that should be -avoided (though it can operate on unicode chars internally if -given by escape directives). - -man-db 2.5 (October 2007) and up can convert input codings to -latin1 for groff, from a charset given either with an Emacs style -\"coding:\" cookie in the file, or a subdir name like -/usr/share/man/fr.UTF-8/man1, or guessing the content bytes. The -coding cookie is probably best for `man-preview' (since it only -sends to man's stdin, there's no subdir name for man to follow). - -On the output side groff can be asked to produce either latin1 or -utf8 (though how well it matches up inked overprinting to output -chars is another matter). - -In any case `man-preview' sends per `buffer-file-coding-system', -the same as if man was run directly on the file. Output from man -is requested as -Tlatin1 if the input coding is latin-1, or --Tutf8 for anything else (and if the running Emacs has utf-8). - ------- -The man-preview home page is -URL `http://user42.tuxfamily.org/man-preview/index.html'" - - (interactive) - - ;; Zap existing `man-preview-error-buffer'. - ;; Turn off any compilation-mode there so that mode won't attempt to parse - ;; the contents (until later when they've been variously munged). - (with-current-buffer (get-buffer-create man-preview-error-buffer) - (fundamental-mode) - (setq buffer-read-only nil) - (erase-buffer)) - - (let ((origin-buffer (current-buffer)) - (T-option "-Tlatin1") - (T-coding 'iso-8859-1) - (directory default-directory)) - - ;; Running man with either "-Tlatin1" or "-Tutf8" makes it print - ;; overstrikes and underscores for bold and italics, which - ;; `Man-fontify-manpage' (below) crunches into fontification. - ;; - ;; It might be that those -T options make man-db 2.5 lose its input - ;; charset detection ("manconv"), though it seems ok with 2.5.2. - ;; - (when (and (not (eq buffer-file-coding-system 'iso-8859-1)) - (memq 'utf-8 (coding-system-list))) - (setq T-option "-Tutf8") - (setq T-coding 'utf-8)) - - (switch-to-buffer man-preview-buffer) - (setq buffer-read-only nil) - - ;; default-directory set from the source buffer, so that find-file or - ;; whatever offers the same default as the source buffer. This is - ;; inherited on initial creation of the preview buffer, but has to be - ;; set explicitly when previewing a new source buffer with a different - ;; default-directory. - (setq default-directory directory) - - ;; if previewing a different buffer then erase here so as not to restore - ;; point+window position into a completely different document - (if (not (equal man-preview-origin (buffer-name origin-buffer))) - (erase-buffer)) - (setq man-preview-origin (buffer-name origin-buffer)) - - (man-preview--with-errorfile ;; compilation output - (man-preview--with-saved-display-position - (erase-buffer) - - (with-current-buffer origin-buffer - (let ((coding-system-for-write buffer-file-coding-system) - (coding-system-for-read T-coding) - (process-connection-type nil)) ;; pipe - (call-process-region (point-min) (point-max) "man" - nil ;; don't delete input - (list man-preview-buffer errorfile) - nil ;; don't redisplay - T-option "-l" "-"))) - - ;; show errors in a window, but only if there are any - (save-selected-window - (with-current-buffer man-preview-error-buffer - (insert-file-contents errorfile) - - ;; emacs21 compilation regexps don't like "" as a - ;; filename, so mung that (which is easier than adding to the - ;; patterns) - (goto-char (point-min)) - (while (re-search-forward "^:" nil t) - (replace-match "standardinput:" t t)) - - (if (= (point-min) (point-max)) - (progn - ;; No errors, kill buffer and window. Killing the window - ;; prevents something unrelated showing in a small window - ;; which can be annoying for buffer cycling etc. - (delete-windows-on (current-buffer)) - (kill-buffer nil)) - - ;; emacs21 ignores the first two lines of a compilation-mode - ;; buffer, so add in dummies - (goto-char (point-min)) - (insert "man-preview\n\n") - - ;; switch to display error buffer - (let ((existing-window (get-buffer-window (current-buffer)))) - (condition-case nil - ;; emacs two args - (switch-to-buffer-other-window (current-buffer) - t) ;; no-record - (error - ;; xemacs one arg - (switch-to-buffer-other-window (current-buffer)))) - ;; if newly displaying an error window then shrink to what's - ;; needed, don't want a half screen if there's only a couple - ;; of lines - (if (not existing-window) - (shrink-window-if-larger-than-buffer - (get-buffer-window (current-buffer))))) - (compilation-mode)))) - - (if (eval-when-compile (fboundp 'Man-mode)) - ;; emacs21 and emacs22 - (progn - (Man-fontify-manpage) - (Man-mode)) - ;; xemacs21 - (Manual-nuke-nroff-bs) - (Manual-mode)))))) - -(defadvice compilation-find-file (around man-preview activate) - "Use `man-preview-origin' buffer for its man/nroff errors." - - ;; args: (compilation-find-file MARKER FILENAME DIRECTORY &rest FORMATS) - (if (let ((marker (ad-get-arg 0)) - (filename (ad-get-arg 1))) - (and (equal filename - "standardinput") - (equal (buffer-name (marker-buffer marker)) - man-preview-error-buffer))) - (setq ad-return-value man-preview-origin) - ad-do-it)) - -(defun man-preview-unload-function () - "Remove defadvice from `compilation-find-file'. -This is called by `unload-feature'." - (when (ad-find-advice 'compilation-find-file 'around 'man-preview) - (ad-remove-advice 'compilation-find-file 'around 'man-preview) - (ad-activate 'compilation-find-file)) - nil) ;; and do normal unload-feature actions too - -;; LocalWords: roff groff Groff nroff latin Tlatin Tutf db subdir usr fr stdin filename ascii utf unicode codings charset - -(provide 'man-preview) - -;;; man-preview.el ends here diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-alert.el b/home-manager/modules/emacs/.emacs.d/lisp/org-alert.el deleted file mode 100644 index 2ab37b5..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-alert.el +++ /dev/null @@ -1,125 +0,0 @@ -;;; org-alert.el --- Notify org deadlines via notify-send - -; Copyright (C) 2015 Stephen Pegoraro -; SPDX-FileCopyrightText: 2022 Richard Brežák -; -; SPDX-License-Identifier: LGPL-3.0-or-later - -;; Author: Stephen Pegoraro -;; Version: 0.1.0 -;; Package-Requires: ((s "1.10.0") (dash "2.11.0") (alert "1.2")) -;; Keywords: org, org-mode, notify, notifications, calendar -;; URL: https://github.com/groksteve/org-alert - -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; This package provides functions to display system notifications for -;; any org-mode deadlines that are due in your agenda. To perform a -;; one-shot check call (org-alert-deadlines). To enable repeated -;; checking call (org-alert-enable) and to disable call -;; (org-alert-disable). You can set the checking interval by changing -;; the org-alert-interval variable to the number of seconds you'd -;; like. - - -;;; Code: - -(require 's) -(require 'dash) -(require 'org-agenda) - - -(defvar org-alert-interval 300 - "Interval in seconds to recheck and display deadlines.") - - -(defvar org-alert-notification-title "*org*" - "Title to be sent with notify-send.") - -(defvar org-alert-headline-regexp "\\(Sched.+:.+\\|Deadline:.+\\)" - "Regexp for headlines to search in agenda buffer.") - -(defun org-alert--strip-prefix (headline) - "Remove the scheduled/deadline prefix from HEADLINE." - (replace-regexp-in-string ".*:\s+" "" headline)) - - -(defun org-alert--unique-headlines (regexp agenda) - "Return unique headlines from the results of REGEXP in AGENDA." - (let ((matches (-distinct (-flatten (s-match-strings-all regexp agenda))))) - (--map (org-alert--strip-prefix it) matches))) - - -(defun org-alert--get-headlines () - "Return the current org agenda as text only." - (with-temp-buffer - (let ((org-agenda-sticky nil) - (org-agenda-buffer-tmp-name (buffer-name))) - (ignore-errors (org-agenda-list 1)) - (org-alert--unique-headlines org-alert-headline-regexp - (buffer-substring-no-properties (point-min) (point-max)))))) - - -(defun org-alert--headline-complete? (headline) - "Return whether HEADLINE has been completed." - (--any? (s-starts-with? it headline) org-done-keywords-for-agenda)) - - -(defun org-alert--filter-active (deadlines) - "Remove any completed headings from the provided DEADLINES." - (-remove 'org-alert--headline-complete? deadlines)) - - -(defun org-alert--strip-states (deadlines) - "Remove the todo states from DEADLINES." - (--map (s-trim (s-chop-prefixes org-todo-keywords-for-agenda it)) deadlines)) - - -(defun org-alert-check () - "Check for active, due deadlines and initiate notifications." - (interactive) - ;; avoid interrupting current command. - (unless (minibufferp) - (save-window-excursion - (save-excursion - (save-restriction - (let ((active (org-alert--filter-active (org-alert--get-headlines)))) - (dolist (dl (org-alert--strip-states active)) - (notifications-notify :title dl)))))) - (when (get-buffer org-agenda-buffer-name) - (ignore-errors - (with-current-buffer org-agenda-buffer-name - (org-agenda-redo t)))))) - - -(defun org-alert-enable () - "Enable the notification timer. Cancels existing timer if running." - (interactive) - (org-alert-disable) - (run-at-time 0 org-alert-interval 'org-alert-check)) - - -(defun org-alert-disable () - "Cancel the running notification timer." - (interactive) - (dolist (timer timer-list) - (if (eq (elt timer 5) 'org-alert-check) - (cancel-timer timer)))) - - - -(provide 'org-alert) -;;; org-alert.el ends here diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/COPYING b/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/COPYING deleted file mode 100644 index 0164265..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/COPYING +++ /dev/null @@ -1,341 +0,0 @@ -As per https://www.c0t0d0s0.de/otdl/otdl.html. - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs-as-csv.el b/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs-as-csv.el deleted file mode 100644 index cbedf90..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs-as-csv.el +++ /dev/null @@ -1,26 +0,0 @@ -;; -;; $Id: org-task-dump-logs-as-csv.el,v 196a830a575e 2016/04/16 15:26:31 pkgs $ -;; - - -(load "org-task-dump-logs.el") - -(defun hmw/csv-formatter(log-entry) - "Format a 3-tuple into comma separated values." - (insert (format "%s,%s,%s\n" (car log-entry) - (cadr log-entry) - (mapconcat 'identity (cddr log-entry) " ")))) - -(defun hmw/org-task-dump-logs-as-csv(csv-file-name &optional with-header) - "Generate a CSV file of the state changes of a given task. The -data is saved in CSV-FILE-NAME. An optional CSV file header can -be generated by calling this function with the prefix argument or -by setting the optional WITH-HEADER parameter." - (interactive "FSave as CSV file: \nP") - (let ((log-entries (hmw/org-task-retrieve-logs))) - (with-temp-buffer - (if with-header (insert "FromState,ToState,Timestamp\n")) - (mapc (lambda(e)(hmw/csv-formatter e)) (cdr log-entries)) - (write-file csv-file-name)))) - -(provide 'org-task-dump-logs-as-csv) diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs.el b/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs.el deleted file mode 100644 index 5107704..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-dump-logs.el +++ /dev/null @@ -1,52 +0,0 @@ -;; -;; $Id: org-task-dump-logs.el,v 1a9aa8013f28 2016/04/18 10:20:04 pkgs $ -;; - - -(defun hmw/org-task-retrieve-logs(&optional date-formatter pom) - "Retrieve all state change notes for a given task and return -them as a list of 3-tuples. Each tuple consists of the old state, -the new state and the timestamp of the state change. The -timestamp is formatted by the optional function DATE-FORMATTER. - -The very first element of the returned list is not a 3-tuple, but a -string holding the heading of the processed task. - -Optionally the point can be set to POM programmatically." - (save-excursion - (unless date-formatter (setq date-formatter 'identity)) - (if pom (goto-char pom)) - (org-back-to-heading t) - (let* ((end (org-entry-end-position)) - (reversed org-log-states-order-reversed) - (search (if reversed 're-search-forward 're-search-backward)) - (limit (if reversed end (point))) - (re (format - "^[ \t]*-[ \t]+\\(?:State \"%s\"\s+from\s+\"%s\".*%s%s\\)" - org-todo-regexp - org-todo-regexp - org-ts-regexp-inactive - (let ((value (cdr (assq 'done org-log-note-headings)))) - (if (not value) "" - (concat "\\|" - (org-replace-escapes - (regexp-quote value) - `(("%d" . ,org-ts-regexp-inactive) - ("%D" . ,org-ts-regexp) - ("%s" . "\"\\S-+\"") - ("%S" . "\"\\S-+\"") - ("%t" . ,org-ts-regexp-inactive) - ("%T" . ,org-ts-regexp) - ("%u" . ".*?") - ("%U" . ".*?")))))))) - log-entries) - (unless reversed (goto-char end)) - (while (funcall search re limit t) - (push (list (org-match-string-no-properties 2) - (org-match-string-no-properties 1) - (funcall date-formatter (org-match-string-no-properties 3))) - log-entries)) - (push (org-no-properties (org-get-heading)) log-entries) - log-entries))) - -(provide 'org-task-dump-logs) diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-generate-calendar-view.el b/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-generate-calendar-view.el deleted file mode 100644 index 8ea5e1e..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-generate-calendar-view.el +++ /dev/null @@ -1,103 +0,0 @@ -;; -;; $Id: org-task-generate-calendar-view.el,v 08890e87177e 2016/04/18 10:24:19 pkgs $ -;; - - -(load "org-task-dump-logs.el") -(load "org-task-svg.el") - -(defun hmw/generate-calendar-view(file-name year heading statechanges) - "Generate a calendar view for the given YEAR and colours the dates -according to the given STATECHANGES. The view is annotated with a -HEADING and a legend. It is saved in FILE-NAME in SVG format. - -If the list contains several state changes for a given date, CANCELLED has precedence over DONE over OPEN." - (with-temp-buffer - (hmw/svg-header 650 170) - (hmw/svg-text 10 20 (format "Statistics for %s for %s" heading year)) - - ;; Month names - (let ((xpos 40) - (ypos 40)) - (dotimes (i 12) - (hmw/svg-text xpos ypos (elt calendar-month-abbrev-array i)) - (setq xpos (+ 40 (* (ceiling (/ (calendar-day-number (list (+ 2 i) 1 year)) 7.0)) 11))))) - - ;; Day names - (let ((xpos 10) - (ypos 60)) - (dotimes (i 7) - (hmw/svg-text xpos ypos (elt calendar-day-abbrev-array - (% (+ i calendar-week-start-day) 7))) - (setq ypos (+ ypos 11)))) - - ;; Boxes - (let ((xpos 40) - (ypos 50) - (colour) - (el) - (free (% (+ (calendar-day-of-week (list 1 1 year)) 6) 7))) - - (setq ypos (+ ypos (* free 11))) - (dotimes (i (calendar-day-number (list 12 31 year))) - (setq els (cl-remove-if-not (lambda (e) (equal (elt e 2) (1+ i))) statechanges)) - - (setq el - (car - (or - (cl-remove-if-not (lambda (e) (equal (elt e 1) "CANCELLED")) els) - (cl-remove-if-not (lambda (e) (equal (elt e 1) "DONE")) els) - (cl-remove-if-not (lambda (e) (equal (elt e 1) "OPEN")) els)))) - - (cond - ((equal el nil) - (hmw/svg-rect xpos ypos 10 10 "#646464")) - - ((equal (elt el 1) "OPEN") - (hmw/svg-rect xpos ypos 10 10 "#0000ff")) - - ((equal (elt el 1) "DONE") - (hmw/svg-rect xpos ypos 10 10 "#00ff00")) - - ((equal (elt el 1) "CANCELLED") - (hmw/svg-rect xpos ypos 10 10 "#ff0000"))) - - ;; Jump to the next column - (if (= (% (+ free 1 i) 7) 0) - (progn - (setq ypos 50) - (setq xpos (+ xpos 11))) - (setq ypos (+ ypos 11))))) - - ;; Legend - (hmw/svg-text 10 150 "OPEN") - (hmw/svg-rect 45 141 10 10 "#0000ff") - (hmw/svg-text 70 150 "DONE") - (hmw/svg-rect 105 141 10 10 "#00ff00") - (hmw/svg-text 130 150 "CANCELLED") - (hmw/svg-rect 195 141 10 10 "#ff0000") - - (hmw/svg-footer) - (write-file file-name))) - - -(defun hmw/date-formatter(d year) - "Converts a date D in ORG date format into the day number. As a side - effect all dates that are not in YEAR are filtered." - (let ((date (org-date-to-gregorian d))) - (if (equal (elt date 2) year) - (calendar-day-number date) - nil))) - - -(defun hmw/org-task-generate-calendar-view(svg-file-name year) - "Generate a calendar view of the state changes of a given task. The - calendar view is generated for YEAR and saved in SVG-FILE-NAME in - SVG format." - (interactive "FSave as SVG file: \nnGenerate view for year (YYYY): ") - (let ((log-entries (hmw/org-task-retrieve-logs - (lambda (d) (hmw/date-formatter d year))))) - (hmw/generate-calendar-view svg-file-name year - (car log-entries) (cdr log-entries)))) - -(provide 'org-task-generate-calendar-view) diff --git a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-svg.el b/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-svg.el deleted file mode 100644 index f26ead4..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/org-task-dump/org-task-svg.el +++ /dev/null @@ -1,42 +0,0 @@ -;; -;; $Id: svg.el,v f0c325fe1142 2016/04/16 12:48:31 pkgs $ -;; - - -(defun hmw/svg-header (width height) - (insert (format " - - " width height))) - - -(defun hmw/svg-footer () - (insert "\n \n")) - - -(defun hmw/svg-text(x y str) - (insert (format " - - %s - " x y str))) - - -(defun hmw/svg-line(x1 y1 x2 y2) - (insert (format " - " x1 y1 x2 y2))) - - -(defun hmw/svg-rect(x y width height col) - (insert (format " - " x y height width col))) - -(provide 'org-task-svg) diff --git a/home-manager/modules/emacs/.emacs.d/lisp/ytplay.el b/home-manager/modules/emacs/.emacs.d/lisp/ytplay.el deleted file mode 100644 index 21fbd40..0000000 --- a/home-manager/modules/emacs/.emacs.d/lisp/ytplay.el +++ /dev/null @@ -1,107 +0,0 @@ -; SPDX-FileCopyrightText: 2022 Richard Brežák -; -; SPDX-License-Identifier: LGPL-3.0-or-later - -;; -*- lexical-binding: t -*- -;;; ytplay.el --- search for and play a YT video - -;;; Commentary: - -(require 'cl-lib) - -(defvar ytplay-youtube-dl-commmad "/nix/store/g0656rl1hplb6w35xs6nc79r6rdm8gzp-python3.8-youtube-dl-2020.12.22/bin/youtube-dl") - -(defvar ytplay-process nil) -(defvar ytplay-buffer (get-buffer-create " yt-play process buffer")) -(defvar ytplay-callback nil) -(defvar ytplay-fail-callback nil) - -(defvar ytplay-command-queue (list)) - -(defun ytplay--run-yt-dl (args callback fail-callback) - (if (or ytplay-callback ytplay-process ytplay-fail-callback) - (push (list args callback fail-callback) ytplay-command-queue) - (setq ytplay-callback callback) - (setq ytplay-fail-callback fail-callback) - (with-current-buffer ytplay-buffer (erase-buffer)) - (let ((command (append (list ytplay-youtube-dl-commmad) args))) - (setq ytplay-process - (make-process - :name "youtube-dl" - :command command - :buffer ytplay-buffer - :sentinel 'ytplay--sentinel))))) - -(defun ytplay--sentinel (process event) - (let ((result (string-trim (with-current-buffer ytplay-buffer (buffer-string)))) - (callback ytplay-callback) - (fail-callback ytplay-fail-callback) - (event (string-trim event))) - (with-current-buffer ytplay-buffer (erase-buffer)) - (setq ytplay-process nil) - (setq ytplay-callback nil) - (setq ytplay-fail-callback nil) - (if (string-equal event "finished") - (funcall callback result) - (funcall fail-callback))) - (when-let ((command (pop ytplay-command-queue))) - (ytplay--run-yt-dl (nth 0 command) (nth 1 command) (nth 2 command)))) - -(defun ytplay--run-yt-dl-seq (args-list callback) - (let ((acc (list)) - (target-count (length args-list)) - (completed 0)) - (cl-loop for args in args-list - do (ytplay--run-yt-dl - args - (lambda (results) - (setq completed (+ completed 1)) - (push results acc) - (when (eq target-count completed) (funcall callback acc))) - (lambda () - (setq completed (+ completed 1)) - (when (eq target-count completed) (funcall callback acc))))))) - -(defun ytplay--reset () - (interactive) - (setq ytplay-process nil) - (setq ytplay-buffer (get-buffer-create " yt-play process buffer")) - (setq ytplay-callback nil) - (setq ytplay-fail-callback nil) - (setq ytplay-command-queue (list))) - -;; (defun ytplay--ivy-builder (acc rest) -;; (if-let ((vid-id (pop rest))) -;; (ytplay--run-yt-dl -;; (list "--get-title" "--" vid-id) -;; (lambda (results vid-id acc rest) -;; (push `(,(string-trim results) . ,vid-id) acc) -;; (ytplay--ivy-builder acc rest))) -;; (let ((vid-id (completing-read "Select a result: " acc))) -;; ))) - -;; (results (split-string results)) - -(defun ytplay--ivy-callback (vid-ids) - (let* ((vid-ids (split-string vid-ids)) - (sequence (cl-loop for vid-id in vid-ids - collect (list "--get-title" "--" vid-id)))) - (ytplay--run-yt-dl-seq - sequence - (lambda (titles) - (let* ((videos (cl-pairlis titles vid-ids)) - (vid-id (completing-read "Select a result: " videos))) - (make-process - :name "xdg-open" - :command (list - "xdg-open" - (format - "https://www.youtube.com/watch?v=%s" - (cdr (assoc vid-id videos)))))))))) - -(defun ytplay-search (search-term) - (interactive "MSearch term: ") - (ytplay--run-yt-dl - (list (format "ytsearch10:%s" search-term) "--get-id") - 'ytplay--ivy-callback - (lambda () (message "ytplay.el failure!")))) diff --git a/home-manager/modules/emacs/.emacs.d/org/base.org b/home-manager/modules/emacs/.emacs.d/org/base.org deleted file mode 100644 index b980a68..0000000 --- a/home-manager/modules/emacs/.emacs.d/org/base.org +++ /dev/null @@ -1,414 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -#+STARTUP: content -#+TITLE: Magic_RB's Emacs configuration - -* Stuff That Needs Work -** TODO Spell checking -** TODO Calc mode -** TODO Org Agenda -*** Make it work on my phone -** TODO Org Roam -** TODO org-evil moving stuff, left, right with M-j M-; instead of M-h M-l -** Org Web Tools -https://github.com/alphapapa/org-web-tools -* Stuff - -#+NAME: base -#+BEGIN_SRC emacs-lisp - (use-package pdf-tools - :straight t - :hook (('TeX-mode-hook . visual-line-mode)) - :config - ;; initialise - (pdf-tools-install) - (setq TeX-PDF-mode 1) - ;; open pdfs scaled to fit page - (setq-default pdf-view-display-size 'fit-page) - ;; automatically annotate highlights - (setq pdf-annot-activate-created-annotations t)) -#+END_SRC - -Enable =all-the-icons=, it's used by =treemacs= and =doom-modeline=. - -#+BEGIN_SRC emacs-lisp - (use-package all-the-icons - :straight t) -#+END_SRC - -Set ispell program to hunspell, this is very much a TODO, since the spelling configuration is rather minimal at this -point in time. - -#+BEGIN_SRC emacs-lisp - (setq ispell-program-name "hunspell") -#+END_SRC - -Fetch the ~SSH_AUTH_PATH~ from ~.profile~. - -#+BEGIN_SRC emacs-lisp - (setenv "SSH_AUTH_SOCK" (shell-command-to-string ". ~/.profile && printf $SSH_AUTH_SOCK")) -#+END_SRC - -* Language -** Nix Expression Language - -Enable ~nix-mode~. - -#+begin_src emacs-lisp - (use-package lsp-nix - :no-require t - :after (lsp-mode) - :custom - (lsp-nix-nil-formatter ["nixpkgs-fmt"])) - - (use-package nix-mode - :hook (nix-mode . lsp-deferred) - :ensure t) -#+end_src - -** HashiCorp -*** HashiCorp Configuration Language - -#+BEGIN_SRC emacs-lisp - (use-package hcl-mode - :straight t) -#+END_SRC - -*** Terraform Configuration Language - -#+BEGIN_SRC emacs-lisp - (use-package terraform-mode - :straight t) -#+END_SRC - -** YAML Configuration Language - -Enable ~yaml-mode~. - -#+BEGIN_SRC emacs-lisp - (use-package yaml-mode - :straight t - :mode ("\\.yml\\'" . yaml-mode) - :mode ("\\.yaml\\'" . yaml-mode)) -#+END_SRC - -** Dockerfile Configuration Language - -Enable ~dockerfile-mode~ - -#+BEGIN_SRC emacs-lisp - (use-package dockerfile-mode - :straight t - :mode ("Dockerfile\\'" . dockerfile-mode)) -#+END_SRC - -** SCAD Programming Language - -Enable ~scad-mode~ - -#+BEGIN_SRC emacs-lisp - (use-package scad-mode - :straight t) -#+END_SRC - -** Rust Programming Language - -Enable ~rustic~ and more feature-full alternative to ~rust-mode~, actually a rather distant fork of it. -Also hook ~lsp-mode~ on it. - -#+NAME: rust -#+BEGIN_SRC emacs-lisp - (use-package rustic - :straight t - :hook (rustic-mode . lsp-mode) - :mode ("\\.rs\\'" . rustic-mode)) -#+END_SRC -* LSP -** envrc - -Enable ~envrc~, which changes ENVs on a per buffer basis. - -#+BEGIN_SRC emacs-lisp - (use-package envrc - :straight t - :init - (envrc-global-mode)) -#+END_SRC - -** lsp-mode - -Increase GC threshold to avoid random freezes on garbage collection. - -#+NAME: gc-cons-threshold -#+BEGIN_SRC emacs-lisp :tangle no - (setq gc-cons-threshold 100000000) -#+END_SRC - -Increase the amount of data Emacs reads from a process in one go, default is 4KB, but some LSP servers produce responses up to 3MB. - -#+NAME: read-process-output-max -#+BEGIN_SRC emacs-lisp :tangle no - (setq read-process-output-max (* (* 1024 1024) 3)) -#+END_SRC - -Switch completion provider to =capf=, even though it should be the default, but just to make sure it. =company-lsp= -is what =lsp-mode= switched away from. - -#+NAME: lsp-completion-provider -#+BEGIN_SRC emacs-lisp :tangle no - (setq lsp-completion-provider :capf) -#+END_SRC - -Set the minimum delay between LSP refreshes, should help with performance when typing really fast. - -#+NAME: lsp-idle-delay -#+BEGIN_SRC emacs-lisp :tangle no - (setq lsp-idle-delay 0.500) ;; adjust me -#+END_SRC - -Setup rustic to prefer ~rust-analyzer~ instead of ~rls~ and also don't format on save, it's really annoying. - -#+NAME: lsp-rustic -#+BEGIN_SRC emacs-lisp :tangle no - (setq rustic-lsp-server 'rust-analyzer) - (setq rustic-compile-command "cargo build") - (setq rustic-format-trigger nil);'on-save -#+END_SRC - -Enable inline type hints and disable chaining and parameter hints for Rust. - -#+NAME: lsp-rust-analyzer -#+BEGIN_SRC emacs-lisp :tangle no - (setq lsp-rust-analyzer-display-chaining-hints nil) - (setq lsp-rust-analyzer-display-parameter-hints nil) - (setq lsp-rust-analyzer-server-display-inlay-hints t) -#+END_SRC - -Finally enable ~lsp-mode~. - -#+BEGIN_SRC emacs-lisp :noweb yes - (use-package lsp-mode - :straight t - :after (envrc) - :config - (setq lsp-prefer-flymake nil) - (setq lsp-ui-doc-enable nil) - :config - <> - ;; <> - - <> - <> - <> - ;; <> - <> - <>) -#+END_SRC - -** lsp-pyright - -Enable ~lsp-pyright~, the best Python language server, all of them are a bit lackluster, this one is the best -option. - -#+BEGIN_SRC emacs-lisp - (use-package lsp-pyright - :straight t - :hook (python-mode . lsp)) -#+END_SRC - -** lsp-ui - -Enable ~lsp-ui~, it adds doc frames, code actions at the side and other cool things, some of them are annoying and -need disabling. - -#+BEGIN_SRC emacs-lisp - (use-package lsp-ui - :straight t - :after (company-box) - :config - ;; disable focus on mouse over - (push '(no-accept-focus . t) lsp-ui-doc-frame-parameters) - (push '(no-accept-focus . t) company-box-frame-parameters) - - (add-to-list 'lsp-ui-doc-frame-parameters '(no-accept-focus . t)) - (add-to-list 'company-box-frame-parameters '(no-accept-focus . t)) - (setq mouse-autoselect-window nil)) -#+END_SRC - -** flycheck - -Enable ~flycheck~ for in-buffer hints and errors and warning and things. - -#+BEGIN_SRC emacs-lisp - (use-package flycheck - :straight t - :init (global-flycheck-mode)) -#+END_SRC - -** origami - -Enable ~origami~. It allows one to fold and unfold a section with =zc= and =zo= in ~evil-mode~. Hook it on both ~conf-mode~ and ~prog-mode~; - -#+BEGIN_SRC emacs-lisp - (use-package origami - :straight t - :hook ((prog-mode . origami-mode) - (conf-mode . origami-mode))) -#+END_SRC - -Enable ~origami-lsp~. Some LSP servers specify these folding ranges and this package makes ~origami~ understand that -and work with it. - -#+BEGIN_SRC emacs-lisp - (use-package lsp-origami - :straight t - :hook (lsp-after-open-hook lsp-origami-try-enable)) -#+END_SRC - -* hledger - -For hledger, it's possible to use =ledger-mode= instead of =hledger-mode=. We'll see how it goes. It does require some convincing though. - -#+BEGIN_SRC emacs-lisp - (use-package ledger-mode - :straight t - :config - (setq ledger-binary-path "hledger") - (setq ledger-mode-should-check-version nil) - (add-to-list 'auto-mode-alist '("\\.\\(h?ledger\\|journal\\|j\\)$" . ledger-mode)) - (setq ledger-report-balance - (list "bal" (concat ledger-binary-path " --strict -f %(ledger-file) bal"))) - - (setq ledger-report-reg - (list "reg" (concat ledger-binary-path " --strict -f %(ledger-file) reg"))) - - (setq ledger-report-payee - (list "payee" (concat ledger-binary-path " --strict -f %(ledger-file) reg @%(payee)"))) - - (setq ledger-report-account - (list "account" (concat ledger-binary-path " --strict -f %(ledger-file) reg %(account)"))) - - (setq ledger-reports - (list ledger-report-balance - ledger-report-reg - ledger-report-payee - ledger-report-account))) -#+END_SRC - -* Projectile - -Enable ~projectile~. - -#+BEGIN_SRC emacs-lisp - (use-package projectile - :straight t - :config - (projectile-mode +1) - (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)) -#+END_SRC - -* Random Bits and Bobs - -Set keystrokes echo to something really low, it's useful to know what you're typing. - -#+BEGIN_SRC emacs-lisp - (setq echo-keystrokes 0.01) -#+END_SRC - -Set default major mode to org mode, it's much more useful than fundamental. - -#+BEGIN_SRC emacs-lisp - (setq-default major-mode 'org-mode) -#+END_SRC - -Delete files by moving to trash. - -#+BEGIN_SRC emacs-lisp - (setq-default delete-by-moving-to-trash t) -#+END_SRC - -Equalize windows after split. - -#+BEGIN_SRC emacs-lisp - (setq-default window-combination-resize t) -#+END_SRC - -Increase undo limit to 80MB and enable fine undo, Evil will no longer chunk all edits in =INSERT= mode into one big -undo blob. - -#+BEGIN_SRC emacs-lisp - (setq undo-limit 80000000 - evil-want-fine-undo t) -#+END_SRC - -For now, don't autosave. Because editing on remote disks, not TRAMP, but just NFS or CIFS, becomes extremely painful. - -#+BEGIN_SRC emacs-lisp :tangle no - (setq auto-save-default t) -#+END_SRC - -Enable line numbers for both programming buffers (Rust, C, and such) and configuration buffers (Nix, Yaml, Json, and -such) and Org mode. - -#+BEGIN_SRC emacs-lisp - (add-hook 'conf-mode-hook 'display-line-numbers-mode) - (add-hook 'prog-mode-hook 'display-line-numbers-mode) -#+END_SRC - -Improve scrolling by: -1. disabling acceleration -2. making it so that the window under the pointer is scroller no matter the focused window -3. changing default scroll amount to 5 lines and 1 when shift is pressed - - #+BEGIN_SRC emacs-lisp - (setq mouse-wheel-scroll-amount '(5 ((shift) . 1))) - (setq mouse-wheel-progressive-speed nil) - (setq mouse-wheel-follow-mouse 't) - #+END_SRC - - Enable perentheses highlighting and pairing. - - #+BEGIN_SRC emacs-lisp - (show-paren-mode 1) - (electric-pair-mode) - #+END_SRC - - Set fill colum, horizontal indicator, for both =fill-paragraph=(=M-q=) and the visual horizontal indicator. - - #+BEGIN_SRC emacs-lisp - (setq-default display-fill-column-indicator-column 120 - fill-column 120) - #+END_SRC - - Start Emacs server, unless it's already running. Starting a new Emacs instance while debugging and getting an error - about a server already running can be a bit annoying. - - #+BEGIN_SRC emacs-lisp - (load "server") - (unless (server-running-p) (server-start)) - #+END_SRC - - #+BEGIN_SRC emacs-lisp - (setq backup-directory-alist - `(("." . ,(concat user-emacs-directory "backups")))) - #+END_SRC - -** Windows - -As [[https://github.com/tecosaur/][tecosaur]] has it in his [[https://tecosaur.github.io/emacs-config/config.html#windows][configuration]], I was to be asked which window to should be brought up when I split a -window in Emacs. So create a new advice which will run after evil split commands and brings up the buffer selector. - -#+BEGIN_SRC emacs-lisp - (defadvice evil-window-vsplit (after activate compile) - (counsel-switch-buffer)) - (defadvice evil-window-split (after activate compile) - (counsel-switch-buffer)) -#+END_SRC - -** PGTK neo2 fix -#+BEGIN_SRC emacs-lisp - (put 'none 'modifier-value 0) - (setq x-hyper-keysym 'none) -#+END_SRC diff --git a/home-manager/modules/emacs/.emacs.d/org/emacs-webkit.org b/home-manager/modules/emacs/.emacs.d/org/emacs-webkit.org deleted file mode 100644 index 762ec2a..0000000 --- a/home-manager/modules/emacs/.emacs.d/org/emacs-webkit.org +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -* EmacsWebkit - #+BEGIN_SRC emacs-lisp :tangle no - (straight-use-package - '(webkit :type git :host github :repo "akirakyle/emacs-webkit" :branch "main" - :files (:defaults "*.js" "*.css" "*.h" "*.c" "Makefile") - :build (("nix-shell" "-p" "gtk3" "gcc" "glib" "pkg-config" "webkit" "--command" "'make debug'")))) - - (use-package webkit - :straight t - :bind ("s-b" . 'webkit) ;; Bind to whatever global key binding you want if you want - :init - (setq webkit-search-prefix "https://duckduckgo.com/search?q=") - ; (setq webkit-ace-chars "aoeuidhtns") ;; More convienent if you use dvorak - ;; (setq webkit-history-filename "~/path/to/webkit-history") ;; If you want history saved in a different place - ;; (setq webkit-history-filename nil) ;; If you don't want history saved to file (will stay in memory) - ;; (setq webkit-own-window t) ;; See above explination; must be set before webkit.el is loaded - ;; (setq browse-url-browser-function 'webkit-browse-url) ; Set as the default browse-url browser - ;; (setq webkit-browse-url-force-new t) ; Always open a new session instead of reusing a current one - :config - (setq webkit-own-window nil) - ;; (add-hook 'webkit-new-hook #'webkit-enable-javascript) - ) - #+END_SRC -** Evil integration - #+BEGIN_SRC emacs-lisp - (use-package evil-collection-webkit - :straight t - :disabled t - :config - (evil-collection-xwidget-setup)) - #+END_SRC diff --git a/home-manager/modules/emacs/.emacs.d/org/exwm.org b/home-manager/modules/emacs/.emacs.d/org/exwm.org deleted file mode 100644 index 364e8cf..0000000 --- a/home-manager/modules/emacs/.emacs.d/org/exwm.org +++ /dev/null @@ -1,77 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -* EXVM -** Moving workspace - Theoretically it's possible to move workspace N to monitor M, by binding \s-C-[0-9], like many people do in i3. All that needs to be done is that a suitable plist needs to be build: - - #+NAME: workspace-plist - #+BEGIN_SRC emacs-lisp :tangle no - (setq exwm-randr-workspace-output-plist `(1 "HDMI-0" 2 "HDMI-1" 3 "HDMI-1")) - #+END_SRC - - And then this function must be called for EXWM to pick up any changes made - - #+NAME: - #+BEGIN_SRC emacs-lisp :tangle no - (exwm-randr-refresh) - #+END_SRC - -** Autostart - #+BEGIN_SRC emacs-lisp :tangle no - (call-interactively '(lambda (command) - (interactive (list (read-shell-command "$ "))) - (message "%s" command) - (apply 'start-process (nth 0 command) nil (nth 0 command) '(nthcdr 1 command)))) - #+END_SRC - - #+NAME: exwm - #+BEGIN_SRC emacs-lisp :noweb yes - (if (string= (getenv "EXWM") "1") - (use-package exwm - :straight t - :after hydra - :init - (require 'exwm-config) - (exwm-config-default) - (require 'exwm-randr) - (setq exwm-randr-workspace-output-plist '(0 "HDMI-0" 1 "HDMI-0" 2 "HDMI-1")) - (add-hook 'exwm-randr-screen-change-hook - (lambda () - (start-process-shell-command - "xrandr" nil "xrandr --output HDMI-1 --right-of HDMI-0 --auto"))) - - (setq exwm-input-global-keys - `(([?\s-r] . exwm-reset) - ([?\s-w] . exwm-workspace-switch) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9)) - ([?\s-\)] . (lambda () (nteractive) (exwm-workspace-move-window 0))) - ([?\s-!] . (lambda () (interactive) (exwm-workspace-move-window 1))) - ([?\s-@] . (lambda () (interactive) (exwm-workspace-move-window 2))) - ([?\s-#] . (lambda () (interactive) (exwm-workspace-move-window 3))) - ([?\s-$] . (lambda () (interactive) (exwm-workspace-move-window 4))) - ([?\s-%] . (lambda () (interactive) (exwm-workspace-move-window 5))) - ([?\s-^] . (lambda () (interactive) (exwm-workspace-move-window 6))) - ([?\s-&] . (lambda () (interactive) (exwm-workspace-move-window 7))) - ([?\s-8] . (lambda () (interactive) (exwm-workspace-move-window 8))) - ([?\s-*] . (lambda () (interactive) (exwm-workspace-move-window 9))) - ([] . (call-process-shell-command "screenshot select &" nil 0)) - ([?\s-d] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (message "%s" command) - (start-process-shell-command command nil command))))) - ;; Make focus follow mouse - ;;(setq mouse-autoselect-window t - ;; focus-follows-mouse t) - - (setq exwm-workspace-number 3) - - (exwm-randr-enable) - )) - #+END_SRC diff --git a/home-manager/modules/emacs/.emacs.d/org/treemacs.org b/home-manager/modules/emacs/.emacs.d/org/treemacs.org deleted file mode 100644 index c7e1372..0000000 --- a/home-manager/modules/emacs/.emacs.d/org/treemacs.org +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -* Treemacs - -#+begin_src emacs-lisp -#+end_src - -#+NAME: treemacs -#+BEGIN_SRC emacs-lisp :tangle no - (use-package treemacs - :straight t - :config - (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme - (doom-themes-treemacs-config) - (treemacs-load-theme 'doom-colors)) - (use-package treemacs-evil - :after (treemacs evil) - :straight t) - (use-package lsp-treemacs - :straight t - :after (lsp-mode treemacs) - :config - (lsp-treemacs-sync-mode 1)) -#+END_SRC diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/box b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/box deleted file mode 100644 index 856a9da..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/box +++ /dev/null @@ -1,6 +0,0 @@ -# -*- mode: snippet -*- -# key: /box -# -- -${1:$(format "┌-%s-┐" (make-string (length yas-text) ?-))} -| $1 | -${1:$(format "└-%s-┘" (make-string (length yas-text) ?-))} \ No newline at end of file diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/cubed b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/cubed deleted file mode 100644 index c2a85a8..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/cubed +++ /dev/null @@ -1,4 +0,0 @@ -# -*- mode: snipper -*- -# key: cb -# -- -^3 $0 \ No newline at end of file diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/display-math b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/display-math deleted file mode 100644 index 2ebe1dd..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/display-math +++ /dev/null @@ -1,6 +0,0 @@ -# -*- mode: snipper -*- -# key: dm -# -- -\[ -$1 -.\] $0 \ No newline at end of file diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/inline-math b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/inline-math deleted file mode 100644 index 8abac37..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/inline-math +++ /dev/null @@ -1,4 +0,0 @@ -# -*- mode: snippet -*- -# key: mk -# -- -$$1$${2:$(unless (string-match-p "\\\\`[,\\\\.? \\\\-].*" yas-text) " ")}$2 $0 \ No newline at end of file diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/r b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/r deleted file mode 100644 index dd97ae3..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/r +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# key: cbr -# -- -#+BEGIN_SRC R :file r-img/$1.png :result file graphics -$2 -#+END_SRC -$0 diff --git a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/square b/home-manager/modules/emacs/.emacs.d/snippets/org-mode/square deleted file mode 100644 index be79193..0000000 --- a/home-manager/modules/emacs/.emacs.d/snippets/org-mode/square +++ /dev/null @@ -1,4 +0,0 @@ -# -*- mode: snippet -*- -# key: sr -# -- -^2 $0 diff --git a/home-manager/modules/emacs/default.nix b/home-manager/modules/emacs/default.nix deleted file mode 100644 index eaca7a3..0000000 --- a/home-manager/modules/emacs/default.nix +++ /dev/null @@ -1,155 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - secret, - ... -}: -with lib; let - cfg = config.magic_rb.programs.emacs; -in { - options.magic_rb.programs.emacs = { - enable = mkEnableOption "Enable emacs with my config"; - enableMu4e = mkEnableOption "Enable mu4e in emacs. WARNING: requires secrets"; - package = mkOption { - description = "Which emacs package to use."; - type = types.package; - default = let - # gensymb is not here, dont add - tex = with pkgs; - texlive.combine - { - inherit - (texlive) - scheme-full - ; - }; - r = with pkgs; - rWrapper.override - {packages = with rPackages; [ggplot2];}; - in - (pkgs.emacs-magicrb.override - { - pkgs.emacs = pkgs.emacs.overrideAttrs - (old: - { - # patches = [ ./native-comp-driver-options.patch ]; - }); - march = config.magic_rb.optimisation.march; - hunspell.enable = true; - hunspell.dictionaries = with pkgs.hunspellDicts; [en_US]; - environment = { - MU4E_CONTEXTS = mkIf cfg.enableMu4e secret.emacs.mu4eContexts; - }; - additionalPackages = - [ - tex - r - ] - ++ (with pkgs; [ - krita - ripgrep - mu - isync - exa - fd - nil - graphviz - ]); - }) - .bundle; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - cfg.package - (makeDesktopItem { - name = "Org-Protocol"; - exec = "emacsclient %u"; - comment = "Org protocol"; - desktopName = "org-protocol"; - type = "Application"; - mimeTypes = ["x-scheme-handler/org-protocol"]; - }) - - fira-code - (iosevka-bin.override {variant = "aile";}) - (iosevka-bin.override {variant = "etoile";}) - (iosevka-bin.override {variant = "";}) - emacs-all-the-icons-fonts - ]; - - fonts.fontconfig.enable = true; - - home.activation.emacsStraightVerions = - config.lib.dag.entryAfter - ["writeBoundary"] '' - mkdir -p ~/.emacs.d/straight/versions - ln -sfn ~/dotfiles/home-manager/modules/emacs/straight-versions.el ~/.emacs.d/straight/versions/default.el - ''; - - systemd.user.services.emacs = { - Unit = { - After = "graphical-session.target"; - PartOf = "graphical-session.target"; - X-RestartIfChanged = false; - }; - - Service = { - Type = "notify"; - ExecStart = ''${pkgs.runtimeShell} -l -c "${lib.getExe cfg.package} --fg-daemon"''; - - # Emacs will exit with status 15 after having received SIGTERM, which - # is the default "KillSignal" value systemd uses to stop services. - SuccessExitStatus = 15; - - Restart = "on-failure"; - }; - - Install = { - WantedBy = [ - "graphical-session.target" - ]; - }; - }; - - home.file = { - ".emacs".source = ./.emacs; - ".mbsyncrc" = mkIf cfg.enableMu4e { - source = secret.emacs.mbsyncrc; - }; - ".emacs.d/org" = { - source = ./.emacs.d/org; - recursive = true; - }; - ".emacs.d/lisp" = { - source = ./.emacs.d/lisp; - recursive = true; - }; - ".emacs.d/mu4e-contexts" = mkIf cfg.enableMu4e { - source = secret.emacs.mu4eContexts; - }; - ".emacs.d/tree-sitter" = { - source = - pkgs.linkFarm "grammars" - (map - (drv: - let - name = lib.strings.getName drv; - in - { - name = "lib" + - (lib.strings.removeSuffix "-grammar" name) - + ".so"; - path = "${drv}/parser"; - } - ) - (builtins.attrValues pkgs.tree-sitter.builtGrammars)); - }; - }; - }; -} diff --git a/home-manager/modules/emacs/straight-versions.el b/home-manager/modules/emacs/straight-versions.el deleted file mode 100644 index 71b07d5..0000000 --- a/home-manager/modules/emacs/straight-versions.el +++ /dev/null @@ -1,104 +0,0 @@ -(("ace-window" . "77115afc1b0b9f633084cf7479c767988106c196") - ("alert" . "c762380ff71c429faf47552a83605b2578656380") - ("all-the-icons.el" . "f75c1130b72c718bfaf18b56c445c4b58efc714f") - ("avy" . "be612110cb116a38b8603df367942e2bb3d9bdbe") - ("cape" . "db3059af52718c7f55485ef183bdad3e40f58df9") - ("cfrs" . "f3a21f237b2a54e6b9f8a420a9da42b4f0a63121") - ("clang-format" . "e48ff8ae18dc7ab6118c1f6752deb48cb1fc83ac") - ("compat" . "b3b18044f9ca99a53ade91794226d71968b3e14f") - ("consult" . "aadb912e126a143c60e6ece92b163a7356bd4730") - ("corfu" . "2e066448df9cc8b16e75f3bc22e6fb5a8d1c065d") - ("dash.el" . "96eaba028ac069ea0e5cc70de15b0229126a054a") - ("dirvish" . "4b63cd2e5ba994f8e674388db7035de1a8f0343f") - ("dockerfile-mode" . "52c6c00da1d31c0b6c29c74335b3af63ed6bf06c") - ("doom-modeline" . "3612082bc5cba712c07860ce37865f938beb9002") - ("el-get" . "22c83206bab10100fdee03cb2d5b97c8c24eff0e") - ("el-secretario" . "93f9b1bd2e381354a6ae799fed3e4a8313f24e11") - ("elisp" . "3497ffd763cadcc1f507aae88c3c7a84007ccfbd") - ("emacs-elixir" . "7641373f0563cab67cc5459c34534a8176b5e676") - ("emacs-hcl-mode" . "751b79247f326ab52e00032e805775c37ad9f080") - ("emacs-libvterm" . "94e2b0b2b4a750e7907dacd5b4c0584900846dd1") - ("emacs-which-key" . "bd34ede7bf77ad3988330b37207f3978e7342c79") - ("emacsmirror-mirror" . "606c3dcfc57ee47a9969b4d9f3d87408f14ebffb") - ("emacsql" . "64012261f65fcdd7ea137d1973ef051af1dced42") - ("embark" . "10ac6b7260c82e3a59a33ea93e7027692b228e5f") - ("ement.el" . "5be1e0700288fea0762b4fc9311e0b05d6c78cc0") - ("envrc" . "15af96080772af415a56b680acdd7d2010a68ffa") - ("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6") - ("f.el" . "af7d37c619010b576fd22b50c62c71ff33093f3c") - ("flycheck" . "5f2ef177cb21ae8b73714575802beef04abd0f5e") - ("flycheck-posframe" . "19896b922c76a0f460bf3fe8d8ebc2f9ac9028d8") - ("general.el" . "7ce8db297e3de258ec43802269438ac7f1918707") - ("gntp.el" . "767571135e2c0985944017dc59b0be79af222ef5") - ("gnu-elpa-mirror" . "eda4c968f0400750e17a013bb80832088dab12d1") - ("go-mode.el" . "166dfb1e090233c4609a50c2ec9f57f113c1da72") - ("haskell-mode" . "20d4e2300302a9af673e82d0185d3f489bfb0f59") - ("hercules" . "557da39878d0637395fdded91243b340c37eff7b") - ("ht.el" . "3c1677f1bf2ded2ab07edffb7d17def5d2b5b6f6") - ("hydra" . "317e1de33086637579a7aeb60f77ed0405bf359b") - ("inheritenv" . "2102ed2d105a5c9f366cb6503d04794600985598") - ("js2-mode" . "7d928272bc311b1dd6f38d3f6365c18153e28636") - ("ledger-mode" . "7bed9b468bf7d2cd4dafa30b067bb576263f8e0c") - ("let-alist" . "021fc10df2e44faba4728d849ee767cf890aa51a") - ("log4e" . "737d275eac28dbdfb0b26d28e99da148bfce9d16") - ("lsp-haskell" . "3249cde75fb411f95fe173c222b848182fd0b752") - ("lsp-mode" . "cf30718ed5128753565452f476385dac1f7821d6") - ("lsp-origami" . "7df9c91a309aa4229bec41f109920b37c4197618") - ("lsp-pyright" . "54a2acddfdd7c3d31cb804a042305a3c6e60cf81") - ("lsp-python-ms" . "f8e7c4bcaefbc3fd96e1ca53d17589be0403b828") - ("lsp-ui" . "295d8984da06a745b0a36c56e28ce915bc389adb") - ("magit" . "6067f92c0195616707b25e23c2d4c0dd81928fd8") - ("map" . "a0e501aede34f183a8baa5d3d41610a3ffa1728e") - ("marginalia" . "3ddd2b7fa09e1e84112749ffbdcb6bd8900bfc26") - ("markdown-mode" . "5d98592fe516748034d8baf92d7c0ba045e1f87a") - ("melpa" . "86ca8d06599c8d7d9067ce92ae5dde3b122f6796") - ("meow" . "07ccf112fc1a56ddd96cfc39967957be7dc8dd5f") - ("mu4e-alert" . "3c9af8c7994df0a1a4f0703552ea3beffb485ace") - ("nongnu-elpa" . "0120f3dfe80cffe0c3016080d9205d12be3b741d") - ("openscad" . "31670fc8bbde97f47f050f1837de093ecee89e1e") - ("orderless" . "e6784026717a8a6a7dcd0bf31fd3414f148c542e") - ("org" . "080710797ad25e76c4556d2b03cc0aa5313cd187") - ("org-ql" . "2c098540cab6a0ee7d82abe2327d524a171edd1e") - ("org-roam" . "5c06471c3a11348342719fd9011486455adeb701") - ("org-super-agenda" . "f4f528985397c833c870967884b013cf91a1da4a") - ("origami.el" . "e558710a975e8511b9386edc81cd6bdd0a5bda74") - ("ov" . "c5b9aa4e1b00d702eb2caedd61c69a22a5fa1fab") - ("password-store" . "28cec11f1dbe6c4273d30370af45b69c9f408386") - ("pdf-tools" . "7ff6293a25baaae65651b3e1c54b61208279a7ef") - ("peg" . "5d4ed356ca89acdf52a3e7e7f8e2408b808552c4") - ("persist" . "c10835478d9f916534a07fad0174d497adf85729") - ("pfuture" . "19b53aebbc0f2da31de6326c495038901bffb73c") - ("pkg-info" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") - ("plz" . "205e8284340ff10bc7a8468f8af0c50eb0e97c60") - ("popper" . "e3991202234e4dc10dbfae8e13b27c590dd52fb5") - ("posframe" . "3b97dc180b03498103cfcc7f44e64150df440bf0") - ("project" . "33511939473551b5cfa42de9a12d606b3d60a2cf") - ("projectile" . "271007c6611fcb08ddd326d7de9727c2ad5ef265") - ("racket-mode" . "c2fe266c18bb6e55a13c7ba795b0a5f7372b6c13") - ("rjsx-mode" . "b697fe4d92cc84fa99a7bcb476f815935ea0d919") - ("rust-mode" . "e443ccf2884028d3b6cc550ff20e7c92dadccb68") - ("rustic" . "39423d1cf4fa054c36bf9577356451f4c06ee148") - ("s.el" . "dda84d38fffdaf0c9b12837b504b402af910d01d") - ("shackle" . "f1467db75a8fa5d51c676181fb308ccbf7b05e6f") - ("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41") - ("spinner" . "634529bb3173e09b37499f636de70abf29d9fa8a") - ("straight.el" . "039e5c9a9b5c00749602afb41341e9e77ba09429") - ("svg-lib" . "31085bbf247f0467e2f6af948085610248fce6c5") - ("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9") - ("taxy" . "b222226f9e1057490150c1a8a98e8b471df88302") - ("taxy-magit-section" . "00e1e41341cbc71fcc8f4d4c98b2cc5c371c4f54") - ("tempel" . "94afb9b916a711c56f23183da93a103338e9f84e") - ("terraform-mode" . "56f19abae95afb7e13e48ec3e6aeba3820d31307") - ("transient" . "af7fe42bd46e24ca7852e73bd1691015c5bd2151") - ("treemacs" . "983ea5a66801a5c1f6e32e3d515bd48761677ac6") - ("ts.el" . "552936017cfdec89f7fc20c254ae6b37c3f22c5b") - ("typescript.el" . "4fcb4594819caf472ae42ea068a1c7795cf07f46") - ("use-package" . "a6e856418d2ebd053b34e0ab2fda328abeba731c") - ("vertico" . "dd8eb3aa3d0d048cc0e1bc455f42a12a4162f5bb") - ("vulpea" . "f4d3448b6ccdb314c5fe3defea66e750e1371a10") - ("web-mode" . "57856ba64b9382811b35df0d9ab0a24aede0c1f0") - ("with-editor" . "df74385b455cd7687232ad189acfea16cb44dd04") - ("xref" . "420511e20187d0c6c8680c0e63ae8810f84dee00") - ("xterm-color" . "2ad407c651e90fff2ea85d17bf074cee2c022912") - ("yaml-mode" . "b153150e0e77b4ec462d741cdb16956c6ae270d6")) -:gamma diff --git a/home-manager/modules/gpg.nix b/home-manager/modules/gpg.nix deleted file mode 100644 index 6797d83..0000000 --- a/home-manager/modules/gpg.nix +++ /dev/null @@ -1,57 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.programs.gpg; -in { - options.magic_rb.programs.gpg = { - enable = - mkEnableOption - '' - Enable gpg and gpg-key. - ''; - pinentryFlavor = mkOption { - description = "Which pinentry flavor should be used."; - type = types.enum [ - "curses" - "emacs" - "mac" - "gtk2" - "qt" - "gnome" - ]; - default = "gtk2"; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - gpg-key-rb - gnupg - pass - yubikey-manager - ]; - - home.file.".gpg-agent.conf".text = '' - enable-ssh-support - pinentry-program ${pkgs.pinentry.${cfg.pinentryFlavor}}/bin/pinentry - ''; - - home.file.".profile".text = '' - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - ''; - - home.activation.gnupghome = config.lib.dag.entryAfter ["writeBoundary"] '' - if [[ ! -e ~/.gnupg/gpg-agent.conf ]] && [[ -d /mnt/key/gnupg ]] - then - ln -sf ~/.gpg-agent.conf /mnt/key/gnupg/gpg-agent.conf - fi - ''; - }; -} diff --git a/home-manager/modules/graphical-programs.nix b/home-manager/modules/graphical-programs.nix deleted file mode 100644 index a69956f..0000000 --- a/home-manager/modules/graphical-programs.nix +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - inputs, - ... -}: -with lib; let - cfg = config.magic_rb.packageCollections.graphical; -in { - options.magic_rb.packageCollections.graphical = { - enable = - mkEnableOption - '' - Enable graphical package collection, contains GIMP, Firefox, mpv, and Discord. - ''; - }; - - config = mkIf cfg.enable { - programs.librewolf = { - enable = true; - settings = { - "webgl.disabled" = false; - }; - }; - home.packages = with pkgs; [ - gimp - mpv - slack - - schildichat-desktop - inputs.nixpkgs-discord.legacyPackages.${stdenv.system}.armcord - pavucontrol - ]; - }; -} diff --git a/home-manager/modules/multimc.nix b/home-manager/modules/multimc.nix deleted file mode 100644 index e791149..0000000 --- a/home-manager/modules/multimc.nix +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.programs.multimc; -in { - options.magic_rb.programs.multimc = { - enable = mkEnableOption "Enable MultiMC Minecraft launcher."; - }; - - config = mkIf cfg.enable { - home.packages = [ - pkgs.prismlauncher - ]; - }; -} diff --git a/home-manager/modules/optimisation.nix b/home-manager/modules/optimisation.nix deleted file mode 120000 index a1de332..0000000 --- a/home-manager/modules/optimisation.nix +++ /dev/null @@ -1 +0,0 @@ -../../nixos/modules/optimisation.nix \ No newline at end of file diff --git a/home-manager/modules/pantalaimon.nix b/home-manager/modules/pantalaimon.nix deleted file mode 100644 index 0c380e1..0000000 --- a/home-manager/modules/pantalaimon.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ pkgs, ... }: -{ - services.pantalaimon = - { - # enable = true; - package = (pkgs.pantalaimon.override (old: { - matrix-nio = old.matrix-nio.overridePythonAttrs (old: { - src = pkgs.fetchFromGitHub { - owner = "codemonium"; - repo = "matrix-nio"; - rev = "1ba34112ca221adf0ed1d9e5028d5a7f3a4a72ca"; - hash = "sha256-T8wFJlUMQVwJHNzIZiQ4M/uImTvIqW5PGJoWV0kbHkA="; - }; - - disabledTests = old.disabledTests ++ [ - "test_room_invite" - "test_account_loading" - "test_olm_session_load" - "test_store_versioning" - ]; - }); - })).overridePythonAttrs - (old: - { - src = pkgs.fetchFromGitHub { - owner = "codemonium"; - repo = "pantalaimon"; - rev = "25d415fac4ad653da1e427bc05beed2d21bc169f"; - hash = "sha256-U+dSlfYx2ADin+zbEPNIHkjytMUmZ6QkklU0bCyt/Pg="; - }; - }); - settings = - { - Default = - { - LogLevel = "Info"; - SSL = true; - }; - local-matrix = - { - Homeserver = "https://matrix.redalder.org"; - ListenAddress = "127.0.0.1"; - ListenPort = 8008; - UseKeyring = false; - IgnoreVerification = true; - SSL = false; - }; - }; - }; -} diff --git a/home-manager/modules/pulseaudio/daemon.conf b/home-manager/modules/pulseaudio/daemon.conf deleted file mode 100644 index 3aecdd3..0000000 --- a/home-manager/modules/pulseaudio/daemon.conf +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -default-sample-format = float32le -default-sample-rate = 48000 -alternate-sample-rate = 44100 -default-sample-channels = 2 -default-channel-map = front-left,front-right -default-fragments = 2 -default-fragment-size-msec = 125 -resample-method = soxr-vhq -enable-lfe-remixing = no -high-priority = yes -nice-level = -11 -realtime-scheduling = yes -realtime-priority = 9 -rlimit-rtprio = 9 -daemonize = no \ No newline at end of file diff --git a/home-manager/modules/pulseaudio/default.nix b/home-manager/modules/pulseaudio/default.nix deleted file mode 100644 index 450c3d3..0000000 --- a/home-manager/modules/pulseaudio/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - ... -}: -throw "Disabled needs rework!!!!" -# { -# home.file.".config/pulse/daemon.conf".source = ./daemon.conf; -# } - diff --git a/home-manager/modules/ssh/config b/home-manager/modules/ssh/config deleted file mode 100644 index 295ca2d..0000000 --- a/home-manager/modules/ssh/config +++ /dev/null @@ -1,14 +0,0 @@ -Host * - ControlMaster auto - ControlPath ~/.ssh/controlmasters/%r@%h:%p - ControlPersist 300s - ServerAliveInterval 30 - -Host 192.168.0.250 - Port 2222 - -Host *redalder.org 10.64.1.* 10.64.0.* - ExitOnForwardFailure yes - SendEnv INSIDE_EMACS - RemoteForward /home/main/.ssh/emacs-server /run/user/1000/emacs/server - diff --git a/home-manager/modules/ssh/default.nix b/home-manager/modules/ssh/default.nix deleted file mode 100644 index 240f3ee..0000000 --- a/home-manager/modules/ssh/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.programs.ssh; -in { - options.magic_rb.programs.ssh = { - enable = mkEnableOption "Enable ssh_config"; - }; - - config = mkIf cfg.enable { - programs.ssh = { - enable = true; - - controlMaster = "auto"; - controlPath = "~/.ssh/controlmasters/%r@%h:%p"; - controlPersist = "300s"; - serverAliveInterval = 30; - matchBlocks = { - "Host *redalder.org 10.64.1.* 10.64.0.*".extraOptions = { - ExitOnForwardFailure = "yes"; - SendEnv = "INSIDE_EMACS"; - RemoteForward = "/home/main/.ssh/emacs-server /run/user/1000/emacs/server"; - }; - }; - }; - - home.activation."ssh-controlmasters" = config.lib.dag.entryAfter ["writeBoundary"] '' - mkdir -p ~/.ssh/controlmasters - ''; - }; -} diff --git a/home-manager/modules/webdev.nix b/home-manager/modules/webdev.nix deleted file mode 100644 index 2cf87cd..0000000 --- a/home-manager/modules/webdev.nix +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.packageCollections.webdev; -in { - options.magic_rb.packageCollections.webdev = { - enable = - mkEnableOption - '' - Enable webdev package collection, contains yarn and wasm-pack. - ''; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - yarn - wasm-pack - ]; - }; -} diff --git a/home-manager/modules/wine.nix b/home-manager/modules/wine.nix deleted file mode 100644 index a7189bd..0000000 --- a/home-manager/modules/wine.nix +++ /dev/null @@ -1,36 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.packageCollections.wine; - - combineWines = wines: - map ( - wine: - pkgs.writeShellScriptBin wine.name - '' - ${wine}/bin/wine "$@" - '' - ) - wines; -in { - options.magic_rb.packageCollections.wine = { - enable = mkEnableOption "Enable wine package collection, contains wine-staging and winetricks"; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; - [ - winetricks - ] - ++ combineWines (with pkgs; [ - wineWowPackages.staging - ]); - }; -} diff --git a/home-manager/modules/xmonad/default.nix b/home-manager/modules/xmonad/default.nix deleted file mode 100644 index 961799c..0000000 --- a/home-manager/modules/xmonad/default.nix +++ /dev/null @@ -1,147 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.programs.xmonad; -in { - options.magic_rb.programs.xmonad = { - enable = mkEnableOption "Enable xmonad config"; - - enableDunst = mkOption { - description = "Enable dunst"; - type = types.bool; - default = true; - }; - - enablePicom = mkOption { - description = "Enable picom"; - type = types.bool; - default = true; - }; - - enableKeynav = mkOption { - description = "Enable keynav"; - type = types.bool; - default = true; - }; - - picomExperimentalBackends = mkOption { - description = "Enable experimental backends in picom"; - type = types.bool; - default = true; - }; - }; - - config = mkIf cfg.enable { - home.packages = with pkgs; [ - powerline-fonts - font-awesome - dejavu_fonts - ]; - - home.file.".keynavrc".source = ./keynavrc; - - home.file.".xmonad/xmonad.hs".source = pkgs.writeSubstitutedFile { - name = "xmonad.hs"; - file = ./xmonad.hs; - substitutes = { - "screenshot" = lib.getExe pkgs.magic_rb.screenshot; - "emacs-rofi" = lib.getExe pkgs.emacs-rofi; - "notify" = lib.getExe pkgs.libnotify; - "playerctl" = lib.getExe pkgs.playerctl; - "reload" = pkgs.writeShellScript "xmonad-reload" - '' - ${lib.getExe pkgs.libnotify} -t 5000 "recompiling xmonad" - - if xmonad --recompile - then - ${lib.getExe pkgs.libnotify} -t 5000 "compilation succeeded" - xmonad --restart - else - ${lib.getExe pkgs.libnotify} -t 5000 "compilation failed" - fi - ''; - "auxmenu" = pkgs.writeShellScript "auxmenu" - '' - export SUDO_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass - - _options="toggle-mic\ntoggle-radio\nscreenshot-all\nscreenshot-select\nscreenshot-focused\nsuspend\nreboot\nkexec\npoweroff\nlogout\nnmtui" - - _option="$(echo -e $_options | emacs-rofi "command: " 90 30 | awk '{print $1}' | tr -d '\r\n')" - if [ ''${#_option} -gt 0 ] - then - case $_option in - toggle-mic) - wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle - ;; - toggle-radio) - if [ "$(nmcli radio wifi)" = "enabled" ] - then - nmcli radio wifi off - else - nmcli radio wifi on - fi - ;; - screenshot-all) - ${lib.getExe pkgs.magic_rb.screenshot} screen - ;; - screenshot-select) - ${lib.getExe pkgs.magic_rb.screenshot} select - ;; - screenshot-focused) - ${lib.getExe pkgs.magic_rb.screenshot} focused - ;; - suspend) - systemctl suspend - ;; - reboot) - systemctl reboot - ;; - poweroff) - systemctl poweroff - ;; - kexec) - sudo -A kexec -l /run/current-system/kernel --initrd=/run/current-system/initrd --reuse-cmdline - systemctl kexec - ;; - logout) - loginctl terminate-session $XDG_SESSION_ID - ;; - nmtui) - alacritty -e nmtui - ;; - *) - ;; - esac - fi - ''; - "dmenu_run" = "${pkgs.dmenu}/bin/dmenu_run"; - "polybar" = pkgs.writeShellScript "polybar" - '' - monitors=$(polybar --list-monitors | cut -f 1 -d':') - MONITOR=''${monitors[$1]} ${lib.getExe pkgs.polybarFull} -c ${./polybar.ini} top - ''; - "dunst" = lib.getExe pkgs.dunst; - "dunstConfig" = ./dunstrc; - - "picom" = lib.getExe pkgs.picom; - "picomConfig" = ./picom.conf; - "picomArgs" = - if cfg.picomExperimentalBackends - then "--experimental-backends" - else ""; - - "keynav" = lib.getExe pkgs.keynav; - "lightLocker" = lib.getExe pkgs.lightlocker; - "lightLockerCommand" = "${pkgs.lightlocker}/bin/light-locker-command"; - "brightnessctl" = lib.getExe pkgs.brightnessctl; - }; - }; - }; -} diff --git a/home-manager/modules/xmonad/dunstrc b/home-manager/modules/xmonad/dunstrc deleted file mode 100644 index 7432578..0000000 --- a/home-manager/modules/xmonad/dunstrc +++ /dev/null @@ -1,464 +0,0 @@ -# -*- mode: conf -*- - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -# See dunst(5) for all configuration options - -[global] - ### Display ### - - # Which monitor should the notifications be displayed on. - monitor = 0 - - # Display notification on focused monitor. Possible modes are: - # mouse: follow mouse pointer - # keyboard: follow window with keyboard focus - # none: don't follow anything - # - # "keyboard" needs a window manager that exports the - # _NET_ACTIVE_WINDOW property. - # This should be the case for almost all modern window managers. - # - # If this option is set to mouse or keyboard, the monitor option - # will be ignored. - follow = none - - ### Geometry ### - - # dynamic width from 0 to 300 - # width = (0, 300) - # constant width of 300 - width = 300 - - # The maximum height of a single notification, excluding the frame. - height = 50 - - # Position the notification in the top right corner - origin = top-right - - # Offset from the origin - offset = 0x15 - - # Scale factor. It is auto-detected if value is 0. - scale = 0 - - # Maximum number of notification (0 means no limit) - notification_limit = 20 - - ### Progress bar ### - - # Turn on the progess bar. It appears when a progress hint is passed with - # for example dunstify -h int:value:12 - progress_bar = true - - # Set the progress bar height. This includes the frame, so make sure - # it's at least twice as big as the frame width. - progress_bar_height = 10 - - # Set the frame width of the progress bar - progress_bar_frame_width = 1 - - # Set the minimum width for the progress bar - progress_bar_min_width = 150 - - # Set the maximum width for the progress bar - progress_bar_max_width = 300 - - # Corner radius for the progress bar. 0 disables rounded corners. - progress_bar_corner_radius = 0 - - # Corner radius for the icon image. - icon_corner_radius = 0 - - # Show how many messages are currently hidden (because of - # notification_limit). - indicate_hidden = yes - - # The transparency of the window. Range: [0; 100]. - # This option will only work if a compositing window manager is - # present (e.g. xcompmgr, compiz, etc.). (X11 only) - transparency = 0 - - # Draw a line of "separator_height" pixel height between two - # notifications. - # Set to 0 to disable. - # If gap_size is greater than 0, this setting will be ignored. - separator_height = 1 - - # Padding between text and separator. - padding = 1 - - # Horizontal padding. - horizontal_padding = 4 - - # Padding between text and icon. - text_icon_padding = 0 - - # Defines width in pixels of frame around the notification window. - # Set to 0 to disable. - frame_width = 1 - - # Defines color of the frame around the notification window. - frame_color = "#555555" - - # Size of gap to display between notifications - requires a compositor. - # If value is greater than 0, separator_height will be ignored and a border - # of size frame_width will be drawn around each notification instead. - # Click events on gaps do not currently propagate to applications below. - gap_size = 0 - - # Define a color for the separator. - # possible values are: - # * auto: dunst tries to find a color fitting to the background; - # * foreground: use the same color as the foreground; - # * frame: use the same color as the frame; - # * anything else will be interpreted as a X color. - separator_color = frame - - # Sort messages by urgency. - sort = yes - - # Don't remove messages, if the user is idle (no mouse or keyboard input) - # for longer than idle_threshold seconds. - # Set to 0 to disable. - # A client can set the 'transient' hint to bypass this. See the rules - # section for how to disable this if necessary - # idle_threshold = 120 - - ### Text ### - - font = Fixed 8 - - # The spacing between lines. If the height is smaller than the - # font height, it will get raised to the font height. - line_height = 0 - - # Possible values are: - # full: Allow a small subset of html markup in notifications: - # bold - # italic - # strikethrough - # underline - # - # For a complete reference see - # . - # - # strip: This setting is provided for compatibility with some broken - # clients that send markup even though it's not enabled on the - # server. Dunst will try to strip the markup but the parsing is - # simplistic so using this option outside of matching rules for - # specific applications *IS GREATLY DISCOURAGED*. - # - # no: Disable markup parsing, incoming notifications will be treated as - # plain text. Dunst will not advertise that it has the body-markup - # capability if this is set as a global setting. - # - # It's important to note that markup inside the format option will be parsed - # regardless of what this is set to. - markup = full - - # The format of the message. Possible variables are: - # %a appname - # %s summary - # %b body - # %i iconname (including its path) - # %I iconname (without its path) - # %p progress value if set ([ 0%] to [100%]) or nothing - # %n progress value if set without any extra characters - # %% Literal % - # Markup is allowed - format = "%a: %s\n%b" - - # Alignment of message text. - # Possible values are "left", "center" and "right". - alignment = left - - # Vertical alignment of message text and icon. - # Possible values are "top", "center" and "bottom". - vertical_alignment = center - - # Show age of message if message is older than show_age_threshold - # seconds. - # Set to -1 to disable. - show_age_threshold = 60 - - # Specify where to make an ellipsis in long lines. - # Possible values are "start", "middle" and "end". - ellipsize = middle - - # Ignore newlines '\n' in notifications. - ignore_newline = no - - # Stack together notifications with the same content - stack_duplicates = true - - # Hide the count of stacked notifications with the same content - hide_duplicate_count = false - - # Display indicators for URLs (U) and actions (A). - show_indicators = yes - - ### Icons ### - - # Recursive icon lookup. You can set a single theme, instead of having to - # define all lookup paths. - enable_recursive_icon_lookup = true - - # Set icon theme (only used for recursive icon lookup) - icon_theme = Adwaita - # You can also set multiple icon themes, with the leftmost one being used first. - # icon_theme = "Adwaita, breeze" - - # Align icons left/right/top/off - icon_position = off - - # Scale small icons up to this size, set to 0 to disable. Helpful - # for e.g. small files or high-dpi screens. In case of conflict, - # max_icon_size takes precedence over this. - min_icon_size = 32 - - # Scale larger icons down to this size, set to 0 to disable - max_icon_size = 128 - - # Paths to default icons (only neccesary when not using recursive icon lookup) - icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ - - ### History ### - - # Should a notification popped up from history be sticky or timeout - # as if it would normally do. - sticky_history = yes - - # Maximum amount of notifications kept in history - history_length = 20 - - ### Misc/Advanced ### - - # dmenu path. - dmenu = /usr/bin/dmenu -p dunst: - - # Browser for opening urls in context menu. - browser = /usr/bin/xdg-open - - # Always run rule-defined scripts, even if the notification is suppressed - always_run_script = true - - # Define the title of the windows spawned by dunst - title = Dunst - - # Define the class of the windows spawned by dunst - class = Dunst - - # Define the corner radius of the notification window - # in pixel size. If the radius is 0, you have no rounded - # corners. - # The radius will be automatically lowered if it exceeds half of the - # notification height to avoid clipping text and/or icons. - corner_radius = 0 - - # Ignore the dbus closeNotification message. - # Useful to enforce the timeout set by dunst configuration. Without this - # parameter, an application may close the notification sent before the - # user defined timeout. - ignore_dbusclose = false - - ### Wayland ### - # These settings are Wayland-specific. They have no effect when using X11 - - # Uncomment this if you want to let notications appear under fullscreen - # applications (default: overlay) - # layer = top - - # Set this to true to use X11 output on Wayland. - force_xwayland = false - - ### Legacy - - # Use the Xinerama extension instead of RandR for multi-monitor support. - # This setting is provided for compatibility with older nVidia drivers that - # do not support RandR and using it on systems that support RandR is highly - # discouraged. - # - # By enabling this setting dunst will not be able to detect when a monitor - # is connected or disconnected which might break follow mode if the screen - # layout changes. - force_xinerama = false - - ### mouse - - # Defines list of actions for each mouse event - # Possible values are: - # * none: Don't do anything. - # * do_action: Invoke the action determined by the action_name rule. If there is no - # such action, open the context menu. - # * open_url: If the notification has exactly one url, open it. If there are multiple - # ones, open the context menu. - # * close_current: Close current notification. - # * close_all: Close all notifications. - # * context: Open context menu for the notification. - # * context_all: Open context menu for all notifications. - # These values can be strung together for each mouse event, and - # will be executed in sequence. - mouse_left_click = close_current - mouse_middle_click = do_action, close_current - mouse_right_click = close_all - -# Experimental features that may or may not work correctly. Do not expect them -# to have a consistent behaviour across releases. -[experimental] - # Calculate the dpi to use on a per-monitor basis. - # If this setting is enabled the Xft.dpi value will be ignored and instead - # dunst will attempt to calculate an appropriate dpi value for each monitor - # using the resolution and physical size. This might be useful in setups - # where there are multiple screens with very different dpi values. - per_monitor_dpi = false - - -[urgency_low] - # IMPORTANT: colors have to be defined in quotation marks. - # Otherwise the "#" and following would be interpreted as a comment. - background = "#000000" - foreground = "#FFFFFF" - timeout = 10 - # Icon for notifications with low urgency, uncomment to enable - #default_icon = /path/to/icon - -[urgency_normal] - background = "#000000" - foreground = "#FFFFFF" - timeout = 10 - # Icon for notifications with normal urgency, uncomment to enable - #default_icon = /path/to/icon - -[urgency_critical] - background = "#000000" - foreground = "#FFFFFF" - frame_color = "#FF0000" - timeout = 0 - # Icon for notifications with critical urgency, uncomment to enable - #default_icon = /path/to/icon - -# Every section that isn't one of the above is interpreted as a rules to -# override settings for certain messages. -# -# Messages can be matched by -# appname (discouraged, see desktop_entry) -# body -# category -# desktop_entry -# icon -# match_transient -# msg_urgency -# stack_tag -# summary -# -# and you can override the -# background -# foreground -# format -# frame_color -# fullscreen -# new_icon -# set_stack_tag -# set_transient -# set_category -# timeout -# urgency -# icon_position -# skip_display -# history_ignore -# action_name -# word_wrap -# ellipsize -# alignment -# hide_text -# -# Shell-like globbing will get expanded. -# -# Instead of the appname filter, it's recommended to use the desktop_entry filter. -# GLib based applications export their desktop-entry name. In comparison to the appname, -# the desktop-entry won't get localized. -# -# SCRIPTING -# You can specify a script that gets run when the rule matches by -# setting the "script" option. -# The script will be called as follows: -# script appname summary body icon urgency -# where urgency can be "LOW", "NORMAL" or "CRITICAL". -# -# NOTE: It might be helpful to run dunst -print in a terminal in order -# to find fitting options for rules. - -# Disable the transient hint so that idle_threshold cannot be bypassed from the -# client -#[transient_disable] -# match_transient = yes -# set_transient = no -# -# Make the handling of transient notifications more strict by making them not -# be placed in history. -#[transient_history_ignore] -# match_transient = yes -# history_ignore = yes - -# fullscreen values -# show: show the notifications, regardless if there is a fullscreen window opened -# delay: displays the new notification, if there is no fullscreen window active -# If the notification is already drawn, it won't get undrawn. -# pushback: same as delay, but when switching into fullscreen, the notification will get -# withdrawn from screen again and will get delayed like a new notification -#[fullscreen_delay_everything] -# fullscreen = delay -#[fullscreen_show_critical] -# msg_urgency = critical -# fullscreen = show - -#[espeak] -# summary = "*" -# script = dunst_espeak.sh - -#[script-test] -# summary = "*script*" -# script = dunst_test.sh - -#[ignore] -# # This notification will not be displayed -# summary = "foobar" -# skip_display = true - -#[history-ignore] -# # This notification will not be saved in history -# summary = "foobar" -# history_ignore = yes - -#[skip-display] -# # This notification will not be displayed, but will be included in the history -# summary = "foobar" -# skip_display = yes - -#[signed_on] -# appname = Pidgin -# summary = "*signed on*" -# urgency = low -# -#[signed_off] -# appname = Pidgin -# summary = *signed off* -# urgency = low -# -#[says] -# appname = Pidgin -# summary = *says* -# urgency = critical -# -#[twitter] -# appname = Pidgin -# summary = *twitter.com* -# urgency = normal -# -#[stack-volumes] -# appname = "some_volume_notifiers" -# set_stack_tag = "volume" -# -# vim: ft=cfg \ No newline at end of file diff --git a/home-manager/modules/xmonad/keynavrc b/home-manager/modules/xmonad/keynavrc deleted file mode 100644 index 501525f..0000000 --- a/home-manager/modules/xmonad/keynavrc +++ /dev/null @@ -1,32 +0,0 @@ -# -*- mode: text -*- - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -clear -ctrl+s start, grid 3x3 -Escape end -u end - -g warp, click 1, end -c warp, click 3, end -d warp, click 4 -b warp, click 5 -l warp, end - - -t move-left -r move-up -n move-down -s move-right - -period cell-select 1x1 -o cell-select 2x1 -comma cell-select 3x1 -a cell-select 1x2 -e cell-select 2x2 -i cell-select 3x2 -q cell-select 1x3 -adiaeresis cell-select 2x3 -udiaeresis cell-select 3x3 diff --git a/home-manager/modules/xmonad/picom.conf b/home-manager/modules/xmonad/picom.conf deleted file mode 100644 index b783144..0000000 --- a/home-manager/modules/xmonad/picom.conf +++ /dev/null @@ -1,238 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -# Thank you code_nomad: http://9m.no/ꪯ鵞 -# and Arch Wiki contributors: https://wiki.archlinux.org/index.php/Compton - -################################# -# -# Backend -# -################################# - -# Backend to use: "xrender" or "glx". -# GLX backend is typically much faster but depends on a sane driver. -backend = "glx"; - -################################# -# -# GLX backend -# -################################# - -glx-no-stencil = true; - -# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all. -# My tests with nvidia-drivers show a 10% decrease in performance when the whole screen is modified, -# but a 20% increase when only 1/4 is. -# My tests on nouveau show terrible slowdown. -glx-copy-from-front = false; - -# GLX backend: Use MESA_copy_sub_buffer to do partial screen update. -# My tests on nouveau shows a 200% performance boost when only 1/4 of the screen is updated. -# May break VSync and is not available on some drivers. -# Overrides --glx-copy-from-front. -# glx-use-copysubbuffermesa = true; - -# GLX backend: Avoid rebinding pixmap on window damage. -# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe). -# Recommended if it works. -# glx-no-rebind-pixmap = true; - -# GLX backend: GLX buffer swap method we assume. -# Could be undefined (0), copy (1), exchange (2), 3-6, or buffer-age (-1). -# undefined is the slowest and the safest, and the default value. -# copy is fastest, but may fail on some drivers, -# 2-6 are gradually slower but safer (6 is still faster than 0). -# Usually, double buffer means 2, triple buffer means 3. -# buffer-age means auto-detect using GLX_EXT_buffer_age, supported by some drivers. -# Useless with --glx-use-copysubbuffermesa. -# Partially breaks --resize-damage. -# Defaults to undefined. -#glx-swap-method = "undefined"; - -################################# -# -# Shadows -# -################################# - -# Enabled client-side shadows on windows. -shadow = true; -# The blur radius for shadows. (default 12) -shadow-radius = 5; -# The left offset for shadows. (default -15) -shadow-offset-x = -5; -# The top offset for shadows. (default -15) -shadow-offset-y = -5; -# The translucency for shadows. (default .75) -shadow-opacity = 0.5; - -# Set if you want different colour shadows -# shadow-red = 0.0; -# shadow-green = 0.0; -# shadow-blue = 0.0; - -# The shadow exclude options are helpful if you have shadows enabled. Due to the way picom draws its shadows, certain applications will have visual glitches -# (most applications are fine, only apps that do weird things with xshapes or argb are affected). -# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher. -shadow-exclude = [ - "! name~=''", - "name = 'Notification'", - "name = 'Plank'", - "name = 'Docky'", - "name = 'Kupfer'", - "name = 'xfce4-notifyd'", - "name *= 'VLC'", - "name *= 'compton'", - "name *= 'picom'", - "name *= 'Chromium'", - "name *= 'Chrome'", - "class_g = 'Firefox' && argb", - "class_g = 'Conky'", - "class_g = 'Kupfer'", - "class_g = 'Synapse'", - "class_g ?= 'Notify-osd'", - "class_g ?= 'Cairo-dock'", - "class_g ?= 'Xfce4-notifyd'", - "class_g ?= 'Xfce4-power-manager'", - "_GTK_FRAME_EXTENTS@:c", - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" -]; -# Avoid drawing shadow on all shaped windows (see also: --detect-rounded-corners) -shadow-ignore-shaped = false; - -################################# -# -# Opacity -# -################################# - -inactive-opacity = 1; -active-opacity = 1; -frame-opacity = 1; -inactive-opacity-override = false; - -# Dim inactive windows. (0.0 - 1.0) -# inactive-dim = 0.2; -# Do not let dimness adjust based on window opacity. -# inactive-dim-fixed = true; -# Blur background of transparent windows. Bad performance with X Render backend. GLX backend is preferred. -blur-background = true; -# Blur background of opaque windows with transparent frames as well. -# blur-background-frame = true; -# Do not let blur radius adjust based on window opacity. -blur-background-fixed = false; -blur-background-exclude = [ - "window_type = 'dock'", - "window_type = 'desktop'" -]; - -blur: -{ - method = "kernel"; - size = 50; - deviation = 5.0; -}; - -################################# -# -# Fading -# -################################# - -# Fade windows during opacity changes. -fading = false; -# The time between steps in a fade in milliseconds. (default 10). -fade-delta = 4; -# Opacity change between steps while fading in. (default 0.028). -fade-in-step = 0.03; -# Opacity change between steps while fading out. (default 0.03). -fade-out-step = 0.03; -# Fade windows in/out when opening/closing -# no-fading-openclose = true; - -# Specify a list of conditions of windows that should not be faded. -fade-exclude = [ ]; - -################################# -# -# Other -# -################################# - -# Try to detect WM windows and mark them as active. -mark-wmwin-focused = true; -# Mark all non-WM but override-redirect windows active (e.g. menus). -mark-ovredir-focused = true; -# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events. -# Usually more reliable but depends on a EWMH-compliant WM. -use-ewmh-active-win = true; -# Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on. -detect-rounded-corners = true; - -# Detect _NET_WM_OPACITY on client windows, useful for window managers not passing _NET_WM_OPACITY of client windows to frame windows. -# This prevents opacity being ignored for some apps. -# For example without this enabled my xfce4-notifyd is 100% opacity no matter what. -detect-client-opacity = true; - -# Specify refresh rate of the screen. -# If not specified or 0, picom will try detecting this with X RandR extension. -refresh-rate = 0; - -# Vertical synchronization: match the refresh rate of the monitor -vsync = true; - -# Enable DBE painting mode, intended to use with VSync to (hopefully) eliminate tearing. -# Reported to have no effect, though. -dbe = false; - -# Limit picom to repaint at most once every 1 / refresh_rate second to boost performance. -# This should not be used with --vsync drm/opengl/opengl-oml as they essentially does --sw-opti's job already, -# unless you wish to specify a lower refresh rate than the actual value. -#sw-opti = true; - -# Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games. -# Known to cause flickering when redirecting/unredirecting windows. -unredir-if-possible = false; - -# Specify a list of conditions of windows that should always be considered focused. -focus-exclude = [ ]; - -# Use WM_TRANSIENT_FOR to group windows, and consider windows in the same group focused at the same time. -detect-transient = true; -# Use WM_CLIENT_LEADER to group windows, and consider windows in the same group focused at the same time. -# WM_TRANSIENT_FOR has higher priority if --detect-transient is enabled, too. -detect-client-leader = true; - -################################# -# -# Window type settings -# -################################# - -wintypes: -{ - tooltip = - { - # fade: Fade the particular type of windows. - fade = true; - # shadow: Give those windows shadow - shadow = false; - # opacity: Default opacity for the type of windows. - opacity = 0.85; - # focus: Whether to always consider windows of this type focused. - focus = true; - }; -}; - -###################### -# -# XSync -# See: https://github.com/yshui/picom/commit/b18d46bcbdc35a3b5620d817dd46fbc76485c20d -# -###################### - -# Use X Sync fence to sync clients' draw calls. Needed on nvidia-drivers with GLX backend for some users. -xrender-sync-fence = true; diff --git a/home-manager/modules/xmonad/polybar.ini b/home-manager/modules/xmonad/polybar.ini deleted file mode 100644 index 0abc1d3..0000000 --- a/home-manager/modules/xmonad/polybar.ini +++ /dev/null @@ -1,184 +0,0 @@ -[colors] -background = #282A2E -background-alt = #373B41 -foreground = #C5C8C6 -primary = #F0C674 -secondary = #8ABEB7 -alert = #A54242 -disabled = #707880 - -[bar/top] -monitor = ${env:MONITOR:} -height = 10pt - -font-0 = Fixed;2 - -modules-left = battery backlight xworkspaces -modules-right = filesystem pulseaudio memory cpu wlan eth xkeyboard date - -module-margin = 1 - -separator = | -separator-foreground = ${colors.disabled} - -border-size = 1pt -border-color = #222222 - -enable-ipc = true - -tray-position = right - -[module/battery] -type = internal/battery - -full-at = 100 - -# format-low once this charge percentage is reached -# Default: 10 -# New in version 3.6.0 -low-at = 20 - -# Use the following command to list batteries and adapters: -# $ ls -1 /sys/class/power_supply/ -battery = BAT0 -adapter = ADP1 - -# If an inotify event haven't been reported in this many -# seconds, manually poll for new values. -# -# Needed as a fallback for systems that don't report events -# on sysfs/procfs. -# -# Disable polling by setting the interval to 0. -# -# Default: 5 -poll-interval = 5 - -format-low = -label-low = %{F#FF0000}! %percentage% - -label-charging = %{F#F0C674}c%{F-} %percentage%% -label-discharging = %{F#F0C674}d%{F-} %percentage%% -label-full = %{F#F0C674}-%{F-} %percentage%% - -[module/backlight] -type = internal/backlight - -# Use the following command to list available cards: -# $ ls -1 /sys/class/backlight/ -card = intel_backlight - -label = %{F#F0C674}b%{F-} %percentage%% - -# Use the `/sys/class/backlight/.../actual-brightness` file -# rather than the regular `brightness` file. -# Defaults to true unless the specified card is an amdgpu backlight. -# New in version 3.6.0 -use-actual-brightness = true - -[module/xworkspaces] -type = internal/xworkspaces - -label-active = %name% -label-active-background = ${colors.background-alt} -label-active-underline= ${colors.primary} -label-active-padding = 1 - -label-occupied = %name% -label-occupied-padding = 1 - -label-urgent = %name% -label-urgent-background = ${colors.alert} -label-urgent-padding = 1 - -label-empty = -# label-empty-foreground = ${colors.disabled} -# label-empty-padding = 1 - -pin-workspaces = true - -enable-click = false -enable-scroll = false - -[module/filesystem] -type = internal/fs -interval = 25 - -mount-0 = / -mount-1 = /nix/store -mount-2 = /home - -label-mounted = %{F#F0C674}%mountpoint%%{F-} %used% - -label-unmounted = %mountpoint% not mounted -label-unmounted-foreground = ${colors.disabled} - -[module/pulseaudio] -type = internal/pulseaudio - -format-volume-prefix = "VOL " -format-volume-prefix-foreground = ${colors.primary} -format-volume = - -label-volume = %percentage%% - -label-muted = muted -label-muted-foreground = ${colors.disabled} - -interval = 0 - -[module/xkeyboard] -type = internal/xkeyboard -blacklist-0 = num lock - -label-layout = %icon% -label-layout-foreground = ${colors.primary} - -label-indicator-on = -label-indicator-off = - -layout-icon-default = some-icon -layout-icon-0 = de;koy;koy -layout-icon-1 = us;us -layout-icon-2 = mine;mine;mine -layout-icon-3 = de;neo;neo - -[module/memory] -type = internal/memory -interval = 2 -format-prefix = "RAM " -format-prefix-foreground = ${colors.primary} -label = %percentage_used:2%% - -[module/cpu] -type = internal/cpu -interval = 2 -format-prefix = "CPU " -format-prefix-foreground = ${colors.primary} -label = %percentage-cores:2% - -[network-base] -type = internal/network -interval = 5 -format-connected = -format-disconnected = -label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected - -[module/wlan] -inherit = network-base -interface-type = wireless -label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip% %{F#707880},%{F-} %upspeed% %downspeed% - -[module/eth] -inherit = network-base -interface-type = wired -label-connected = %{F#F0C674}%ifname%%{F-} %local_ip% %{F#707880},%{F-} %upspeed% %downspeed% - -[module/date] -type = internal/date -interval = 1 - -date = %Y-%m-%d %H:%M:%S - -label = %date% -label-foreground = ${colors.primary} diff --git a/home-manager/modules/xmonad/xmobarrc b/home-manager/modules/xmonad/xmobarrc deleted file mode 100644 index 959019b..0000000 --- a/home-manager/modules/xmonad/xmobarrc +++ /dev/null @@ -1,114 +0,0 @@ --- -*- mode: haskell; -*- - --- SPDX-FileCopyrightText: 2022 Richard Brežák --- --- SPDX-License-Identifier: LGPL-3.0-or-later - -Config { - - -- appearance - font = "DejaVu Sans Mono 10" - , bgColor = "#222222" - , fgColor = "#eaeaea" - , position = Top - , border = BottomB - , borderColor = "#646464" - - -- layout - , sepChar = "%" -- delineator between plugin names and straight text - , alignSep = "}{" -- separator between left-right alignment - , template = "%_XMONAD_LOG% | %battery% | %multicpu% | %multicoretemp% | %memory% | %dynnetwork% }{ %date% || %kbd% " - - -- general behavior - , lowerOnStart = True -- send to bottom of window stack on start - , hideOnStart = False -- start with window unmapped (hidden) - , allDesktops = True -- show on all desktops - , overrideRedirect = True -- set the Override Redirect flag (Xlib) - , pickBroadest = False -- choose widest display (multi-monitor) - , persistent = True -- enable/disable hiding (True = disabled) - - -- plugins - -- Numbers can be automatically colored according to their value. xmobar - -- decides color based on a three-tier/two-cutoff system, controlled by - -- command options: - -- --Low sets the low cutoff - -- --High sets the high cutoff - -- - -- --low sets the color below --Low cutoff - -- --normal sets the color between --Low and --High cutoffs - -- --High sets the color above --High cutoff - -- - -- The --template option controls how the plugin is displayed. Text - -- color can be set by enclosing in tags. For more details - -- see http://projects.haskell.org/xmobar/#system-monitor-plugins. - , commands = - - -- weather monitor - [ Run Weather "RJTT" [ "--template", " | °C | % | hPa" - ] 36000 - - -- network activity monitor (dynamic interface resolution) - , Run DynNetwork [ "--template" , ": kB/s|kB/s" - , "--Low" , "1000" -- units: B/s - , "--High" , "5000" -- units: B/s - , "--low" , "green" - , "--normal" , "orange" - , "--high" , "red" - ] 10 - - -- cpu activity monitor - , Run MultiCpu [ "--template" , "Cpu: " --  - , "--Low" , "25" -- units: % - , "--High" , "75" -- units: % - , "--low" , "green" - , "--normal" , "orange" - , "--high" , "red" - , "--minwidth" , "3" - ] 10 - - -- cpu core temperature monitor - , Run MultiCoreTemp [ "--template" , "Temp: " - , "--Low" , "70" -- units: °C - , "--High" , "80" -- units: °C - , "--low" , "green" - , "--normal" , "orange" - , "--high" , "red" - , "--minwidth" , "3" - ] 50 - - -- memory usage monitor - , Run Memory [ "--template" ,"Mem: %" - , "--Low" , "20" -- units: % - , "--High" , "90" -- units: % - , "--low" , "green" - , "--normal" , "orange" - , "--high" , "red" - , "--minwidth" , "2" - ] 10 - - -- battery monitor - , Run Battery [ "--template" , "Batt: " - , "--Low" , "10" -- units: % - , "--High" , "80" -- units: % - , "--low" , "red" - , "--normal" , "orange" - , "--high" , "green" - , "--width" , "6" - , "--" -- battery specific options - -- discharging status - , "-o", "% ()" - -- AC "on" status - , "-O", "% Charging" - -- charged status - , "-i", "% Charged" - ] 50 - - -- time and date indicator - -- (%F = y-m-d date, %a = day of week, %T = h:m:s time) - , Run Date "%F (%a) %T" "date" 10 - - -- keyboard layout indicator - , Run Kbd [ ] - , Run XPropertyLog "_XMONAD_LOG" - ] - } diff --git a/home-manager/modules/xmonad/xmonad.hs b/home-manager/modules/xmonad/xmonad.hs deleted file mode 100644 index 92cb531..0000000 --- a/home-manager/modules/xmonad/xmonad.hs +++ /dev/null @@ -1,349 +0,0 @@ --- SPDX-FileCopyrightText: 2022 Richard Brežák --- --- SPDX-License-Identifier: LGPL-3.0-or-later - --- --- xmonad example config file. --- --- A template showing all available configuration hooks, --- and how to override the defaults in your own xmonad.hs conf file. --- --- Normally, you'd only override those defaults you care about. --- - -import XMonad -import Data.Monoid -import Data.Function -import Data.Functor -import System.Exit -import XMonad.Util.EZConfig -import XMonad.Util.SpawnOnce -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.EwmhDesktops - -import XMonad.Layout.BinarySpacePartition -import XMonad.Layout.Tabbed -import XMonad.Layout.NoBorders -import XMonad.Util.WorkspaceCompare -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.StatusBar -import XMonad.Actions.UpdatePointer -import XMonad.Actions.FloatKeys - -import Control.Monad - -import qualified XMonad.StackSet as W -import qualified Data.Map as M - - -myTerminal = "xterm" -myFocusFollowsMouse = True -myClickJustFocuses = False --- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] -myWorkspaces = map show ([1..9] ++ [0]) - -toggleFloat = withFocused (\windowId -> do - { floats <- gets (W.floating . windowset); - if windowId `M.member` floats - then withFocused $ windows . W.sink - else float windowId }) - -modm :: KeyMask -modm = mod4Mask - ------------------------------------------------------------------------- --- Key bindings. Add, modify or remove key bindings here. --- -myKeymap c = - -- launch a terminal - [ ("M-S-", spawn "alacritty") - - -- launch dmenu - , ("M-e", spawn "@dmenu_run@") - - -- close focused window - , ("M-S-q", io (exitWith ExitSuccess)) - - -- Rotate through the available layout algorithms - , ("M-", sendMessage NextLayout) - - -- Reset the layouts on the current workspace to default - -- , ("M-S-Space", setLayout $ XMonad.layoutHook c) - - -- Resize viewed windows to the correct size - , ("M-b", refresh) - - -- Move focus to the next window - , ("M-", windows W.focusDown) - - -- Move focus to the next window - , ("M-n", windows W.focusDown) - - -- Move focus to the previous window - , ("M-r", windows W.focusUp) - - -- Move focus to the master window - , ("M-p", windows W.focusMaster) - - -- Swap the focused window and the master window - , ("M-", windows W.swapMaster) - - -- Swap the focused window with the next window - , ("M-S-n", windows W.swapDown) - - -- Swap the focused window with the previous window - , ("M-S-r", windows W.swapUp) - - -- Shrink the master area - , ("M-t", sendMessage Shrink) - - -- Expand the master area - , ("M-s", sendMessage Expand) - - -- Push window back into tiling - , ("M-y", toggleFloat) - - -- Increment the number of windows in the master area - , ("M-w", sendMessage (IncMasterN 1)) - - -- Deincrement the number of windows in the master area - , ("M-m", sendMessage (IncMasterN (-1))) - - -- , ("M-b", spawn ("pkill xmobar && " ++ xmobarCmd)) - , ("", spawn "sleep 0.1 ; @screenshot@ select") - , ("S-", spawn "@screenshot@ screen && sleep 0.1 && @notify@ -t 5000 \"snap\"") - , ("C-S-", spawn "@screenshot@ focused && sleep 0.1 && @notify@ -t 5000 \"snap\"") - - -- Toggle the status bar gap - -- Use this binding with avoidStruts from Hooks.ManageDocks. - -- See also the statusBar function from Hooks.DynamicLog. - -- - , ("M-b", sendMessage ToggleStruts) - - -- Quit xmonad - , ("M-S-k", kill) - - -- Restart xmonad - , ("M-k", spawn "@reload@") - - -- float keys - , ("M-g", withFocused (keysResizeWindow (-10, 0) (0, 0))) - , ("M-c", withFocused (keysResizeWindow ( 0, 10) (0, 0))) - , ("M-l", withFocused (keysResizeWindow ( 0,-10) (0, 0))) - , ("M-ß", withFocused (keysResizeWindow ( 10, 0) (0, 0))) - , ("M-S-g", withFocused (xMoveWindow (-10, 0))) - , ("M-S-c", withFocused (xMoveWindow ( 0, 10))) - , ("M-S-l", withFocused (xMoveWindow ( 0,-10))) - , ("M-S-ß", withFocused (xMoveWindow ( 10, 0))) - - , ("M-z", spawn "@lightLockerCommand@ --lock") - - , ("" , spawn "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle") - , ("" , spawn "wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+") - , ("" , spawn "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-") - , ("" , spawn "@brightnessctl@ set +5%") - , ("" , spawn "@brightnessctl@ set 5%-") - - , ("" , spawn "@notify@ -t 5000 \"Music: Play\"" >> spawn "@playerctl@ play-pause") - , ("" , spawn "@notify@ -t 5000 \"Music: Stop\"" >> spawn "@playerctl@ stop") - , ("" , spawn "@notify@ -t 5000 \"Music: Prev\"" >> spawn "@playerctl@ previous") - , ("" , spawn "@notify@ -t 5000 \"Music: Next\"" >> spawn "@playerctl@ next") - - , ("M-", spawn "@auxmenu@") - ] - ++ - - -- - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - -- - [("M-" ++ m ++ [k], windows $ f i) - | (i, k) <- zip (XMonad.workspaces c) "1234567890" - , (f, m) <- [(W.view, ""), (W.shift, "S-")]] - ++ - - -- - -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 - -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 - -- - [("M-"++m++[key], screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip ".o," [0..] - , (f, m) <- [(W.view, ""), (W.shift, "S-")]] - where - xMoveWindow - :: (Position, Position) - -> Window - -> X () - xMoveWindow (x, y) w = withDisplay (\d -> do - (_, ox, oy, _, _, _, _) <- io $ getGeometry d w - io $ moveWindow d w (ox + x) (oy + y)) - - ------------------------------------------------------------------------- --- Mouse bindings: default actions bound to mouse events --- -myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ - - -- mod-button1, Set the window to floating mode and move by dragging - [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w - >> windows W.shiftMaster)) - - -- mod-button2, Raise the window to the top of the stack - , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) - - -- mod-button3, Set the window to floating mode and resize by dragging - , ((modm, button3), (\w -> focus w >> mouseResizeWindow w - >> windows W.shiftMaster)) - - -- you may also bind events to the mouse scroll wheel (button4 and button5) - ] - ------------------------------------------------------------------------- --- Layouts: - --- You can specify and transform your layouts by modifying these values. --- If you change layout bindings be sure to use 'mod-shift-space' after --- restarting (with 'mod-q') to reset your layout state to the new --- defaults, as xmonad preserves your old layout settings by default. --- --- The available layouts. Note that each layout is separated by |||, --- which denotes layout choice. --- -myLayout = smartBorders tiled ||| smartBorders simpleTabbed ||| smartBorders emptyBSP ||| noBorders Full - where - -- default tiling algorithm partitions the screen into two panes - tiled = Tall nmaster delta ratio - - -- The default number of windows in the master pane - nmaster = 1 - - -- Default proportion of screen occupied by master pane - ratio = 1/2 - - -- Percent of screen to increment by when resizing panes - delta = 3/100 - -myPP = def - { ppLayout = const "" -- Don't show the layout name - , ppSort = getSortByXineramaRule -- Sort left/right screens on the left, non-empty workspaces after those - , ppTitle = const "" -- Don't show the focused window's title - , ppTitleSanitize = const "" -- Also about window's title - , ppVisible = wrap "(" ")" -- Non-focused (but still visible) screen - } - -spawnBar :: ScreenId -> IO StatusBarConfig -spawnBar screen = pure $ statusBarPropTo "_XMONAD_LOG" ("@polybar@ " <> (show (fromIntegral screen :: Int))) (pure myPP) - ------------------------------------------------------------------------- --- Now run xmonad with all the defaults we set up. - --- Run xmonad with the settings you specify. No need to modify this. --- --- main = xmonad $ ewmh $ docks $ defaults -main = do - pure defaults <&> dynamicSBs spawnBar <&> docks >>= xmonad - --- A structure containing your configuration settings, overriding --- fields in the default config. Any you don't override, will --- use the defaults defined in xmonad/XMonad/Config.hs --- --- No need to modify this. --- -defaults = let - c = def { - -- simple stuff - terminal = myTerminal, - focusFollowsMouse = myFocusFollowsMouse, - clickJustFocuses = myClickJustFocuses, - modMask = modm, - workspaces = myWorkspaces, - - -- key bindings - -- keys = myKeys, - mouseBindings = myMouseBindings, - - -- hooks, layouts - layoutHook = avoidStruts $ myLayout, - - -- To find the property name associated with a program, use - -- > xprop | grep WM_CLASS - -- and click on the client you're interested in. - -- - -- To match on the WM_NAME, you can use 'title' in the same way that - -- 'className' and 'resource' are used below. - manageHook = manageDocks <+> composeAll - [ title =? "emacs-completing-read-float" --> doFloat - -- , className =? "Gimp" --> doFloat - -- , resource =? "desktop_window" --> doIgnore - -- , resource =? "kdesktop" --> doIgnore - ], - - logHook = - updatePointer (0.5, 0.5) (1, 1), - - -- XMonad.Layout.PerWorkspace - startupHook = do - spawnOnce "@dunst@ -config @dunstConfig@" - spawnOnce "@picom@ --config @picomConfig@ @picomArgs@" - spawnOnce "@keynav@" - spawnOnce "@lightLocker@ --lock-on-suspend", - - -- Looks - focusedBorderColor = "#5c5c5c", - normalBorderColor = "#222222", - borderWidth = 4 - } - in additionalKeysP c (myKeymap c) - & flip additionalKeys [ ((mod1Mask, xK_v), return ()) ] - & ewmh - --- | Finally, a copy of the default bindings in simple textual tabular format. -help :: String -help = unlines ["The default modifier key is 'alt'. Default keybindings:", - "", - "-- launching and killing programs", - "mod-Shift-Enter Launch xterminal", - "mod-p Launch dmenu", - "mod-Shift-p Launch gmrun", - "mod-Shift-c Close/kill the focused window", - "mod-Space Rotate through the available layout algorithms", - "mod-Shift-Space Reset the layouts on the current workSpace to default", - "mod-n Resize/refresh viewed windows to the correct size", - "", - "-- move focus up or down the window stack", - "mod-Tab Move focus to the next window", - "mod-Shift-Tab Move focus to the previous window", - "mod-j Move focus to the next window", - "mod-k Move focus to the previous window", - "mod-m Move focus to the master window", - "", - "-- modifying the window order", - "mod-Return Swap the focused window and the master window", - "mod-Shift-j Swap the focused window with the next window", - "mod-Shift-k Swap the focused window with the previous window", - "", - "-- resizing the master/slave ratio", - "mod-h Shrink the master area", - "mod-l Expand the master area", - "", - "-- floating layer support", - "mod-t Push window back into tiling; unfloat and re-tile it", - "", - "-- increase or decrease number of windows in the master area", - "mod-comma (mod-,) Increment the number of windows in the master area", - "mod-period (mod-.) Deincrement the number of windows in the master area", - "", - "-- quit, or restart", - "mod-Shift-q Quit xmonad", - "mod-q Restart xmonad", - "mod-[1..9] Switch to workSpace N", - "", - "-- Workspaces & screens", - "mod-Shift-[1..9] Move client to workspace N", - "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3", - "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3", - "", - "-- Mouse bindings: default actions bound to mouse events", - "mod-button1 Set the window to floating mode and move by dragging", - "mod-button2 Raise the window to the top of the stack", - "mod-button3 Set the window to floating mode and resize by dragging"] diff --git a/lefthook.yaml b/lefthook.yaml deleted file mode 100644 index bf97d3e..0000000 --- a/lefthook.yaml +++ /dev/null @@ -1,7 +0,0 @@ -pre-commit: - commands: - alejandra: - glob: "*.nix" - run: alejandra {all_files} -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{...}: { - perSystem = { pkgs, ... }: - { - apps = { - runZfsIso.program = pkgs.writeShellScript "run-zfs-iso" - '' - ${pkgs.qemu}/bin/qemu-system-x86_64 - ''; - - runZfsInstall.program = pkgs.writeShellScript "run-zfs-install" - '' - ''; - }; - }; -} - diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index 9e8ac00..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{...}: { - imports = [ - ./systems.nix - ./overlays.nix - ./devShells.nix - ./nixos_modules.nix - # Doesn't build - # ./qmk - ]; -} diff --git a/modules/devShells.nix b/modules/devShells.nix deleted file mode 100644 index 727d329..0000000 --- a/modules/devShells.nix +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ inputs, ... }: -{ - perSystem = {pkgs, ...}: - let - pkgs-hashicorp = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}; - in - { - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - lefthook - alejandra - reuse - pkgs-hashicorp.vault - pkgs-hashicorp.nomad - pkgs-hashicorp.consul - dnsutils - qemu_kvm - usbutils - jq - ]; - }; - }; -} diff --git a/modules/nixos_modules.nix b/modules/nixos_modules.nix deleted file mode 100644 index 797e309..0000000 --- a/modules/nixos_modules.nix +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -{ config, roots, ... }: { - flake.nixosModules = { - hashicorp = import (roots.nixos + "/modules/hashicorp.nix"); - }; -} diff --git a/modules/overlays.nix b/modules/overlays.nix deleted file mode 100644 index 4b8aad2..0000000 --- a/modules/overlays.nix +++ /dev/null @@ -1,80 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - lib, - inputs, - config, - perSystem, - roots, - ... -}: -with lib; let - cfg = config.flake.overlays; - - packageSets = let - all = builtins.readDir overlayDir; - overlayFiles = filterAttrs (n: v: n != "default.nix" && (hasSuffix ".nix" n || v == "directory")) all; - overlays = - mapAttrs' - ( - file: _: let - packageSet = import "${overlayDir}/${file}"; - overlay = callPackageWith inputs packageSet.overlay {}; - - dependencies = - map - (n: overlays.${n}.overlay) - (packageSet.overlays or []); - foldedOverlay = - foldOverlays - (dependencies ++ singleton overlay); - in - nameValuePair - packageSet.name - { - overlay = foldedOverlay; - systems = packageSet.systems or config.systems; - rawOverlay = overlay; - packages = mapAttrsToList (n: _: n) (overlay null null); - } - ) - overlayFiles; - in - overlays; - - foldOverlays = overlays: final: prev: - foldl - (acc: overlay: acc // overlay final acc) - prev - overlays; - - traceOverlay = overlay: - trace (builtins.attrNames (overlay {} {})) overlay; - - overlayDir = roots.flake + "/overlays"; -in { - flake.overlays = mapAttrs (_: v: v.rawOverlay) packageSets; - - perSystem = { - config, - system, - pkgs, - ... - }: { - packages = - foldl - (acc: attrs: recursiveUpdate acc attrs) - {} - (flatten - (flip mapAttrsToList - (filterAttrs (_: v: elem system v.systems) packageSets) - # packageSets - (_: packageSet: let - pkgs = import inputs.nixpkgs { - overlays = singleton packageSet.overlay; - inherit system; - }; - in (filterAttrs (const isDerivation) (genAttrs packageSet.packages (n: pkgs.${n})))))); - }; -} diff --git a/modules/qmk/config.h b/modules/qmk/config.h deleted file mode 100644 index 446a4ec..0000000 --- a/modules/qmk/config.h +++ /dev/null @@ -1,2 +0,0 @@ -#define RAW_USAGE_PAGE 0xFF60 -#define RAW_USAGE_ID 0x61 diff --git a/modules/qmk/default.nix b/modules/qmk/default.nix deleted file mode 100644 index 0305162..0000000 --- a/modules/qmk/default.nix +++ /dev/null @@ -1,100 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{inputs, ...}: { - perSystem = - {lib, pkgs, ...}: - let - avrlibc = pkgs.pkgsCross.avr.libcCross; - avrBinutils = pkgs.pkgsCross.avr.buildPackages.binutils; - avrGcc = pkgs.pkgsCross.avr.buildPackages.gcc8; - - bootloadHID = - (((import ../../overlays/bootloadHID.nix).overlay - { inherit (inputs) bootloadHID; }) null pkgs).bootloadHID; - - avr_incflags = [ - "-isystem ${avrlibc}/avr/include" - "-B${avrlibc}/avr/lib/avr5" - "-L${avrlibc}/avr/lib/avr5" - "-B${avrlibc}/avr/lib/avr35" - "-L${avrlibc}/avr/lib/avr35" - "-B${avrlibc}/avr/lib/avr51" - "-L${avrlibc}/avr/lib/avr51" - ]; - - pythonEnv = with pkgs; poetry2nix.mkPoetryEnv { - projectDir = "${inputs.qmk}/util/nix"; - overrides = poetry2nix.overrides.withDefaults (self: super: { - qmk = super.qmk.overridePythonAttrs (old: { - # Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes - # $PATH and breaks these invocations). - dontWrapPythonPrograms = true; - }); - }); - }; - in - { - devShells.qmk = pkgs.mkShell { - name = "qmk-devshell"; - - buildInputs = with pkgs; - [clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadHID - qmk - avrBinutils - avrGcc - avrlibc - avrdude - gcc-arm-embedded - teensy-loader-cli]; - - AVR_CFLAGS = avr_incflags; - AVR_ASFLAGS = avr_incflags; - shellHook = '' - # Prevent the avr-gcc wrapper from picking up host GCC flags - # like -iframework, which is problematic on Darwin - unset NIX_CFLAGS_COMPILE_FOR_TARGET - ''; - }; - - packages.qmk = pkgs.stdenv.mkDerivation { - name = "qmk-firmware"; - - src = inputs.qmk; - - configurePhase = '' - mkdir -p keyboards/mt/split75/keymaps/custom - cp ${./keymap.c} keyboards/mt/split75/keymaps/custom/keymap.c - cp ${./rules.mk} keyboards/mt/split75/rules.mk - cp ${./config.h} keyboards/mt/split75/keymaps/custom/config.h - ''; - - buildPhase = '' - qmk setup - make mt/split75:default - - ''; - - nativeBuildInputs = with pkgs; - [clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadHID which - qmk - avrBinutils - avrGcc - avrlibc - avrdude - gcc-arm-embedded - teensy-loader-cli]; - AVR_CFLAGS = avr_incflags; - AVR_ASFLAGS = avr_incflags; - shellHook = '' - # Prevent the avr-gcc wrapper from picking up host GCC flags - # like -iframework, which is problematic on Darwin - unset NIX_CFLAGS_COMPILE_FOR_TARGET - ''; - - installPhase = '' - cp wheatfield_split75_custom.hex $out - ''; - }; - }; -} diff --git a/modules/qmk/keymap.c b/modules/qmk/keymap.c deleted file mode 100644 index 8a98ee1..0000000 --- a/modules/qmk/keymap.c +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright 2020 Johannes Krude - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "raw_hid.h" -#include "string.h" - -enum layer_names { - BASE, - KOY_L1 -}; - -enum custom_keycodes { - CS_LCTL = SAFE_RANGE, - CS_LGUI, - CS_LALT, - - CS_SWP_SWTCH, - - KOY_M2, - KOY_M3, - KOY_M4, -}; - -bool cs_swapped = false; -uint8_t cs_lctl_key = KC_LCTL; -uint8_t cs_lgui_key = KC_LGUI; -uint8_t cs_lalt_key = KC_LALT; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case CS_LCTL: - if (record->event.pressed) - { - register_code(cs_lctl_key); - } - else - unregister_code(cs_lctl_key); - break; - - case CS_LGUI: - if (record->event.pressed) - register_code(cs_lgui_key); - else - unregister_code(cs_lgui_key); - break; - - case CS_LALT: - if (record->event.pressed) - register_code(cs_lalt_key); - else - unregister_code(cs_lalt_key); - break; - - case CS_SWP_SWTCH: - if (record->event.pressed) - { - if (cs_swapped) - { - cs_lctl_key = KC_LCTL; - cs_lgui_key = KC_LGUI; - cs_lalt_key = KC_LALT; - } - else - { - cs_lctl_key = KC_LGUI; - cs_lgui_key = KC_LALT; - cs_lalt_key = KC_LCTL; - } - cs_swapped = !cs_swapped; - } - break; - } - - return true; -} - -void raw_hid_receive(uint8_t* data, uint8_t length) { - raw_hid_send(data, length); -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - /* Base ,-----------------------------------------. ,-----------------------------------------------------. - * | ESC | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |Print| Ins | Del | - * ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----| - * | 9 | 0 | | ~ | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | Backspac | Home| - * |-----+-----| |-----------------------------------------' ,--------------------------------------------------+-----| - * | 7 | 8 | | Tab | Q | W | E | R | T | | Y | U | I | O | P | [ | ] | | PgUp| - * |-----+-----| |---------------------------------------. `------------------------------------------+ Enter +-----| - * | 5 | 6 | | Caps | A | S | D | F | G | | H | J | K | L | ; | ' | # | | PgDn| - * |-----+-----| |-----------------------------------------. `-------------------------------------------------+-----| - * | 3 | KOY | | Shift | > | Z | X | C | V | B | | N | M | , | . | / | Shift | Up | End | - * |-----+-----| |-----------------------------------------' ,-------------------------------------------+-----+-----| - * | 1 | SWP | | Ctrl | GUI | Alt | Space |Space| | Space | Alt | Slk | Ctrl | Left| Down|Right| - * `-----------' `---------------------------------------' `-------------------------------------------------------' - */ - [BASE] = LAYOUT_iso( - //--------------------------------Left Hand----------------------------------------| |--------------------------------Right Hand------------------------------------------------ - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_DEL, - KC_9, KC_0, KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPC, KC_HOME, - KC_7, KC_8, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGUP, - KC_5, KC_6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENTER, KC_PGDN, - KC_3, DF(KOY_L1), KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, - KC_1, CS_SWP_SWTCH, CS_LCTL, CS_LGUI, CS_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_SLCK ,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT - ), - /* K.O,Y - L1 ,-----------------------------------------. ,-----------------------------------------------------. - * | ESC | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |Print| Ins | Del | - * ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----| - * | 9 | 0 | | N/A | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | Backspac | Home| - * |-----+-----| |-----------------------------------------' ,--------------------------------------------------+-----| - * | 7 | 8 | | Tab | K | . | O | , | Y | | V | G | C | L | ẞ | Z | N/A | | PgUp| - * |-----+-----| |---------------------------------------. `------------------------------------------+ Enter +-----| - * | 5 | 6 | | M3 | H | A | E | I | U | | D | T | R | N | S | F | M3 | | PgDn| - * |-----+-----| |-----------------------------------------. `-------------------------------------------------+-----| - * | 3 | KOY | | M2 | M4| X | Q | Ä | Ü | Ö | | B | P | W | M | J | M2 | Up | End | - * |-----+-----| |-----------------------------------------' ,-------------------------------------------+-----+-----| - * | 1 | SWP | | Ctrl | GUI | Alt | Space |Space| | Space | M4 | Slk | Ctrl | Left| Down|Right| - * `-----------' `---------------------------------------' `-------------------------------------------------------' - */ - [KOY_L1] = LAYOUT_iso( - //--------------------------------Left Hand-----------------------------------------| |--------------------------------Right Hand------------------------------------------------ - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_DEL, - KC_9, KC_0, KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPC, KC_HOME, - KC_7, KC_8, KC_TAB, KC_K, KC_DOT, KC_O, KC_COMM, KC_Y, KC_V, KC_G, KC_C, KC_L, KC_NO, KC_Z, KC_NO, KC_PGUP, - KC_5, KC_6, KC_NO, KC_H, KC_A, KC_E, KC_I, KC_U, KC_D, KC_T, KC_R, KC_N, KC_S, KC_F, KC_NO, KC_ENTER, KC_PGDN, - KC_3, DF(BASE), KC_LSFT, KC_NO, KC_X, KC_Q, KC_NO, KC_NO, KC_NO, KC_B, KC_P, KC_W, KC_M, KC_J, KC_RSFT, KC_UP, KC_END, - KC_1, CS_SWP_SWTCH, CS_LCTL, CS_LGUI, CS_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_SLCK ,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT - ) -}; - -/* Base ,-----------------------------------------. ,-----------------------------------------------------. - * | | | | | | | | | | | | | | | | | | - * ,-----------. |-----+-----+-----+-----+-----+-----+-----| |-----+-----+-----+-----+-----+-----+-----------+-----| - * | | | | | | | | | | | | | | | | | | | | - * |-----+-----| |-----------------------------------------' ,--------------------------------------------------+-----| - * | | | | | | | | | | | | | | | | | | | | - * |-----+-----| |---------------------------------------. `------------------------------------------+ +-----| - * | | | | | | | | | | | | | | | | | | | | - * |-----+-----| |-----------------------------------------. `-------------------------------------------------+-----| - * | | | | | | | | | | | | | | | | | | | | - * |-----+-----| |-----------------------------------------' ,-------------------------------------------+-----+-----| - * | | | | | | | | | | | | | | | | | - * `-----------' `---------------------------------------' `-------------------------------------------------------' - */ -// [] = LAYOUT( -// //--------------------------------Left Hand-----------------------------------------------| |--------------------------------Right Hand------------------------------------------------ -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -// ), diff --git a/modules/qmk/rules.mk b/modules/qmk/rules.mk deleted file mode 100644 index 421a61b..0000000 --- a/modules/qmk/rules.mk +++ /dev/null @@ -1,24 +0,0 @@ -# MCU name -MCU = atmega32a - -# Bootloader selection -BOOTLOADER = bootloadhid - -# Build Options -# change yes to no to disable -# -RAW_ENABLE = yes -#VIRTSER_ENABLE = yes # Virtual Serial Port -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = no # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -WS2812_DRIVER = i2c - -# custom matrix setup -CUSTOM_MATRIX = lite -SRC = matrix.c -QUANTUM_LIB_SRC += i2c_master.c diff --git a/modules/systems.nix b/modules/systems.nix deleted file mode 100644 index 9b42c49..0000000 --- a/modules/systems.nix +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - inputs, - lib, - withSystem, - self, - roots, - config, - ... -}: -let - inherit (lib) - isFunction - isPath - isString - typeOf - mapAttrsToList - id - const - filterAttrs - hasSuffix - foldr - mergeAttrs - mapAttrs - seq - deepSeq - ; - seqVal = v: seq v v; - deepSeqVal = v: deepSeq v v; - mkNixos = { - system, - name, - }: module: let - module' = - if isFunction module - then module - else if isPath module || isString module - then import module - else throw "Expected `function`, `path` or `string`, but got `${typeOf module}`"; - in - withSystem system - ({pkgs, ...}: - inputs.nixpkgs.lib.nixosSystem - { - inherit system; - specialArgs = { - inherit self inputs roots; - config' = config; - }; - - modules = [ - module' - ({config, ...}: { - networking.hostName = name; - nixpkgs.overlays = mapAttrsToList (const id) self.overlays; - nixpkgs.pkgs = import inputs.nixpkgs { - inherit system; - inherit (config.nixpkgs) overlays config; - }; - }) - ]; - }); - - eachNixosSystem = path: let - all = builtins.readDir path; - filtered = filterAttrs (n: v: hasSuffix ".nix" n || v == "directory" ) all; - systemFiles = mapAttrsToList (n: _: n) filtered; - systems = map (file: import "${path}/${file}") systemFiles; - systemConfigurations = - map - ( - system: { - ${system.name} = mkNixos {inherit (system) name system;} system.module; - } - ) - systems; - in - foldr mergeAttrs {} systemConfigurations; -in { - flake.nixosConfigurations = eachNixosSystem (roots.nixos + "/systems"); - flake.hydraJobs = deepSeqVal mapAttrs (n: v: seqVal v.config.system.build.toplevel) (eachNixosSystem (roots.nixos + "/systems")); -} diff --git a/nix/dyn.redalder.org.crt b/nix/dyn.redalder.org.crt deleted file mode 100644 index 74dff0f..0000000 --- a/nix/dyn.redalder.org.crt +++ /dev/null @@ -1,27 +0,0 @@ - ------BEGIN CERTIFICATE----- -MIIESjCCAjKgAwIBAgIBEjANBgkqhkiG9w0BAQ0FADCBiTELMAkGA1UEBhMCU0sx -EzARBgNVBAgMCkJyYXRpc2xhdmExEzARBgNVBAcMCkJyYXRpc2xhdmExEjAQBgNV -BAoMCVJlZCBBbGRlcjEVMBMGA1UEAwwMcmVkYWxkZXIub3JnMSUwIwYJKoZIhvcN -AQkBFhZ3ZWJtYXN0ZXJAcmVkYWxkZXIub3JnMB4XDTIxMDYxOTEwMjYzNVoXDTIx -MDgxNDEwMjYzNVowADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKlB -UEqYdnM5YM3GXeetlQ41UsUJCfpPLAcPVLY39nGuK1IavXfPujPtM2faAZBiHXxi -jnrf9Tm6JK2EZN1dspW8YPR+rKktHot6DFcFElcOD4EDNpfrfpYeKAHaOAjPQGAE -nTSzj3dQOpU6oMbvmSg5quXg88tZKkiyaCsJE2Q3HpdglbK2yU0HnLNdvZ29no/J -lq5wkUjaK6VKzm4mkYAa9FYCMyBR+QmmusNoa2zCNNrdg/NNQmtt3IzXi0HojtUQ -Sg9NkO+aW8PjtT79f63X9/FO0aFPhi/5u6pBdmQFYk0dh6nTdQA9lxTjDxULwNTm -navJqmXVFVi4/c5MMcsCAwEAAaNFMEMwHQYDVR0OBBYEFAYfVeJ7WdvijmvLp3uf -+H3OUhN5MBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgGGMA0GCSqG -SIb3DQEBDQUAA4ICAQAoFzSlxZYj7t+c0yK3qsZvhg2bBVMrdIwweZgZ1flRDaee -9VT8D3fG8q9LHBcVYj3hv61YPVbnID2ZfMaU7Rcp6U9MpzMn4r+hOImhLR61Yjuq -3clOaC+bwASr0oEYXKRtQdH7FiBQGvam8D27Ptlc/X62yC9XMEJV1dvjprUGI4UI -QZ4l9Gh3CmmhNKt7poyeWjX9PnzyCgX8j35mnhZH+o5JMkzjOZtWU+EuSu3NS3a5 -fGxllgyhkSmJUXuM9mundZsHKHuRWFtXA5GESIxpH9kNp7y0Ua6hLeYWLiYdJF6e -QACF7MA6SVbBBzvrIkb1dQOhj3bg2yvnyJ4LrGdWZtdxjyadUeEuKXoe/CISFEJ7 -A/SCXXJ6aCp34vHmUpKxIvBT0szxbZnuOwEjyc4bYFjGEz/73DQa98Nz65IMOtQ9 -wJAyiPAkQJEi7Y2x1Tf3qwB6unM93D3UNzMgtmkjc0kRQh479jIYKdIzpnNEHPI7 -0IrDM/AmMjotbr0/Min1LRqB6x/sT3OcCEs1s6p4OCM/jh9nADyCHQ2IybJ28cfd -kT6Ocp8i3NEdFKTjnAf6j+Jsvxk4QE6YyjRdUPca3HVA+TyuJsALgsUuKA4Ak+EH -SjjPq8t0ph7/6u3wZSf9P3dZjSh7BmwyMOjaNT2XmNHH3bx/l0BV4uQxKUGGLg== ------END CERTIFICATE----- - diff --git a/nix/extra/qmk/sp84.nix b/nix/extra/qmk/sp84.nix deleted file mode 100644 index 239c9db..0000000 --- a/nix/extra/qmk/sp84.nix +++ /dev/null @@ -1,134 +0,0 @@ -{qmk}: { - avr ? true, - arm ? true, - teensy ? true, - pkgsCross, - mkShell, - lib, - poetry2nix, - stdenv, - fetchurl, - fetchFromGitHub, - clang-tools, - dfu-programmer, - dfu-util, - diffutils, - git, - which, - avrBinutils' ? pkgsCross.avr.buildPackages.binutils, - avrGcc' ? pkgsCross.avr.buildPackages.gcc8, - avrlibc' ? pkgsCross.avr.libcCross, - avrdude, - gcc-arm-embedded, - teensy-loader-cli, - libusb-compat-0_1, -}: let - avr_incflags = [ - "-isystem ${avrlibc'}/avr/include" - "-B${avrlibc'}/avr/lib/avr5" - "-L${avrlibc'}/avr/lib/avr5" - "-B${avrlibc'}/avr/lib/avr35" - "-L${avrlibc'}/avr/lib/avr35" - "-B${avrlibc'}/avr/lib/avr51" - "-L${avrlibc'}/avr/lib/avr51" - ]; - - pythonEnv = poetry2nix.mkPoetryEnv { - projectDir = "${qmk}/util/nix"; - overrides = poetry2nix.overrides.withDefaults (self: super: { - qmk = super.qmk.overridePythonAttrs (old: { - # Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes - # $PATH and breaks these invocations). - dontWrapPythonPrograms = true; - }); - }); - }; -in rec { - bootloadhid = stdenv.mkDerivation rec { - pname = "bootloadhid"; - version = "2012-12-08"; - - src = fetchurl { - url = "https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz"; - sha256 = "sha256-FU5+OGKaOi7sLfZm7foe4vLppXAY8X2fD48GTMINh1Q="; - }; - - sourceRoot = "bootloadHID.${version}/commandline"; - - nativeBuildInputs = [libusb-compat-0_1.dev]; - - installPhase = '' - mkdir -p $out/bin - cp bootloadHID $out/bin - ''; - }; - - shell = mkShell { - name = "qmk-devshell"; - - buildInputs = - [clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid] - ++ lib.optional avr [ - avrBinutils' - avrGcc' - avrlibc' - avrdude - ] - ++ lib.optional arm [gcc-arm-embedded] - ++ lib.optional teensy [teensy-loader-cli]; - - AVR_CFLAGS = lib.optional avr avr_incflags; - AVR_ASFLAGS = lib.optional avr avr_incflags; - shellHook = '' - # Prevent the avr-gcc wrapper from picking up host GCC flags - # like -iframework, which is problematic on Darwin - unset NIX_CFLAGS_COMPILE_FOR_TARGET - ''; - }; - - qmk-firmware = stdenv.mkDerivation { - name = "qmk-firmware"; - - src = fetchFromGitHub { - owner = "qmk"; - repo = "qmk_firmware"; - fetchSubmodules = true; - leaveDotGit = true; - sha256 = "sha256-bd+NOzwqQCDBw2FYYtGWpmja0tFhsfpdDFyZXlSM/U4="; - rev = "0.16.5"; - }; - - configurePhase = '' - mkdir -p keyboards/mt/split75/keymaps/custom - cp ${./keymap.c} keyboards/mt/split75/keymaps/custom/keymap.c - cp ${./rules.mk} keyboards/mt/split75/rules.mk - cp ${./config.h} keyboards/mt/split75/keymaps/custom/config.h - ''; - - buildPhase = '' - make mt/split75:custom - ''; - - nativeBuildInputs = - [clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid which] - ++ lib.optional avr [ - avrBinutils' - avrGcc' - avrlibc' - avrdude - ] - ++ lib.optional arm [gcc-arm-embedded] - ++ lib.optional teensy [teensy-loader-cli]; - AVR_CFLAGS = lib.optional avr avr_incflags; - AVR_ASFLAGS = lib.optional avr avr_incflags; - shellHook = '' - # Prevent the avr-gcc wrapper from picking up host GCC flags - # like -iframework, which is problematic on Darwin - unset NIX_CFLAGS_COMPILE_FOR_TARGET - ''; - - installPhase = '' - cp wheatfield_split75_custom.hex $out - ''; - }; -} diff --git a/nixos/hardware/blowhole.nix b/nixos/hardware/blowhole.nix deleted file mode 100644 index a13b972..0000000 --- a/nixos/hardware/blowhole.nix +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - secret, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.blowhole; -in { - options.magic_rb.hardware.blowhole = mkEnableOption "Enable blowhole."; - - config = mkIf cfg { - boot = { - supportedFilesystems = ["zfs"]; - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - "nvme" - ]; - zfs.enableUnstable = true; - kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - }; - - hardware.enableRedistributableFirmware = true; - - fileSystems = - { - "/boot" = { - device = "/dev/disk/by-uuid/738acc32-3e2e-4986-987c-40264153d5bf"; - fsType = "ext4"; - }; - "/" = { - device = "blowhole-zpool/local/root"; - fsType = "zfs"; - }; - "/nix" = { - device = "blowhole-zpool/local/nix"; - fsType = "zfs"; - }; - - "/var/nfs" = { - device = "/dev/disk/by-uuid/e06f6d2c-e434-4eec-b00d-b13c1ecc96f0"; - fsType = "btrfs"; - options = [ - "subvol=/nfs" - "noatime" - ]; - }; - - "/old-root" = { - device = "/dev/disk/by-uuid/e06f6d2c-e434-4eec-b00d-b13c1ecc96f0"; - fsType = "btrfs"; - options = [ - "subvol=/arch" - "noatime" - ]; - }; - "/var/lib/nomad" = { - device = "blowhole-zpool/persist/nomad"; - fsType = "zfs"; - }; - "/var/secrets" = { - device = "blowhole-zpool/persist/secrets"; - fsType = "zfs"; - }; - "/var/lib/consul" = { - device = "/old-root/var/lib/consul"; - options = singleton "bind"; - }; - "/var/lib/vault" = { - device = "/old-root/var/lib/vault"; - options = singleton "bind"; - }; - } - // secret.mounts.blowhole or {}; - }; -} diff --git a/nixos/hardware/deck.nix b/nixos/hardware/deck.nix deleted file mode 100644 index b5906e3..0000000 --- a/nixos/hardware/deck.nix +++ /dev/null @@ -1,72 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - secret, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.deck; - kernel = pkgs.linuxKernel.packages.linux_xanmod_latest; -in { - options.magic_rb.hardware.deck = mkEnableOption "Enable deck."; - - config = mkIf cfg { - boot = { - supportedFilesystems = ["zfs"]; - zfs.enableUnstable = true; - - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - "nvme" - ]; - initrd.kernelModules = ["dm-snapshot"]; - kernelModules = ["i2c-dev" "kvm-amd"]; - kernelParams = [ - "zfs.zfs_arc_max=8589934592" - ]; - extraModulePackages = []; - kernelPackages = kernel;ws - }; - - hardware.firmware = singleton pkgs.firmwareLinuxNonfree; - - # powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; - - fileSystems = { - "/" = { - device = "deck-zpool/local/root"; - fsType = "zfs"; - }; - - "/nix" = { - device = "deck-zpool/local/nix"; - fsType = "zfs"; - }; - - "/home" = { - device = "deck-zpool/safe/home"; - fsType = "zfs"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/5e590840-9e62-4231-8ac5-e6a27325254d"; - fsType = "ext4"; - }; - - "/boot/EFI" = { - device = "/dev/disk/by-uuid/D381-9D12"; - fsType = "vfat"; - }; - }; - - swapDevices = []; - }; -} diff --git a/nixos/hardware/default.nix b/nixos/hardware/default.nix deleted file mode 100644 index 8cf82ee..0000000 --- a/nixos/hardware/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.hardware; -in { - options = {}; - - imports = [ - ./heater.nix - ./mark.nix - ./omen.nix - ./recovery-usb.nix - (import ./oci-nixos.nix - { - hostName = "tweedledum"; - rootUUID = "79ba4403-7532-4e2c-ac5d-2910dce62009"; - efiUUID = "4478-6009"; - swapUUID = "d50e7ebf-8c62-4d2d-b19d-347378f7e5fe"; - }) - (import ./oci-nixos.nix - { - hostName = "tweedledee"; - rootUUID = ""; - efiUUID = ""; - swapUUID = ""; - }) - ./toothpick.nix - ./gooseberry.nix - ./blowhole.nix - ]; - - config = { - assertions = [ - { - assertion = let - selection = mapAttrsToList (system: enabled: {inherit system enabled;}) cfg; - in - count (x: x.enabled) selection == 1; - message = "You must select exactly one hardware configuration"; - } - ]; - }; -} diff --git a/nixos/hardware/gooseberry.nix b/nixos/hardware/gooseberry.nix deleted file mode 100644 index 715cd07..0000000 --- a/nixos/hardware/gooseberry.nix +++ /dev/null @@ -1,90 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.gooseberry; -in { - options.magic_rb.hardware.gooseberry = mkEnableOption "Enable gooseberry."; - - config = mkIf cfg { - boot = { - initrd.availableKernelModules = [ - "sd_mod" - ]; - - kernelPackages = pkgs.linuxPackages_latest; - }; - - hardware.firmware = with pkgs; [ - raspberrypiWirelessFirmware - ]; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/e8d0f836-0851-45b2-801f-8cb2bfc016ac"; - fsType = "btrfs"; - options = [ - "space_cache" - "noatime" - "subvol=/local/root" - ]; - }; - - "/nix" = { - device = "/dev/disk/by-uuid/e8d0f836-0851-45b2-801f-8cb2bfc016ac"; - fsType = "btrfs"; - options = [ - "space_cache" - "noatime" - "subvol=/local/nix" - ]; - }; - - "/home" = { - device = "/dev/disk/by-uuid/e8d0f836-0851-45b2-801f-8cb2bfc016ac"; - fsType = "btrfs"; - options = [ - "space_cache" - "noatime" - "subvol=/safe/home" - ]; - }; - - "/var/lib/klipper/sdcard" = { - device = "/dev/disk/by-uuid/e8d0f836-0851-45b2-801f-8cb2bfc016ac"; - fsType = "btrfs"; - options = [ - "space_cache" - "noatime" - "subvol=/safe/klipper-sdcard" - ]; - }; - - "/btrfs" = { - device = "/dev/disk/by-uuid/e8d0f836-0851-45b2-801f-8cb2bfc016ac"; - fsType = "btrfs"; - options = [ - "space_cache" - "noatime" - "subvol=/" - ]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/f358d9fd-1ae2-4a60-89f4-1da2146ef92d"; - fsType = "ext4"; - }; - - "/boot/EFI" = { - device = "/dev/disk/by-uuid/61DC-10CA"; - fsType = "vfat"; - }; - }; - }; -} diff --git a/nixos/hardware/heater.nix b/nixos/hardware/heater.nix deleted file mode 100644 index 303f420..0000000 --- a/nixos/hardware/heater.nix +++ /dev/null @@ -1,116 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - secret, - ... -}: -with lib; let - defaultBtrfsOpts = [ - "noatime" - "space_cache" - ]; - cfg = config.magic_rb.hardware.heater; - kernel = config.boot.zfs.package.latestCompatibleLinuxPackages; -in { - options.magic_rb.hardware.heater = mkEnableOption "Enable heater."; - - config = mkIf cfg { - boot = { - supportedFilesystems = ["zfs"]; - zfs.enableUnstable = true; - - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - "nvme" - ]; - initrd.kernelModules = ["dm-snapshot"]; - kernelModules = ["i2c-dev" "kvm-amd"]; - kernelParams = [ - "zfs.zfs_arc_max=8589934592" - "nvidia.NVreg_EnablePCIeGen3=1" - "nvidia.NVreg_UsePageAttributeTable=1" - "nvidia-drm.modeset=1" - ]; - extraModulePackages = []; - kernelPackages = kernel; - }; - - hardware.nvidia.package = kernel.nvidia_x11_beta; - hardware.firmware = singleton pkgs.firmwareLinuxNonfree; - - powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; - - fileSystems = { - "/" = { - device = "heater-zpool/local/root"; - fsType = "zfs"; - }; - - "/nix" = { - device = "heater-zpool/local/nix"; - fsType = "zfs"; - }; - - "/home" = { - device = "heater-zpool/safe/home"; - fsType = "zfs"; - }; - - "/var/lib/nomad" = { - device = "heater-zpool/persist/nomad"; - fsType = "zfs"; - }; - - "/var/lib/syncthing" = { - device = "heater-zpool/persist/syncthing"; - fsType = "zfs"; - }; - - "/etc/vault-agent" = - mkIf config.services.vault-agent.enable - { - device = "heater-zpool/persist/vault-agent"; - fsType = "zfs"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/5e590840-9e62-4231-8ac5-e6a27325254d"; - fsType = "ext4"; - }; - - "/boot/EFI" = { - device = "/dev/disk/by-uuid/D381-9D12"; - fsType = "vfat"; - }; - - "/mnt/cartman" = { - device = "10.64.2.1:/mnt/cartman"; - fsType = "nfs"; - options = [ "_netdev" "hard" "async" ]; - }; - - "/mnt/kyle" = { - device = "10.64.2.1:/mnt/kyle"; - fsType = "nfs"; - options = [ "_netdev" "hard" "async" ]; - - }; - - "/mnt/stan" = { - device = "10.64.2.1:/mnt/stan"; - fsType = "nfs"; - options = [ "_netdev" "hard" "async" ]; - }; - }; - - swapDevices = []; - }; -} diff --git a/nixos/hardware/mark.nix b/nixos/hardware/mark.nix deleted file mode 100644 index 7e2a592..0000000 --- a/nixos/hardware/mark.nix +++ /dev/null @@ -1,79 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.mark; -in { - options.magic_rb.hardware.mark = mkEnableOption "Enable mark."; - - config = mkIf cfg { - boot = { - loader.grub = { - enable = true; - version = 2; - mirroredBoots = [ - { - devices = [ - "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_072124EF1B657269-0:0" - ]; - path = "/boot1"; - } - { - devices = [ - "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_072124E17216D761-0:0" - ]; - path = "/boot2"; - } - ]; - efiSupport = false; - enableCryptodisk = true; - }; - - initrd = { - luks.devices = { - boot1 = { - device = "/dev/disk/by-partuuid/51ee175f-bc24-9545-803e-b39eb99a5513"; - preLVM = true; - }; - - boot2 = { - device = "/dev/disk/by-partuuid/c46fef20-f0e5-1c43-a515-78baf8fff6c3"; - preLVM = true; - }; - }; - - supportedFilesystems = ["zfs"]; - availableKernelModules = [ - "xhci_pci" - "ahci" - "usbhid" - "aesni_intel" - "cryptd" - ]; - }; - }; - - fileSystems = { - "/" = { - device = "mark-usb/root"; - fsType = "zfs"; - }; - - "/boot1" = { - device = "/dev/mapper/mark-boot-1"; - fsType = "ext4"; - }; - "/boot2" = { - device = "/dev/mapper/mark-boot-2"; - fsType = "ext4"; - }; - }; - - networking.hostId = "fab3c3c6"; - }; -} diff --git a/nixos/hardware/oci-nixos.nix b/nixos/hardware/oci-nixos.nix deleted file mode 100644 index d3b218c..0000000 --- a/nixos/hardware/oci-nixos.nix +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - hostName, - rootUUID, - efiUUID, - swapUUID, -}: { - config, - pkgs, - lib, - modulesPath, - ... -} @ all: -with lib; let - cfg = config.magic_rb.hardware."${hostName}"; - qemu-guest = import (modulesPath + "/profiles/qemu-guest.nix") all; -in { - options.magic_rb.hardware."${hostName}" = mkEnableOption ""; - - config = mkIf cfg (mkMerge - [ - { - boot = { - kernelPackages = pkgs.linuxPackages_latest; - loader.grub.extraConfig = '' - serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 - terminal_input --append serial - terminal_output --append serial - ''; - - initrd.kernelModules = [ - "nvme" - ]; - }; - - swapDevices = [ - { - device = "/dev/disk/by-uuid/${swapUUID}"; - } - ]; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/${rootUUID}"; - fsType = "xfs"; - }; - - "/boot/EFI" = { - device = "/dev/disk/by-uuid/${efiUUID}"; - fsType = "vfat"; - }; - }; - } - qemu-guest - ]); -} diff --git a/nixos/hardware/omen.nix b/nixos/hardware/omen.nix deleted file mode 100644 index 3497cdd..0000000 --- a/nixos/hardware/omen.nix +++ /dev/null @@ -1,153 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.omen; - kernelPackages = pkgs.linuxKernel.packages.linux_6_1; -in { - options.magic_rb.hardware.omen = mkEnableOption "Enable omen."; - - config = mkIf cfg { - boot = { - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usb_storage" - "sr_mod" - "rtsx_pci_sdmmc" - "nvme" - ]; - initrd.kernelModules = []; - kernelModules = ["kvm-intel"]; - extraModulePackages = []; - supportedFilesystems = ["zfs"]; - kernelParams = [ - "zfs.zfs_arc_max=8589934592" - "zfs.zfs_arc_sys_free=3221225472" - "intel_pstate=active" - # "nvidia.NVreg_EnablePCIeGen3=1" - # "nvidia.NVreg_UsePageAttributeTable=1" - # "nvidia-drm.modeset=1" - ]; - kernelPackages = kernelPackages; - zfs.enableUnstable = true; - }; - - hardware.enableRedistributableFirmware = true; - hardware.nvidia.package = kernelPackages.nvidia_x11_beta; - - powerManagement.cpuFreqGovernor = pkgs.lib.mkDefault "schedutil"; - - fileSystems = { - "/" = { - device = "omen-ssd/local/root"; - fsType = "zfs"; - }; - - "/var/lib/secrets" = { - device = "omen-ssd/local/secrets"; - fsType = "zfs"; - }; - - "/home" = { - device = "omen-ssd/safe/home"; - fsType = "zfs"; - }; - - "/nix" = { - device = "omen-ssd/local/nix"; - fsType = "zfs"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/078c1885-5e0c-4bb8-bec3-5bf40785f5cd"; - fsType = "ext4"; - }; - - "/mnt/net/kyle" = { - fsType = "nfs"; - device = "10.64.2.1:/mnt/kyle"; - options = [ - "noauto" - "X-mount.mkdir" - "x-systemd.device-timeout=10" - "timeo=14" - "soft" - "noatime" - "x-systemd.after=wireguard-wg0.service" - ]; - }; - - "/mnt/net/cartman" = { - fsType = "nfs"; - device = "10.64.2.1:/mnt/cartman"; - options = [ - "noauto" - "X-mount.mkdir" - "x-systemd.device-timeout=10" - "timeo=14" - "soft" - "noatime" - "x-systemd.after=wireguard-wg0.service" - ]; - }; - - "/mnt/net/stan" = { - fsType = "nfs"; - device = "10.64.2.1:/mnt/stan"; - options = [ - "noauto" - "X-mount.mkdir" - "x-systemd.device-timeout=10" - "timeo=14" - "soft" - "noatime" - "x-systemd.after=wireguard-wg0.service" - ]; - }; - - "/mnt/net/getmail.d" = { - fsType = "nfs"; - device = "10.64.2.1:/var/nfs/getmail/getmail.d"; - options = [ - "noauto" - "X-mount.mkdir" - "x-systemd.device-timeout=10" - "timeo=14" - "soft" - "noatime" - "x-systemd.after=wireguard-wg0.service" - ]; - }; - - "/mnt/net/mail-configuration" = { - fsType = "nfs"; - device = "10.64.2.1:/var/nfs/mail-configuration"; - options = [ - "noauto" - "X-mount.mkdir" - "x-systemd.device-timeout=10" - "timeo=14" - "soft" - "noatime" - "x-systemd.after=wireguard-wg0.service" - ]; - }; - - "/boot/EFI" = { - device = "/dev/disk/by-uuid/6F1E-8B1B"; - fsType = "vfat"; - }; - }; - - swapDevices = [ - # { device = "/dev/disk/by-partlabel/swap-WL157385"; } - ]; - }; -} diff --git a/nixos/hardware/recovery-usb.nix b/nixos/hardware/recovery-usb.nix deleted file mode 100644 index 61bbbdc..0000000 --- a/nixos/hardware/recovery-usb.nix +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.hardware.recoveryUsb; -in { - options.magic_rb.hardware.recoveryUsb = mkEnableOption "Enable recovery USB."; - - config = mkIf cfg { - # boot.supportedFilesystems = [ "zfs" ]; - }; -} diff --git a/nixos/hardware/toothpick.nix b/nixos/hardware/toothpick.nix deleted file mode 100644 index 191735c..0000000 --- a/nixos/hardware/toothpick.nix +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - modulesPath, - ... -} @ all: -with lib; let - cfg = config.magic_rb.hardware.toothpick; - qemu-guest = import (modulesPath + "/profiles/qemu-guest.nix") all; -in { - options.magic_rb.hardware.toothpick = mkEnableOption "Enable omen."; - - config = mkIf cfg (mkMerge - [ - { - boot.loader.grub = { - device = "/dev/vda"; - enable = true; - version = 2; - }; - boot.initrd.kernelModules = ["nvme"]; - fileSystems."/" = { - device = "/dev/vda1"; - fsType = "ext4"; - }; - } - qemu-guest - ]); -} diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix deleted file mode 100644 index 9a3eb66..0000000 --- a/nixos/modules/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{roots, ...}: { - imports = [ - (roots.flake + "/nixos/secret-lib") - (roots.nixos + "/hardware/default.nix") - ./template-files.nix - ./efi-grub.nix - ./erase-my-darlings.nix - ./main.nix - ./networking.nix - ./nix-flakes.nix - ./optimisation.nix - ./pulseaudio.nix - ./vault-agent.nix - ./vps-remote-access.nix - ./sshd-emacs.nix - ./xserver - ./home-manager.nix - ./serokell.nix - ./gaming.nix - ./hashicorp.nix - ./public/telegraf.nix - ./public/grafana.nix - ./public/hashicorp-envoy.nix - ]; -} diff --git a/nixos/modules/efi-grub.nix b/nixos/modules/efi-grub.nix deleted file mode 100644 index 56c9534..0000000 --- a/nixos/modules/efi-grub.nix +++ /dev/null @@ -1,45 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.grub; -in { - options.magic_rb.grub = with lib; { - enable = mkEnableOption "GRUB preconfigured for my setup style"; - efi = mkOption { - type = types.submodule { - options.enable = mkEnableOption "EFI support"; - }; - default = {}; - }; - - devices = mkOption { - description = "GRUB devices for legacy"; - default = []; - type = with types; listOf string; - }; - }; - - config = { - boot.loader = mkIf cfg.enable { - systemd-boot.enable = false; - efi.canTouchEfiVariables = cfg.efi.enable; - efi.efiSysMountPoint = "/boot/EFI"; - - grub = { - enable = true; - efiSupport = cfg.efi.enable; - version = 2; - devices = - if cfg.efi.enable - then ["nodev"] - else cfg.devices; - }; - }; - }; -} diff --git a/nixos/modules/erase-my-darlings.nix b/nixos/modules/erase-my-darlings.nix deleted file mode 100644 index 399b7f8..0000000 --- a/nixos/modules/erase-my-darlings.nix +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.erase-my-darlings; -in - # Send love to https://grahamc.com/blog/erase-your-darlings - { - options.magic_rb.erase-my-darlings = { - zfs = { - enable = mkEnableOption "Erase the root filesystem using ZFS snapshots on boot."; - - snapshot = mkOption { - type = types.str; - description = "Which snapshot to rollback to, also specifies which dataset to rollback."; - }; - }; - - btrfs = { - enable = mkEnableOption "Erase the root filesystem using BTRFS snapshots on boot."; - - snapshot = mkOption { - type = types.str; - description = "Which snapshot to rollback to."; - }; - - target = mkOption { - type = types.str; - description = "Which subvolume to rollback."; - }; - - disk = mkOption { - type = types.str; - description = "Which disk contains these subvolumes."; - }; - }; - }; - - config = - mkIf (cfg.zfs.enable || cfg.btrfs.enable) - { - boot.initrd.postDeviceCommands = - mkAfter - ((optionalString cfg.zfs.enable '' - zfs rollback -r ${cfg.zfs.snapshot} - '') - + (optionalString cfg.btrfs.enable '' - waitDevice "${cfg.btrfs.disk}" - - mkdir -p /mnt - - mount -o subvol=/ ${cfg.btrfs.disk} /mnt - - btrfs subvolume list -o /mnt/${cfg.btrfs.target} | - cut -f9 -d' ' | - while read subvolume; do - echo "deleting /$subvolume subvolume..." - btrfs subvolume delete "/mnt/$subvolume" - done && - echo "deleting ${cfg.btrfs.target} subvolume..." && - btrfs subvolume delete /mnt/${cfg.btrfs.target} - - echo "restoring ${cfg.btrfs.snapshot} to ${cfg.btrfs.target}..." - btrfs subvolume snapshot /mnt/${cfg.btrfs.snapshot} /mnt/${cfg.btrfs.target} - - umount /mnt - '')); - - assertions = [ - { - assertion = - (cfg.zfs.enable == true && cfg.btrfs.enable == false) - || (cfg.zfs.enable == false && cfg.btrfs.enable == true) - || (cfg.zfs.enable == false && cfg.btrfs.enable == false); - message = "Erase my darlings can be enable either with zfs, btrfs or none, not both."; - } - ]; - }; - } diff --git a/nixos/modules/gaming.nix b/nixos/modules/gaming.nix deleted file mode 100644 index c478e46..0000000 --- a/nixos/modules/gaming.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - config, - pkgs, - lib, - options, - ... -}: -with lib; let - cfg = config.magic_rb.gaming; -in { - options.magic_rb.gaming = { - enable = mkEnableOption "Enable Gaming support."; - - steam.remotePlay = mkOption { - description = '' - Open ports required for remote play; - ''; - type = types.bool; - default = false; - }; - }; - - config = mkMerge [ - (optionalAttrs (options ? "home-manager") - { - home-manager.users."main" = mkIf cfg.enable ({...}: { - magic_rb = { - packageCollections.wine.enable = true; - programs.multimc.enable = true; - }; - }); - }) - (mkIf cfg.enable { - programs.steam = { - enable = cfg.enable; - remotePlay.openFirewall = cfg.steam.remotePlay; - }; - }) - ]; -} diff --git a/nixos/modules/hashicorp.nix b/nixos/modules/hashicorp.nix deleted file mode 100644 index c7a104d..0000000 --- a/nixos/modules/hashicorp.nix +++ /dev/null @@ -1,174 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; -let - format = pkgs.formats.json { }; - - hashiServiceModule = - { config, ... }: - let - cfg' = config; - in - { - options = { - enable = mkEnableOption "Enable HashiCorp service"; - - package = mkOption { - type = with types; - package; - }; - - settings = mkOption { - type = format.type; - default = {}; - }; - - settingsFile = mkOption { - type = with types; - path; - default = format.generate "${cfg'.package.pname}.json" cfg'.settings; - }; - - command = mkOption { - type = with types; - str; - default = - let - switch = - { "nomad" = "agent"; - "vault" = "server"; - "vault-bin" = "server"; - "consul" = "agent"; - }; - in switch.${cfg'.package.pname} or ""; - }; - - extraSettingsPaths = mkOption { - type = with types; - listOf path; - default = []; - }; - - extraPluginPaths = mkOption { - type = with types; - listOf path; - default = []; - }; - - extraArguments = mkOption { - type = with types; - listOf str; - default = []; - }; - - extraPackages = mkOption { - type = with types; - listOf package; - default = with pkgs; - let - switch = - { "nomad" = [ coreutils iproute2 iptables ]; - "vault" = [ ]; - "vault-bin" = [ ]; - "consul" = [ ]; - }; - in - switch.${cfg'.package.pname} or []; - }; - - dynamic = mkOption { - type = with types; - nullOr package; - default = null; - }; - }; - }; - - cfg = config.services.hashicorp; -in -{ - options.services.hashicorp = mkOption { - type = with types; - attrsOf (submodule hashiServiceModule); - default = {}; - }; - - config.environment.etc = flip mapAttrs' (filterAttrs (_: v: v.enable) cfg) - (name: value: - nameValuePair - "${name}.d/main.json" - { source = value.settingsFile; } - ); - - config.systemd.services = zipAttrsWith (const head) - [ (flip mapAttrs' (filterAttrs (_: v: v.enable) cfg) - (name: value: - let - configOpt = - let - switch = - { "nomad" = "--config"; - "consul" = "--config-file"; - "vault" = "--config"; - "vault-bin" = "--config"; - }; - in - switch.${value.package.pname} or ""; - in - nameValuePair - ("hashicorp-" + name) - { description = name; - - wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - - path = value.extraPackages; - - restartIfChanged = false; - - serviceConfig = - { ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; - ExecStart = "${value.package}/bin/${value.package.meta.mainProgram or value.package.pname} ${value.command} " + - (optionalString (value.package.pname != "vault" || value.command != "agent") "${configOpt}=/etc/${name}.d ") + - "${concatMapStringsSep " " (v: "${configOpt}=${v}") value.extraSettingsPaths} " + - "${concatMapStringsSep " " (v: "--plugin-dir=${v}/bin") value.extraPluginPaths} " + - (optionalString (value.package.pname == "vault" && value.command == "agent") "${configOpt}=/etc/${name}.d/main.json ") + - "${concatStringsSep " " value.extraArguments} "; - - KillMode = "process"; - KillSignal = "SIGINT"; - LimitNOFILE = 65536; - LimitNPROC = "infinity"; - OOMScoreAdjust = -1000; - Restart = "always"; - RestartSec = 2; - TasksMax = "infinity"; - - StateDirectory = value.package.pname; - }; - } - )) - (flip mapAttrs' (filterAttrs (_: v: v.enable && v.dynamic != null) cfg) - (name: value: - nameValuePair - ("hashicorp-${name}-dynamic") - { description = name; - - wantedBy = [ "hashicorp-${name}.service" ]; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - before = [ "hashicorp-${name}.service" ]; - - path = value.extraPackages; - - restartIfChanged = true; - - serviceConfig = - { ExecStart = value.dynamic; - RemainAfterExit = true; - Type = "oneshot"; - }; - } - )) - ]; -} diff --git a/nixos/modules/home-manager.nix b/nixos/modules/home-manager.nix deleted file mode 100644 index 8ec7b13..0000000 --- a/nixos/modules/home-manager.nix +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - roots, - inputs, - lib, - options, - ... -}: -with lib; { - config = - optionalAttrs (options ? "home-manager") - { - home-manager.useGlobalPkgs = true; - home-manager.extraSpecialArgs = {inherit roots inputs;}; - }; -} diff --git a/nixos/modules/hostapd.nix b/nixos/modules/hostapd.nix deleted file mode 100644 index 63bb442..0000000 --- a/nixos/modules/hostapd.nix +++ /dev/null @@ -1,219 +0,0 @@ -{ config, lib, pkgs, utils, ... }: - -# TODO: -# -# asserts -# ensure that the nl80211 module is loaded/compiled in the kernel -# wpa_supplicant and hostapd on the same wireless interface doesn't make any sense - -with lib; - -let - - cfg = config.services.hostapd; - - escapedInterface = utils.escapeSystemdPath cfg.interface; - - configFile = pkgs.writeText "hostapd.conf" '' - interface=${cfg.interface} - driver=${cfg.driver} - ssid=${cfg.ssid} - hw_mode=${cfg.hwMode} - channel=${toString cfg.channel} - ${optionalString (cfg.countryCode != null) "country_code=${cfg.countryCode}"} - ${optionalString (cfg.countryCode != null) "ieee80211d=1"} - - # logging (debug level) - logger_syslog=-1 - logger_syslog_level=${toString cfg.logLevel} - logger_stdout=-1 - logger_stdout_level=${toString cfg.logLevel} - - ctrl_interface=/run/hostapd - ctrl_interface_group=${cfg.group} - - ${optionalString cfg.wpa '' - wpa=2 - wpa_passphrase=${cfg.wpaPassphrase} - ''} - ${optionalString cfg.noScan "noscan=1"} - - ${cfg.extraConfig} - '' ; - -in - -{ - ###### interface - - options = { - - services.hostapd = { - - enable = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Enable putting a wireless interface into infrastructure mode, - allowing other wireless devices to associate with the wireless - interface and do wireless networking. A simple access point will - {option}`enable hostapd.wpa`, - {option}`hostapd.wpaPassphrase`, and - {option}`hostapd.ssid`, as well as DHCP on the wireless - interface to provide IP addresses to the associated stations, and - NAT (from the wireless interface to an upstream interface). - ''; - }; - - interface = mkOption { - default = ""; - example = "wlp2s0"; - type = types.str; - description = lib.mdDoc '' - The interfaces {command}`hostapd` will use. - ''; - }; - - noScan = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Do not scan for overlapping BSSs in HT40+/- mode. - Caution: turning this on will violate regulatory requirements! - ''; - }; - - driver = mkOption { - default = "nl80211"; - example = "hostapd"; - type = types.str; - description = lib.mdDoc '' - Which driver {command}`hostapd` will use. - Most applications will probably use the default. - ''; - }; - - ssid = mkOption { - default = "nixos"; - example = "mySpecialSSID"; - type = types.str; - description = lib.mdDoc "SSID to be used in IEEE 802.11 management frames."; - }; - - hwMode = mkOption { - default = "g"; - type = types.enum [ "a" "b" "g" ]; - description = lib.mdDoc '' - Operation mode. - (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g). - ''; - }; - - channel = mkOption { - default = 7; - example = 11; - type = types.int; - description = lib.mdDoc '' - Channel number (IEEE 802.11) - Please note that some drivers do not use this value from - {command}`hostapd` and the channel will need to be configured - separately with {command}`iwconfig`. - ''; - }; - - group = mkOption { - default = "wheel"; - example = "network"; - type = types.str; - description = lib.mdDoc '' - Members of this group can control {command}`hostapd`. - ''; - }; - - wpa = mkOption { - type = types.bool; - default = true; - description = lib.mdDoc '' - Enable WPA (IEEE 802.11i/D3.0) to authenticate with the access point. - ''; - }; - - wpaPassphrase = mkOption { - default = "my_sekret"; - example = "any_64_char_string"; - type = types.str; - description = lib.mdDoc '' - WPA-PSK (pre-shared-key) passphrase. Clients will need this - passphrase to associate with this access point. - Warning: This passphrase will get put into a world-readable file in - the Nix store! - ''; - }; - - logLevel = mkOption { - default = 2; - type = types.int; - description = lib.mdDoc '' - Levels (minimum value for logged events): - 0 = verbose debugging - 1 = debugging - 2 = informational messages - 3 = notification - 4 = warning - ''; - }; - - countryCode = mkOption { - default = null; - example = "US"; - type = with types; nullOr str; - description = lib.mdDoc '' - Country code (ISO/IEC 3166-1). Used to set regulatory domain. - Set as needed to indicate country in which device is operating. - This can limit available channels and transmit power. - These two octets are used as the first two octets of the Country String - (dot11CountryString). - If set this enables IEEE 802.11d. This advertises the countryCode and - the set of allowed channels and transmit power levels based on the - regulatory limits. - ''; - }; - - extraConfig = mkOption { - default = ""; - example = '' - auth_algo=0 - ieee80211n=1 - ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40] - ''; - type = types.lines; - description = lib.mdDoc "Extra configuration options to put in hostapd.conf."; - }; - }; - }; - - - ###### implementation - - config = mkIf cfg.enable { - - environment.systemPackages = [ pkgs.hostapd ]; - - services.udev.packages = optionals (cfg.countryCode != null) [ pkgs.crda ]; - - systemd.services.hostapd = - { description = "hostapd wireless AP"; - - path = [ pkgs.hostapd ]; - after = [ "sys-subsystem-net-devices-${escapedInterface}.device" ]; - bindsTo = [ "sys-subsystem-net-devices-${escapedInterface}.device" ]; - requiredBy = [ "network-link-${cfg.interface}.service" ]; - wantedBy = [ "multi-user.target" ]; - - serviceConfig = - { ExecStart = "${pkgs.hostapd}/bin/hostapd ${configFile}"; - Restart = "always"; - }; - }; - }; -} diff --git a/nixos/modules/main.nix b/nixos/modules/main.nix deleted file mode 100644 index 552c714..0000000 --- a/nixos/modules/main.nix +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - secret, - ... -}: -with lib; { - users = { - mutableUsers = false; - - users.root.hashedPassword = secret.passwordHashes.main or ""; - users.main = { - isNormalUser = true; - home = "/home/main"; - hashedPassword = secret.passwordHashes.main or ""; - description = "main"; - - uid = 1000; - - extraGroups = ["wheel" "audio"]; - - openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFVkFvalffJ/SMjJGG3WPiqCqFygnWzhGUaeALBIoCsJ (none)"]; - }; - - groups.main = { - gid = 1000; - }; - }; -} diff --git a/nixos/modules/networking.nix b/nixos/modules/networking.nix deleted file mode 100644 index bba9feb..0000000 --- a/nixos/modules/networking.nix +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.networking; -in { - options.magic_rb.networking = { - networkManager = mkEnableOption "Whether to enable Network Manager, usefull on laptops."; - bluetooth = mkEnableOption "Whether to enable bluetooth."; - }; - - config = { - networking.networkmanager.enable = mkIf cfg.networkManager true; - hardware.bluetooth.enable = mkIf cfg.bluetooth true; - }; -} diff --git a/nixos/modules/nix-flakes.nix b/nixos/modules/nix-flakes.nix deleted file mode 100644 index 3274986..0000000 --- a/nixos/modules/nix-flakes.nix +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.flakes; -in { - options.magic_rb.flakes = { - enable = mkEnableOption "Enable flake support"; - nixMaster = mkEnableOption "Whether to enable Nix master for dwarffs."; - }; - config = mkIf cfg.enable { - nixpkgs.overlays = mkIf cfg.nixMaster [config.magic_rb.pins.nix.overlay]; - - nix = { - package = - if !cfg.nixMaster - then pkgs.nixVersions.stable - else pkgs.nix; - extraOptions = '' - experimental-features = nix-command flakes - ''; - }; - }; -} diff --git a/nixos/modules/optimisation.nix b/nixos/modules/optimisation.nix deleted file mode 100644 index a6ddff3..0000000 --- a/nixos/modules/optimisation.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.optimisation; -in { - options.magic_rb.optimisation = { - march = mkOption { - description = '' - Which march is native to this system, to maximize efficiency. - ''; - type = types.str; - default = builtins.trace '' - Please enable a more specific march to get better performance - '' "x86-64"; - }; - }; -} diff --git a/nixos/modules/public/grafana.nix b/nixos/modules/public/grafana.nix deleted file mode 100644 index 726e54b..0000000 --- a/nixos/modules/public/grafana.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ options, config, lib, pkgs, ... }: -let - inherit (lib) - mkEnableOption - mkOption - literalExpression - types - mkDefault - mkIf - recursiveUpdate - ; - - cfg = config.services.grafana-magic; - settingsFile = settingsFormatIni.generate "config.ini" (recursiveUpdate cfg.settings { - paths.provisioning = "/etc/grafana.d/provisioning"; - }); - - provisioningSettingsFormat = pkgs.formats.yaml {}; - settingsFormatIni = pkgs.formats.ini {}; -in { - options.services.grafana-magic = { - enable = mkEnableOption (lib.mdDoc "grafana"); - - package = mkOption { - description = lib.mdDoc "Package to use."; - default = pkgs.grafana; - defaultText = literalExpression "pkgs.grafana"; - type = types.package; - }; - - dataDir = mkOption { - description = lib.mdDoc "Data directory."; - default = "/var/lib/grafana"; - type = types.path; - }; - - settings = mkOption { - description = lib.mdDoc '' - Grafana settings. See - for available options. INI format is used. - ''; - - type = types.submodule { - freeformType = settingsFormatIni.type; - - options = { - paths.provisioning = mkOption { - type = types.submodule { - options = - let - provisioningOption = name: cname: - mkOption { - type = types.submodule { - options = { - apiVersion = mkOption { - type = types.int; - default = 1; - }; - - "delete${cname}" = mkOption { - type = provisioningSettingsFormat.type; - default = []; - }; - - "${name}" = mkOption { - type = provisioningSettingsFormat.type; - default = []; - }; - }; - }; - default = {}; - }; - in - { - datasources = provisioningOption "datasources" "Datasources"; - plugins = provisioningOption "plugins" "Plugins"; - dashboards = provisioningOption "dashboards" "Dashboards"; - notifiers = provisioningOption "notifiers" "Notifiers"; - alerting = provisioningOption "alerting" "Alerting"; - }; - }; - default = {}; - apply = x: - let - ln = name: - '' - mkdir -p $out/${name} - ln -s ${provisioningSettingsFormat.generate "config.yaml" x.${name}} $out/${name}/config.yaml - ''; - in - pkgs.runCommand "grafana-provisioning" {} '' - ${ln "datasources"} - ${ln "notifiers"} - ${ln "alerting"} - ${ln "plugins"} - ${ln "dashboards"} - ''; - }; - }; - }; - - default = {}; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ cfg.package ]; - - services.grafana-magic.settings = { - server = { - static_root_path = "${cfg.package}/share/grafana/public"; - http_port = mkDefault 3000; - protocol = mkDefault "http"; - }; - }; - - environment.etc."grafana.d/main.ini" = { - source = settingsFile; - }; - - environment.etc."grafana.d/provisioning" = { - source = cfg.settings.paths.provisioning; - }; - - systemd.services.grafana = { - description = "Grafana Service Daemon"; - wantedBy = [ "multi-user.target" ]; - after = [ "networking.target" ]; - serviceConfig = { - ExecStart = "${cfg.package}/bin/grafana-server -homepath ${cfg.dataDir} -config ${settingsFile}"; - WorkingDirectory = cfg.dataDir; - User = "grafana"; - RuntimeDirectory = "grafana"; - RuntimeDirectoryMode = "0755"; - # Hardening - AmbientCapabilities = lib.mkIf (cfg.settings.server.http_port < 1024) [ "CAP_NET_BIND_SERVICE" ]; - CapabilityBoundingSet = if (cfg.settings.server.http_port < 1024) then [ "CAP_NET_BIND_SERVICE" ] else [ "" ]; - DeviceAllow = [ "" ]; - LockPersonality = true; - NoNewPrivileges = true; - PrivateDevices = true; - PrivateTmp = true; - ProtectClock = true; - ProtectControlGroups = true; - ProtectHome = true; - ProtectHostname = true; - ProtectKernelLogs = true; - ProtectKernelModules = true; - ProtectKernelTunables = true; - ProtectProc = "invisible"; - ProtectSystem = "full"; - RemoveIPC = true; - RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ]; - RestrictNamespaces = true; - RestrictRealtime = true; - RestrictSUIDSGID = true; - SystemCallArchitectures = "native"; - # Upstream grafana is not setting SystemCallFilter for compatibility - # reasons, see https://github.com/grafana/grafana/pull/40176 - SystemCallFilter = [ - "@system-service" - "~@privileged" - ] ++ lib.optional (cfg.settings.server.protocol == "socket") [ "@chown" ]; - UMask = "0027"; - }; - preStart = '' - ln -fs ${cfg.package}/share/grafana/conf ${cfg.dataDir} - ln -fs ${cfg.package}/share/grafana/tools ${cfg.dataDir} - ''; - }; - - users.users.grafana = { - uid = config.ids.uids.grafana; - description = "Grafana user"; - home = cfg.dataDir; - createHome = true; - group = "grafana"; - }; - users.groups.grafana = {}; - }; -} diff --git a/nixos/modules/public/hashicorp-envoy.nix b/nixos/modules/public/hashicorp-envoy.nix deleted file mode 100644 index 978244e..0000000 --- a/nixos/modules/public/hashicorp-envoy.nix +++ /dev/null @@ -1,173 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.hashicorp-envoy; - - serviceFormat = pkgs.formats.json {}; - serviceFile = name: value: - if value.type == "normal" then - serviceFormat.generate "${name}-service.json" { service = value.service; } - else - serviceFormat.generate "${name}-service.json" value.service; -in -{ - options.services.hashicorp-envoy = mkOption { - description = mdDoc '' - ''; - type = types.attrsOf (types.submodule { - options = { - service = mkOption { - description = mdDoc '' - ''; - type = with types; oneOf [ serviceFormat.type (listOf serviceFormat.type) ]; - }; - - type = mkOption { - description = mdDoc '' - ''; - type = with types; enum [ "ingress" "terminating" "normal" ]; - default = "normal"; - }; - - environment = mkOption { - description = mdDoc '' - ''; - type = with types; attrsOf str; - default = {}; - }; - - adminBind = mkOption { - description = mdDoc '' - ''; - type = types.str; - }; - - address = mkOption { - description = mdDoc '' - ''; - type = types.str; - default = "0.0.0.0:19000"; - }; - - - drainTime = mkOption { - description = mdDoc '' - ''; - type = types.int; - default = 15; - }; - - parentShutdownTime = mkOption { - description = mdDoc '' - ''; - type = types.int; - default = 20; - }; - - hotRestart = mkOption { - description = mdDoc '' - ''; - type = types.bool; - default = false; - }; - - consulPackage = mkOption { - description = mdDoc '' - ''; - type = types.package; - default = pkgs.consul; - }; - - envoyPackage = mkOption { - description = mdDoc '' - ''; - type = types.package; - default = pkgs.envoy; - }; - }; - }); - default = {}; - }; - - config = { - systemd.services = flip mapAttrs' cfg (name: value: - nameValuePair - "hashicorp-envoy-${name}" - { - description = name; - - wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - - path = [ value.envoyPackage ]; - - restartIfChanged = true; - - preStart = - if value.type == "normal" then - '' - ${value.consulPackage}/bin/consul services register ${serviceFile name value} - '' - else - '' - ${value.consulPackage}/bin/consul config write ${serviceFile name value} - ''; - postStop = - if value.type == "normal" then - '' - ${value.consulPackage}/bin/consul services deregister -id=${value.service.id} - '' - else - '' - ${value.consulPackage}/bin/consul config delete -filename ${serviceFile name value} - ''; - script = - let - startEnvoy = pkgs.writeShellScript "start_envoy_${name}.sh" - '' - exec ${value.consulPackage}/bin/consul connect envoy \ - ${optionalString (value.type == "normal") '' - -sidecar-for ${value.service.id} \ - ''} \ - ${optionalString (value.type == "ingress") '' - -gateway=ingress \ - -register \ - -service ${value.service.name} \ - ''} \ - -admin-bind ${value.adminBind} \ - -address ${value.address} \ - ${optionalString value.hotRestart '' - -- \ - $([[ $RESTART_EPOCH == 0 ]] && printf -- "--use-dynamic-base-id --base-id-path $RUNTIME_DIRECTORY/id") \ - $([[ $RESTART_EPOCH == 0 ]] || printf -- "--base-id $(cat $RUNTIME_DIRECTORY/id)") \ - --restart-epoch $RESTART_EPOCH \ - --drain-time-s ${toString value.drainTime} \ - --parent-shutdown-time-s ${toString value.parentShutdownTime} - ''} - ''; - in - if value.hotRestart then - "exec ${pkgs.python3}/bin/python ${value.envoyPackage.src}/restarter/hot-restarter.py ${startEnvoy}" - else - "exec ${startEnvoy}"; - - environment = value.environment; - - serviceConfig = { - ExecReload = if value.hotRestart then "${pkgs.coreutils}/bin/kill -HUP $MAINPID" else null; - KillMode = "control-group"; - KillSignal = "SIGINT"; - LimitNOFILE = 65536; - LimitNPROC = "infinity"; - OOMScoreAdjust = -1000; - Restart = "always"; - RestartSec = 2; - TasksMax = "infinity"; - - RuntimeDirectory = name; - }; - } - ); - }; -} diff --git a/nixos/modules/public/telegraf.nix b/nixos/modules/public/telegraf.nix deleted file mode 100644 index dd80b62..0000000 --- a/nixos/modules/public/telegraf.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.telegraf-magic; - - settingsFormat = pkgs.formats.toml {}; - configFile = settingsFormat.generate "config.toml" cfg.settings; -in { - options = { - services.telegraf-magic = { - enable = mkEnableOption (lib.mdDoc "telegraf server"); - - package = mkOption { - default = pkgs.telegraf; - defaultText = literalExpression "pkgs.telegraf"; - description = lib.mdDoc "Which telegraf derivation to use"; - type = types.package; - }; - - settings = mkOption { - default = {}; - description = lib.mdDoc "Extra configuration options for telegraf"; - type = settingsFormat.type; - example = { - outputs.influxdb = { - urls = ["http://localhost:8086"]; - database = "telegraf"; - }; - inputs.statsd = { - service_address = ":8125"; - delete_timings = true; - }; - }; - }; - - systemd = mkOption { - default = {}; - description = lib.mdDoc "Applied to `systemd.services.telegraf`."; - type = types.unspecified; - }; - }; - }; - - config = mkIf cfg.enable { - systemd.services.telegraf = mkMerge [ - (cfg.systemd) - { - description = "Telegraf Agent"; - wantedBy = [ "multi-user.target" ]; - after = [ "network-online.target" ]; - serviceConfig = { - ExecStart="${cfg.package}/bin/telegraf -config ${configFile}"; - ExecReload="${pkgs.coreutils}/bin/kill -HUP $MAINPID"; - RuntimeDirectory = "telegraf"; - User = "telegraf"; - Group = "telegraf"; - Restart = "on-failure"; - # for ping probes - AmbientCapabilities = [ "CAP_NET_RAW" ]; - }; - } - ]; - - users.users.telegraf = { - uid = config.ids.uids.telegraf; - group = "telegraf"; - description = "telegraf daemon user"; - }; - - users.groups.telegraf = {}; - }; -} diff --git a/nixos/modules/pulseaudio.nix b/nixos/modules/pulseaudio.nix deleted file mode 100644 index 9bbf1e6..0000000 --- a/nixos/modules/pulseaudio.nix +++ /dev/null @@ -1,29 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - bluetooth-enable = config.hardware.bluetooth.enable; - cfg = config.magic_rb.pulseaudio; -in { - options.magic_rb.pulseaudio = { - enable = mkEnableOption "Enable pulseaudio, with bluetooth support if bt enabled"; - }; - - config = mkIf cfg.enable { - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - wireplumber.enable = true; - }; - }; -} diff --git a/nixos/modules/serokell.nix b/nixos/modules/serokell.nix deleted file mode 100644 index e105c17..0000000 --- a/nixos/modules/serokell.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.magic_rb.serokell; -in { - options.magic_rb.serokell = mkEnableOption "Enable Serokell related configuration"; - - config = mkMerge [ - (mkIf cfg { - nix.settings.substituters = [ - "https://cache.nixos.org" - ]; - - nix.settings.trusted-public-keys = [ - ]; - }) - (optionalAttrs (options ? "home-manager") { - home-manager.users."main" = {...}: { - programs.ssh.matchBlocks = { - "*.serokell.team" = { - port = 17788; - user = "magicrb"; - }; - }; - }; - }) - ]; -} diff --git a/nixos/modules/sshd-emacs.nix b/nixos/modules/sshd-emacs.nix deleted file mode 100644 index dd87810..0000000 --- a/nixos/modules/sshd-emacs.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - options, - pkgs, - ... -}: -with lib; let - cfg = config.magic_rb.sshdEmacs; -in { - options.magic_rb.sshdEmacs = { - enable = mkEnableOption "Enable sshd options necessary for emacs socket forwarding."; - }; - - config = { - services.openssh.extraConfig = '' - AcceptEnv INSIDE_EMACS - StreamLocalBindUnlink yes - ''; - }; -} diff --git a/nixos/modules/template-files.nix b/nixos/modules/template-files.nix deleted file mode 100644 index 4e02369..0000000 --- a/nixos/modules/template-files.nix +++ /dev/null @@ -1,98 +0,0 @@ -{config, lib, pkgs, ...}: -with lib; -let - cfg = config.services.template-files; - format = pkgs.formats.json {}; -in -{ - options.services.template-files = mkOption { - description = - '' - Attrset of template-files - ''; - type = with types; - attrsOf (submodule - ({...}: - { - options = { - text = mkOption { - description = - '' - Text to template into result, mutually exclusive with - ''; - type = nullOr str; - default = null; - }; - json = mkOption { - description = - '' - Nix attrset to template into result, mutually exclusive with - ''; - type = nullOr format.type; - default = null; - }; - script = mkOption { - description = - '' - Script to run prior to templating. - ''; - type = lines; - default = ""; - }; - result = mkOption { - description = - '' - Path to result of templating, filled in at runtime. - ''; - type = string; - readOnly = true; - }; - }; - })); - default = {}; - apply = - mapAttrs - (n: v: - v // - { - result = - if v.text != null then - "/run/cfg/templates/${n}" - else if v.json != null then - "/run/cfg/templates/${n}.json" - else - throw "unreachable"; - } - ); - }; - - config.systemd.tmpfiles.rules = mkIf (cfg != {}) - ["d /run/cfg/templates 1755 root root -"]; - - config.systemd.services = flip mapAttrs' cfg - (n: v: - nameValuePair - (n + "-dynamic") - { - path = with pkgs; [ envsubst ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = - let - template = - if v.text != null then - pkgs.writeText n v.text - else if v.json != null then - format.generate (n + ".json") v.json - else - throw "unreachable"; - in - pkgs.writeShellScript (n + "-script") - '' - ${v.script} - envsubst -i "${template}" -o "${v.result}" - ''; - }; - } - ); -} diff --git a/nixos/modules/vault-agent.nix b/nixos/modules/vault-agent.nix deleted file mode 100644 index 5987415..0000000 --- a/nixos/modules/vault-agent.nix +++ /dev/null @@ -1,149 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.services.vault-agent; - format = pkgs.formats.json {}; -in { - options = { - services.vault-agent = { - enable = mkEnableOption "Vault, secure credentials storage and manager"; - - package = mkOption { - type = types.package; - default = pkgs.vault; - defaultText = "nixpkgs.vault"; - description = '' - The package used for the Vault agent and CLI. - ''; - }; - - secretsDir = mkOption { - type = types.nullOr types.path; - default = "/var/secrets"; - description = '' - Vault secrets directory; - ''; - }; - - settings = mkOption { - type = format.type; - default = {}; - description = '' - Configuration for Vault Agent. See the documentation - ''; - }; - - secretsGroup = mkOption { - type = types.submodule { - options = { - name = mkOption { - type = types.str; - default = "secrets"; - description = '' - Group used for accessing the secrets. - ''; - }; - id = mkOption { - type = types.int; - default = 1984; - description = '' - Group ID for the secrets group. - ''; - }; - }; - }; - default = {}; - }; - - userName = mkOption { - type = types.str; - default = "vault-agent"; - }; - - groupName = mkOption { - type = types.str; - default = "vault-agent"; - }; - - uid = mkOption { - type = types.int; - default = 1985; - }; - - gid = mkOption { - type = types.int; - default = 1985; - }; - }; - }; - - config = - mkIf cfg.enable - (let - vaultConfig = format.generate "vault.json" cfg.settings; - in { - users = { - users = { - "${cfg.userName}" = { - group = cfg.groupName; - uid = cfg.uid; - isSystemUser = true; - }; - }; - groups = { - "${cfg.groupName}" = { - gid = cfg.gid; - }; - - "${cfg.secretsGroup.name}" = { - gid = cfg.secretsGroup.id; - }; - }; - }; - - systemd.tmpfiles.rules = mkIf (cfg.secretsDir != null) [ - "d ${cfg.secretsDir} 6755 vault-agent ${cfg.secretsGroup.name} 0" - ]; - - systemd.services.vault-agent = { - description = "Vault Agent"; - - wantedBy = ["multi-user.target"]; - wants = ["network-online.target"]; - after = ["network-online.target"]; - - path = with pkgs; [ - glibc - ]; - - serviceConfig = mkMerge [ - { - User = cfg.userName; - Group = cfg.groupName; - - ExecReload = "${pkgs.busybox}/bin/kill -HUP $MAINPID"; - ExecStart = "${cfg.package}/bin/vault agent -config=${vaultConfig}"; - - KillMode = "process"; - KillSignal = "SIGINT"; - LimitNOFILE = 65536; - LimitNPROC = "infinity"; - OOMScoreAdjust = -1000; - Restart = "always"; - RestartSec = 2; - TasksMax = "infinity"; - - ConfigurationDirectory = "vault-agent"; - ConfigurationDirectoryMode = "0700"; - } - ]; - }; - }); -} diff --git a/nixos/modules/vps-remote-access.nix b/nixos/modules/vps-remote-access.nix deleted file mode 100644 index 9b9e140..0000000 --- a/nixos/modules/vps-remote-access.nix +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.magic_rb.vpsRemoteAccess; -in { - options.magic_rb = { - vpsRemoteAccess = { - enable = mkEnableOption "Enable VPS remote access module."; - trustedWheel = mkEnableOption "Add the wheel group to Nix trusted-users."; - }; - }; - - config = - mkIf cfg.enable - { - nix.settings.trusted-users = - mkIf cfg.trustedWheel - ["@wheel"]; - - services.openssh = { - enable = true; - settings = { - PasswordAuthentication = false; - PermitRootLogin = "no"; - }; - }; - }; -} diff --git a/nixos/modules/xserver/default.nix b/nixos/modules/xserver/default.nix deleted file mode 100644 index 2111897..0000000 --- a/nixos/modules/xserver/default.nix +++ /dev/null @@ -1,135 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - lib, - pkgs, - ... -}: -with lib; let - xserver-enable = config.services.xserver.enable; - nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' - export __NV_PRIME_RENDER_OFFLOAD=1 - export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 - export __GLX_VENDOR_LIBRARY_NAME=nvidia - export __VK_LAYER_NV_optimus=NVIDIA_only - exec -a "$0" "$@" - ''; - cfg = config.magic_rb.xserver; -in { - options.magic_rb.xserver = { - enable = mkEnableOption "XServer for my setup style"; - gpu = mkOption { - description = "Which GPU type do you have?"; - type = types.enum ["nvidia" "amd" ]; - }; - - nvidia = mkOption { - description = "NVidia section"; - type = types.submodule { - options = { - primeOffload = mkEnableOption "NVidia PRIME sync support"; - primeSync = mkEnableOption "NVidia PRIME offload support"; - - intelBusId = mkOption { - type = types.str; - default = ""; - }; - nvidiaBusId = mkOption { - type = types.str; - default = ""; - }; - - linux-5-11-patch = mkEnableOption "Linux 5.11 compat patch"; - }; - }; - default = {}; - }; - xmonad = mkEnableOption "Enable xmonad"; - lightdm = mkEnableOption "Enable lightdm"; - qwertyNeo2 = mkEnableOption "Add custom qwerty neo layout."; - mimickInTty = mkEnableOption "Mimick xkb set keyboard layouts in TTYs."; - }; - - config = mkIf cfg.enable (mkMerge [ - { - services.xserver = { - enable = true; - - windowManager = mkIf cfg.xmonad { - xmonad.enable = true; - xmonad.enableContribAndExtras = true; - }; - - displayManager = mkIf cfg.xmonad { - lightdm.enable = mkIf cfg.lightdm true; - defaultSession = "none+xmonad"; - }; - - libinput = { - enable = true; - touchpad.disableWhileTyping = true; - }; - }; - - hardware = { - opengl.enable = true; - opengl.driSupport32Bit = true; - }; - } - (mkIf (cfg.gpu == "nvidia") { - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia.modesetting.enable = mkIf cfg.nvidia.primeSync true; - - services.xserver.deviceSection = mkIf cfg.nvidia.primeSync '' - Option "Coolbits" "28" - Option "UseEvents" "on" - ''; - - environment.systemPackages = - mkIf cfg.nvidia.primeOffload - [nvidia-offload pkgs.libglvnd]; - - hardware.nvidia.prime = mkIf (cfg.nvidia.primeSync || cfg.nvidia.primeOffload) { - sync.enable = cfg.nvidia.primeSync; - offload.enable = cfg.nvidia.primeOffload; - - intelBusId = cfg.nvidia.intelBusId; - nvidiaBusId = cfg.nvidia.nvidiaBusId; - }; - }) - (mkIf (cfg.gpu == "amd") { - services.xserver.videoDrivers = [ "amd" ]; - }) - (mkIf cfg.qwertyNeo2 { - - services.xserver.displayManager.sessionCommands = - "${pkgs.xorg.xmodmap}/bin/xmodmap ${pkgs.writeText "xkb-layout" '' - ! bind the omen key to switching layouts - keycode 157 = ISO_Next_Group - ''}"; - - services.xserver = { - layout = "de,de,mine,us"; - xkbVariant = "koy,neo_qwerty,mine,"; - xkbOptions = "ctrl:swap_lalt_lctl_lwin, altwin:menu_win, grp:sclk_toggle"; - - extraLayouts."neo_qwerty" = { - description = "QWERTY neo2 layout."; - languages = ["de"]; - symbolsFile = ./qwerty_neo.xkb; - }; - - extraLayouts."mine" = { - description = "mine neo layout."; - languages = ["de"]; - symbolsFile = ./mine.xkb; - }; - }; - }) - (mkIf cfg.mimickInTty { - console.useXkbConfig = true; - }) - ]); -} diff --git a/nixos/modules/xserver/mine.xkb b/nixos/modules/xserver/mine.xkb deleted file mode 100644 index 0512909..0000000 --- a/nixos/modules/xserver/mine.xkb +++ /dev/null @@ -1,81 +0,0 @@ -// Bei einem Hochströmen sollte der nächste Abschnitt zu symbols/de hinzugefügt werden -// und im unteren Teil mine(mine_base) durch de(mine_base) ersetzt werden - -partial alphanumeric_keys -xkb_symbols "mine_base" { - include "de(neo_base)" - - - key.type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK"; - key { [ comma, endash, NoSymbol, U03F1, NoSymbol, NoSymbol, U21D2, NoSymbol ] }; - key { [ period, enfilledcircbullet, NoSymbol, U03D1, NoSymbol, NoSymbol, U21A6, NoSymbol ] }; - - - key.type[Group1] = "EIGHT_LEVEL_ALPHABETIC_LEVEL_FIVE_LOCK"; - key { [ j, J, NoSymbol, Greek_theta, NoSymbol, NoSymbol, Greek_THETA, NoSymbol ] }; - key { [ l, L, NoSymbol, Greek_lambda, NoSymbol, NoSymbol, Greek_LAMBDA, NoSymbol ] }; - key { [ u, U, NoSymbol, NoSymbol, NoSymbol, NoSymbol, includedin, NoSymbol ] }; - key { [ a, A, NoSymbol, Greek_alpha, NoSymbol, NoSymbol, U2200, NoSymbol ] }; - key { [ q, Q, NoSymbol, U03D5, NoSymbol, NoSymbol, U211A, NoSymbol ] }; - key { [ w, W, NoSymbol, Greek_omega, NoSymbol, NoSymbol, Greek_OMEGA, NoSymbol ] }; - key { [ b, B, NoSymbol, Greek_beta, NoSymbol, NoSymbol, U21D0, NoSymbol ] }; - key { [ d, D, NoSymbol, Greek_delta, NoSymbol, NoSymbol, Greek_DELTA, NoSymbol ] }; - key { [ g, G, NoSymbol, Greek_gamma, NoSymbol, NoSymbol, Greek_GAMMA, NoSymbol ] }; - key { [ y, Y, NoSymbol, Greek_upsilon, NoSymbol, NoSymbol, nabla, NoSymbol ] }; - // AD11 receives symbol from neo AC11 in layers 3 and from neo AD11 in layer 4 - key { [ z, Z, at, Greek_zeta, U2212, NoSymbol, U2124, NoSymbol ] }; - // AD12 recieves symbol from neo AD11 in layers 3 and from neo AB10 in layer 4 - key { [ ssharp, U1E9E, U017F, Greek_finalsmallsigma, semicolon, NoSymbol, jot, NoSymbol ] }; - - key { [ c, C, NoSymbol, Greek_chi, NoSymbol, NoSymbol, U2102, NoSymbol ] }; - key { [ r, R, NoSymbol, Greek_rho, NoSymbol, NoSymbol, U211D, NoSymbol ] }; - key { [ i, I, NoSymbol, Greek_iota, NoSymbol, NoSymbol, integral, NoSymbol ] }; - key { [ e, E, NoSymbol, Greek_epsilon, NoSymbol, NoSymbol, U2203, NoSymbol ] }; - key { [ o, O, NoSymbol, Greek_omicron, NoSymbol, NoSymbol, elementof, NoSymbol ] }; - key { [ m, M, NoSymbol, Greek_mu, NoSymbol, NoSymbol, ifonlyif, NoSymbol ] }; - key { [ n, N, NoSymbol, Greek_nu, NoSymbol, NoSymbol, U2115, NoSymbol ] }; - key { [ t, T, NoSymbol, Greek_tau, NoSymbol, NoSymbol, partialderivative, NoSymbol ] }; - key { [ s, S, NoSymbol, Greek_sigma, NoSymbol, NoSymbol, Greek_SIGMA, NoSymbol ] }; - key { [ h, H, NoSymbol, Greek_psi, NoSymbol, NoSymbol, Greek_PSI, NoSymbol ] }; - - key.type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK"; - // AC12 recieves symbols from neo AD12 - key { [ dead_acute, dead_tilde, dead_stroke, dead_psili, dead_doubleacute, NoSymbol, dead_breve, NoSymbol ] }; - - key.type[Group1] = "EIGHT_LEVEL_ALPHABETIC_LEVEL_FIVE_LOCK"; - key { [ v, V, NoSymbol, NoSymbol, NoSymbol, NoSymbol, radical, NoSymbol ] }; - key { [ x, X, NoSymbol, Greek_xi, NoSymbol, NoSymbol, Greek_XI, NoSymbol ] }; - key { [ udiaeresis, Udiaeresis, NoSymbol, NoSymbol, NoSymbol, NoSymbol, union, NoSymbol ] }; - key { [ adiaeresis, Adiaeresis, NoSymbol, Greek_eta, NoSymbol, NoSymbol, U2135, NoSymbol ] }; - key { [ odiaeresis, Odiaeresis, NoSymbol, U03F5, NoSymbol, NoSymbol, intersection, NoSymbol ] }; - key { [ p, P, NoSymbol, Greek_pi, NoSymbol, NoSymbol, Greek_PI, NoSymbol ] }; - key { [ f, F, NoSymbol, Greek_phi, NoSymbol, NoSymbol, Greek_PHI, NoSymbol ] }; - // AB10 receives symbol from neo AC11 in layer 4 - key { [ k, K, NoSymbol, Greek_kappa, period, KP_Decimal, multiply, NoSymbol ] }; -}; - -default partial alphanumeric_keys modifier_keys keypad_keys -xkb_symbols "mine" { - - include "mine(mine_base)" - - name[Group1]= "German (Mine)"; - - include "shift(both_capslock)" - include "level3(caps_switch)" - include "mine(ac11_switch)" - include "level5(lsgt_switch_lock)" - include "level5(ralt_switch_lock)" -}; - -// Bei einem Hochströmen sollte der nächste Abschnitt zu symbols/level3 hinzugefügt werden -// und mine(ac11_switch) durch level3(ac11_switch) -// The Backslash key (while pressed) chooses the third shift level. -partial modifier_keys -xkb_symbols "ac11_switch" { - key { - type[Group1]="ONE_LEVEL", - symbols[Group1] = [ ISO_Level3_Shift ] - }; -}; - diff --git a/nixos/modules/xserver/qwerty_neo.xkb b/nixos/modules/xserver/qwerty_neo.xkb deleted file mode 100644 index 6f43a78..0000000 --- a/nixos/modules/xserver/qwerty_neo.xkb +++ /dev/null @@ -1,265 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Richard Brežák -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -// # QWERTY/Neo 2 -// -// This is a custom keyboard layout that combines regular German QWERTY (mostly -// letters of the first 2 levels) with the upper levels of Neo 2. It is -// especially useful if you do lots of programming, but don’t want to lose the -// letters peculiar to the German layout (ä, ö, u, etc.). I use this layout -// with vim where it has proven to be quite useful. -// -// ## How this layout was created -// -// - I took the original "neo_base" layout, defined in -// /usr/share/X11/xkb/symbols/de -// - and modified it to include the standard QWERTY layout for the first -// 2 levels. -// -// The QWERTY layout is built up of the following sections: -// -// - "de(basic)", defined in /usr/share/X11/xkb/symbols/de. -// It includes "kpdl(comma)" and "level3(ralt_switch)", both of which are not -// necessary as Neo 2 takes care of the respective keys, -// - "latin(type4)", defined in /usr/share/X11/xkb/symbols/latin. -// It includes "latin(basic)". -// -// The end result is mostly identical to Neo 2 except for the letters and a few -// other keys that have different mappings in either "de(basic)", -// "latin(type4)", or "latin(basic)". The changes to Neo 2’s default mappings -// can be found at the end of the layout. -// -// ## Installation -// -// Append the contents of this file to /usr/share/X11/xkb/symbols/de. You can -// use `cat qwerty_neo | sudo tee -a /usr/share/X11/xkb/symbols/de >/dev/null` -// to do that. -// -// Add the following tag to /usr/share/X11/xkb/rules/evdev.xml (e. g. after the -// tag that configures Neo 2). -// -// ``` -// -// -// qwerty_neo -// German (QWERTY/Neo 2) -// -// -// ``` -// -// On Ubuntu, you will likely have to reinstall this layout after an upgrade to -// a new version of the OS (e. g. after an update from 17.04 to 17.10). -// -// ## Usage -// -// Use it with `setxkbmap de qwerty_neo` or select the layout in your desktop -// environment. -// -partial alphanumeric_keys modifier_keys keypad_keys -xkb_symbols "qwerty_neo" { - - // Levels in Neo jargon - // -------------------------------------------------------------- - // Ebene 1: normal - // Ebene 2: Shift - // Ebene 3: Mod3 - // Ebene 4: Mod4 (for marking something use Shift + Mod4) - // Ebene 5: Shift + Mod3 - // Ebene 6: Mod3 + Mod4 - // Compose (not a level): Mod3 + Tab - // Feststelltaste (Capslock): Shift + Shift - // Mod4-Lock: Mod4 + Mod4 - // Mod4-Lock: Shift + Mod3 + Tab - - // Legend - // =============== - // Levels in Xkbmap jargon to be found here in the definitions. - // These are the levels used, and Xorg's translations: - // -------------------------------------------------------------- - // Xorg: Level1 Level2 Level3 Level4 Level5 Level6 Level7 Level8 - // Neo: Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Pseudo-Ebene Ebene6 ??? - // Keys (Neo): None Shift Mod3 Mod3 + Shift Mod4 Mod4 + Shift Mod3 + Mod4 Mod3 + Mod4 + Shift - - - // Alphanumeric-keys - // =============== - key.type[Group1] = "EIGHT_LEVEL"; - - // Tab as Multi_key (Compose) - // -------------------------------------------------------------- - key { [ Tab, ISO_Left_Tab, Multi_key, ISO_Level5_Lock, NoSymbol, NoSymbol, NoSymbol, ISO_Level5_Lock ] }; - - - // Number row - // -------------------------------------------------------------- - key { [ dead_circumflex, dead_caron, U21BB, U02DE, dead_abovedot, Pointer_EnableKeys, dead_belowdot, NoSymbol ] }; - - key { [ 1, degree, onesuperior, onesubscript, ordfeminine, NoSymbol, notsign, NoSymbol ] }; - key { [ 2, section, twosuperior, twosubscript, masculine, NoSymbol, logicalor, NoSymbol ] }; - key { [ 3, U2113, threesuperior, threesubscript, numerosign, NoSymbol, logicaland, NoSymbol ] }; - key { [ 4, guillemotright, U203A, femalesymbol, NoSymbol, NoSymbol, U22A5, NoSymbol ] }; - key { [ 5, guillemotleft, U2039, malesymbol, periodcentered, NoSymbol, U2221, NoSymbol ] }; - key { [ 6, dollar, cent, U26A5, sterling, NoSymbol, U2225, NoSymbol ] }; - - key { [ 7, EuroSign, yen, U03F0, currency, NoSymbol, rightarrow, NoSymbol ] }; - key { [ 8, doublelowquotemark, singlelowquotemark, U27E8, Tab, ISO_Left_Tab, U221E, NoSymbol ] }; - key { [ 9, leftdoublequotemark, leftsinglequotemark, U27E9, KP_Divide, KP_Divide, variation, NoSymbol ] }; - key { [ 0, rightdoublequotemark, rightsinglequotemark, zerosubscript, KP_Multiply, KP_Multiply, emptyset, NoSymbol ] }; - - key { [ minus, emdash, NoSymbol, U2011, KP_Subtract, KP_Subtract, hyphen, NoSymbol ] }; - key { [ dead_grave, dead_cedilla, dead_abovering, dead_dasia, dead_diaeresis, NoSymbol, dead_macron, NoSymbol ] }; - - // Top row - // -------------------------------------------------------------- - key.type[Group1] = "EIGHT_LEVEL_SEMIALPHABETIC"; - key { [ x, X, ellipsis, Greek_xi, Prior, Prior, Greek_XI, NoSymbol ] }; - key { [ v, V, underscore, NoSymbol, BackSpace, BackSpace, radical, NoSymbol ] }; - key { [ l, L, bracketleft, Greek_lambda, Up, Up, Greek_LAMBDA, NoSymbol ] }; - key { [ c, C, bracketright, Greek_chi, Delete, Delete, U2102, NoSymbol ] }; - key { [ w, W, asciicircum, Greek_omega, Next, Next, Greek_OMEGA, NoSymbol ] }; - - key { [ k, K, exclam, Greek_kappa, exclamdown, NoSymbol, multiply, NoSymbol ] }; - key { [ h, H, less, Greek_psi, KP_7, KP_7, Greek_PSI, NoSymbol ] }; - key { [ g, G, greater, Greek_gamma, KP_8, KP_8, Greek_GAMMA, NoSymbol ] }; - key { [ f, F, equal, Greek_phi, KP_9, KP_9, Greek_PHI, NoSymbol ] }; - key { [ q, Q, ampersand, U03D5, KP_Add, KP_Add, U211A, NoSymbol ] }; - - key { [ ssharp, U1E9E, U017F, Greek_finalsmallsigma, U2212, NoSymbol, jot, NoSymbol ] }; - - key.type[Group1] = "EIGHT_LEVEL"; - key { [ dead_acute, dead_tilde, dead_stroke, dead_psili, dead_doubleacute, NoSymbol, dead_breve, NoSymbol ] }; - - // Middle row - // -------------------------------------------------------------- - key.type[Group1] = "EIGHT_LEVEL_SEMIALPHABETIC"; - key { [ u, U, backslash, NoSymbol, Home, Home, includedin, NoSymbol ] }; - key { [ i, I, slash, Greek_iota, Left, Left, integral, NoSymbol ] }; - key { [ a, A, braceleft, Greek_alpha, Down, Down, U2200, NoSymbol ] }; - key { [ e, E, braceright, Greek_epsilon, Right, Right, U2203, NoSymbol ] }; - key { [ o, O, asterisk, Greek_omicron, End, End, elementof, NoSymbol ] }; - - key { [ s, S, question, Greek_sigma, questiondown, NoSymbol, Greek_SIGMA, NoSymbol ] }; - key { [ n, N, parenleft, Greek_nu, KP_4, KP_4, U2115, NoSymbol ] }; - key { [ r, R, parenright, Greek_rho, KP_5, KP_5, U211D, NoSymbol ] }; - key { [ t, T, minus, Greek_tau, KP_6, KP_6, partialderivative, NoSymbol ] }; - key { [ d, D, colon, Greek_delta, KP_Separator, comma, Greek_DELTA, NoSymbol ] }; - - key { [ y, Y, at, Greek_upsilon, period, KP_Decimal, nabla, NoSymbol ] }; - - // Bottom row - // -------------------------------------------------------------- - key { [ udiaeresis, Udiaeresis, numbersign, NoSymbol, Escape, Escape, union, NoSymbol ] }; - key { [ odiaeresis, Odiaeresis, dollar, U03F5, Tab, Tab, intersection, NoSymbol ] }; - key { [ adiaeresis, Adiaeresis, bar, Greek_eta, Insert, Insert, U2135, NoSymbol ] }; - key { [ p, P, asciitilde, Greek_pi, Return, Return, Greek_PI, NoSymbol ] }; - key { [ z, Z, grave, Greek_zeta, Undo, Redo, U2124, NoSymbol ] }; - - key { [ b, B, plus, Greek_beta, colon, NoSymbol, U21D0, NoSymbol ] }; - key { [ m, M, percent, Greek_mu, KP_1, KP_1, ifonlyif, NoSymbol ] }; - key.type[Group1] = "EIGHT_LEVEL"; - key { [ comma, endash, quotedbl, U03F1, KP_2, KP_2, U21D2, NoSymbol ] }; - key { [ period, enfilledcircbullet, apostrophe, U03D1, KP_3, KP_3, U21A6, NoSymbol ] }; - key.type[Group1] = "EIGHT_LEVEL_SEMIALPHABETIC"; - key { [ j, J, semicolon, Greek_theta, semicolon, NoSymbol, Greek_THETA, NoSymbol ] }; - key.type[Group1] = "EIGHT_LEVEL"; - - // Space key - // -------------------------------------------------------------- - key { [ space, space, space, nobreakspace, KP_0, KP_0, U202F, NoSymbol ] }; - - - // Keypad-keys - // =============== - - // The former Numlock key: - key { [ Tab, ISO_Left_Tab, equal, approxeq, notequal, Pointer_EnableKeys, identical, NoSymbol ] }; - - // Topmost row - // -------------------------------------------------------------- - key { [ KP_Divide, KP_Divide, division, U2300, U2215, NoSymbol, U2223, NoSymbol ] }; - key { [ KP_Multiply, KP_Multiply, U22C5, U2299, multiply, NoSymbol, U2297, NoSymbol ] }; - key { [ KP_Subtract, KP_Subtract, U2212, U2296, U2216, NoSymbol, U2238, NoSymbol ] }; - - // Top row - // -------------------------------------------------------------- - key { [ KP_7, U2714, U2195, U226A, KP_Home, KP_Home, upstile, NoSymbol ] }; - key { [ KP_8, U2718, uparrow, intersection, KP_Up, KP_Up, U22C2, NoSymbol ] }; - key { [ KP_9, dagger, U20D7, U226B, KP_Prior, KP_Prior, U2309, NoSymbol ] }; - key { [ KP_Add, KP_Add, plusminus, U2295, U2213, NoSymbol, U2214, NoSymbol ] }; - - // Middle row - // -------------------------------------------------------------- - key { [ KP_4, club, leftarrow, includedin, KP_Left, KP_Left, U2286, NoSymbol ] }; - key { [ KP_5, EuroSign, colon, U22B6, KP_Begin, KP_Begin, U22B7, NoSymbol ] }; - key { [ KP_6, U2023, rightarrow, includes, KP_Right, KP_Right, U2287, NoSymbol ] }; - - // Bottom row - // -------------------------------------------------------------- - key { [ KP_1, diamond, U2194, lessthanequal, KP_End, KP_End, downstile, NoSymbol ] }; - key { [ KP_2, heart, downarrow, union, KP_Down, KP_Down, U22C3, NoSymbol ] }; - key { [ KP_3, U2660, U21CC, greaterthanequal, KP_Next, KP_Next, U230B, NoSymbol ] }; - key { [ KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, NoSymbol ] }; - key { [ KP_Equal, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol ] }; - - // Bottommost row - // -------------------------------------------------------------- - key { [ KP_0, U2423, percent, U2030, KP_Insert, KP_Insert, U25A1, NoSymbol ] }; - key { [ KP_Separator, period, comma, minutes, KP_Delete, KP_Delete, seconds, NoSymbol ] }; - - // The above is the full Neo 2 layout. What follows are the customizations - // that make most of the letters of a standard German layout available. - - // latin(basic) - - - key { [ q, Q ] }; - key { [ w, W ] }; - key { [ e, E ] }; - key { [ r, R ] }; - key { [ t, T ] }; - key { [ y, Y ] }; - key { [ u, U ] }; - key { [ i, I ] }; - key { [ o, O ] }; - key { [ p, P ] }; - key { [udiaeresis, Udiaeresis ] }; - - key { [ a, A ] }; - key { [ s, S ] }; - key { [ d, D ] }; - key { [ f, F ] }; - key { [ g, G ] }; - key { [ h, H ] }; - key { [ j, J ] }; - key { [ k, K ] }; - key { [ l, L ] }; - key { [ colon, semicolon ] }; - key { [apostrophe, quotedbl ] }; - - - key { [ z, Z ] }; - key { [ x, X ] }; - key { [ c, C ] }; - key { [ v, V ] }; - key { [ b, B ] }; - key { [ n, N ] }; - key { [ m, M ] }; - key { [ slash, backslash, question, questiondown ] }; - - // latin(type4) - - // Modified to have minus and emdash where you would find minus on a QWERTY - // layout. - // Neo 2: key { [ j, J ] } - // Neo 2: key { [ minus, emdash ] } - key { [plus, equal ] }; - - name[Group1]="German (QWERTY/Neo 2)"; - - include "shift(both_capslock)" - include "level3(caps_switch)" - include "level5(lsgt_switch)" - include "level5(ralt_switch)" - -}; diff --git a/nixos/profiles/iso-image.nix b/nixos/profiles/iso-image.nix deleted file mode 100644 index f7d5930..0000000 --- a/nixos/profiles/iso-image.nix +++ /dev/null @@ -1,820 +0,0 @@ -# This module creates a bootable ISO image containing the given NixOS -# configuration. The derivation for the ISO image will be placed in -# config.system.build.isoImage. - -{ config, lib, pkgs, inputs, ... }: - -with lib; - -let - /** - * Given a list of `options`, concats the result of mapping each options - * to a menuentry for use in grub. - * - * * defaults: {name, image, params, initrd} - * * options: [ option... ] - * * option: {name, params, class} - */ - menuBuilderGrub2 = - defaults: options: lib.concatStrings - ( - map - (option: '' - menuentry '${defaults.name} ${ - # Name appended to menuentry defaults to params if no specific name given. - option.name or (if option ? params then "(${option.params})" else "") - }' ${if option ? class then " --class ${option.class}" else ""} { - linux ${defaults.image} \''${isoboot} ${defaults.params} ${ - option.params or "" - } - initrd ${defaults.initrd} - } - '') - options - ) - ; - - /** - * Given a `config`, builds the default options. - */ - buildMenuGrub2 = config: - buildMenuAdditionalParamsGrub2 config "" - ; - - /** - * Given a `config` and params to add to `params`, build a set of default options. - * Use this one when creating a variant (e.g. hidpi) - */ - buildMenuAdditionalParamsGrub2 = config: additional: - let - finalCfg = { - name = "NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}"; - params = "init=${config.system.build.toplevel}/init ${additional} ${toString config.boot.kernelParams}"; - image = "/boot/${config.system.boot.loader.kernelFile}"; - initrd = "/boot/initrd"; - }; - in - menuBuilderGrub2 - finalCfg - [ - { class = "copytoram"; params = "copytoram nomodeset debug"; } - { class = "installer"; } - { class = "nomodeset"; params = "nomodeset"; } - { class = "debug"; params = "debug"; } - ] - ; - - # Timeout in syslinux is in units of 1/10 of a second. - # 0 is used to disable timeouts. - syslinuxTimeout = if config.boot.loader.timeout == null then - 0 - else - max (config.boot.loader.timeout * 10) 1; - - - max = x: y: if x > y then x else y; - - # The configuration file for syslinux. - - # Notes on syslinux configuration and UNetbootin compatiblity: - # * Do not use '/syslinux/syslinux.cfg' as the path for this - # configuration. UNetbootin will not parse the file and use it as-is. - # This results in a broken configuration if the partition label does - # not match the specified config.isoImage.volumeID. For this reason - # we're using '/isolinux/isolinux.cfg'. - # * Use APPEND instead of adding command-line arguments directly after - # the LINUX entries. - # * COM32 entries (chainload, reboot, poweroff) are not recognized. They - # result in incorrect boot entries. - - baseIsolinuxCfg = '' - SERIAL 0 115200 - TIMEOUT ${builtins.toString syslinuxTimeout} - UI vesamenu.c32 - MENU BACKGROUND /isolinux/background.png - - ${config.isoImage.syslinuxTheme} - - DEFAULT boot-copytoram - - LABEL boot - MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} - LINUX /boot/${config.system.boot.loader.kernelFile} - APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} - INITRD /boot/${config.system.boot.loader.initrdFile} - - # A variant to boot with 'nomodeset' - LABEL boot-nomodeset - MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (nomodeset) - LINUX /boot/${config.system.boot.loader.kernelFile} - APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset - INITRD /boot/${config.system.boot.loader.initrdFile} - - # A variant to boot with 'copytoram' - LABEL boot-copytoram - MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (copytoram) (nomodeset) (loglevel=7) - LINUX /boot/${config.system.boot.loader.kernelFile} - APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram nomodeset loglevel=7 - INITRD /boot/${config.system.boot.loader.initrdFile} - - # A variant to boot with verbose logging to the console - LABEL boot-debug - MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug) - LINUX /boot/${config.system.boot.loader.kernelFile} - APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7 - INITRD /boot/${config.system.boot.loader.initrdFile} - - # A variant to boot with a serial console enabled - LABEL boot-serial - MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (serial console=ttyS0,115200n8) - LINUX /boot/${config.system.boot.loader.kernelFile} - APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} console=ttyS0,115200n8 - INITRD /boot/${config.system.boot.loader.initrdFile} - ''; - - isolinuxMemtest86Entry = '' - LABEL memtest - MENU LABEL Memtest86+ - LINUX /boot/memtest.bin - APPEND ${toString config.boot.loader.grub.memtest86.params} - ''; - - isolinuxCfg = concatStringsSep "\n" - ([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry); - - refindBinary = if targetArch == "x64" || targetArch == "aa64" then "refind_${targetArch}.efi" else null; - - # Setup instructions for rEFInd. - refind = - if refindBinary != null then - '' - # Adds rEFInd to the ISO. - cp -v ${pkgs.refind}/share/refind/${refindBinary} $out/EFI/boot/ - '' - else - "# No refind for ${targetArch}" - ; - - grubPkgs = if config.boot.loader.grub.forcei686 then pkgs.pkgsi686Linux else pkgs; - - grubMenuCfg = '' - # - # Menu configuration - # - - # Search using a "marker file" - search --set=root --file /EFI/nixos-installer-image - - insmod gfxterm - insmod png - set gfxpayload=keep - set gfxmode=${concatStringsSep "," [ - # GRUB will use the first valid mode listed here. - # `auto` will sometimes choose the smallest valid mode it detects. - # So instead we'll list a lot of possibly valid modes :/ - #"3840x2160" - #"2560x1440" - "1920x1080" - "1366x768" - "1280x720" - "1024x768" - "800x600" - "auto" - ]} - - # Fonts can be loaded? - # (This font is assumed to always be provided as a fallback by NixOS) - if loadfont (\$root)/EFI/boot/unicode.pf2; then - set with_fonts=true - fi - if [ "\$textmode" != "true" -a "\$with_fonts" == "true" ]; then - # Use graphical term, it can be either with background image or a theme. - # input is "console", while output is "gfxterm". - # This enables "serial" input and output only when possible. - # Otherwise the failure mode is to not even enable gfxterm. - if test "\$with_serial" == "yes"; then - terminal_output gfxterm serial - terminal_input console serial - else - terminal_output gfxterm - terminal_input console - fi - else - # Sets colors for the non-graphical term. - set menu_color_normal=cyan/blue - set menu_color_highlight=white/blue - fi - - ${ # When there is a theme configured, use it, otherwise use the background image. - if config.isoImage.grubTheme != null then '' - # Sets theme. - set theme=(\$root)/EFI/boot/grub-theme/theme.txt - # Load theme fonts - $(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (\$root)/EFI/boot/grub-theme/%P\n") - '' else '' - if background_image (\$root)/EFI/boot/efi-background.png; then - # Black background means transparent background when there - # is a background image set... This seems undocumented :( - set color_normal=black/black - set color_highlight=white/blue - else - # Falls back again to proper colors. - set menu_color_normal=cyan/blue - set menu_color_highlight=white/blue - fi - ''} - ''; - - # The EFI boot image. - # Notes about grub: - # * Yes, the grubMenuCfg has to be repeated in all submenus. Otherwise you - # will get white-on-black console-like text on sub-menus. *sigh* - efiDir = pkgs.runCommand "efi-directory" { - nativeBuildInputs = [ pkgs.buildPackages.grub2_efi ]; - strictDeps = true; - } '' - mkdir -p $out/EFI/boot/ - - # Add a marker so GRUB can find the filesystem. - touch $out/EFI/nixos-installer-image - - # ALWAYS required modules. - MODULES="fat iso9660 part_gpt part_msdos \ - normal boot linux configfile loopback chain halt \ - efifwsetup efi_gop \ - ls search search_label search_fs_uuid search_fs_file \ - gfxmenu gfxterm gfxterm_background gfxterm_menu test all_video loadenv \ - exfat ext2 ntfs btrfs hfsplus udf \ - videoinfo png \ - echo serial \ - " - - echo "Building GRUB with modules:" - for mod in $MODULES; do - echo " - $mod" - done - - # Modules that may or may not be available per-platform. - echo "Adding additional modules:" - for mod in efi_uga; do - if [ -f ${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget}/$mod.mod ]; then - echo " - $mod" - MODULES+=" $mod" - fi - done - - # Make our own efi program, we can't rely on "grub-install" since it seems to - # probe for devices, even with --skip-fs-probe. - grub-mkimage --directory=${grubPkgs.grub2_efi}/lib/grub/${grubPkgs.grub2_efi.grubTarget} -o $out/EFI/boot/boot${targetArch}.efi -p /EFI/boot -O ${grubPkgs.grub2_efi.grubTarget} \ - $MODULES - cp ${grubPkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/ - - cat < $out/EFI/boot/grub.cfg - - set with_fonts=false - set textmode=false - # If you want to use serial for "terminal_*" commands, you need to set one up: - # Example manual configuration: - # → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 - # This uses the defaults, and makes the serial terminal available. - set with_serial=no - if serial; then set with_serial=yes ;fi - export with_serial - clear - set timeout=10 - - # This message will only be viewable when "gfxterm" is not used. - echo "" - echo "Loading graphical boot menu..." - echo "" - echo "Press 't' to use the text boot menu on this console..." - echo "" - - ${grubMenuCfg} - - hiddenentry 'Text mode' --hotkey 't' { - loadfont (\$root)/EFI/boot/unicode.pf2 - set textmode=true - terminal_output gfxterm console - } - hiddenentry 'GUI mode' --hotkey 'g' { - $(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (\$root)/EFI/boot/grub-theme/%P\n") - set textmode=false - terminal_output gfxterm - } - - - # If the parameter iso_path is set, append the findiso parameter to the kernel - # line. We need this to allow the nixos iso to be booted from grub directly. - if [ \''${iso_path} ] ; then - set isoboot="findiso=\''${iso_path}" - fi - - # - # Menu entries - # - - ${buildMenuGrub2 config} - submenu "HiDPI, Quirks and Accessibility" --class hidpi --class submenu { - ${grubMenuCfg} - submenu "Suggests resolution @720p" --class hidpi-720p { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "video=1280x720@60"} - } - submenu "Suggests resolution @1080p" --class hidpi-1080p { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "video=1920x1080@60"} - } - - # If we boot into a graphical environment where X is autoran - # and always crashes, it makes the media unusable. Allow the user - # to disable this. - submenu "Disable display-manager" --class quirk-disable-displaymanager { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "systemd.mask=display-manager.service"} - } - - # Some laptop and convertibles have the panel installed in an - # inconvenient way, rotated away from the keyboard. - # Those entries makes it easier to use the installer. - submenu "" {return} - submenu "Rotate framebuffer Clockwise" --class rotate-90cw { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:1"} - } - submenu "Rotate framebuffer Upside-Down" --class rotate-180 { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:2"} - } - submenu "Rotate framebuffer Counter-Clockwise" --class rotate-90ccw { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:3"} - } - - # As a proof of concept, mainly. (Not sure it has accessibility merits.) - submenu "" {return} - submenu "Use black on white" --class accessibility-blakconwhite { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "vt.default_red=0xFF,0xBC,0x4F,0xB4,0x56,0xBC,0x4F,0x00,0xA1,0xCF,0x84,0xCA,0x8D,0xB4,0x84,0x68 vt.default_grn=0xFF,0x55,0xBA,0xBA,0x4D,0x4D,0xB3,0x00,0xA0,0x8F,0xB3,0xCA,0x88,0x93,0xA4,0x68 vt.default_blu=0xFF,0x58,0x5F,0x58,0xC5,0xBD,0xC5,0x00,0xA8,0xBB,0xAB,0x97,0xBD,0xC7,0xC5,0x68"} - } - - # Serial access is a must! - submenu "" {return} - submenu "Serial console=ttyS0,115200n8" --class serial { - ${grubMenuCfg} - ${buildMenuAdditionalParamsGrub2 config "console=ttyS0,115200n8"} - } - } - - ${lib.optionalString (refindBinary != null) '' - # GRUB apparently cannot do "chainloader" operations on "CD". - if [ "\$root" != "cd0" ]; then - menuentry 'rEFInd' --class refind { - # Force root to be the FAT partition - # Otherwise it breaks rEFInd's boot - search --set=root --no-floppy --fs-uuid 1234-5678 - chainloader (\$root)/EFI/boot/${refindBinary} - } - fi - ''} - menuentry 'Firmware Setup' --class settings { - fwsetup - clear - echo "" - echo "If you see this message, your EFI system doesn't support this feature." - echo "" - } - menuentry 'Shutdown' --class shutdown { - halt - } - EOF - - ${refind} - ''; - - efiImg = pkgs.runCommand "efi-image_eltorito" { - nativeBuildInputs = [ pkgs.buildPackages.mtools pkgs.buildPackages.libfaketime pkgs.buildPackages.dosfstools ]; - strictDeps = true; - } - # Be careful about determinism: du --apparent-size, - # dates (cp -p, touch, mcopy -m, faketime for label), IDs (mkfs.vfat -i) - '' - mkdir ./contents && cd ./contents - mkdir -p ./EFI/boot - cp -rp "${efiDir}"/EFI/boot/{grub.cfg,*.efi} ./EFI/boot - - # Rewrite dates for everything in the FS - find . -exec touch --date=2000-01-01 {} + - - # Round up to the nearest multiple of 1MB, for more deterministic du output - usage_size=$(( $(du -s --block-size=1M --apparent-size . | tr -cd '[:digit:]') * 1024 * 1024 )) - # Make the image 110% as big as the files need to make up for FAT overhead - image_size=$(( ($usage_size * 110) / 100 )) - # Make the image fit blocks of 1M - block_size=$((1024*1024)) - image_size=$(( ($image_size / $block_size + 1) * $block_size )) - echo "Usage size: $usage_size" - echo "Image size: $image_size" - truncate --size=$image_size "$out" - faketime "2000-01-01 00:00:00" mkfs.vfat -i 12345678 -n EFIBOOT "$out" - - # Force a fixed order in mcopy for better determinism, and avoid file globbing - for d in $(find EFI -type d | sort); do - faketime "2000-01-01 00:00:00" mmd -i "$out" "::/$d" - done - - for f in $(find EFI -type f | sort); do - mcopy -pvm -i "$out" "$f" "::/$f" - done - - # Verify the FAT partition. - fsck.vfat -vn "$out" - ''; # */ - - # Name used by UEFI for architectures. - targetArch = - if pkgs.stdenv.isi686 || config.boot.loader.grub.forcei686 then - "ia32" - else if pkgs.stdenv.isx86_64 then - "x64" - else if pkgs.stdenv.isAarch32 then - "arm" - else if pkgs.stdenv.isAarch64 then - "aa64" - else - throw "Unsupported architecture"; - - # Syslinux (and isolinux) only supports x86-based architectures. - canx86BiosBoot = pkgs.stdenv.hostPlatform.isx86; - -in - -{ - options = { - - isoImage.isoName = mkOption { - default = "${config.isoImage.isoBaseName}.iso"; - description = lib.mdDoc '' - Name of the generated ISO image file. - ''; - }; - - isoImage.isoBaseName = mkOption { - default = "nixos"; - description = lib.mdDoc '' - Prefix of the name of the generated ISO image file. - ''; - }; - - isoImage.compressImage = mkOption { - default = false; - description = lib.mdDoc '' - Whether the ISO image should be compressed using - {command}`zstd`. - ''; - }; - - isoImage.squashfsCompression = mkOption { - default = with pkgs.stdenv.targetPlatform; "xz -Xdict-size 100% " - + lib.optionalString isx86 "-Xbcj x86" - # Untested but should also reduce size for these platforms - + lib.optionalString isAarch "-Xbcj arm" - + lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc" - + lib.optionalString (isSparc) "-Xbcj sparc"; - description = lib.mdDoc '' - Compression settings to use for the squashfs nix store. - ''; - example = "zstd -Xcompression-level 6"; - }; - - isoImage.edition = mkOption { - default = ""; - description = lib.mdDoc '' - Specifies which edition string to use in the volume ID of the generated - ISO image. - ''; - }; - - isoImage.volumeID = mkOption { - # nixos-$EDITION-$RELEASE-$ARCH - default = "nixos${optionalString (config.isoImage.edition != "") "-${config.isoImage.edition}"}-${config.system.nixos.release}-${pkgs.stdenv.hostPlatform.uname.processor}"; - description = lib.mdDoc '' - Specifies the label or volume ID of the generated ISO image. - Note that the label is used by stage 1 of the boot process to - mount the CD, so it should be reasonably distinctive. - ''; - }; - - isoImage.contents = mkOption { - example = literalExpression '' - [ { source = pkgs.memtest86 + "/memtest.bin"; - target = "boot/memtest.bin"; - } - ] - ''; - description = lib.mdDoc '' - This option lists files to be copied to fixed locations in the - generated ISO image. - ''; - }; - - isoImage.storeContents = mkOption { - example = literalExpression "[ pkgs.stdenv ]"; - description = lib.mdDoc '' - This option lists additional derivations to be included in the - Nix store in the generated ISO image. - ''; - }; - - isoImage.includeSystemBuildDependencies = mkOption { - default = false; - description = lib.mdDoc '' - Set this option to include all the needed sources etc in the - image. It significantly increases image size. Use that when - you want to be able to keep all the sources needed to build your - system or when you are going to install the system on a computer - with slow or non-existent network connection. - ''; - }; - - isoImage.makeEfiBootable = mkOption { - default = false; - description = lib.mdDoc '' - Whether the ISO image should be an efi-bootable volume. - ''; - }; - - isoImage.makeUsbBootable = mkOption { - default = false; - description = lib.mdDoc '' - Whether the ISO image should be bootable from CD as well as USB. - ''; - }; - - isoImage.efiSplashImage = mkOption { - default = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/efi-background.png"; - sha256 = "18lfwmp8yq923322nlb9gxrh5qikj1wsk6g5qvdh31c4h5b1538x"; - }; - description = lib.mdDoc '' - The splash image to use in the EFI bootloader. - ''; - }; - - isoImage.splashImage = mkOption { - default = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/isolinux/bios-boot.png"; - sha256 = "1wp822zrhbg4fgfbwkr7cbkr4labx477209agzc0hr6k62fr6rxd"; - }; - description = lib.mdDoc '' - The splash image to use in the legacy-boot bootloader. - ''; - }; - - isoImage.grubTheme = mkOption { - default = pkgs.nixos-grub2-theme; - type = types.nullOr (types.either types.path types.package); - description = lib.mdDoc '' - The grub2 theme used for UEFI boot. - ''; - }; - - isoImage.syslinuxTheme = mkOption { - default = '' - MENU TITLE NixOS - MENU RESOLUTION 800 600 - MENU CLEAR - MENU ROWS 6 - MENU CMDLINEROW -4 - MENU TIMEOUTROW -3 - MENU TABMSGROW -2 - MENU HELPMSGROW -1 - MENU HELPMSGENDROW -1 - MENU MARGIN 0 - - # FG:AARRGGBB BG:AARRGGBB shadow - MENU COLOR BORDER 30;44 #00000000 #00000000 none - MENU COLOR SCREEN 37;40 #FF000000 #00E2E8FF none - MENU COLOR TABMSG 31;40 #80000000 #00000000 none - MENU COLOR TIMEOUT 1;37;40 #FF000000 #00000000 none - MENU COLOR TIMEOUT_MSG 37;40 #FF000000 #00000000 none - MENU COLOR CMDMARK 1;36;40 #FF000000 #00000000 none - MENU COLOR CMDLINE 37;40 #FF000000 #00000000 none - MENU COLOR TITLE 1;36;44 #00000000 #00000000 none - MENU COLOR UNSEL 37;44 #FF000000 #00000000 none - MENU COLOR SEL 7;37;40 #FFFFFFFF #FF5277C3 std - ''; - type = types.str; - description = lib.mdDoc '' - The syslinux theme used for BIOS boot. - ''; - }; - - isoImage.appendToMenuLabel = mkOption { - default = " Installer"; - example = " Live System"; - description = lib.mdDoc '' - The string to append after the menu label for the NixOS system. - This will be directly appended (without whitespace) to the NixOS version - string, like for example if it is set to `XXX`: - - `NixOS 99.99-pre666XXX` - ''; - }; - - }; - - # store them in lib so we can mkImageMediaOverride the - # entire file system layout in installation media (only) - config.lib.isoFileSystems = { - "/" = mkImageMediaOverride - { - fsType = "tmpfs"; - options = [ "mode=0755" ]; - }; - - # Note that /dev/root is a symlink to the actual root device - # specified on the kernel command line, created in the stage 1 - # init script. - "/iso" = mkImageMediaOverride - { device = "/dev/root"; - neededForBoot = true; - noCheck = true; - }; - - # In stage 1, mount a tmpfs on top of /nix/store (the squashfs - # image) to make this a live CD. - "/nix/.ro-store" = mkImageMediaOverride - { fsType = "squashfs"; - device = "/iso/nix-store.squashfs"; - options = [ "loop" ]; - neededForBoot = true; - }; - - "/nix/.rw-store" = mkImageMediaOverride - { fsType = "tmpfs"; - options = [ "mode=0755" ]; - neededForBoot = true; - }; - - "/nix/store" = mkImageMediaOverride - { fsType = "overlay"; - device = "overlay"; - options = [ - "lowerdir=/nix/.ro-store" - "upperdir=/nix/.rw-store/store" - "workdir=/nix/.rw-store/work" - ]; - depends = [ - "/nix/.ro-store" - "/nix/.rw-store/store" - "/nix/.rw-store/work" - ]; - }; - }; - - config = { - assertions = [ - { - assertion = !(stringLength config.isoImage.volumeID > 32); - # https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor - # Volume Identifier can only be 32 bytes - message = let - length = stringLength config.isoImage.volumeID; - howmany = toString length; - toomany = toString (length - 32); - in - "isoImage.volumeID ${config.isoImage.volumeID} is ${howmany} characters. That is ${toomany} characters longer than the limit of 32."; - } - ]; - - boot.loader.grub.version = 2; - - # Don't build the GRUB menu builder script, since we don't need it - # here and it causes a cyclic dependency. - boot.loader.grub.enable = false; - - environment.systemPackages = [ grubPkgs.grub2 grubPkgs.grub2_efi ] - ++ optional canx86BiosBoot pkgs.syslinux - ; - - # In stage 1 of the boot, mount the CD as the root FS by label so - # that we don't need to know its device. We pass the label of the - # root filesystem on the kernel command line, rather than in - # `fileSystems' below. This allows CD-to-USB converters such as - # UNetbootin to rewrite the kernel command line to pass the label or - # UUID of the USB stick. It would be nicer to write - # `root=/dev/disk/by-label/...' here, but UNetbootin doesn't - # recognise that. - boot.kernelParams = - [ "root=LABEL=${config.isoImage.volumeID}" - "boot.shell_on_fail" - ]; - - fileSystems = config.lib.isoFileSystems; - - boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "uas" "overlay" ]; - - boot.initrd.kernelModules = [ "loop" "overlay" ]; - - # Closures to be copied to the Nix store on the CD, namely the init - # script and the top-level system configuration directory. - isoImage.storeContents = - [ config.system.build.toplevel ] ++ - optional config.isoImage.includeSystemBuildDependencies - config.system.build.toplevel.drvPath; - - # Create the squashfs image that contains the Nix store. - system.build.squashfsStore = pkgs.callPackage "${inputs.nixpkgs}/nixos/lib/make-squashfs.nix" { - storeContents = config.isoImage.storeContents; - comp = config.isoImage.squashfsCompression; - }; - - # Individual files to be included on the CD, outside of the Nix - # store on the CD. - isoImage.contents = - [ - { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; - target = "/boot/" + config.system.boot.loader.kernelFile; - } - { source = config.system.build.initialRamdisk + "/" + config.system.boot.loader.initrdFile; - target = "/boot/" + config.system.boot.loader.initrdFile; - } - { source = config.system.build.squashfsStore; - target = "/nix-store.squashfs"; - } - { source = pkgs.writeText "version" config.system.nixos.label; - target = "/version.txt"; - } - ] ++ optionals canx86BiosBoot [ - { source = config.isoImage.splashImage; - target = "/isolinux/background.png"; - } - { source = pkgs.substituteAll { - name = "isolinux.cfg"; - src = pkgs.writeText "isolinux.cfg-in" isolinuxCfg; - bootRoot = "/boot"; - }; - target = "/isolinux/isolinux.cfg"; - } - { source = "${pkgs.syslinux}/share/syslinux"; - target = "/isolinux"; - } - ] ++ optionals config.isoImage.makeEfiBootable [ - { source = efiImg; - target = "/boot/efi.img"; - } - { source = "${efiDir}/EFI"; - target = "/EFI"; - } - { source = (pkgs.writeTextDir "grub/loopback.cfg" "source /EFI/boot/grub.cfg") + "/grub"; - target = "/boot/grub"; - } - { source = config.isoImage.efiSplashImage; - target = "/EFI/boot/efi-background.png"; - } - ] ++ optionals (config.boot.loader.grub.memtest86.enable && canx86BiosBoot) [ - { source = "${pkgs.memtest86plus}/memtest.bin"; - target = "/boot/memtest.bin"; - } - ] ++ optionals (config.isoImage.grubTheme != null) [ - { source = config.isoImage.grubTheme; - target = "/EFI/boot/grub-theme"; - } - ]; - - boot.loader.timeout = 10; - - # Create the ISO image. - system.build.isoImage = pkgs.callPackage "${inputs.nixpkgs}/nixos/lib/make-iso9660-image.nix" ({ - inherit (config.isoImage) isoName compressImage volumeID contents; - bootable = canx86BiosBoot; - bootImage = "/isolinux/isolinux.bin"; - syslinux = if canx86BiosBoot then pkgs.syslinux else null; - } // optionalAttrs (config.isoImage.makeUsbBootable && canx86BiosBoot) { - usbBootable = true; - isohybridMbrImage = "${pkgs.syslinux}/share/syslinux/isohdpfx.bin"; - } // optionalAttrs config.isoImage.makeEfiBootable { - efiBootable = true; - efiBootImage = "boot/efi.img"; - }); - - boot.postBootCommands = - '' - # After booting, register the contents of the Nix store on the - # CD in the Nix database in the tmpfs. - ${config.nix.package.out}/bin/nix-store --load-db < /nix/store/nix-path-registration - - # nixos-rebuild also requires a "system" profile and an - # /etc/NIXOS tag. - touch /etc/NIXOS - ${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system - ''; - - # Add vfat support to the initrd to enable people to copy the - # contents of the CD to a bootable USB stick. - boot.initrd.supportedFilesystems = [ "vfat" ]; - - }; - -} diff --git a/nixos/profiles/oracle-cloud.nix b/nixos/profiles/oracle-cloud.nix deleted file mode 100644 index 101556c..0000000 --- a/nixos/profiles/oracle-cloud.nix +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - lib, - roots, - ... -}: -with lib; { - imports = [ - (roots.nixos + "/profiles/vps.nix") - ]; - - magic_rb.grub = { - enable = true; - efi.enable = true; - devices = ["nodev"]; - }; - - networking.interfaces.ens3.useDHCP = true; - - time.timeZone = "Europe/Bratislava"; - security.pki.certificates = - singleton (builtins.readFile (roots.flake + "/redalder.org.crt")); -} diff --git a/nixos/profiles/vps.nix b/nixos/profiles/vps.nix deleted file mode 100644 index 9b0ea6e..0000000 --- a/nixos/profiles/vps.nix +++ /dev/null @@ -1,43 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - lib, - roots, - inputs, - pkgs, - ... -}: -with lib; { - imports = [ - (roots.nixos + "/modules") - inputs.home-manager.nixosModules.home-manager - inputs.serokell-nix.nixosModules.acme-sh - ]; - - home-manager.users."main" = {config, ...}: { - imports = [(roots.home-manager + "/modules")]; - magic_rb.programs.bash.enable = true; - - home.packages = with pkgs; [ - htop - ]; - }; - - zramSwap.enable = true; - - magic_rb = { - flakes.enable = true; - sshdEmacs.enable = true; - vpsRemoteAccess = { - enable = true; - trustedWheel = true; - }; - }; - - networking.firewall.enable = true; - - time.timeZone = "Europe/Bratislava"; - security.pki.certificates = - singleton (builtins.readFile (roots.flake + "/redalder.org.crt")); -} diff --git a/nixos/profiles/workstation.nix b/nixos/profiles/workstation.nix deleted file mode 100644 index 79950a6..0000000 --- a/nixos/profiles/workstation.nix +++ /dev/null @@ -1,100 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - lib, - roots, - inputs, - pkgs, - ... -}: -with lib; { - imports = [ - inputs.home-manager.nixosModules.home-manager - (roots.nixos + "/modules") - ]; - - documentation.dev.enable = true; - - environment.systemPackages = [ pkgs.man-pages pkgs.man-pages-posix ]; - - magic_rb = { - flakes.enable = true; - sshdEmacs.enable = true; - pulseaudio.enable = true; - - serokell = true; - - xserver = { - enable = true; - xmonad = true; - qwertyNeo2 = true; - mimickInTty = true; - }; - }; - - home-manager.users."main" = {...}: { - imports = [ - (roots.home-manager + "/modules") - ]; - - services.pantalaimon.enable = true; - - magic_rb = { - programs = { - alacritty.enable = true; - bash = { - enable = true; - enableDirenv = true; - }; - ssh.enable = true; - emacs = { - enable = true; - enableMu4e = true; - }; - xmonad.enable = true; - gpg.enable = true; - multimc.enable = true; - }; - - packageCollections = { - "3dPrinting".enable = true; - cmdline.enable = true; - graphical.enable = true; - webdev.enable = true; - }; - }; - }; - - services.syncthing = { - enable = true; - user = "main"; - group = "main"; - }; - - nixpkgs.config.allowUnfree = true; - services.sshd.enable = true; - - # Virtualisation - virtualisation.docker.enable = true; - - # Enable PCSCD for smart card stuff - services.pcscd.enable = true; - - ## Fuck podman, 2021-08-31, `podman info` fails with a stack trace - ## and all containers tested fail with `Operation not supported`... - # virtualisation.podman = { - # enable = true; - # dockerCompat = true; - # }; - - # System emulation - boot.binfmt.emulatedSystems = [ - "aarch64-linux" - "riscv64-linux" - ]; - - time.timeZone = "Europe/Bratislava"; - security.pki.certificates = - singleton (builtins.readFile (roots.flake + "/redalder.org.crt")); -} diff --git a/nixos/secret-lib/default.nix b/nixos/secret-lib/default.nix deleted file mode 100644 index ba5f62b..0000000 --- a/nixos/secret-lib/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - lib, - config, - pkgs, - inputs, - ... -}: -with lib; { - options.magic_rb.secret = mkOption { - description = '' - Magic_RB's secret sause. - ''; - type = types.unspecified; - }; - - config = { - _module.args.secret = config.magic_rb.secret; - - magic_rb.secret = let - secret = "${inputs.secret}/default.nix"; - modules = - evalModules - { - modules = - [ - ./wireguard.nix - ./network.nix - ./password-hashes.nix - ./mounts.nix - ./emacs.nix - ./ical2org.nix - ({...}: {_module.args.pkgs = pkgs;}) - ] - ++ ( - if (builtins.pathExists secret) - then [ secret ] - else builtins.trace "Warning! Not loading any secrets, you may get errors." [] - ); - }; - in - modules.config; - }; -} diff --git a/nixos/secret-lib/emacs.nix b/nixos/secret-lib/emacs.nix deleted file mode 100644 index d014686..0000000 --- a/nixos/secret-lib/emacs.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.emacs; -in { - options.emacs = { - mbsyncrc = mkOption { - type = types.path; - default = pkgs.writeText "mbsyncrb" ""; - }; - - mu4eContexts = mkOption { - type = types.path; - default = pkgs.writeText "mu4e-contexts.el" ""; - }; - }; -} diff --git a/nixos/secret-lib/ical2org.nix b/nixos/secret-lib/ical2org.nix deleted file mode 100644 index 1d5932d..0000000 --- a/nixos/secret-lib/ical2org.nix +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.emacs; -in { - options.ical2org = { - icalUrlCanvas = mkOption { - type = types.str; - default = ""; - }; - icalUrlRooster = mkOption { - type = types.str; - default = ""; - }; - - orgPath = mkOption { - type = types.str; - default = ""; - }; - }; -} diff --git a/nixos/secret-lib/mounts.nix b/nixos/secret-lib/mounts.nix deleted file mode 100644 index e867689..0000000 --- a/nixos/secret-lib/mounts.nix +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.mounts; -in { - options.mounts = mkOption { - type = with types; attrsOf (attrsOf unspecified); - description = '' - Mounts - ''; - default = {}; - }; -} diff --git a/nixos/secret-lib/network.nix b/nixos/secret-lib/network.nix deleted file mode 100644 index 11e56d9..0000000 --- a/nixos/secret-lib/network.nix +++ /dev/null @@ -1,63 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{lib, ...}: -with lib; -let - mkIpOption = - mkOption { - description = '' - Host IP - ''; - type = types.str; - default = ""; - }; - mkNetworkOption = - mkOption { - description = '' - Network IPs - ''; - type = types.str; - default = ""; - }; -in -{ - options = { - network.ips = { - vault.dns = mkIpOption; - vault.vpn = mkIpOption; - blowhole.dns = mkIpOption; - blowhole.ip = mkIpOption; - blowhole.vpn = mkIpOption; - heater = mkIpOption; - edge.vpn = mkIpOption; - omen.vpn = mkIpOption; - toothpick = mkIpOption; - woodchip = mkIpOption; - media = mkIpOption; - }; - - network.dhcpd.blowhole-lan = mkOption { - description = '' - Secret config specific to blowhole's lan dhcpcd. - ''; - type = types.str; - default = ""; - }; - - network.dhcpd.blowhole-wlan = mkOption { - description = '' - Secret config specific to blowhole's wlan dhcpcd. - ''; - type = types.str; - default = ""; - }; - - network.networks = { - home.inner = mkNetworkOption; - home.outer = mkNetworkOption; - home.mine = mkNetworkOption; - vpn = mkNetworkOption; - }; - }; -} diff --git a/nixos/secret-lib/password-hashes.nix b/nixos/secret-lib/password-hashes.nix deleted file mode 100644 index e6decce..0000000 --- a/nixos/secret-lib/password-hashes.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{lib, ...}: -with lib; -let - mkPasswordHashOptions = - users: - genAttrs - users - (user: - mkOption { - description = '' - Password hash for user ${user}. - ''; - type = with types; str; - default = ""; - }); -in -{ - options = { - passwordHashes = mkPasswordHashOptions [ "main" ]; - }; -} diff --git a/nixos/secret-lib/wireguard.nix b/nixos/secret-lib/wireguard.nix deleted file mode 100644 index ac3b64a..0000000 --- a/nixos/secret-lib/wireguard.nix +++ /dev/null @@ -1,118 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{lib, ...}: -with lib; { - options = { - wireguard = mkOption { - description = '' - Wireguard machine specific settings. - ''; - type = with types; - attrsOf ( - submodule - { - options = { - ips = mkOption { - description = '' - IP addresses. - ''; - type = listOf str; - default = []; - }; - - listenPort = mkOption { - description = '' - Listen port. - ''; - type = port; - }; - - privateKeyFile = mkOption { - description = '' - Path to private key - ''; - type = str; - }; - - postSetup = mkOption { - description = '' - Post setup script. - ''; - type = coercedTo (listOf str) (concatStringsSep "\n") lines; - default = ""; - }; - - peers = mkOption { - description = '' - List of peers. - ''; - type = listOf ( - submodule - { - options = { - publicKey = mkOption { - description = '' - Peer public key. - ''; - type = str; - }; - allowedIPs = mkOption { - description = '' - Allowed IPs for peer. - ''; - type = listOf str; - }; - endpoint = mkOption { - description = '' - Peer endpoint. - ''; - type = nullOr str; - default = null; - }; - persistentKeepalive = mkOption { - description = '' - Persistent keepalive. - ''; - type = nullOr int; - default = null; - }; - dynamicEndpointRefreshSeconds = mkOption { - description = '' - dynamicEndpointRefreshSeconds. - ''; - type = int; - default = 0; - }; - }; - } - ); - default = []; - }; - }; - } - ); - default = {}; - example = - literalExample - '' - { - heater = { - ips = - [ "stuff" ]; - listenPort = 0; - privateKeyFile = "stuff"; - peers = [ - { publicKey = - "stuff"; - allowedIPs = - [ "stuff" - ]; - }; - ]; - } - } - ''; - }; - }; -} diff --git a/nixos/systems/0001-Add-Nix-integration.patch b/nixos/systems/0001-Add-Nix-integration.patch deleted file mode 100644 index 442287d..0000000 --- a/nixos/systems/0001-Add-Nix-integration.patch +++ /dev/null @@ -1,287 +0,0 @@ -From ce5fb5686e7d54f51dc15aeb1ef4ec08d5635740 Mon Sep 17 00:00:00 2001 -From: main -Date: Tue, 25 Oct 2022 17:22:50 +0200 -Subject: [PATCH] Add Nix integration - -Signed-off-by: main ---- - drivers/docker/config.go | 19 ++++++- - drivers/docker/driver.go | 52 +++++++++++++++++-- - drivers/docker/nix.go | 109 +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 176 insertions(+), 4 deletions(-) - create mode 100644 drivers/docker/nix.go - -diff --git a/drivers/docker/config.go b/drivers/docker/config.go -index 40d98966a..9aa26458f 100644 ---- a/drivers/docker/config.go -+++ b/drivers/docker/config.go -@@ -108,6 +108,10 @@ func PluginLoader(opts map[string]string) (map[string]interface{}, error) { - conf["nvidia_runtime"] = v - } - -+ if v, ok := opts["docker.gcroots_dir"]; ok { -+ conf["gcroots_dir"] = v -+ } -+ - return conf, nil - } - -@@ -281,6 +285,11 @@ var ( - hclspec.NewLiteral(`"5m"`), - ), - -+ "gcroots_dir": hclspec.NewDefault( -+ hclspec.NewAttr("gcroots_dir", "string", false), -+ hclspec.NewLiteral(`"/nix/var/nix/gcroots/nomad-docker"`), -+ ), -+ - // the duration that the driver will wait for activity from the Docker engine during an image pull - // before canceling the request - "pull_activity_timeout": hclspec.NewDefault( -@@ -327,7 +336,7 @@ var ( - // taskConfigSpec is the hcl specification for the driver config section of - // a task within a job. It is returned in the TaskConfigSchema RPC - taskConfigSpec = hclspec.NewObject(map[string]*hclspec.Spec{ -- "image": hclspec.NewAttr("image", "string", true), -+ "image": hclspec.NewAttr("image", "string", false), - "advertise_ipv6_address": hclspec.NewAttr("advertise_ipv6_address", "bool", false), - "args": hclspec.NewAttr("args", "list(string)", false), - "auth": hclspec.NewBlock("auth", false, hclspec.NewObject(map[string]*hclspec.Spec{ -@@ -402,6 +411,9 @@ var ( - "volumes": hclspec.NewAttr("volumes", "list(string)", false), - "volume_driver": hclspec.NewAttr("volume_driver", "string", false), - "work_dir": hclspec.NewAttr("work_dir", "string", false), -+ -+ "nix_flake_ref": hclspec.NewAttr("nix_flake_ref", "string", false), -+ "nix_flake_sha": hclspec.NewAttr("nix_flake_sha", "string", false), - }) - - // driverCapabilities represents the RPC response for what features are -@@ -474,6 +486,9 @@ type TaskConfig struct { - VolumeDriver string `codec:"volume_driver"` - WorkDir string `codec:"work_dir"` - -+ NixFlakeRef string `codec:"nix_flake_ref"` -+ NixFlakeSha string `codec:"nix_flake_sha"` -+ - // MountsList supports the pre-1.0 mounts array syntax - MountsList []DockerMount `codec:"mounts"` - } -@@ -642,6 +657,8 @@ type DriverConfig struct { - ExtraLabels []string `codec:"extra_labels"` - Logging LoggingConfig `codec:"logging"` - -+ GCRootsDir string `codec:"gcroots_dir"` -+ - AllowRuntimesList []string `codec:"allow_runtimes"` - allowRuntimes map[string]struct{} `codec:"-"` - } -diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go -index 0aa993845..812952fad 100644 ---- a/drivers/docker/driver.go -+++ b/drivers/docker/driver.go -@@ -14,6 +14,7 @@ import ( - "strings" - "sync" - "time" -+ "os/exec" - - docker "github.com/fsouza/go-dockerclient" - "github.com/hashicorp/consul-template/signals" -@@ -254,7 +255,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive - return nil, nil, fmt.Errorf("failed to decode driver config: %v", err) - } - -- if driverConfig.Image == "" { -+ if driverConfig.Image == "" && !(driverConfig.NixFlakeRef != "" && driverConfig.NixFlakeSha != "") { - return nil, nil, fmt.Errorf("image name required for docker driver") - } - -@@ -269,6 +270,47 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive - return nil, nil, fmt.Errorf("Failed to connect to docker daemon: %s", err) - } - -+ if driverConfig.NixFlakeRef != "" && driverConfig.NixFlakeSha != "" { -+ driverConfig.Image = "magicrb/nix-container-base@sha256:01f199486f5b0e3c90411d700436395f21154f8234b6dfa86eb224eb5b6ad43b"; -+ -+ nixExecutable, err := exec.LookPath("nix") -+ if err != nil { -+ return nil, nil, fmt.Errorf("failed to find `nix` executable") -+ } -+ -+ err = NixBuildFlake(nixExecutable, driverConfig.NixFlakeRef, driverConfig.NixFlakeSha) -+ if err != nil { -+ return nil, nil, err -+ } -+ -+ deps, err := NixGetDeps(nixExecutable, driverConfig.NixFlakeRef) -+ if err != nil { -+ return nil, nil, err -+ } -+ -+ for _, dep := range deps { -+ var mount DockerMount -+ mount.Type = "bind" -+ mount.Target = dep; -+ mount.Source = dep; -+ mount.ReadOnly = true; -+ -+ driverConfig.Mounts = append(driverConfig.Mounts, mount); -+ } -+ -+ storePath, err := NixGetStorePath(nixExecutable, driverConfig.NixFlakeRef) -+ if err != nil { -+ return nil, nil, err -+ } -+ -+ driverConfig.Entrypoint[0] = storePath + "/" + driverConfig.Entrypoint[0] -+ -+ os.Symlink(storePath, GetGCRoot(d.config.GCRootsDir, cfg.Name, cfg.AllocID)) -+ } -+ if (driverConfig.NixFlakeRef != "") != (driverConfig.NixFlakeSha != "") { -+ d.logger.Warn("one of either nix_flake_ref or nix_flake_sha is not set", "container_id", cfg.ID, "nix_flake_ref", driverConfig.NixFlakeRef, "nix_flake_sha", driverConfig.NixFlakeSha) -+ } -+ - id, err := d.createImage(cfg, &driverConfig, client) - if err != nil { - return nil, nil, err -@@ -1263,7 +1305,7 @@ func (d *Driver) toDockerMount(m *DockerMount, task *drivers.TaskConfig) (*docke - - // paths inside alloc dir are always allowed as they mount within - // a container, and treated as relative to task dir -- if !d.config.Volumes.Enabled && !isParentPath(task.AllocDir, hm.Source) { -+ if !d.config.Volumes.Enabled && !isParentPath(task.AllocDir, hm.Source) && !isParentPath("/nix/store", hm.Source) { - return nil, fmt.Errorf( - "volumes are not enabled; cannot mount host path: %q %q", - hm.Source, task.AllocDir) -@@ -1425,7 +1467,11 @@ func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) e - return drivers.ErrTaskNotFound - } - -- return h.Kill(timeout, signal) -+ err := h.Kill(timeout, signal) -+ -+ os.Remove(GetGCRoot(d.config.GCRootsDir, h.task.Name, h.task.AllocID)) -+ -+ return err - } - - func (d *Driver) DestroyTask(taskID string, force bool) error { -diff --git a/drivers/docker/nix.go b/drivers/docker/nix.go -new file mode 100644 -index 000000000..426cc51fd ---- /dev/null -+++ b/drivers/docker/nix.go -@@ -0,0 +1,109 @@ -+package docker -+ -+import ( -+ "fmt" -+ "os/exec" -+ "strings" -+ "encoding/json" -+) -+ -+func NixGetDeps(executable string, flakeRef string) ([]string, error) { -+ nixDepsCmd := &exec.Cmd { -+ Path: executable, -+ Args: []string{ -+ executable, -+ "path-info", -+ "-r", -+ flakeRef, -+ }, -+ } -+ res, err := nixDepsCmd.Output() -+ if err != nil { -+ return nil, fmt.Errorf("failed to get dependencies of built flake-ref %s", flakeRef) -+ } -+ deps := strings.Split(strings.Trim(string(res), " \n"), "\n") -+ -+ return deps, nil -+} -+ -+func NixBuildFlake(executable string, flakeRef string, flakeSha string) error { -+ -+ flakeHost := strings.Split(flakeRef, "#") -+ -+ if len(flakeHost) != 2 { -+ return fmt.Errorf("Invalid flake ref.") -+ } -+ -+ nixShaCmd := &exec.Cmd { -+ Path: executable, -+ Args: []string{ -+ executable, -+ "flake", -+ "metadata", -+ "--json", -+ flakeHost[0], -+ }, -+ } -+ nixSha, err := nixShaCmd.Output() -+ if err != nil { -+ return fmt.Errorf("failed to get sha for flake-ref %s with %s:\n %s", flakeRef, err, string(nixSha)) -+ } -+ -+ var shaJson map[string]interface{} -+ err = json.Unmarshal(nixSha, &shaJson) -+ -+ if err != nil { -+ return fmt.Errorf("failed to parse json %s", err) -+ } -+ -+ lockedVal, ok := shaJson["locked"].(map[string]interface{}) -+ if !ok { -+ return fmt.Errorf("failed to parse `nix flake metadata` output") -+ } -+ fetchedSha, ok := lockedVal["narHash"].(string) -+ if !ok { -+ return fmt.Errorf("failed to parse `nix flake metadata` output") -+ } -+ -+ if string(fetchedSha) != flakeSha { -+ return fmt.Errorf("pinned flake sha doesn't match: \"%s\" != \"%s\"", flakeSha, fetchedSha) -+ } -+ -+ nixBuildCmd := &exec.Cmd { -+ Path: executable, -+ Args: []string{ -+ executable, -+ "build", -+ "--no-link", -+ flakeRef, -+ }, -+ } -+ res, err := nixBuildCmd.Output() -+ if err != nil { -+ return fmt.Errorf("failed to build flake-ref %s with %s:\n %s", flakeRef, err, string(res)) -+ } -+ -+ return nil -+} -+ -+func NixGetStorePath(executable string, flakeRef string) (string, error) { -+ nixEvalCmd := exec.Cmd { -+ Path: executable, -+ Args: []string{ -+ executable, -+ "eval", -+ "--raw", -+ flakeRef + ".outPath", -+ }, -+ } -+ -+ storePath, err := nixEvalCmd.Output() -+ if err != nil { -+ return "", fmt.Errorf("failed to get store path of %s", flakeRef) -+ } -+ return string(storePath), nil -+} -+ -+func GetGCRoot(gcRootsDir string, containerName string, allocationId string) string { -+ return fmt.Sprintf("%s/%s-%s", gcRootsDir, containerName, allocationId) -+} --- -2.37.1 - diff --git a/nixos/systems/0001-Revert-Change-consul-SI-tokens-to-be-local.patch b/nixos/systems/0001-Revert-Change-consul-SI-tokens-to-be-local.patch deleted file mode 100644 index f10f6f6..0000000 --- a/nixos/systems/0001-Revert-Change-consul-SI-tokens-to-be-local.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ba55d4ee4e05fd7b5c885ad91132a333651c80e1 Mon Sep 17 00:00:00 2001 -From: main -Date: Sat, 30 Jul 2022 15:48:33 +0200 -Subject: [PATCH] Revert "Change consul SI tokens to be local" - -This reverts commit 7bfb482b1ef3a1bf0138c2f9e00700466127c3fc. ---- - nomad/consul.go | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/nomad/consul.go b/nomad/consul.go -index 7eac19ff8..3c238a8c8 100644 ---- a/nomad/consul.go -+++ b/nomad/consul.go -@@ -290,7 +290,6 @@ func (c *consulACLsAPI) CreateToken(ctx context.Context, sir ServiceIdentityRequ - Description: sir.Description(), - ServiceIdentities: []*api.ACLServiceIdentity{{ServiceName: service}}, - Namespace: sir.ConsulNamespace, -- Local: true, - } - - // Ensure we are under our rate limit. --- -2.36.1 - diff --git a/nixos/systems/blowhole/999-hostapd-2.10-lar.patch b/nixos/systems/blowhole/999-hostapd-2.10-lar.patch deleted file mode 100644 index d5159e8..0000000 --- a/nixos/systems/blowhole/999-hostapd-2.10-lar.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -3459,6 +3459,8 @@ - conf->noscan = atoi(pos); - } else if (os_strcmp(buf, "ht_coex") == 0) { - conf->no_ht_coex = !atoi(pos); -+ } else if (os_strcmp(buf, "intel_lar") == 0) { -+ conf->intel_lar = atoi(pos); - } else if (os_strcmp(buf, "ieee80211n") == 0) { - conf->ieee80211n = atoi(pos); - } else if (os_strcmp(buf, "ht_capab") == 0) { ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -1050,6 +1050,7 @@ - u16 ht_capab; - int noscan; - int no_ht_coex; -+ int intel_lar; - int ieee80211n; - int secondary_channel; - int no_pri_sec_switch; ---- a/src/ap/hw_features.c -+++ b/src/ap/hw_features.c -@@ -26,6 +26,17 @@ - #include "beacon.h" - #include "hw_features.h" - -+static void ieee80211n_do_nothing(struct hostapd_iface *iface) -+{ -+ wpa_printf(MSG_DEBUG, -+ "Scan finished!"); -+} -+ -+static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface, -+ struct wpa_driver_scan_params *params); -+static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface, -+ struct wpa_driver_scan_params *params); -+ - - void hostapd_free_hw_features(struct hostapd_hw_modes *hw_features, - size_t num_hw_features) -@@ -82,6 +93,33 @@ - - if (hostapd_drv_none(hapd)) - return -1; -+ -+ //if (!iface->conf->noscan) { -+ if (iface->conf->intel_lar && !iface->conf->noscan) { -+ // scan -+ struct wpa_driver_scan_params params; -+ int ret1; -+ -+ os_memset(¶ms, 0, sizeof(params)); -+ ieee80211n_scan_channels_5g(iface, ¶ms); -+ -+ ret1 = hostapd_driver_scan(iface->bss[0], ¶ms); -+ -+ if (ret1 == -EBUSY) { -+ wpa_printf(MSG_ERROR, -+ "Failed to request a scan of neighboring BSSes ret=%d (%s)!", -+ ret1, strerror(-ret1)); -+ } -+ -+ if (ret1 == 0) { -+ iface->scan_cb = ieee80211n_do_nothing; -+ wpa_printf(MSG_DEBUG, -+ "Sleeping..."); -+ for (int i=0; i<110; i++) { -+ usleep(100000); -+ } -+ } -+ } - modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags, - &dfs_domain); - if (modes == NULL) { - -@@ -308,7 +346,6 @@ - sec_chan); - } - -- - static void ieee80211n_check_scan(struct hostapd_iface *iface) - { - struct wpa_scan_results *scan_res; -@@ -517,8 +554,10 @@ - int ret; - - /* Check that HT40 is used and PRI / SEC switch is allowed */ -- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch) -+ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch || iface->conf->noscan) { -+ wpa_printf(MSG_DEBUG, "Not scanning due to noscan?"); - return 0; -+ } - - hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); - wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling " -@@ -916,7 +954,7 @@ - if (!hostapd_is_usable_edmg(iface)) - return 0; - -- if (!iface->conf->secondary_channel) -+ if (!iface->conf->secondary_channel || iface->conf->noscan) - return 1; - - if (hostapd_is_usable_chan(iface, iface->freq + - diff --git a/nixos/systems/blowhole/bind.nix b/nixos/systems/blowhole/bind.nix deleted file mode 100644 index 664b87e..0000000 --- a/nixos/systems/blowhole/bind.nix +++ /dev/null @@ -1,174 +0,0 @@ -{ pkgs, ... }: -let - loggingConfig = '' - logging { - channel default_file { - file "/var/log/named/default.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel general_file { - file "/var/log/named/general.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel database_file { - file "/var/log/named/database.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel security_file { - file "/var/log/named/security.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel config_file { - file "/var/log/named/config.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel resolver_file { - file "/var/log/named/resolver.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel xfer-in_file { - file "/var/log/named/xfer-in.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel xfer-out_file { - file "/var/log/named/xfer-out.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel notify_file { - file "/var/log/named/notify.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel client_file { - file "/var/log/named/client.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel unmatched_file { - file "/var/log/named/unmatched.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel queries_file { - file "/var/log/named/queries.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel network_file { - file "/var/log/named/network.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel update_file { - file "/var/log/named/update.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel dispatch_file { - file "/var/log/named/dispatch.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel dnssec_file { - file "/var/log/named/dnssec.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - channel lame-servers_file { - file "/var/log/named/lame-servers.log" versions 3 size 5m; - severity dynamic; - print-time yes; - }; - - category default { default_file; }; - category general { general_file; }; - category database { database_file; }; - category security { security_file; }; - category config { config_file; }; - category resolver { resolver_file; }; - category xfer-in { xfer-in_file; }; - category xfer-out { xfer-out_file; }; - category notify { notify_file; }; - category client { client_file; }; - category unmatched { unmatched_file; }; - category queries { queries_file; }; - category network { network_file; }; - category update { update_file; }; - category dispatch { dispatch_file; }; - category dnssec { dnssec_file; }; - category lame-servers { lame-servers_file; }; - }; - ''; -in -{ - systemd.tmpfiles.rules = [ - "d /var/log/named 0750 named named - -" - ]; - - services.bind = { - enable = true; - forward = "only"; - forwarders = [ - "127.0.0.1 port 5353" - ]; - - directory = "/var/lib/bind"; - zones = { - "in.redalder.org" = { - file = ./zones/in.redalder.org.zone; - master = true; - }; - "hosts.in.redalder.org" = { - file = ./zones/hosts.in.redalder.org.zone; - master = true; - }; - # "youtube.com" = { - # file = ./zones/blocked.zone; - # master = true; - # }; - }; - - cacheNetworks = [ - "127.0.0.0/8" - "10.64.3.0/24" - "10.64.2.0/24" - "10.64.99.0/24" - "10.64.1.0/24" - "10.64.0.0/24" - "172.26.64.0/20" - ]; - extraConfig = '' - ${loggingConfig} - ''; - extraOptions = '' - # recursion yes; - dnssec-validation auto; - ''; - # extraConfig = '' - # zone "consul.in.redalder.org" IN { - # type forward; - # forward only; - # forwarders { 10.64.1.201 port 8600; }; - # }; - # ''; - }; - - systemd.services.bind = { - before = [ "network-online.target" ]; - }; - - networking.firewall.allowedTCPPorts = [ - 53 - ]; - networking.firewall.allowedUDPPorts = [ - 53 - ]; -} diff --git a/nixos/systems/blowhole/consul.nix b/nixos/systems/blowhole/consul.nix deleted file mode 100644 index b8b2047..0000000 --- a/nixos/systems/blowhole/consul.nix +++ /dev/null @@ -1,83 +0,0 @@ -{inputs, lib, config, pkgs, secret, ...}: -with lib; -let -in -{ - services.hashicorp.vault-agent = { - settings.template = singleton { - source = pkgs.writeText "consul.json.vtmpl" - '' - { - "encrypt": "{{ with secret "kv/data/homelab-1/blowhole/consul/encryption_key" }}{{ or .Data.data.key "" }}{{ end }}", - "acl": { - "tokens": { - "agent": "{{ with secret "kv/data/homelab-1/blowhole/consul/agent_token" }}{{ or .Data.data.secret "" }}{{ end }}", - "default": "{{ with secret "kv/data/homelab-1/blowhole/consul/anonymous_token" }}{{ or .Data.data.secret "" }}{{ end }}" - } - } - } - ''; - destination = "/run/secrets/consul.json"; - command = pkgs.writeShellScript "consul-command" - '' - sudo systemctl try-reload-or-restart hashicorp-consul.service - ''; - }; - }; - - systemd.services.hashicorp-consul.unitConfig = { - ConditionPathExists = "/run/secrets/consul.json"; - }; - - services.hashicorp.consul = { - enable = true; - - extraSettingsPaths = - [ "/run/secrets/consul.json" - ]; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.consul; - - settings = { - datacenter = "homelab-1"; - data_dir = "/var/lib/consul"; - log_level = "INFO"; - - server = true; - - bind_addr = secret.network.ips.blowhole.ip; - client_addr = secret.network.ips.blowhole.ip; - - primary_datacenter = "homelab-1"; - - acl = { - enabled = true; - default_policy = "deny"; - enable_token_persistence = true; - }; - - ports = { - http = 8500; - grpc = 8502; - }; - - connect = { - enabled = true; - }; - - ca_file = "/var/secrets/consul-ca.crt"; - # cert_file = "" - # key_file = "" - verify_incoming = false; - verify_outgoing = false; - verify_server_hostname = false; - - ui_config.enabled = true; - domain = "consul.in.redalder.org"; - }; - }; - - systemd.services.hashicorp-consul.serviceConfig = { - LimitNOFILE = mkForce "infinity"; - LimitNPROC = mkForce "infinity"; - }; -} diff --git a/nixos/systems/blowhole/default.nix b/nixos/systems/blowhole/default.nix deleted file mode 100644 index 52069c0..0000000 --- a/nixos/systems/blowhole/default.nix +++ /dev/null @@ -1,180 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "blowhole"; - module = { - pkgs, - config, - lib, - secret, - roots, - inputs, - ... - }: - { - imports = [ - (roots.nixos + "/profiles/vps.nix") - (roots.nixos + "/systems/blowhole/consul.nix") - (roots.nixos + "/systems/blowhole/nomad.nix") - (roots.nixos + "/systems/blowhole/vault.nix") - (roots.nixos + "/systems/blowhole/bind.nix") - (roots.nixos + "/systems/blowhole/vault-agent.nix") - (roots.nixos + "/systems/blowhole/nas.nix") - (roots.nixos + "/systems/blowhole/firewall.nix") - (roots.nixos + "/systems/blowhole/ical2org.nix") - (roots.nixos + "/systems/blowhole/hostapd.nix") - (roots.nixos + "/systems/blowhole/klipper.nix") - (roots.nixos + "/systems/blowhole/monitoring.nix") - (roots.nixos + "/systems/blowhole/uterranix.nix") - ]; - - home-manager.users."main" = {...}: { - home.stateVersion = "21.05"; - }; - - magic_rb = { - grub = { - enable = true; - devices = [ "/dev/disk/by-id/usb-Verbatim_STORE_N_GO_072124E3712B7287-0:0" ]; - }; - - hardware.blowhole = true; - sshdEmacs.enable = true; - }; - - _module.args.nixinate = { - host = "blowhole.hosts.in.redalder.org"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - systemd.services.nfs-mountd.serviceConfig = { - LimitNOFILE = 8192; - }; - - systemd.watchdog.runtimeTime = "60s"; - systemd.watchdog.rebootTime = "10m"; - systemd.watchdog.kexecTime = "5m"; - systemd.services."emergency".serviceConfig.ExecStartPre = "/bin/sh -c \"read -t 30 || /run/current-system/sw/bin/systemctl reboot\""; - - services.nfs.server = { - enable = true; - lockdPort = 4001; - mountdPort = 4002; - statdPort = 4000; - exports = '' - /var/nfs/jellyfin/cache 10.64.2.1/32(rw,subtree_check,async,no_root_squash,crossmnt) - /var/nfs/jellyfin/config 10.64.2.1/32(rw,subtree_check,async,no_root_squash,crossmnt) - /var/nfs/jellyfin/media 10.64.2.1/32(rw,subtree_check,async,no_root_squash,crossmnt) - - /var/nfs/gitea-data 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/gitea-db 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/hydra-data 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/hydra-nix 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/hydra-db 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/minecraft/atm6 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/ingress-letsencrypt 10.64.0.1(rw,subtree_check,async,no_root_squash) - - /var/nfs/Magic_RB 10.64.2.129(rw,subtree_check,async) - /mnt/cartman 10.64.0.8/32(rw,subtree_check,async,no_root_squash,crossmnt) 10.64.2.129(rw,subtree_check,async,crossmnt) - /mnt/kyle 10.64.0.8/32(rw,subtree_check,async,no_root_squash,crossmnt) 10.64.2.129(rw,subtree_check,async,crossmnt) - /mnt/stan 10.64.0.8/32(rw,subtree_check,async,no_root_squash,crossmnt) 10.64.2.129(rw,subtree_check,async,crossmnt) - - /var/nfs/home-assistant_hass 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/home-assistant_db 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/home-assistant_mosquitto 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/home-assistant_zigbee2mqtt 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/syncthing/data 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/syncthing/config 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/syncthing/storage 10.64.2.1/32(rw,subtree_check,async,crossmnt) - - /var/nfs/dovecot/maildir 10.64.0.8/32(rw,subtree_check,async,no_root_squash) 10.64.2.1/32(rw,subtree_check,async,no_root_squash) 10.64.3.20/32(rw,subtree_check,async,no_root_squash) - /var/nfs/getmail/getmail.d 10.64.0.8/32(rw,subtree_check,async,no_root_squash) 10.64.2.1/32(rw,subtree_check,async,no_root_squash) 10.64.3.20/32(rw,subtree_check,async,no_root_squash) - /var/nfs/mail-configuration 10.64.0.8/32(rw,subtree_check,async,no_root_squash) 10.64.2.1/32(rw,subtree_check,async,no_root_squash) 10.64.3.20/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/baikal/specific 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/baikal/config 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - - /var/nfs/matrix/synapse 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/matrix/postgresql 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/matrix/mautrix-facebook 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - /var/nfs/matrix/registrations 10.64.2.1/32(rw,subtree_check,async,no_root_squash) - ''; - }; - - # systemd.tmpfiles.rules = singleton "d /run/cfg/vault 0750 vault vault 1d"; - - networking = { - hostName = "blowhole"; - useDHCP = false; - interfaces.enp7s0f1.useDHCP = true; - - firewall = { - enable = true; - - allowedTCPPorts = [ - 80 - ## Nomad - 4646 - 4647 - 4648 - ## Consul - 8600 # DNS - 8500 # HTTP - 8502 # gRPC - 8300 # server - 8301 # LAN serf - 8302 # WAN serf - ## Vault - 8200 - ## NFS - 111 - 2049 - 4000 - 4001 - 4002 - 20048 - ]; - allowedTCPPortRanges = [ - { - from = 21000; - to = 21999; - } - ]; - allowedUDPPorts = [ - ## Consul - 8600 # DNS - 8301 # LAN serf - 8302 # WAN serf - ## NFS - 111 - 2049 - 4000 - 4001 - 4002 - 20048 - ]; - allowedUDPPortRanges = [ - { - from = 21000; - to = 21999; - } - ]; - }; - hostId = "2cb135ac"; - }; - - system.stateVersion = "21.05"; - }; -} diff --git a/nixos/systems/blowhole/firewall.nix b/nixos/systems/blowhole/firewall.nix deleted file mode 100644 index 7007af1..0000000 --- a/nixos/systems/blowhole/firewall.nix +++ /dev/null @@ -1,323 +0,0 @@ -{ pkgs, secret, config, lib, ... }: -with lib; -let - wlan = "wlp10s0"; - lan = "enp8s0f1"; - wan = "enp3s0"; - doVPN = "do_vpn0"; - - nomad = mapAttrs (const toString) { - inherit (config.services.hashicorp.nomad.settings.client) - min_dynamic_port - max_dynamic_port; - }; -in -{ - boot.kernel.sysctl = { - # Enable forwarding on IPv4 but disable on IPv6 - "net.ipv4.conf.all.forwarding" = true; - "net.ipv6.conf.all.forwarding" = false; - - # source: https://github.com/mdlayher/homelab/blob/master/nixos/routnerr-2/configuration.nix#L52 - # By default, not automatically configure any IPv6 addresses. - "net.ipv6.conf.all.accept_ra" = 0; - "net.ipv6.conf.all.autoconf" = 0; - "net.ipv6.conf.all.use_tempaddr" = 0; - - # On WAN, allow IPv6 autoconfiguration and tempory address use. - # "net.ipv6.conf.${name}.accept_ra" = 2; - # "net.ipv6.conf.${name}.autoconf" = 1; - }; - - services.dnscrypt-proxy2 = { - enable = true; - upstreamDefaults = true; - settings = { - listen_addresses = [ "127.0.0.1:5353" ]; - - dnscrypt_servers = false; - doh_servers = true; - odoh_servers = false; - - block_ipv6 = true; - - static."mullvad".stamp = "sdns://AgcAAAAAAAAAAAAPZG9oLm11bGx2YWQubmV0Ci9kbnMtcXVlcnk"; - static."meganerd".stamp = "sdns://AQcAAAAAAAAADjEzNi4yNDQuOTcuMTE0ICif6V9M6EF_9Xo_MHwkDN4ZJjERopSJN8hBuUWg9YeMJTIuZG5zY3J5cHQtY2VydC5jaGV3YmFjY2EubWVnYW5lcmQubmw"; - sources = {}; - }; - }; - - systemd.services.dnscrypt-proxy2 = { - before = [ "network-online.target" ]; - }; - - services.dhcpd4 = { - enable = true; - interfaces = [ "${lan}" "${wlan}" ]; - extraConfig = '' - option domain-name-servers 10.64.2.1; - option subnet-mask 255.255.255.0; - - subnet 10.64.2.0 netmask 255.255.255.0 { - option broadcast-address 10.64.2.255; - option routers 10.64.2.1; - interface ${lan}; - range 10.64.2.128 10.64.2.254; - - ${secret.network.dhcpd.blowhole-lan} - } - - subnet 10.64.3.0 netmask 255.255.255.0 { - option broadcast-address 10.64.3.255; - option routers 10.64.3.1; - interface ${wlan}; - range 10.64.3.128 10.64.3.254; - - ${secret.network.dhcpd.blowhole-wlan} - } - ''; - }; - - # systemd.services.dns-check = { - # before = [ "network-online.target"]; - # serviceConfig.Type = "oneshot"; - # script = '' - # ''; - # }; - - networking = { - useDHCP = false; - hostName = "blowhole"; - - resolvconf.useLocalResolver = false; - nameservers = [ "10.64.2.1" ]; - - # Disable the in-built iptable based firewall - firewall.enable = mkForce false; - - localCommands = '' - ip link add enp4s0 type dummy || true - ip link set enp4s0 up || true - ip addr add 10.64.2.1/24 dev enp4s0 || true - ''; - - interfaces = { - # Don't do DHCP on the LAN interface - "${lan}" = { - useDHCP = false; - ipv4.addresses = [{ - address = "10.64.2.1"; - prefixLength = 24; - }]; - }; - "${wlan}" = { - useDHCP = false; - ipv4.addresses = [{ - address = "10.64.3.1"; - prefixLength = 24; - }]; - }; - # But do DHCP on the WAN interface - "${wan}".useDHCP = true; - }; - - wireguard = { - enable = true; - interfaces."${doVPN}" = - config.magic_rb.secret.wireguard."${config.networking.hostName}" or {} - // { - listenPort = 6666; - privateKeyFile = "/var/secrets/${doVPN}.key"; - }; - }; - - nftables = { - enable = true; - ruleset = '' - table ip nf_filter { - chain input_out { - ct state { established, related } accept comment "Allow established traffic" - icmp type { echo-request, destination-unreachable, time-exceeded } counter accept comment "Allow select ICMP" - } - - chain input_doVPN { - tcp dport { 4646, 4647, 4648 } accept comment "Nomad traffic" - tcp dport { 8600, 8500, 8502, 8300, 8301, 8302 } accept comment "Consul traffic" - tcp dport { 8200 } accept comment "Vault traffic" - tcp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept comment "NFS traffic" - tcp dport ${nomad.min_dynamic_port}-${nomad.max_dynamic_port} accept comment "Consul Connect sidecar traffic" - tcp dport { 53 } accept comment "DNS traffic" - tcp dport { 80 } accept comment "HTTP traffic" - - udp dport { 8600, 8301, 8302 } comment "Consul traffic" - udp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept comment "NFS traffic" - udp dport ${nomad.min_dynamic_port}-${nomad.max_dynamic_port} accept comment "Consul Connect sidecar traffic" - udp dport { 53 } accept comment "DNS traffic" - } - - chain input { - type filter hook input priority 0; policy drop; - - tcp dport 22 accept comment "Accept SSH traffic always" - iifname != "lo" tcp dport 5353 drop comment "Drop traffic to dnscrypt-proxy always except for localhost to localhost traffic" - - iifname { "nomad", "ve-monitor", "ve-klipper" } oifname { "nomad", "ve-monitor", "ve-klipper" } accept comment "Allow Nomad to do whatever it wants in its interface" - iifname { "${wlan}", "${lan}", "lo" } accept comment "Allow local network to access the router" - iifname { "${wan}", "${doVPN}", "nomad", "docker0", "ve-monitor", "ve-klipper" } jump input_out - iifname { "${doVPN}" } jump input_doVPN - - # Allow containers to reach the DNS server - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } tcp dport 53 accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } udp dport 53 accept - - # Allow Nomad Containers to reach Nomad - iifname { "nomad" } tcp dport 4646 accept - - # Allow proxies to reach consul - iifname { "nomad", "ve-monitor", "ve-klipper" } tcp dport 8500 accept - iifname { "ve-monitor", "ve-klipper" } tcp dport 8502 accept - - # Allow containers to reach the NFS server - iifname { "docker0" } tcp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept comment "NFS traffic" - iifname { "docker0" } udp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept comment "NFS traffic" - - meta nftrace set 1 - } - - chain output { - type filter hook output priority 0; policy accept; - - # Drop all DNS traffic if leaving through "wan" - oifname { "${wan}" } tcp dport 53 drop - oifname { "${wan}" } udp dport 53 drop - # Allow DoT traffic to leave through "wan" if it comes from "lo" - # iifname != { "lo" } oifname { "${wan}" } tcp dport 853 drop - } - - chain forward { - type filter hook forward priority 10; policy drop; - - # Enable flow offloading for better throughput - # ip protocol { tcp, udp } flow offload @f - - # Drop all DNS or DoT traffic if forwarded through "wan" - oifname { "${wan}" } tcp dport 853 drop - oifname { "${wan}" } tcp dport 53 drop - oifname { "${wan}" } udp dport 53 drop - - # Allow trusted LAN to WAN" - iifname { "${lan}", "${wlan}" } oifname { "${wan}" } accept - iifname { "${wan}" } oifname { "${lan}", "${wlan}" } ct state established, related accept - - - iifname { "nomad" } oifname { "${doVPN}", "${lan}", "${wlan}" } accept - iifname { "${doVPN}", "${lan}", "${wlan}" } oifname { "nomad" } accept - iifname { "${doVPN}" } oifname { "${lan}", "${wlan}" } accept - iifname { "${lan}", "${wlan}" } oifname { "${doVPN}" } accept - - # Allow containers to reach WAN - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${wan}" } accept - iifname { "${wan}" } oifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } ct state established, related accept - - # Allow containers to reach the DNS and NFS server - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip daddr 10.64.2.1 tcp dport { 53 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip saddr 10.64.2.1 tcp sport { 53 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip daddr 10.64.2.1 tcp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip saddr 10.64.2.1 tcp sport { 111, 2049, 4000, 4001, 4002, 20048 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip daddr 10.64.2.1 udp dport { 53 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip saddr 10.64.2.1 udp sport { 53 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip daddr 10.64.2.1 udp dport { 111, 2049, 4000, 4001, 4002, 20048 } accept - iifname { "nomad", "docker0", "ve-monitor", "ve-klipper" } oifname { "${lan}" } ip saddr 10.64.2.1 udp sport { 111, 2049, 4000, 4001, 4002, 20048 } accept - - - # Rules to make CNI happy - meta mark and 0x01 == 0x01 accept - - meta nftrace set 1 - } - } - - table ip nf_nat { - chain postrouting { - type nat hook postrouting priority 100; policy accept; - oifname "${wan}" masquerade - } - - chain prerouting { - type nat hook prerouting priority 100; policy accept; - } - } - - table ip6 nf_filter { - chain output { - type filter hook output priority 0; policy drop; - - meta nftrace set 1 - - oifname "lo" icmpv6 type { echo-request, destination-unreachable, time-exceeded } counter accept comment "Allow select ICMP" - oifname "lo" ip6 saddr "::1" ip6 daddr "::1" reject - } - chain input { - type filter hook input priority 0; policy drop; - - meta nftrace set 1 - - iifname "lo" icmpv6 type { echo-request, destination-unreachable, time-exceeded } counter accept comment "Allow select ICMP" - } - chain forward { - type filter hook forward priority 0; policy drop; - } - } - ''; - }; - }; - - systemd.services.nftables = { - serviceConfig = - let - rulesScript = pkgs.writeShellScript "nftables-rules" '' - set -ex - export PATH=${pkgs.nftables}/bin:${pkgs.iptables}/bin:${pkgs.bash}/bin:$PATH - - tmpfile="$(mktemp)" - iptables-save -t filter >> $tmpfile - iptables-save -t nat >> $tmpfile - - nft flush ruleset - - cat $tmpfile | iptables-restore - nft -f "${pkgs.writeText "nftables-rules" config.networking.nftables.ruleset}" - rm $tmpfile - - iptables -D FORWARD -j MARK --set-mark 0x01 || true - iptables -D FORWARD -j MARK --set-mark 0x00 || true - - iptables -I FORWARD -j MARK --set-mark 0x01 - iptables -A FORWARD -j MARK --set-mark 0x00 - ''; - in { - ExecStart = mkForce rulesScript; - ExecReload = mkForce rulesScript; - ExecStop = mkForce (pkgs.writeShellScript "nftables-flush" '' - set -ex - export PATH=${pkgs.nftables}/bin:${pkgs.iptables}/bin:${pkgs.bash}/bin:$PATH - - tmpfile="$(mktemp)" - iptables-save -t filter >> $tmpfile - iptables-save -t nat >> $tmpfile - - nft flush ruleset - - cat $tmpfile | iptables-restore - rm $tmpfile - - iptables -D FORWARD -j MARK --set-mark 0x01 || true - iptables -D FORWARD -j MARK --set-mark 0x00 || true - - iptables -I FORWARD -j MARK --set-mark 0x01 - iptables -A FORWARD -j MARK --set-mark 0x00 - ''); - }; - }; -} - diff --git a/nixos/systems/blowhole/hostapd.nix b/nixos/systems/blowhole/hostapd.nix deleted file mode 100644 index ae5e3fe..0000000 --- a/nixos/systems/blowhole/hostapd.nix +++ /dev/null @@ -1,623 +0,0 @@ -{ pkgs, config,lib, ... }: -with lib; -let -in -{ - # giturl="https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/" - # for patch in *.patch - # do - # nix-prefetch-url "$giturl$patch" 2>/dev/null | \ - # sed -e 's~^~{ url = "'"$giturl$patch"'"; sha256 = "~' | sed -e 's~$~"; \}~' - # done - - services.hashicorp.vault-agent.settings.template = singleton { - source = pkgs.writeText "hostapd_wpa_psk.vtmpl" '' - {{ with secret "kv/data/homelab-1/blowhole/hostapd/wpa_psk" -}} - {{ range $key, $value := .Data.data -}} - {{ with $data := $value -}} - {{ $data.mac_address }} {{ $data.psk }} - {{ end -}} - {{ end -}} - {{ end -}} - ''; - destination = "/run/secrets/hostapd_wpa_psk"; - }; - - systemd.services.hostapd.unitConfig = { - ConditionPathExists = "/run/secrets/hostapd_wpa_psk"; - }; - - services.hostapd = { - interface = "wlp10s0"; - driver = "nl80211"; - ssid = "nothing"; - wpa = false; - hwMode = "a"; - channel = 149; - countryCode = "NL"; - enable = true; - extraConfig = '' - wpa=2 - wpa_psk_file=/run/secrets/hostapd_wpa_psk - - ieee80211d=1 - ieee80211h=1 - intel_lar=1 - noscan=0 - beacon_int=100 - channel=149 - chanlist=149 - - tx_queue_data2_burst=2.0 - ieee80211n=1 - ht_coex=0 - ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][MAX-AMSDU-7935][DSSS_CCK-40] - ieee80211ac=1 - vht_oper_chwidth=1 - vht_oper_centr_freq_seg0_idx=155 - vht_capab=[RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE][RX-STBC-1][BF-ANTENNA-4][VHT160][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7] - ieee80211ax=1 - he_oper_chwidth=1 - he_oper_centr_freq_seg0_idx=155 - he_default_pe_duration=4 - he_rts_threshold=1023 - he_mu_edca_qos_info_param_count=0 - he_mu_edca_qos_info_q_ack=0 - he_mu_edca_qos_info_queue_request=0 - he_mu_edca_qos_info_txop_request=0 - he_mu_edca_ac_be_aifsn=8 - he_mu_edca_ac_be_aci=0 - he_mu_edca_ac_be_ecwmin=9 - he_mu_edca_ac_be_ecwmax=10 - he_mu_edca_ac_be_timer=255 - he_mu_edca_ac_bk_aifsn=15 - he_mu_edca_ac_bk_aci=1 - he_mu_edca_ac_bk_ecwmin=9 - he_mu_edca_ac_bk_ecwmax=10 - he_mu_edca_ac_bk_timer=255 - he_mu_edca_ac_vi_ecwmin=5 - he_mu_edca_ac_vi_ecwmax=7 - he_mu_edca_ac_vi_aifsn=5 - he_mu_edca_ac_vi_aci=2 - he_mu_edca_ac_vi_timer=255 - he_mu_edca_ac_vo_aifsn=5 - he_mu_edca_ac_vo_aci=3 - he_mu_edca_ac_vo_ecwmin=5 - he_mu_edca_ac_vo_ecwmax=7 - he_mu_edca_ac_vo_timer=255 - - ap_isolate=1 - bss_load_update_period=60 - chan_util_avg_period=600 - disassoc_low_ack=1 - skip_inactivity_poll=0 - preamble=1 - wmm_enabled=1 - ignore_broadcast_ssid=0 - uapsd_advertisement_enabled=1 - utf8_ssid=1 - multi_ap=0 - - auth_algs=1 - wpa=2 - wpa_pairwise=CCMP - wpa_disable_eapol_key_retries=0 - wpa_key_mgmt=WPA-PSK - okc=0 - disable_pmksa_caching=1 - - bssid=e0:d0:45:81:50:00 - - # bss=wlp10s1 - # ssid=nothing2 - # bssid=e0:d0:45:81:50:01 - - # hw_mode=g - # channel=9 - # vht_capab= - # ht_capab= - - # auth_algs=1 - # wpa=2 - # wpa_pairwise=CCMP - # wpa_disable_eapol_key_retries=0 - # wpa_key_mgmt=WPA-PSK - # okc=0 - # disable_pmksa_caching=1 - # wpa_passphrase=${config.services.hostapd.wpaPassphrase} - ''; - }; - - nixpkgs.overlays = singleton - (final: prev: - { - hostapd = prev.hostapd.overrideAttrs (old: { - buildInputs = old.buildInputs ++ (with pkgs; [ - libubox - ubus - ]); - - src = pkgs.fetchgit { - url = "http://w1.fi/hostap.git"; - rev = "cff80b4f7d3c0a47c052e8187d671710f48939e4"; - sha256 = "sha256-DQ1SiaMP3CbmPFtKKpJe9ASdal3Y5+D3cBHUauKDjGg="; - }; - - extraConfig = '' - # Example hostapd build time configuration - # - # This file lists the configuration options that are used when building the - # hostapd binary. All lines starting with # are ignored. Configuration option - # lines must be commented out complete, if they are not to be included, i.e., - # just setting VARIABLE=n is not disabling that variable. - # - # This file is included in Makefile, so variables like CFLAGS and LIBS can also - # be modified from here. In most cass, these lines should use += in order not - # to override previous values of the variables. - - # Driver interface for Host AP driver - #CONFIG_DRIVER_HOSTAP=y - - # Driver interface for wired authenticator - CONFIG_DRIVER_WIRED=y - - # Driver interface for drivers using the nl80211 kernel interface - CONFIG_DRIVER_NL80211=y - - # QCA vendor extensions to nl80211 - #CONFIG_DRIVER_NL80211_QCA=y - - # driver_nl80211.c requires libnl. If you are compiling it yourself - # you may need to point hostapd to your version of libnl. - # - #CFLAGS += -I$ - #LIBS += -L$ - - # Use libnl v2.0 (or 3.0) libraries. - #CONFIG_LIBNL20=y - - # Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored) - #CONFIG_LIBNL32=y - - - # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver) - #CONFIG_DRIVER_BSD=y - #CFLAGS += -I/usr/local/include - #LIBS += -L/usr/local/lib - #LIBS_p += -L/usr/local/lib - #LIBS_c += -L/usr/local/lib - - # Driver interface for no driver (e.g., RADIUS server only) - #CONFIG_DRIVER_NONE=y - - # IEEE 802.11F/IAPP - CONFIG_IAPP=y - - # WPA2/IEEE 802.11i RSN pre-authentication - CONFIG_RSN_PREAUTH=y - - # IEEE 802.11w (management frame protection) - #CONFIG_IEEE80211W=y - - # Support Operating Channel Validation - #CONFIG_OCV=y - - # Integrated EAP server - CONFIG_EAP=y - - # EAP Re-authentication Protocol (ERP) in integrated EAP server - CONFIG_ERP=y - - # EAP-MD5 for the integrated EAP server - CONFIG_EAP_MD5=y - - # EAP-TLS for the integrated EAP server - CONFIG_EAP_TLS=y - - # EAP-MSCHAPv2 for the integrated EAP server - CONFIG_EAP_MSCHAPV2=y - - # EAP-PEAP for the integrated EAP server - CONFIG_EAP_PEAP=y - - # EAP-GTC for the integrated EAP server - CONFIG_EAP_GTC=y - - # EAP-TTLS for the integrated EAP server - CONFIG_EAP_TTLS=y - - # EAP-SIM for the integrated EAP server - #CONFIG_EAP_SIM=y - - # EAP-AKA for the integrated EAP server - #CONFIG_EAP_AKA=y - - # EAP-AKA' for the integrated EAP server - # This requires CONFIG_EAP_AKA to be enabled, too. - #CONFIG_EAP_AKA_PRIME=y - - # EAP-PAX for the integrated EAP server - #CONFIG_EAP_PAX=y - - # EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK) - #CONFIG_EAP_PSK=y - - # EAP-pwd for the integrated EAP server (secure authentication with a password) - #CONFIG_EAP_PWD=y - - # EAP-SAKE for the integrated EAP server - #CONFIG_EAP_SAKE=y - - # EAP-GPSK for the integrated EAP server - #CONFIG_EAP_GPSK=y - # Include support for optional SHA256 cipher suite in EAP-GPSK - #CONFIG_EAP_GPSK_SHA256=y - - # EAP-FAST for the integrated EAP server - CONFIG_EAP_FAST=y - - # EAP-TEAP for the integrated EAP server - # Note: The current EAP-TEAP implementation is experimental and should not be - # enabled for production use. The IETF RFC 7170 that defines EAP-TEAP has number - # of conflicting statements and missing details and the implementation has - # vendor specific workarounds for those and as such, may not interoperate with - # any other implementation. This should not be used for anything else than - # experimentation and interoperability testing until those issues has been - # resolved. - #CONFIG_EAP_TEAP=y - - # Wi-Fi Protected Setup (WPS) - CONFIG_WPS=y - # Enable UPnP support for external WPS Registrars - #CONFIG_WPS_UPNP=y - # Enable WPS support with NFC config method - #CONFIG_WPS_NFC=y - - # EAP-IKEv2 - #CONFIG_EAP_IKEV2=y - - # Trusted Network Connect (EAP-TNC) - #CONFIG_EAP_TNC=y - - # EAP-EKE for the integrated EAP server - #CONFIG_EAP_EKE=y - - # PKCS#12 (PFX) support (used to read private key and certificate file from - # a file that usually has extension .p12 or .pfx) - CONFIG_PKCS12=y - - # RADIUS authentication server. This provides access to the integrated EAP - # server from external hosts using RADIUS. - #CONFIG_RADIUS_SERVER=y - - # Build IPv6 support for RADIUS operations - CONFIG_IPV6=y - - # IEEE Std 802.11r-2008 (Fast BSS Transition) - CONFIG_IEEE80211R=y - - # Use the hostapd's IEEE 802.11 authentication (ACL), but without - # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) - #CONFIG_DRIVER_RADIUS_ACL=y - - # IEEE 802.11n (High Throughput) support - CONFIG_IEEE80211N=y - - # Wireless Network Management (IEEE Std 802.11v-2011) - # Note: This is experimental and not complete implementation. - CONFIG_WNM=y - - # IEEE 802.11ac (Very High Throughput) support - CONFIG_IEEE80211AC=y - - # IEEE 802.11ax HE support - # Note: This is experimental and work in progress. The definitions are still - # subject to change and this should not be expected to interoperate with the - # final IEEE 802.11ax version. - CONFIG_IEEE80211AX=y - - # Remove debugging code that is printing out debug messages to stdout. - # This can be used to reduce the size of the hostapd considerably if debugging - # code is not needed. - #CONFIG_NO_STDOUT_DEBUG=y - - # Add support for writing debug log to a file: -f /tmp/hostapd.log - # Disabled by default. - #CONFIG_DEBUG_FILE=y - - # Send debug messages to syslog instead of stdout - CONFIG_DEBUG_SYSLOG=y - - # Add support for sending all debug messages (regardless of debug verbosity) - # to the Linux kernel tracing facility. This helps debug the entire stack by - # making it easy to record everything happening from the driver up into the - # same file, e.g., using trace-cmd. - #CONFIG_DEBUG_LINUX_TRACING=y - - # Remove support for RADIUS accounting - #CONFIG_NO_ACCOUNTING=y - - # Remove support for RADIUS - #CONFIG_NO_RADIUS=y - - # Remove support for VLANs - #CONFIG_NO_VLAN=y - - # Enable support for fully dynamic VLANs. This enables hostapd to - # automatically create bridge and VLAN interfaces if necessary. - CONFIG_FULL_DYNAMIC_VLAN=y - - # Use netlink-based kernel API for VLAN operations instead of ioctl() - # Note: This requires libnl 3.1 or newer. - #CONFIG_VLAN_NETLINK=y - - # Remove support for dumping internal state through control interface commands - # This can be used to reduce binary size at the cost of disabling a debugging - # option. - CONFIG_NO_DUMP_STATE=y - - # Enable tracing code for developer debugging - # This tracks use of memory allocations and other registrations and reports - # incorrect use with a backtrace of call (or allocation) location. - #CONFIG_WPA_TRACE=y - # For BSD, comment out these. - #LIBS += -lexecinfo - #LIBS_p += -lexecinfo - #LIBS_c += -lexecinfo - - # Use libbfd to get more details for developer debugging - # This enables use of libbfd to get more detailed symbols for the backtraces - # generated by CONFIG_WPA_TRACE=y. - #CONFIG_WPA_TRACE_BFD=y - # For BSD, comment out these. - #LIBS += -lbfd -liberty -lz - #LIBS_p += -lbfd -liberty -lz - #LIBS_c += -lbfd -liberty -lz - - # hostapd depends on strong random number generation being available from the - # operating system. os_get_random() function is used to fetch random data when - # needed, e.g., for key generation. On Linux and BSD systems, this works by - # reading /dev/urandom. It should be noted that the OS entropy pool needs to be - # properly initialized before hostapd is started. This is important especially - # on embedded devices that do not have a hardware random number generator and - # may by default start up with minimal entropy available for random number - # generation. - # - # As a safety net, hostapd is by default trying to internally collect - # additional entropy for generating random data to mix in with the data - # fetched from the OS. This by itself is not considered to be very strong, but - # it may help in cases where the system pool is not initialized properly. - # However, it is very strongly recommended that the system pool is initialized - # with enough entropy either by using hardware assisted random number - # generator or by storing state over device reboots. - # - # hostapd can be configured to maintain its own entropy store over restarts to - # enhance random number generation. This is not perfect, but it is much more - # secure than using the same sequence of random numbers after every reboot. - # This can be enabled with -e command line option. The specified - # file needs to be readable and writable by hostapd. - # - # If the os_get_random() is known to provide strong random data (e.g., on - # Linux/BSD, the board in question is known to have reliable source of random - # data from /dev/urandom), the internal hostapd random pool can be disabled. - # This will save some in binary size and CPU use. However, this should only be - # considered for builds that are known to be used on devices that meet the - # requirements described above. - CONFIG_NO_RANDOM_POOL=y - - # Should we attempt to use the getrandom(2) call that provides more reliable - # yet secure randomness source than /dev/random on Linux 3.17 and newer. - # Requires glibc 2.25 to build, falls back to /dev/random if unavailable. - CONFIG_GETRANDOM=y - - # Should we use poll instead of select? Select is used by default. - #CONFIG_ELOOP_POLL=y - - # Should we use epoll instead of select? Select is used by default. - CONFIG_ELOOP_EPOLL=y - - # Should we use kqueue instead of select? Select is used by default. - #CONFIG_ELOOP_KQUEUE=y - - # Select TLS implementation - # openssl = OpenSSL (default) - # gnutls = GnuTLS - # internal = Internal TLSv1 implementation (experimental) - # linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental) - # none = Empty template - CONFIG_TLS=openssl - - # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1) - # can be enabled to get a stronger construction of messages when block ciphers - # are used. - #CONFIG_TLSV11=y - - # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2) - # can be enabled to enable use of stronger crypto algorithms. - #CONFIG_TLSV12=y - - # Select which ciphers to use by default with OpenSSL if the user does not - # specify them. - #CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW" - - # If CONFIG_TLS=internal is used, additional library and include paths are - # needed for LibTomMath. Alternatively, an integrated, minimal version of - # LibTomMath can be used. See beginning of libtommath.c for details on benefits - # and drawbacks of this option. - CONFIG_INTERNAL_LIBTOMMATH=y - #ifndef CONFIG_INTERNAL_LIBTOMMATH - #LTM_PATH=/usr/src/libtommath-0.39 - #CFLAGS += -I$(LTM_PATH) - #LIBS += -L$(LTM_PATH) - #LIBS_p += -L$(LTM_PATH) - #endif - # At the cost of about 4 kB of additional binary size, the internal LibTomMath - # can be configured to include faster routines for exptmod, sqr, and div to - # speed up DH and RSA calculation considerably - #CONFIG_INTERNAL_LIBTOMMATH_FAST=y - - # Interworking (IEEE 802.11u) - # This can be used to enable functionality to improve interworking with - # external networks. - CONFIG_INTERWORKING=y - - # Hotspot 2.0 - #CONFIG_HS20=y - - # Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file - #CONFIG_SQLITE=y - - # Enable Fast Session Transfer (FST) - #CONFIG_FST=y - - # Enable CLI commands for FST testing - #CONFIG_FST_TEST=y - - # Testing options - # This can be used to enable some testing options (see also the example - # configuration file) that are really useful only for testing clients that - # connect to this hostapd. These options allow, for example, to drop a - # certain percentage of probe requests or auth/(re)assoc frames. - # - #CONFIG_TESTING_OPTIONS=y - - # Automatic Channel Selection - # This will allow hostapd to pick the channel automatically when channel is set - # to "acs_survey" or "0". Eventually, other ACS algorithms can be added in - # similar way. - # - # Automatic selection is currently only done through initialization, later on - # we hope to do background checks to keep us moving to more ideal channels as - # time goes by. ACS is currently only supported through the nl80211 driver and - # your driver must have survey dump capability that is filled by the driver - # during scanning. - # - # You can customize the ACS survey algorithm with the hostapd.conf variable - # acs_num_scans. - # - # Supported ACS drivers: - # * ath9k - # * ath5k - # * ath10k - # - # For more details refer to: - # http://wireless.kernel.org/en/users/Documentation/acs - # - #CONFIG_ACS=y - - # Multiband Operation support - # These extentions facilitate efficient use of multiple frequency bands - # available to the AP and the devices that may associate with it. - #CONFIG_MBO=y - - # Client Taxonomy - # Has the AP retain the Probe Request and (Re)Association Request frames from - # a client, from which a signature can be produced which can identify the model - # of client device like "Nexus 6P" or "iPhone 5s". - CONFIG_TAXONOMY=y - - # Fast Initial Link Setup (FILS) (IEEE 802.11ai) - #CONFIG_FILS=y - # FILS shared key authentication with PFS - #CONFIG_FILS_SK_PFS=y - - # Include internal line edit mode in hostapd_cli. This can be used to provide - # limited command line editing and history support. - #CONFIG_WPA_CLI_EDIT=y - - # Opportunistic Wireless Encryption (OWE) - # Experimental implementation of draft-harkins-owe-07.txt - #CONFIG_OWE=y - - # Airtime policy support - CONFIG_AIRTIME_POLICY=y - - # Proxy ARP support - CONFIG_PROXYARP=y - - # Override default value for the wpa_disable_eapol_key_retries configuration - # parameter. See that parameter in hostapd.conf for more details. - #CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 - - # uBus IPC/RPC System - # Services can connect to the bus and provide methods - # that can be called by other services or clients. - CONFIG_UBUS=y - - # OpenWrt patch 380-disable-ctrl-iface-mib.patch - # leads to the MIB only being compiled in if - # CONFIG_CTRL_IFACE_MIB is enabled. - CONFIG_CTRL_IFACE_MIB=y - ''; - - postPatch = '' - cp ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/src/src/ap/ubus.h"; - sha256 = "sha256-qA+ISdYJkAEmojmHjWJCBCMngYPpZRGNRstdYP5JTcc="; - }} src/ap/ubus.h - cp ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/src/src/ap/ubus.c"; - sha256 = "sha256-ZaMx+D6e02soQZIjBDs3T7BNhMcEJ9iWq1mbSbjyuUU="; - }} src/ap/ubus.c - cp ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/src/src/utils/build_features.h"; - sha256 = "sha256-KW8RKVQAWr91ach/F1k9XQH2rQCiQNfcNiDqUbNVrkc="; - }} src/utils/build_features.h - ''; - - patches = (map pkgs.fetchurl [ - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/001-wolfssl-init-RNG-with-ECC-key.patch"; sha256 = "1h4wqn6dpc5vw19428v6s49i3xsdqc1ikwv6gvdhs2ly98cxwb91"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch"; sha256 = "06limshm4zprqd2cnjf2911k8dg2rc5wvdkqcdlxw49r5ihb4wmh"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/011-mesh-use-deterministic-channel-on-channel-switch.patch"; sha256 = "1nkp8kmq1dxhrf19cz346jyaxh888vgvl9hnlsdqak5cb5g0k0a6"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/021-fix-sta-add-after-previous-connection.patch"; sha256 = "1nj4h8z8kz335cwz6qq1qd0k0h5c47nhqvpb6n4k0mabw3q19rd5"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch"; sha256 = "1sfy9j86550g90gw5w80773dgf6i1w22sidichxjqgkhdm507kz7"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/023-ndisc_snoop-call-dl_list_del-before-freeing-ipv6-add.patch"; sha256 = "03pq0h5lmlgn05dkd5vf0v3abaa30vza962vbp9kc66jbga38113"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch"; sha256 = "0vl3v7b2p17maxnz02jiy89rz6jbmj54sqxkw14j1s6mxji0x510"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/040-mesh-allow-processing-authentication-frames-in-block.patch"; sha256 = "0w56gr3lp6h2y88vc1g6ddjvrymrg9sv65bhq46dcjjc6i6fgq96"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/050-build_fix.patch"; sha256 = "19km2glb39nqd3a25dsh2mnv57yj8mywi0kln86rizncyv0wbp5f"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/100-daemonize_fix.patch"; sha256 = "1wsxnanirdjf75zqdp6ff5yny8vaxnlb9ss2b3zwwca9ixl41fr1"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/200-multicall.patch"; sha256 = "0y305476mq8zp83hy45spsb16aw8a7720s3cnmc1msj1wx0axvl2"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/300-noscan.patch"; sha256 = "0qfn9in5ly7yk8y4psvbhn3sh667b6v0yjnimga20gclabfylpyb"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/301-mesh-noscan.patch"; sha256 = "1awln2b489j3nam8b81kjjvi91xwm46f5pcjag3smks8ra0v1zw7"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/310-rescan_immediately.patch"; sha256 = "0hvmwkkd2vfhz8yf1rbz11s3x7ll21f12r6kz9pl9mcn80dljicd"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/320-optional_rfkill.patch"; sha256 = "1i243v8sjcxb3bhwy2vmgkrmy622a2v484g8b10y7pr4qzn9z2zg"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch"; sha256 = "0zspfajraipx0p50nlj0ym69hx47g4z1hk6f7dpra3ds61l7m7fq"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/340-reload_freq_change.patch"; sha256 = "0cj4almw5aaj908jyy4h3a2klwyyvqhgy76lxml3czfcavylrf47"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/341-mesh-ctrl-iface-channel-switch.patch"; sha256 = "1avv33hghsc23hjxizkh5ppxs1jk0gskkhfy1yj8r73iabgs5m6s"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch"; sha256 = "1701bqy3glm26zy3c2mn3hxyj357xhjfl44c4rcnd8059bspcnxy"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch"; sha256 = "07cialpbc6dl5rmijb7knaq4pgf1vnizq5m9g3caw8czczal9d46"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/370-ap_sta_support.patch"; sha256 = "0a636ihrxqq09vivvcmm6a1x7vxpprhba5izin0f5y7b2vqk4cl6"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch"; sha256 = "1gkf43gbpcqk1h0kjlbx1d3llzx4m23rpw9hc9ijs35zs159yfs1"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/381-hostapd_cli_UNKNOWN-COMMAND.patch"; sha256 = "1l3vdp6z0chcri32prx15mky9dk1wsdzlc6cxwhbpn1yil05yfq3"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch"; sha256 = "107nyd34x9kl3spcfnzwpc8jva36f72jmzdkrjapkjks685vl6sc"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch"; sha256 = "0nzfj2fjl9pic4siadahx8wm4vy7v9immvc224k22hbmffaqz98v"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/410-limit_debug_messages.patch"; sha256 = "1nmq4gb3ff9zsrfxiqpfrnv8j9w79m77ahjw6mx53dyxwp0zmy0f"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/420-indicate-features.patch"; sha256 = "16zb20kyfhxqnh03i0nwcy4ky08x27ickh8c0im5cgw6fmggi9sh"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch"; sha256 = "10jf1pl8jpl0yp09f6al42j63j82r869lhfpan4iprh8hvnb77mj"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch"; sha256 = "0zy5548v4d20l6m10pa4ggdcfm0nxpihj17h82kva0aqd2n53nfr"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/432-missing-typedef.patch"; sha256 = "0qw7nxriv6dmpxzgbpbl33spgllxph9qyjnsbqhqq67spii1j6cf"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/450-scan_wait.patch"; sha256 = "1jp9ffbsb537k95w3dllzivarv913i6n3znlfim5qp416yjx75yr"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch"; sha256 = "1cpj1fh9r2g8vmhm6nhl0p8mg0sdqvsacqxda03mmpb0i8phznmh"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch"; sha256 = "0dcq4ik7bjwfpmazq0bb4p3j58inyjlnf3c8m01fkmh8ax422rl8"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/463-add-mcast_rate-to-11s.patch"; sha256 = "0sg64azsgr8d4z8my81y862r2cjxa6x06v3sjbmllz5i0a7sxgz9"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch"; sha256 = "08chf9rwwzj2aa33qmcgx2dabrmvph6gyd512nms31dvk55l8sxc"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/470-survey_data_fallback.patch"; sha256 = "195y6k22nq5y5vm1xddxrqgx7n0np5bq66xmib0b6xarnmks1m4h"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/500-lto-jobserver-support.patch"; sha256 = "0k13fgidgylv9w9ghdzrip20rxz9y9phibafcilc945rixjvr49p"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/590-rrm-wnm-statistics.patch"; sha256 = "0gmvf6f8v39z1i5ya3rsw8dxbzkblsmizdizvbi93zasbf1lslm2"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/599-wpa_supplicant-fix-warnings.patch"; sha256 = "0hssi2j0cinp028fkcvc1q9ns7q37gvs0rhbw348h61bsm1ddgij"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/600-ubus_support.patch"; sha256 = "1rd3dnjhk0lrhi8ci40zzlp5bijyyjj8gvg9pgf7d1ws36n6pvvz"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch"; sha256 = "06vpg82lmnq6jkj2qx1z3dvvj6f487rpz1gkfzq61l6xh4amdaq8"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/700-wifi-reload.patch"; sha256 = "14g0nyx4gs8kfqn7vmgglysk7k9dv8ppi2vm6dsy608g8qrlr5vq"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/710-vlan_no_bridge.patch"; sha256 = "05fxjsdnzajwq8kb9znp48lhg7x3kic2l1y4z6sn2j0i1n0yqlz3"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/711-wds_bridge_force.patch"; sha256 = "1xwkpg79178qafb2qlb26blk7m58zadzwlwrgjnxylrbmh6lv79s"; }{ url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/720-iface_max_num_sta.patch"; sha256 = "1iy09zp1xr8mya3kzv7pv60k0h830mnxxxhs1rlgg98fd7p8i0ld"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/730-ft_iface.patch"; sha256 = "03qrd5q825a60nrh0kndgmycyzbpziqf6bz65avllcy2pm6b27ff"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/740-snoop_iface.patch"; sha256 = "07q23gixnyvz20ih87z25rcim7388jx7c63djgprp7pl4hrbnsgk"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch"; sha256 = "1ak72l0n7s1j87671w85nyz590m0js4sm08zg5npj4ykdi8b0iz6"; } - { url = "https://raw.githubusercontent.com/openwrt/openwrt/75b83e94a395fedeb4d308f42013a72c6fee2df4/package/network/services/hostapd/patches/751-qos_map_ignore_when_unsupported.patch"; sha256 = "0zp7y7zac0hf9w7bm2lzqz4mkziiq10bn077vhvxaqmyli0hq2gg"; } - ]) ++ [ - ./999-hostapd-2.10-lar.patch - ]; - }); - } - ); -} diff --git a/nixos/systems/blowhole/ical2org.nix b/nixos/systems/blowhole/ical2org.nix deleted file mode 100644 index 51df8b8..0000000 --- a/nixos/systems/blowhole/ical2org.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ pkgs, secret, ... }: -{ - systemd.services.ical-vu-sync = { - serviceConfig.Type = "oneshot"; - path = with pkgs; [ bash ical2orgpy curl ]; - script = '' - rm "${secret.ical2org.orgPath}" - cat < "${secret.ical2org.orgPath}" - :PROPERTIES: - :ID: 56ed0bf0-c6d0-4a86-980a-905ccab89345 - :END: - #+title: VU Calendar - #+filetags: :project-forced: - EOF - curl '${secret.ical2org.icalUrlRooster}' -o - | ical2orgpy - - >> "${secret.ical2org.orgPath}" - curl '${secret.ical2org.icalUrlCanvas}' -o - | CANVAS_TODO=1 ical2orgpy - - >> "${secret.ical2org.orgPath}" - chown 404:404 "${secret.ical2org.orgPath}" - ''; - }; - systemd.timers.ical-vu-sync = { - wantedBy = [ "timers.target" ]; - partOf = [ "ical-vu-sync.service" ]; - timerConfig = { - OnCalendar = "*-*-* 3:00:00"; - Unit = "ical-vu-sync.service"; - }; - }; -} diff --git a/nixos/systems/blowhole/klipper.nix b/nixos/systems/blowhole/klipper.nix deleted file mode 100644 index 823a6ba..0000000 --- a/nixos/systems/blowhole/klipper.nix +++ /dev/null @@ -1,535 +0,0 @@ -{ inputs, lib, pkgs, secret, config, ...}: -let - inherit (lib) - concatStringsSep - ; -in -{ - uterranix.config = { tflib, ... }: - let - inherit (tflib) - tf; - in - { - output."envoy_klipper".value = tf "vault_consul_secret_backend_role.envoy-klipper"; - }; - - services.hashicorp.vault-agent = - { - settings.template = [ - { - source = pkgs.writeText "envoy-klipper.token.vtmpl" '' - {{ with secret "consul/creds/envoy-klipper" }}{{ .Data.token }}{{ end }} - ''; - destination = "/run/secrets/klipper/envoy-klipper.token"; - command = - let - serviceList = - [ "hashicorp-envoy-mainsail" ]; - in - pkgs.writeShellScript "envoy-mainsail-reload.sh" - '' - sudo systemd-run -P --machine klipper /run/current-system/sw/bin/bash -l -c \ - 'systemctl try-reload-or-restart ${concatStringsSep " " serviceList}' - ''; - } - ]; - }; - - fileSystems."/var/lib/klipper" = { - device = "blowhole-zpool/persist/klipper"; - fsType = "zfs"; - }; - - systemd.services."container@klipper" = { - restartIfChanged = lib.mkForce false; - }; - - containers.klipper = { - ephemeral = true; - autoStart = true; - privateNetwork = true; - - localAddress = "10.64.99.6"; - hostAddress = "10.64.99.5"; - - bindMounts = { - "/run/secrets" = { - hostPath = "/run/secrets/klipper"; - isReadOnly = true; - }; - "/var/lib/klipper" = { - hostPath = "/var/lib/klipper"; - isReadOnly = false; - }; - "/var/lib/moonraker/gcodes" = { - hostPath = "/var/lib/klipper/gcodes"; - isReadOnly = false; - }; - "/dev/serial/by-id/" = { - hostPath = "/dev/serial/by-id/"; - isReadOnly = false; - }; - }; - - allowedDevices = [ - { - node = "/dev/serial/by-id/usb-Klipper_lpc1768_13E0FF0C469027AEBAA84A52871E00F5-if00"; - modifier = "rwm"; - } - ]; - - config = { - nixpkgs.overlays = config.nixpkgs.overlays; - - imports = [ - ../../modules/hashicorp.nix - ../../modules/public/hashicorp-envoy.nix - ]; - - services.hashicorp-envoy.mainsail = { - service = { - name = "mainsail"; - id = "mainsail"; - address = "10.64.99.6"; - port = 80; - - connect.sidecar_service = {}; - }; - - environment = { - "CONSUL_HTTP_ADDR" = "http://10.64.2.1:8500"; - "CONSUL_GRPC_ADDR" = "http://10.64.2.1:8502"; - "CONSUL_HTTP_TOKEN_FILE" = "/run/secrets/envoy-klipper.token"; - }; - - address = "10.64.99.6:19000"; - adminBind = "127.0.0.1:19100"; - hotRestart = false; - }; - - users.users.klipper = { - home = "/var/lib/klipper"; - isSystemUser = true; - group = "klipper"; - uid = 321; - }; - - users.groups.klipper = { - gid = 321; - }; - - services.klipper = { - enable = true; - - user = "klipper"; - group = "klipper"; - - package = pkgs.klipper; - - settings = let - indentGcode = with lib; - gcode: - "\n" + (concatMapStringsSep "\n" (x: " " + x) (splitString "\n" gcode)); - in { - stepper_x = { - step_pin = "P2.2"; - dir_pin = "!P2.6"; - enable_pin = "!P2.1"; - rotation_distance = "40"; - microsteps = "16"; - endstop_pin = "P1.29"; # P1.28 for X-max - position_endstop = "0"; - position_max = "235"; - homing_speed = "50"; - }; - - stepper_y = { - step_pin = "P0.19"; - dir_pin = "!P0.20"; - enable_pin = "!P2.8"; - rotation_distance = "40"; - microsteps = "16"; - endstop_pin = "P1.27"; # P1.26 for Y-max - position_endstop = "0"; - position_max = "235"; - homing_speed = "50"; - }; - - stepper_z = { - step_pin = "P0.22"; - dir_pin = "P2.11"; - enable_pin = "!P0.21"; - rotation_distance = "8"; - microsteps = "16"; - endstop_pin = "P1.25"; # P1.24 for Z-max" - position_min = "-4.5"; - position_endstop = "1.290"; - position_max = "250"; - }; - - extruder = { - step_pin = "P2.13"; - dir_pin = "!P0.11"; - enable_pin = "!P2.12"; - rotation_distance = "23.291"; - gear_ratio = "3:1"; - microsteps = "16"; - nozzle_diameter = "0.400"; - filament_diameter = "1.750"; - heater_pin = "P2.7"; - sensor_type = "PT1000"; - sensor_pin = "P0.24"; - control = "pid"; - pid_Kp = "22.2"; - pid_Ki = "1.08"; - pid_Kd = "114"; - min_temp = "0"; - max_temp = "260"; - pressure_advance = "0.92"; - }; - - bed_screws = { - screw1 = "30,35"; - screw2 = "200,35"; - screw3 = "200,205"; - screw4 = "30,205"; - }; - - "heater_fan my_nozzle_fan" = { - pin = "P2.4"; - heater = "extruder"; - heater_temp = "50.0"; - fan_speed = "1.0"; - }; - - heater_bed = { - heater_pin = "P2.5"; - sensor_type = "ATC Semitec 104GT-2"; - sensor_pin = "P0.23"; - control = "watermark"; - min_temp = "0"; - max_temp = "80"; - }; - - fan = { - pin = "P2.3"; - }; - - mcu = { - serial = "/dev/serial/by-id/usb-Klipper_lpc1768_13E0FF0C469027AEBAA84A52871E00F5-if00"; - }; - - printer = { - kinematics = "cartesian"; - max_velocity = "200"; - max_accel = "2000"; - max_z_velocity = "25"; - max_z_accel = "100"; - }; - - virtual_sdcard = { - path = "/var/lib/moonraker/gcodes"; - }; - - ### Mainsail - pause_resume = {}; - display_status = {}; - endstop_phase = {}; - - "tmc2208 stepper_x" = { - uart_pin = "P1.17"; - run_current = "0.475"; - hold_current = "0.275"; - stealthchop_threshold = "250"; - }; - - "tmc2208 stepper_y" = { - uart_pin = "P1.15"; - run_current = "0.475"; - hold_current = "0.275"; - stealthchop_threshold = "250"; - }; - - "tmc2208 stepper_z" = { - uart_pin = "P1.10"; - run_current = "0.475"; - hold_current = "0.275"; - stealthchop_threshold = "30"; - }; - - "tmc2208 extruder" = { - uart_pin = "P1.8"; - run_current = "0.560"; - hold_current = "0.360"; - stealthchop_threshold = "5"; - }; - - board_pins = { - aliases = - indentGcode - '' - # EXP1 header - EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=, - EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>, - # EXP2 header - EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=, - EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=, EXP2_10= - # Pins EXP2_1, EXP2_6, EXP2_2 are also MISO, MOSI, SCK of bus "ssp0" - ''; - }; - - display = { - lcd_type = "st7920"; - cs_pin = "EXP1_7"; - sclk_pin = "EXP1_6"; - sid_pin = "EXP1_8"; - encoder_pins = "^EXP1_5, ^EXP1_3"; - click_pin = "^!EXP1_2"; - }; - - # "endstop_phase stepper_z" = - # { endstop_phase = "29"; - # }; - - # "endstop_phase stepper_y" = - # { endstop_phase = "57"; - # }; - - # "endstop_phase stepper_x" = - # { endstop_phase = "3"; - # }; - - "gcode_macro M600" = { - gcode = - indentGcode - '' - {% set x = params.X|default(50)|float %} - {% set y = params.Y|default(0)|float %} - {% set z = params.Z|default(10)|float %} - SAVE_GCODE_STATE NAME=M600_state - PAUSE - G91 - G1 E-.8 F2700 - G1 Z{z} - G90 - G1 X{x} Y{y} F3000 - G91 - G1 E-50 F1000 - G1 X0.1 F3000 - G1 E-50 F1000 - G1 X-0.1 F3000 - G1 E-50 F1000 - G1 X0.1 F3000 - G1 E-50 F1000 - G1 X-0.1 F3000 - G1 E-50 F1000 - G1 X0.1 F3000 - G1 E-50 F1000 - G1 X-0.1 F3000 - RESTORE_GCODE_STATE NAME=M600_state - ''; - }; - - "gcode_macro CANCEL_PRINT" = { - rename_existing = "BASE_CANCEL_PRINT"; - gcode = - indentGcode - '' - TURN_OFF_HEATERS - CLEAR_PAUSE - SDCARD_RESET_FILE - BASE_CANCEL_PRINT - ''; - }; - - "gcode_macro PARK_WAIT" = { - gcode = - indentGcode - '' - {% set x = params.X|default(0)|float %} - {% set y = params.Y|default(230)|float %} - {% set z = params.Z|default(10)|float %} - {% set e = params.Z|default(20)|float %} - {% set millis = params.MILLIS|default(5)|float %} - - SAVE_GCODE_STATE NAME=PAUSE_state - G91 - G1 E-{e} F2100 - G1 Z{z} - G90 - G1 X{x} Y{y} F6000 - - G4 P{millis} - - G91 - G1 E{e} F2100 - G90 - RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 - ''; - }; - - "gcode_macro PAUSE" = { - rename_existing = "BASE_PAUSE"; - gcode = - indentGcode - '' - {% set x = params.X|default(0)|float %} - {% set y = params.Y|default(230)|float %} - {% set z = params.Z|default(10)|float %} - {% set e = params.E|default(20)|float %} - - SAVE_GCODE_STATE NAME=PAUSE_state - BASE_PAUSE - G91 - G1 E-{e} F2100 - G1 Z{z} - G90 - G1 X{x} Y{y} F6000 - ''; - }; - - "gcode_macro RESUME" = { - rename_existing = "BASE_RESUME"; - gcode = - indentGcode - '' - {% set e = params.Z|default(20)|float %} - - G91 - G1 E{e} F2100 - G90 - RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 - BASE_RESUME - ''; - }; - - "gcode_macro PRIME_LINE" = { - gcode = - indentGcode - '' - G92 E0 # Reset Extruder - G1 Z2.0 F3000 # Move Z Axis up little to prevent scratching of Heat Bed - G1 X0.1 Y20 Z0.3 F5000.0 # Move to start position - G1 X0.1 Y200.0 Z0.3 F1500.0 E15 # Draw the first line - G1 X0.4 Y200.0 Z0.3 F5000.0 # Move to side a little - G1 X0.4 Y20 Z0.3 F1500.0 E30 # Draw the second line - G92 E0 # Reset Extruder - G1 Z2.0 F3000 # Move Z Axis up little to prevent scratching of Heat Bed - G1 X5 Y20 Z0.3 F5000.0 # Move over to prevent blob squish - ''; - }; - - "gcode_macro START_PRINT" = { - gcode = - indentGcode - '' - {% set z = params.Z|default(0)|float %} - - # Use absolute coordinates - G90 - # Reset the G-Code Z offset (adjust Z offset if needed) - SET_GCODE_OFFSET Z={z} - # Home the printer - G28 - # Prime line - G0 Z0 - PRIME_LINE - ''; - }; - - "gcode_macro END_PRINT" = { - gcode = - indentGcode - '' - G91 # Relative positioning - G1 E-2 F2700 # Retract a bit - G1 E-2 Z0.2 F2400 # Retract and raise Z - G1 X5 Y5 F3000 # Wipe out - G1 Z10 #Raise Z more - G90 # Absolute positionning - - G1 X0 Y200 # Present print - M106 S0 # Turn-off fan - M104 S0 # Turn-off hotend - M140 S0 # Turn-off bed - - M84 X Y E # Disable all steppers but Z - ''; - }; - }; - }; - - services.moonraker = { - enable = true; - - group = "klipper"; - - settings = { - authorization = { - trusted_clients = with secret.network.ips; [ - "127.0.0.1" - heater - edge.vpn - omen.vpn - ]; - }; - - octoprint_compat = {}; - history = {}; - }; - }; - - services.nginx = { - enable = true; - - recommendedGzipSettings = true; - recommendedProxySettings = true; - recommendedOptimisation = true; - - upstreams."apiserver" = { - servers."127.0.0.1:7125" = {}; - extraConfig = '' - ip_hash; - ''; - }; - - virtualHosts.${secret.network.ips.blowhole.dns} = { - root = pkgs.mainsail; - - locations."/".extraConfig = '' - try_files $uri $uri/ /index.html; - ''; - - locations."/index.html".extraConfig = '' - add_header Cache-Control "no-store, no-cache, must-revalidate"; - ''; - - locations."/websocket".extraConfig = '' - proxy_pass http://apiserver/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_read_timeout 86400; - ''; - - - locations."~ ^/(printer|api|access|machine|server)/".extraConfig = '' - proxy_pass http://apiserver$request_uri; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Scheme $scheme; - ''; - - extraConfig = '' - client_max_body_size 512M; - ''; - }; - }; - }; - }; -} diff --git a/nixos/systems/blowhole/monitoring.nix b/nixos/systems/blowhole/monitoring.nix deleted file mode 100644 index 1e9d819..0000000 --- a/nixos/systems/blowhole/monitoring.nix +++ /dev/null @@ -1,558 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ pkgs, roots, lib, inputs, config, secret, ... }: -let - inherit (lib) - singleton - nixosTests - concatStringsSep - ; -in -{ - uterranix.config = { tflib, ... }: - let - inherit (tflib) - tf; - in - { - output."envoy_grafana".value = tf "vault_consul_secret_backend_role.envoy-grafana"; - output."envoy_blowhole".value = tf "vault_consul_secret_backend_role.envoy-blowhole"; - - data."influxdb-v2_organization"."redalder" = { - name = "redalder"; - }; - - resource."influxdb-v2_bucket"."metrics_bucket" = { - name = "metrics"; - description = "Metrics bucket"; - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - retention_rules = { - every_seconds = 30 * 24 * 60 * 60; # days * h/d * m/h * s/m - }; - }; - - resource."influxdb-v2_bucket"."logs_bucket" = { - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - name = "logs"; - description = "Logs bucket"; - retention_rules = { - every_seconds = 30 * 24 * 60 * 60; # days * h/d * m/h * s/m - }; - }; - - resource."influxdb-v2_authorization"."telegraf_authorization" = { - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - description = "Token for telegraf ingestion"; - status = "active"; - permissions = [ - { - action = "write"; - resource = { - id = "\${influxdb-v2_bucket.logs_bucket.id}"; - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - type = "buckets"; - }; - } - { - action = "write"; - resource = { - id = "\${influxdb-v2_bucket.metrics_bucket.id}"; - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - type = "buckets"; - }; - } - ]; - }; - - resource."influxdb-v2_authorization"."grafana_authorization" = { - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - description = "Token for Grefana"; - status = "active"; - permissions = [ - { - action = "read"; - resource = { - id = "\${influxdb-v2_bucket.logs_bucket.id}"; - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - type = "buckets"; - }; - } - { - action = "read"; - resource = { - id = "\${influxdb-v2_bucket.metrics_bucket.id}"; - org_id = "\${data.influxdb-v2_organization.redalder.id}"; - type = "buckets"; - }; - } - ]; - }; - - resource."vault_mount"."kv" = { - path = "kv"; - type = "kv"; - options = { version = 2; }; - description = "KV Version 2 secret engine mount"; - }; - - resource."vault_kv_secret_v2"."telegraf_secret" = { - mount = "\${vault_mount.kv.path}"; - name = "homelab-1/blowhole/monitor/telegraf"; - options = { version = 2; }; - data_json = builtins.toJSON { - influxdb_token = "\${influxdb-v2_authorization.telegraf_authorization.token}"; - }; - }; - - resource."vault_kv_secret_v2"."grafana_secret" = { - mount = "\${vault_mount.kv.path}"; - name = "homelab-1/blowhole/monitor/grafana"; - options = { version = 2; }; - data_json = builtins.toJSON { - influxdb_token = "\${influxdb-v2_authorization.grafana_authorization.token}"; - }; - }; - }; - - nixpkgs.overlays = singleton (_: _: - { - telegraf = - pkgs.buildGoModule rec { - pname = "telegraf"; - version = "1.25.3"; - - excludedPackages = "test"; - doCheck = false; - - subPackages = [ "cmd/telegraf" ]; - - src = pkgs.fetchFromGitHub { - owner = "influxdata"; - repo = "telegraf"; - rev = "v${version}"; - sha256 = "sha256-FUZDS4As9qP2Dn0NSBM/e8udDLMk5OZol4CQSI39T4s="; - }; - - vendorHash = "sha256-uWoWvS9ZZzhpE+PiJv0fqblMLOAGIrhCdi0ugvF/lQI="; - proxyVendor = true; - - ldflags = [ - "-w" "-s" "-X main.version=${version}" - ]; - - passthru.tests = { inherit (nixosTests) telegraf; }; - - meta = with lib; { - description = "The plugin-driven server agent for collecting & reporting metrics"; - license = licenses.mit; - homepage = "https://www.influxdata.com/time-series-platform/telegraf/"; - maintainers = with maintainers; [ mic92 roblabla timstott ]; - }; - }; - envoy = inputs.nixpkgs-stable.legacyPackages.${pkgs.stdenv.system}.envoy; - }); - - services.hashicorp.vault-agent = - { - settings.template = [ - { - source = pkgs.writeText "envoy-grafana.token.vtmpl" '' - {{ with secret "consul/creds/envoy-grafana" }}{{ .Data.token }}{{ end }} - ''; - destination = "/run/secrets/monitor/envoy-grafana.token"; - command = - let - serviceList = - [ "hashicorp-envoy-grafana" "hashicorp-envoy-influx" "hashicorp-envoy-telegraf" ]; - in - pkgs.writeShellScript "envoy-grafana-reload.sh" - '' - sudo systemd-run -P --machine monitor /run/current-system/sw/bin/bash -l -c \ - 'systemctl try-reload-or-restart ${concatStringsSep " " serviceList}' - ''; - } - { - source = pkgs.writeText "envoy-blowhole.token.vtmpl" - '' - {{ with secret "consul/creds/envoy-blowhole" }}{{ .Data.token }}{{ end }} - ''; - destination = "/run/secrets/envoy-blowhole.token"; - command = pkgs.writeShellScript "envoy-blowhole-reload.sh" - '' - sudo systemctl try-reload-or-restart hashicorp-envoy-telegraf - ''; - } - { - source = pkgs.writeText "telegraf.env.vtmpl" '' - INFLUXDB_TOKEN={{ with secret "kv/data/homelab-1/blowhole/monitor/telegraf" }}{{ .Data.data.influxdb_token }}{{ end }} - ''; - destination = "/run/secrets/monitor/telegraf.env"; - command = pkgs.writeShellScript "monitor-telegraf-reload.sh" - '' - sudo systemd-run -P --machine monitor /run/current-system/sw/bin/bash -l -c \ - 'systemctl try-reload-or-restart telegraf' - ''; - } - { - source = pkgs.writeText "grafana-influx.token.vtmpl" '' - {{ with secret "kv/data/homelab-1/blowhole/monitor/grafana" }} - {{ .Data.data.influxdb_token }} - {{ end }} - ''; - destination = "/run/secrets/monitor/grafana-influx.token"; - perms = "0644"; - command = pkgs.writeShellScript "monitor-telegraf-reload.sh" - '' - sudo systemd-run -P --machine monitor /run/current-system/sw/bin/bash -l -c \ - 'systemctl try-reload-or-restart grafana' - ''; - } - ]; - }; - - - ## There is no way to say, hey, listen on localhost. The listeners option is missing the `address` field - ## and the `name` field so it's impossible to configure.... - services.hashicorp-envoy.telegraf = { - type = "ingress"; - address = "${secret.network.ips.blowhole.ip}:19000"; - service = { - kind = "ingress-gateway"; - name = "telegraf-blowhole"; - - listeners = [ - { - port = 8086; - protocol = "tcp"; - services = singleton { - name = "telegraf"; - }; - } - ]; - }; - - environment = { - "CONSUL_HTTP_ADDR" = "http://${secret.network.ips.blowhole.ip}:8500"; - "CONSUL_GRPC_ADDR" = "http://${secret.network.ips.blowhole.ip}:8502"; - "CONSUL_HTTP_TOKEN_FILE" = "/run/secrets/envoy-blowhole.token"; - }; - - adminBind = "127.0.0.1:19100"; - hotRestart = false; - }; - - services.telegraf-magic = { - enable = true; - settings = { - inputs.cpu = { - percpu = true; - totalcpu = true; - tags.host = "blowhole"; - tags.bucket = "metrics"; - }; - - inputs.mem = { - tags.host = "blowhole"; - tags.bucket = "metrics"; - }; - - inputs.nomad = { - url = "http://${secret.network.ips.blowhole.ip}:4646"; - tags.host = "blowhole"; - tags.bucket = "metrics"; - }; - - # aggregators.minmax = { - # period = "30s"; - # drop_original = true; - # namepass = [ "nomad" ]; - # }; - - inputs.zfs = { - tags.host = "blowhole"; - tags.bucket = "metrics"; - }; - - # inputs.tail = [ - # { - # files = ["/var/lib/nomad/alloc/*/alloc/logs/*.stdout.*"]; - # data_format = "value"; - # data_type = "string"; - - # name_override = "nomad_alloc_log"; - # tags.bucket = "logs"; - # } - # { - # files = ["/var/lib/nomad/alloc/*/alloc/logs/*.stderr.*"]; - # data_format = "value"; - # data_type = "string"; - - # name_override = "nomad_alloc_log"; - # tags.bucket = "logs"; - # } - # ]; - - inputs.docker_log = { - tags.bucket = "logs"; - }; - - outputs.influxdb_v2 = [ - { - urls = [ "http://${secret.network.ips.blowhole.ip}:8086" ]; - bucket = "metrics"; - tagpass = { - bucket = [ "metrics" ]; - }; - } - { - urls = [ "http://${secret.network.ips.blowhole.ip}:8086" ]; - bucket = "logs"; - tagpass = { - bucket = [ "logs" ]; - }; - } - ]; - }; - - systemd = { - serviceConfig.SupplementaryGroups = [ "docker" ]; - }; - }; - - fileSystems."/var/lib/grafana" = { - device = "blowhole-zpool/persist/grafana"; - fsType = "zfs"; - }; - - fileSystems."/var/lib/grafana-postgres" = { - device = "blowhole-zpool/persist/grafana-postgres"; - fsType = "zfs"; - }; - - fileSystems."/var/lib/grafana-influxdb2" = { - device = "blowhole-zpool/persist/grafana-influxdb2"; - fsType = "zfs"; - }; - - systemd.services."container@monitor".serviceConfig.LimitNOFILE = "infinity"; - - # TODO: split interface name and container name, i.e. rewrite the container module....... again - containers.monitor = { - ephemeral = true; - autoStart = true; - privateNetwork = true; - - localAddress = "10.64.99.2"; - hostAddress = "10.64.99.1"; - # 0 1 2 3 - # 4 5 6 7 - # 8 9 10 11 - - extraFlags = [ - "--capability=CAP_IPC_LOCK" - ]; - - bindMounts = { - "/run/secrets" = { - hostPath = "/run/secrets/monitor"; - isReadOnly = true; - }; - "/var/lib/grafana" = { - hostPath = "/var/lib/grafana"; - isReadOnly = false; - }; - "/var/lib/postgresql" = { - hostPath = "/var/lib/grafana-postgres"; - isReadOnly = false; - }; - "/var/lib/influxdb2" = { - hostPath = "/var/lib/grafana-influxdb2"; - isReadOnly = false; - }; - }; - config = { - nixpkgs.overlays = config.nixpkgs.overlays; - - imports = [ - ../../modules/public/grafana.nix - ../../modules/public/telegraf.nix - ../../modules/public/hashicorp-envoy.nix - ../../modules/hashicorp.nix - ]; - - services.hashicorp-envoy.grafana = { - service = { - name = "grafana"; - id = "grafana"; - address = "10.64.99.2"; - port = 3000; - - connect.sidecar_service = {}; - }; - - environment = { - "CONSUL_HTTP_ADDR" = "http://${secret.network.ips.blowhole.ip}:8500"; - "CONSUL_GRPC_ADDR" = "http://${secret.network.ips.blowhole.ip}:8502"; - "CONSUL_HTTP_TOKEN_FILE" = "/run/secrets/envoy-grafana.token"; - }; - - address = "10.64.99.2:19000"; - adminBind = "127.0.0.1:19100"; - hotRestart = false; - }; - - services.postgresql = { - enable = true; - ensureDatabases = [ - "grafana" - ]; - ensureUsers = [ - { - name = "grafana"; - ensurePermissions = { - "DATABASE grafana" = "ALL PRIVILEGES"; - }; - } - ]; - }; - - systemd.services.grafana = { - serviceConfig = { - Restart = "always"; - RestartSec = "10s"; - }; - }; - - services.grafana-magic = { - settings = { - security = { - content_security_policy = true; - disable_gravatar = true; - data_source_proxy_whitelist = concatStringsSep " " [ - "127.0.0.1:8086" - ]; - }; - server = { - domain = "grafana.in.redalder.org"; - }; - system = { - http_addr = "127.0.0.1"; - }; - database = { - type = "postgres"; - host = "/var/run/postgresql"; - name = "grafana"; - user = "grafana"; - }; - - paths.provisioning = { - datasources.datasources = [ - { - name = "InfluxDB"; - type = "influxdb"; - access = "proxy"; - orgId = 1; - uid = "influxdb"; - url = "http://127.0.0.1:8086"; - jsonData = { - version = "Flux"; - organization = "redalder"; - defaultBucket = "bucket"; - }; - secureJsonData = { - token = "$__file{/run/secrets/grafana-influx.token}"; - }; - } - ]; - }; - }; - - enable = true; - }; - - services.hashicorp-envoy.influx = { - service = { - name = "influx"; - id = "influx"; - address = "10.64.99.2"; - port = 8086; - - connect.sidecar_service = {}; - }; - - environment = { - "CONSUL_HTTP_ADDR" = "http://${secret.network.ips.blowhole.ip}:8500"; - "CONSUL_GRPC_ADDR" = "http://${secret.network.ips.blowhole.ip}:8502"; - "CONSUL_HTTP_TOKEN_FILE" = "/run/secrets/envoy-grafana.token"; - }; - - address = "10.64.99.2:19001"; - adminBind = "127.0.0.1:19101"; - hotRestart = false; - }; - - services.influxdb2 = { - enable = true; - settings = { - http-bind-address = "127.0.0.1:8086"; - hardening-enabled = true; - reporting-disabled = true; - }; - }; - - services.hashicorp-envoy.telegraf = { - service = { - name = "telegraf"; - id = "telegraf"; - address = "10.64.99.2"; - port = 8087; - - connect.sidecar_service = {}; - }; - - environment = { - "CONSUL_HTTP_ADDR" = "http://${secret.network.ips.blowhole.ip}:8500"; - "CONSUL_GRPC_ADDR" = "http://${secret.network.ips.blowhole.ip}:8502"; - "CONSUL_HTTP_TOKEN_FILE" = "/run/secrets/envoy-grafana.token"; - }; - - address = "10.64.99.2:19002"; - adminBind = "127.0.0.1:19102"; - hotRestart = false; - }; - - services.telegraf-magic = { - enable = true; - settings = { - inputs.influxdb_v2_listener = { - service_address = "127.0.0.1:8087"; - bucket_tag = "bucket"; - parser_type = "upstream"; - }; - - inputs.systemd_units = { - unittype = "service"; - tags = { - host = "blowhole#monitoring"; - bucket = "metrics"; - }; - }; - - outputs.influxdb_v2 = [ - { - urls = [ "http://127.0.0.1:8086" ]; - token = "\${INFLUXDB_TOKEN}"; - organization = "redalder"; - bucket_tag = "bucket"; - } - ]; - }; - - systemd.serviceConfig = { - EnvironmentFile = "/run/secrets/telegraf.env"; - }; - }; - }; - }; -} diff --git a/nixos/systems/blowhole/nas.nix b/nixos/systems/blowhole/nas.nix deleted file mode 100644 index 0a81474..0000000 --- a/nixos/systems/blowhole/nas.nix +++ /dev/null @@ -1,167 +0,0 @@ -{ pkgs, ... }: -{ - fileSystems."/mnt/cartman" = { - device = "storfa/ds1/cartman"; - fsType = "zfs"; - }; - systemd.services.mnt-kyle-zfs-relmount = { - requires = ["mnt-kyle.mount"]; - after = ["mnt-kyle.mount"]; - requiredBy = ["local-fs.target"]; - - path = with pkgs; [zfs util-linux]; - - serviceConfig = { - RemainAfterExit = true; - Type = "oneshot"; - ExecStart = "${pkgs.zfs-relmount}/bin/zfs-relmount mount storfa/ds1/kyle /mnt/kyle"; - }; - }; - - fileSystems."/mnt/kyle" = { - device = "storfa/ds1/kyle"; - fsType = "zfs"; - }; - - systemd.services.mnt-cartman-zfs-relmount = { - requires = ["mnt-cartman.mount"]; - after = ["mnt-cartman.mount"]; - requiredBy = ["local-fs.target"]; - - path = with pkgs; [zfs util-linux]; - - serviceConfig = { - RemainAfterExit = true; - Type = "oneshot"; - ExecStart = "${pkgs.zfs-relmount}/bin/zfs-relmount mount storfa/ds1/cartman /mnt/cartman"; - }; - }; - - fileSystems."/mnt/stan" = { - device = "storfa/ds1/stan"; - fsType = "zfs"; - }; - - systemd.services.mnt-stan-zfs-relmount = { - requires = ["mnt-stan.mount"]; - after = ["mnt-stan.mount"]; - requiredBy = ["local-fs.target"]; - - path = with pkgs; [zfs util-linux]; - - serviceConfig = { - RemainAfterExit = true; - Type = "oneshot"; - ExecStart = "${pkgs.zfs-relmount}/bin/zfs-relmount mount storfa/ds1/stan /mnt/stan"; - }; - }; - - # services.samba = { - # enable = true; - # package = pkgs.sambaFull; - # openFirewall = true; - - # securityType = "user"; - # extraConfig = '' - # workgroup = WORKGROUP - # server string = blowhole - # netbios name = blowhole - # security = user - # #use sendfile = yes - # #max protocol = smb2 - # # note: localhost is the ipv6 localhost ::1 - # hosts allow = 192.168.0. 127.0.0.1 localhost - # hosts deny = 0.0.0.0/0 - # guest account = nobody - # map to guest = bad user - - # # Enable POSIX ACLs - # vfs objects = acl_xattr - # map acl inherit = yes - # store dos attributes = yes - # smb2 unix extensions = yes - # ''; - - # shares = { - # cartman = { - # path = "/mnt/cartman"; - # browseable = "yes"; - # "read only" = "no"; - # "guest ok" = "no"; - # "force user" = "main"; - # "force group" = "main"; - # "locking" = "yes"; - # "valid users" = "main"; - # }; - # kyle = { - # path = "/mnt/kyle"; - # browseable = "yes"; - # "read only" = "no"; - # "guest ok" = "no"; - # "force user" = "main"; - # "force group" = "main"; - # "locking" = "yes"; - # "valid users" = "main"; - # }; - # stan = { - # path = "/mnt/stan"; - # browseable = "yes"; - # "read only" = "no"; - # "guest ok" = "no"; - # "force user" = "main"; - # "force group" = "main"; - # "locking" = "yes"; - # "valid users" = "main"; - # }; - # }; - # }; - - fileSystems."/run/restic" = { - fsType = "tmpfs"; - options = [ "size=64M" ]; - }; - - services.restic.backups.cartman = { - initialize = true; - timerConfig = { - OnCalendar = "03:00"; - }; - - paths = [ "/run/restic/cartman" ]; - backupPrepareCommand = '' - snapshot="$(date +restic%+4Y_%U_%u)" - ${pkgs.zfs-relmount}/bin/zfs-relmount snapshot storfa/ds1/cartman "''${snapshot}" - - mkdir /run/restic/cartman - ${pkgs.zfs-relmount}/bin/zfs-relmount mount-snapshot storfa/ds1/cartman /run/restic/cartman "''${snapshot}" - - export RESTIC_PROGRESS_FPS=1 - ''; - backupCleanupCommand = '' - ${pkgs.zfs-relmount}/bin/zfs-relmount umount storfa/ds1/cartman /run/restic/cartman - rm -r /run/restic/cartman - ''; - - passwordFile = ""; - repository = ""; - }; - - systemd.timers."restic-backups-cartman" = { - timerConfig = { - Persistent = true; - WakeSystem = true; - }; - }; - - systemd.services."restic-backups-cartman" = { - path = with pkgs; [ - util-linux - zfs - ]; - serviceConfig = { - Nice = 19; - IOSchedulingClass = "idle"; - EnvironmentFile = "/var/secrets/restic-b2"; - }; - }; -} diff --git a/nixos/systems/blowhole/nomad.nix b/nixos/systems/blowhole/nomad.nix deleted file mode 100644 index 26dfe17..0000000 --- a/nixos/systems/blowhole/nomad.nix +++ /dev/null @@ -1,180 +0,0 @@ -{inputs, lib, config, pkgs, secret, ...}: -with lib; -let -in -{ - services.hashicorp.vault-agent = { - settings.template = singleton { - source = pkgs.writeText "nomad.json.vtmpl" - '' - { - "server": { - "encrypt": "{{ with secret "kv/data/homelab-1/blowhole/nomad/encryption_key" }}{{ or .Data.data.key "" }}{{ end }}" - }, - "vault": { - "token": "{{ with secret "kv/data/homelab-1/blowhole/nomad/vault_token" }}{{ or .Data.data.secret "" }}{{ end }}" - }, - "consul": { - "token": "{{ with secret "kv/data/homelab-1/blowhole/nomad/consul_token" }}{{ or .Data.data.secret "" }}{{ end }}" - } - } - ''; - destination = "/run/secrets/nomad.json"; - command = pkgs.writeShellScript "nomad-command" - '' - sudo systemctl try-reload-or-restart hashicorp-nomad.service - ''; - }; - }; - - systemd.services.hashicorp-nomad.unitConfig = { - ConditionPathExists = "/run/secrets/nomad.json"; - }; - - services.hashicorp.nomad = { - enable = true; - - extraPackages = with pkgs; [coreutils iproute2 iptables consul glibc config.nix.package git]; - extraSettingsPaths = [ - "/run/secrets/nomad.json" - ]; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.nomad_1_5.overrideAttrs (old: - { - patches = [ - ../0001-Revert-Change-consul-SI-tokens-to-be-local.patch - ../0001-Add-Nix-integration.patch - ]; - }); - - settings = { - bind_addr = secret.network.ips.blowhole.ip; - server = { - enabled = true; - }; - - tls = { - # http = false # true - # rpc = true - - # ca_file = "nomad-ca.pem" - # cert_file = "client.pem" - # key_file = "client-key.pem" - - # verify_server_hostname = true - # verify_https_client = true - }; - - vault = { - enabled = true; - address = "https://${secret.network.ips.vault.dns}:8200"; - allow_unauthenticated = true; - create_from_role = "nomad-cluster"; - }; - - consul = { - address = "${secret.network.ips.blowhole.ip}:8500"; - auto_advertise = true; - server_auto_join = true; - client_auto_join = true; - }; - - acl = { - enabled = true; - }; - - telemetry = { - publish_allocation_metrics = true; - publish_node_metrics = true; - }; - - client = { - cni_path = "${pkgs.cni-plugins}/bin"; - - min_dynamic_port = 20000; - max_dynamic_port = 32000; - - options = { - "docker.privileged.enabled" = "true"; - }; - - host_network."default" = { - cidr = secret.network.networks.home.mine; - }; - - host_network."mesh" = { - cidr = secret.network.networks.home.mine; - }; - - network_interface = "enp4s0"; - - # host_volume."renderD128" = { - # path = "/dev/dri/renderD128"; - # }; - - # host_volume."card0" = { - # path = "/dev/dri/card0"; - # }; - - host_volume."jellyfin-mount" = { - path = "/mnt/jellyfin-mount"; - }; - - host_volume."cctv" = { - path = "/mnt/cctv"; - read_only = false; - }; - - # host_volume."sonoff" = { - # path = "/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_4c004e9c53c9eb118a9f8b4f1d69213e-if00-port0"; - # }; - - enabled = true; - }; - - plugin."docker" = { - config = { - allow_caps = [ - "CHOWN" - "DAC_OVERRIDE" - "FSETID" - "FOWNER" - "MKNOD" - "NET_RAW" - "SETGID" - "SETUID" - "SETFCAP" - "SETPCAP" - "NET_BIND_SERVICE" - "SYS_CHROOT" - "KILL" - "AUDIT_WRITE" - "SYS_ADMIN" - ]; - allow_privileged = true; - extra_labels = [ - "job_name" - "job_id" - "task_group_name" - "task_name" - "namespace" - "node_name" - "node_id" - ]; - }; - }; - - disable_update_check = true; - data_dir = "/var/lib/nomad"; - - datacenter = "homelab-1"; - region = "homelab-1"; - }; - }; - - virtualisation.docker.enable = true; - virtualisation.docker.daemon.settings = { - dns = [ - "10.64.2.1" - ]; - }; -} diff --git a/nixos/systems/blowhole/uterranix.nix b/nixos/systems/blowhole/uterranix.nix deleted file mode 100644 index b4bb138..0000000 --- a/nixos/systems/blowhole/uterranix.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ config, inputs, lib, config', pkgs, ... }: -{ - imports = [ inputs.uterranix.nixosModules.default ]; - - uterranix.config = { config, tflib, ... }: - let - inherit (tflib) - tf; - in - { - terraform.required_providers = ((a: builtins.break a) config'.flake.uterranix.config.${pkgs.stdenv.system}).terraform.required_providers; - - imports = config'.uterranix.modules; - - resource."vault_consul_secret_backend_role"."envoy-grafana" = { - name = "envoy-grafana"; - - backend = "consul"; - - service_identities = [ - "grafana" - "influx" - "telegraf" - ]; - - node_identities = [ - "blowhole:homelab-1" - ]; - }; - - resource."consul_acl_policy"."envoy-blowhole" = { - name = "envoy-blowhole"; - datacenters = [ "homelab-1" ]; - - rules = '' - mesh = "write" - ''; - }; - - resource."vault_consul_secret_backend_role"."envoy-blowhole" = { - name = "envoy-blowhole"; - backend = "consul"; - - consul_policies = [ - (tf "consul_acl_policy.envoy-blowhole.name") - ]; - - service_identities = [ - "telegraf-blowhole" - ]; - - node_identities = [ - "blowhole:homelab-1" - ]; - }; - - resource."vault_consul_secret_backend_role"."envoy-klipper" = { - name = "envoy-klipper"; - - backend = "consul"; - - service_identities = [ - "mainsail" - ]; - - node_identities = [ - "blowhole:homelab-1" - ]; - }; - }; -} diff --git a/nixos/systems/blowhole/vault-agent.nix b/nixos/systems/blowhole/vault-agent.nix deleted file mode 100644 index 1008065..0000000 --- a/nixos/systems/blowhole/vault-agent.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ pkgs, lib, config, tf, inputs, ... }: -with lib; -let -in -{ - systemd.services.hashicorp-vault-agent = - let - config = pkgs.writeText "hashicorp-vault-agent-tmpfiles.d" '' - d /run/secrets 0750 root root 0 - x /run/secrets/monitor 0755 root root - - d /run/secrets/monitor 0755 root root 0 - x /run/secrets/klipper 0755 root root - - d /run/secrets/klipper 0755 root root 0 - ''; - in - { - preStart = "systemd-tmpfiles --create " + config; - postStop = "systemd-tmpfiles --clean " + config; - }; - - services.hashicorp.vault-agent = - { enable = true; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.vault; - - command = "agent"; - - extraPackages = with pkgs; - [ sudo getent ]; - - settings = - { vault = - { address = "https://vault.in.redalder.org:8200"; - retry = - { num_retries = 5; - }; - }; - - auto_auth = { - method = singleton - { "approle" = - { mount_path = "auth/approle"; - config = - { role_id_file_path = "/var/secrets/approle.roleid"; - secret_id_file_path = "/var/secrets/approle.secretid"; - remove_secret_id_file_after_reading = false; - }; - }; - }; - - sink = - [ { type = "file"; - config = - { path = "/run/secrets/vault-token"; - }; - } - ]; - }; - - template = [ - { - source = pkgs.writeText "id_ed_camera" '' - {{ with secret "kv/data/homelab-1/blowhole/id_ed_camera" }}{{ .Data.data.private }}{{ end }} - ''; - destination = "/run/secrets/id_ed_camera"; - command = pkgs.writeShellScript "id_ed_camera-command" '' - export PATH=${pkgs.util-linux}/bin:$PATH - chown root:root /run/secrets/id_ed_camera - chmod 600 /run/secrets/id_ed_camera - ''; - } - ]; - }; - }; -} diff --git a/nixos/systems/blowhole/vault.nix b/nixos/systems/blowhole/vault.nix deleted file mode 100644 index e1b5c9c..0000000 --- a/nixos/systems/blowhole/vault.nix +++ /dev/null @@ -1,85 +0,0 @@ -{lib, config, pkgs, secret, inputs, ...}: -with lib; -let - certs = config.services.acme-sh.certs; -in -{ - services.hashicorp.vault = { - enable = true; - - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.vault-bin; - - settings = { - backend."file" = { - path = "/var/lib/vault"; - }; - - ui = true; - - listener = [ - { - "tcp" = { - address = "localhost:8200"; - tls_cert_file = - "${certs.vault.certPath}"; - tls_key_file = - "${certs.vault.keyPath}"; - }; - } - { - "tcp" = { - address = "${secret.network.ips.blowhole.ip}:8200"; - tls_cert_file = - "${certs.vault.certPath}"; - tls_key_file = - "${certs.vault.keyPath}"; - }; - } - ]; - - storage."raft" = { - path = "/var/lib/vault"; - node_id = "blowhole"; - }; - cluster_addr = "https://${secret.network.ips.blowhole.ip}:8201"; - api_addr = "http://${secret.network.ips.blowhole.ip}:8200"; - }; - }; - - services.acme-sh.certs.vault = { - production = true; - user = "root"; - domains = { - "vault.in.redalder.org" = "dns_hetzner"; - }; - mainDomain = "vault.in.redalder.org"; - # Trigger vault to reread certificate files. - postRun = '' - systemctl try-reload-or-restart --no-block hashicorp-vault.service - ''; - }; - systemd.services."acme-sh-vault" = { - serviceConfig.EnvironmentFile = mkForce "/var/secrets/hetzner.env"; - }; - - services.acme-sh.certs.vault-wildcard = { - production = true; - user = "root"; - domains = { - "*.in.redalder.org" = "dns_hetzner"; - }; - mainDomain = "*.in.redalder.org"; - # Trigger vault to reread certificate files. - postRun = '' - ( - exec 44<<<"$(cat '${certs.vault-wildcard.statePath}/*.in.redalder.org/ca.cer')\n$(cat '${certs.vault-wildcard.keyPath}')" - VAULT_ADDR="https://vault.in.redalder.org:8200" \ - VAULT_TOKEN="$(cat /run/secrets/vault-token)" \ - ${pkgs.vault}/bin/vault write pki-inra/config/ca pem_bundle=@/proc/self/fd/44 - ) - ''; - }; - systemd.services."acme-sh-vault-wildcard" = { - serviceConfig.EnvironmentFile = mkForce "/var/secrets/hetzner.env"; - }; -} diff --git a/nixos/systems/blowhole/zones/blocked.zone b/nixos/systems/blowhole/zones/blocked.zone deleted file mode 100644 index 6b77217..0000000 --- a/nixos/systems/blowhole/zones/blocked.zone +++ /dev/null @@ -1,15 +0,0 @@ -; -; BIND data file for example.local -; -$TTL 3600 -@ IN SOA ns1.example.local. info.example.local. ( - 2022092600 ; Serial - 7200 ; Refresh - 120 ; Retry - 2419200 ; Expire - 3600) ; Default TTL -; - A 10.64.2.1 ; This means that naughydomain.com gets directed to the designated address -* IN A 10.64.2.1 ; This wildcard entry means that any permutation of xxx.naughtydomain.com gets directed to the designated address - AAAA ::1 ; This means that naughydomain.com gets directed to IPv6 localhost -* IN AAAA ::1 ; This wildcard entry means that any permutation of xxx.naughtydomain.com gets directed to IPv6 localhost diff --git a/nixos/systems/blowhole/zones/hosts.in.redalder.org.zone b/nixos/systems/blowhole/zones/hosts.in.redalder.org.zone deleted file mode 100644 index da1505d..0000000 --- a/nixos/systems/blowhole/zones/hosts.in.redalder.org.zone +++ /dev/null @@ -1,16 +0,0 @@ -$ORIGIN in.redalder.org. -$TTL 5m - -hosts IN SOA ns.in.redalder.org. root.redalder.org. ( - 14 ; serial - 4h ; refresh - 15m ; retry - 8h ; expire - 4m) ; negativa caching TTL - IN NS ns.redalder.org - IN A 10.64.2.1 - -$ORIGIN hosts.in.redalder.org. - -blowhole IN A 10.64.2.1 -toothpick IN A 10.64.0.1 diff --git a/nixos/systems/blowhole/zones/in.redalder.org.zone b/nixos/systems/blowhole/zones/in.redalder.org.zone deleted file mode 100644 index f091c83..0000000 --- a/nixos/systems/blowhole/zones/in.redalder.org.zone +++ /dev/null @@ -1,26 +0,0 @@ -$ORIGIN redalder.org. -$TTL 5m - -in IN SOA ns.redalder.org. root.redalder.org. ( - 24 ; serial - 4h ; refresh - 15m ; retry - 8h ; expire - 4m) ; negativa caching TTL - IN NS ns.redalder.org - IN A 10.64.2.1 - -$ORIGIN in.redalder.org. - -vault IN A 10.64.2.1 -consul IN A 10.64.2.1 -nomad IN A 10.64.2.1 -grafana IN A 10.64.2.1 -hass IN A 10.64.2.1 -jellyfin IN A 10.64.2.1 -zigbee2mqtt IN A 10.64.2.1 -syncthing IN A 10.64.2.1 -influx IN A 10.64.2.1 -mainsail IN A 10.64.2.1 -matrix IN A 10.64.2.1 - diff --git a/nixos/systems/deck.nix b/nixos/systems/deck.nix deleted file mode 100644 index fb01b8b..0000000 --- a/nixos/systems/deck.nix +++ /dev/null @@ -1,86 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "heater"; - module = { - roots, - inputs, - pkgs, - secret, - lib, - config, - ... - }: - with lib; { - imports = [ - # (roots.nixos + "/profiles/workstation.nix") - ]; - - # _module.args.nixinate = { - # host = "10.64.2.129"; - # sshUser = "main"; - # buildOn = "local"; - # substituteOnTarget = true; - # hermetic = false; - # nixOptions = [ - # "--override-input secret path://$HOME/dotfiles/secret" - # ]; - # }; - - nixpkgs.config.allowUnfree = true; - - home-manager.users."main" = {...}: { - magic_rb = { - # optimisation.march = "znver2"; - }; - - home.stateVersion = "20.09"; - }; - - magic_rb = { - # optimisation.march = "znver2"; - grub = { - enable = true; - efi.enable = true; - }; - - xserver = { - gpu = "nvidia"; - }; - - # erase-my-darlings.zfs = { - # enable = true; - # snapshot = "heater-zpool/local/root@blank"; - # }; - - hardware.deck = true; - - gaming.enable = true; - }; - - # Pinning - nix.registry = - flip mapAttrs inputs - ( - n: flake: {inherit flake;} - ); - - networking = { - hostName = "deck"; - useDHCP = false; - - firewall.enable = true; - hostId = "3457b231"; - - firewall = { - allowedTCPPorts = [22]; - }; - }; - - # System - system.stateVersion = "22.05"; - }; -} - diff --git a/nixos/systems/heater.nix b/nixos/systems/heater.nix deleted file mode 100644 index 12a6840..0000000 --- a/nixos/systems/heater.nix +++ /dev/null @@ -1,86 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "heater"; - module = { - roots, - inputs, - pkgs, - secret, - lib, - config, - ... - }: - with lib; { - imports = [ - (roots.nixos + "/profiles/workstation.nix") - ]; - - _module.args.nixinate = { - host = "10.64.2.129"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - nixpkgs.config.allowUnfree = true; - - home-manager.users."main" = {...}: { - magic_rb = { - optimisation.march = "znver2"; - }; - - home.stateVersion = "20.09"; - }; - - magic_rb = { - optimisation.march = "znver2"; - grub = { - enable = true; - efi.enable = true; - }; - - xserver = { - gpu = "nvidia"; - }; - - erase-my-darlings.zfs = { - enable = true; - snapshot = "heater-zpool/local/root@blank"; - }; - - hardware.heater = true; - - gaming.enable = true; - }; - - # Pinning - nix.registry = - flip mapAttrs inputs - ( - n: flake: {inherit flake;} - ); - - networking = { - hostName = "heater"; - useDHCP = false; - interfaces.enp3s0.useDHCP = true; - - firewall.enable = true; - hostId = "3457b383"; - - firewall = { - allowedTCPPorts = [22 25565]; - }; - }; - - # System - system.stateVersion = "20.09"; - }; -} diff --git a/nixos/systems/mark.nix b/nixos/systems/mark.nix deleted file mode 100644 index ee5d6ca..0000000 --- a/nixos/systems/mark.nix +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "mark"; - module = { - pkgs, - config, - roots, - ... - }: { - imports = [ - (roots.nixos + "/modules") - ]; - - magic_rb = { - hardware.mark = true; - }; - time.timeZone = "Europe/Bratislava"; - system.stateVersion = "20.09"; - - environment.systemPackages = with pkgs; [ - gnupg - pinentry - openssl - paperkey - monkeysphere - ssss - ]; - }; -} diff --git a/nixos/systems/omen.nix b/nixos/systems/omen.nix deleted file mode 100644 index 2a77525..0000000 --- a/nixos/systems/omen.nix +++ /dev/null @@ -1,198 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "omen"; - module = { - pkgs, - lib, - config, - secret, - roots, - inputs, - ... - }: - with lib; { - imports = [ - (roots.nixos + "/profiles/workstation.nix") - ]; - - services.fwupd.enable = true; - - _module.args.nixinate = { - host = "10.64.0.8"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - home-manager.users."main" = {...}: { - magic_rb = { - optimisation.march = "skylake"; - }; - - home.stateVersion = "20.09"; - }; - - specialisation.nvidia-sync = { - configuration = { - magic_rb.xserver.nvidia = { - primeSync = true; - primeOffload = lib.mkForce false; - }; - }; - inheritParentConfig = true; - }; - - systemd.services."emergency".serviceConfig.ExecStartPre = "/bin/sh -c \"read -t 30 || /run/current-system/sw/bin/systemctl reboot\""; - - magic_rb = { - optimisation.march = "skylake"; - grub = { - enable = true; - efi.enable = true; - }; - - xserver = { - gpu = "nvidia"; - nvidia = { - primeOffload = true; - - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - }; - - gaming.enable = true; - hardware.omen = true; - networking = { - bluetooth = true; - networkManager = true; - }; - }; - - # Pinning - nix.registry = - flip mapAttrs inputs - ( - n: flake: {inherit flake;} - ); - - # Networking - networking = { - hostName = "omen"; - useDHCP = false; - interfaces.eno1.useDHCP = true; - hostId = "10c7ffc5"; - networkmanager.dns = "none"; - nameservers = [ "10.64.2.1" ]; - - firewall.allowedTCPPorts = [22000]; - - wireguard.interfaces."wg0" = - {} // config.magic_rb.secret.wireguard."omen" or { privateKey = ""; }; - }; - - networking.networkmanager.dispatcherScripts = [ - { - source = pkgs.writeShellScript "udp2tcp.sh" - '' - export PATH=${makeBinPath [ pkgs.wireguard-tools ]}:$PATH - _interface="$1" - _action="$2" - - echo "action: $_action interface: $_interface id: $CONNECTION_ID" - case "$_action" in - up) - case "$_interface" in - wlo1) - case "$CONNECTION_ID" in - VU-Campusnet) - wg set wg0 \ - peer h4g6vWjOB6RS0NbrP/Kvb2CZeutm/F+ZfDbJmEd1Dgk= \ - endpoint 127.0.0.1:6665 - systemctl restart udp2tcp.service - ;; - *) - wg set wg0 \ - peer h4g6vWjOB6RS0NbrP/Kvb2CZeutm/F+ZfDbJmEd1Dgk= \ - endpoint 64.225.104.221:6666 - systemctl stop udp2tcp.service - ;; - esac - ;; - *) - ;; - esac - ;; - down) - wg set wg0 \ - peer h4g6vWjOB6RS0NbrP/Kvb2CZeutm/F+ZfDbJmEd1Dgk= \ - endpoint 64.225.104.221:6666 - systemctl stop udp2tcp.service - ;; - *) - ;; - esac - ''; - } - { - source = pkgs.writeShellScript "nfs-mounts.sh" - '' - export PATH=${makeBinPath [ pkgs.iputils ]}:$PATH - - ping -c 1 -W 0.7 8.8.4.4 # > /dev/null 2>&1 - - if [ $? -eq 0 ] ; then - echo "Mounting network drives" - systemctl start mnt-net-kyle.mount \ - mnt-net-cartman.mount \ - mnt-net-stan.mount \ - mnt-net-getmail.d.mount \ - mnt-net-mail\\x2dconfiguration & - else - echo "Unmounting network drives" - umount -ql \ - /mnt/net/kyle \ - /mnt/net/cartman \ - /mnt/net/stan \ - /mnt/net/getmail.d \ - /mnt/net/mail-configuration & - fi - ''; - } - ]; - - systemd.services.udp2tcp = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - - path = with pkgs; [ dig.host ]; - - restartIfChanged = true; - - script = '' - ${pkgs.udp-over-tcp}/bin/udp2tcp\ - --udp-listen 127.0.0.1:6665 \ - --tcp-forward "64.225.104.221:6001" - ''; - }; - - systemd.services.udp2tcp-wake-restart = { - wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ]; - after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ]; - - script = '' - systemctl restart udp2tcp.service - ''; - }; - - # System - system.stateVersion = "20.09"; - }; -} diff --git a/nixos/systems/recovery-usb.nix b/nixos/systems/recovery-usb.nix deleted file mode 100644 index 32cc155..0000000 --- a/nixos/systems/recovery-usb.nix +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "recovery-usb"; - module = { - pkgs, - inputs, - roots, - ... - }: { - imports = [ - (roots.nixos + "/modules") - inputs.home-manager.nixosModules.home-manager - "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" - ]; - home-manager.users."main" = {...}: { - imports = [(roots.home-manager + "/modules")]; - - magic_rb = { - programs = { - bash.enable = true; - ssh.enable = true; - gpg.enable = true; - gpg.pinentryFlavor = "curses"; - }; - }; - - home.packages = with pkgs; [ - openssl - pcsclite - paperkey - monkeysphere - ssss - xxd - usbutils - pciutils - ]; - - home.stateVersion = "20.09"; - }; - - - # Enable PCSCD for smart card stuff - services.pcscd.enable = true; - - magic_rb = { - hardware.recoveryUsb = true; - flakes.enable = true; - }; - }; -} diff --git a/nixos/systems/toothpick/consul.nix b/nixos/systems/toothpick/consul.nix deleted file mode 100644 index 09d1904..0000000 --- a/nixos/systems/toothpick/consul.nix +++ /dev/null @@ -1,56 +0,0 @@ -{inputs, lib, config, pkgs, secret, ...}: -with lib; -let -in -{ - services.hashicorp.consul = { - enable = true; - - extraSettingsPaths = - [ "/run/secrets/consul.json" - ]; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.consul; - - settings = { - datacenter = "do-1"; - data_dir = "/var/lib/consul"; - - retry_join_wan = [ "${secret.network.ips.blowhole.ip}" ]; - - server = true; - - bind_addr = secret.network.ips.toothpick; - client_addr = secret.network.ips.toothpick; - - primary_datacenter = "homelab-1"; - - acl = { - enabled = true; - default_policy = "deny"; - enable_token_persistence = true; - enable_token_replication = true; - }; - - ports = { - http = 8500; - grpc = 8502; - }; - - ui_config.enabled = true; - - connect.enabled = true; - - # ca_file = "/var/secrets/consul-ca.crt"; - # cert_file = "" - # key_file = "" - verify_incoming = false; - verify_outgoing = false; - verify_server_hostname = false; - }; - }; - - systemd.services.hashicorp-consul.serviceConfig = { - LimitNOFILE = mkForce "infinity"; - LimitNPROC = mkForce "infinity"; - }; -} diff --git a/nixos/systems/toothpick/default.nix b/nixos/systems/toothpick/default.nix deleted file mode 100644 index 044e86f..0000000 --- a/nixos/systems/toothpick/default.nix +++ /dev/null @@ -1,195 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "toothpick"; - module = { - lib, - pkgs, - config, - secret, - inputs, - roots, - self, - ... - }: -with lib; -{ - imports = [ - (roots.nixos + "/profiles/vps.nix") - ./consul.nix - ./nomad.nix - ./vault-agent.nix - ./u2t.nix - ]; - - home-manager.users."main" = {...}: { - home.stateVersion = "22.05"; - }; - - _module.args.nixinate = { - host = "redalder.org"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - magic_rb = { - hardware.toothpick = true; - flakes.enable = true; - sshdEmacs.enable = true; - vpsRemoteAccess = { - enable = true; - trustedWheel = true; - }; - }; - boot.loader.grub = { - enable = true; - version = 2; - efiSupport = false; - }; - - environment.systemPackages = [ - pkgs.git - ]; - - boot.kernel.sysctl = {"net.ipv4.ip_forward" = "1";}; - - # https://github.com/NixOS/nixpkgs/issues/76671 - # the rpc.statd daemon is not running when not mounting any nfs filesystems on boot - # and can't be manually started... - services.nfs.server.enable = true; - - networking = { - hostName = "toothpick"; - - nameservers = [ - "${secret.network.ips.blowhole.ip}" - "93.184.77.2" - "67.207.67.3" - ]; - - wireguard = { - enable = true; - interfaces."wg0" = - { - postSetup = '' - ${pkgs.iptables}/bin/iptables -I FORWARD -i wg0 -o wg0 -j ACCEPT - ''; - - postShutdown = '' - ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT - ''; - } - // config.magic_rb.secret.wireguard."toothpick" or { privateKey = ""; }; - }; - - defaultGateway = "64.225.96.1"; - defaultGateway6 = ""; - dhcpcd.enable = false; - usePredictableInterfaceNames = lib.mkForce false; - - firewall = { - extraCommands = '' - iptables -P FORWARD DROP - ''; - - # extraStopCommands = '' - # ''; - - interfaces."eth0" = { - allowedTCPPorts = [ - 80 - 443 - 6001 - ]; - allowedUDPPorts = [ - 6666 - ]; - }; - - interfaces."nomad" = { - allowedTCPPorts = [ - 8500 - ]; - }; - - interfaces."wg0" = { - allowedTCPPorts = [ - ## Consul - 8600 # DNS - 8500 # HTTP - 8502 # gRPC - 8300 # server - 8301 # LAN serf - 8302 # WAN serf - 4646 # Nomad - 4647 - 4648 - 10000 - ]; - allowedTCPPortRanges = [ - { - from = 21000; - to = 21255; - } - ]; - allowedUDPPorts = [ - ## Consul - 8600 # DNS - 8301 # LAN serf - 8302 # WAN serf - ]; - allowedUDPPortRanges = [ - { - from = 21000; - to = 21255; - } - ]; - }; - }; - - interfaces = { - eth0 = { - ipv4.addresses = [ - { - address = "64.225.104.221"; - prefixLength = 20; - } - { - address = "10.19.0.6"; - prefixLength = 16; - } - ]; - ipv6.addresses = [ - { - address = "fe80::8ce0:84ff:fefb:f981"; - prefixLength = 64; - } - ]; - ipv4.routes = [ - { - address = "64.225.96.1"; - prefixLength = 32; - } - ]; - }; - }; - }; - - security.pki.certificates = - singleton (builtins.readFile (roots.flake + "/redalder.org.crt")); - - services.udev.extraRules = '' - ATTR{address}=="8e:e0:84:fb:f9:81", NAME="eth0" - ''; - - time.timeZone = "Europe/Bratislava"; - system.stateVersion = "21.05"; - }; -} diff --git a/nixos/systems/toothpick/nomad.nix b/nixos/systems/toothpick/nomad.nix deleted file mode 100644 index 586c7a5..0000000 --- a/nixos/systems/toothpick/nomad.nix +++ /dev/null @@ -1,133 +0,0 @@ -{lib, config, pkgs, inputs, secret, ...}: -with lib; -let -in -{ - services.hashicorp.nomad = { - enable = true; - - extraPackages = with pkgs; [coreutils iproute2 iptables consul glibc config.nix.package git]; - extraSettingsPaths = [ - "/run/secrets/nomad.json" - ]; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.nomad_1_5.overrideAttrs (old: - { - patches = [ - ../0001-Revert-Change-consul-SI-tokens-to-be-local.patch - ../0001-Add-Nix-integration.patch - ]; - }); - - settings = { - server = { - enabled = true; - }; - - tls = { - # http = false # true - # rpc = true - - # ca_file = "nomad-ca.pem" - # cert_file = "client.pem" - # key_file = "client-key.pem" - - # verify_server_hostname = true - # verify_https_client = true - }; - - vault = { - enabled = true; - address = "https://${secret.network.ips.vault.dns}:8200"; - allow_unauthenticated = true; - create_from_role = "nomad-cluster"; - }; - - consul = { - address = "${secret.network.ips.toothpick}:8500"; - auto_advertise = true; - server_auto_join = true; - client_auto_join = true; - }; - - acl = { - enabled = true; - }; - - client = { - cni_path = "${pkgs.cni-plugins}/bin"; - - options = { - "docker.privileged.enabled" = "true"; - }; - - host_network."default" = { - cidr = secret.network.ips.toothpick + "/32"; - }; - - host_network."private" = { - cidr = secret.network.ips.toothpick + "/32"; - }; - - host_network."mesh" = { - cidr = secret.network.ips.toothpick + "/32"; - }; - - network_interface = "wg0"; - - host_network."public" = { - cidr = "64.225.104.221/32"; - reserved_ports = "22"; - }; - - enabled = true; - }; - - plugin."docker" = { - config = { - allow_caps = [ - "CHOWN" - "DAC_OVERRIDE" - "FSETID" - "FOWNER" - "MKNOD" - "NET_RAW" - "SETGID" - "SETUID" - "SETFCAP" - "SETPCAP" - "NET_BIND_SERVICE" - "SYS_CHROOT" - "KILL" - "AUDIT_WRITE" - "SYS_ADMIN" - ]; - allow_privileged = true; - extra_labels = [ - "job_name" - "job_id" - "task_group_name" - "task_name" - "namespace" - "node_name" - "node_id" - ]; - }; - }; - - bind_addr = "${secret.network.ips.toothpick}"; - disable_update_check = true; - data_dir = "/var/lib/nomad"; - - server.authoritative_region = "homelab-1"; - datacenter = "do-1"; - region = "do-1"; - }; - }; - - virtualisation.docker.enable = true; - virtualisation.docker.daemon.settings = { - dns = [ - "10.64.2.1" - ]; - }; -} diff --git a/nixos/systems/toothpick/u2t.nix b/nixos/systems/toothpick/u2t.nix deleted file mode 100644 index 26a8869..0000000 --- a/nixos/systems/toothpick/u2t.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: -{ - systemd.services.udp2tcp = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - - restartIfChanged = true; - - path = with pkgs; [ dig.host ]; - - script = '' - ${pkgs.udp-over-tcp}/bin/tcp2udp\ - --tcp-listen 127.0.0.1:6001 \ - --tcp-listen "$(host redalder.org | sed -e 's/.* //'):6001" \ - --udp-forward 127.0.0.1:6666 - ''; - }; -} diff --git a/nixos/systems/toothpick/vault-agent.nix b/nixos/systems/toothpick/vault-agent.nix deleted file mode 100644 index 239e5aa..0000000 --- a/nixos/systems/toothpick/vault-agent.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ config, lib, pkgs, secret, inputs, ... }: -with lib; -{ - services.hashicorp.vault-agent = { - enable = true; - package = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system}.vault; - - command = "agent"; - - extraPackages = with pkgs; - [ - sudo - getent - ]; - - settings = { - vault = { - address = "https://${secret.network.ips.vault.dns}:8200"; - retry = - { num_retries = 5; - }; - }; - - auto_auth.method = singleton - { - "approle" = { - mount_path = "auth/approle"; - config = - { - role_id_file_path = "/var/secrets/approle.roleid"; - secret_id_file_path = "/var/secrets/approle.secretid"; - remove_secret_id_file_after_reading = false; - }; - }; - }; - - sink = singleton - { - "file" = { - type = "file"; - config = { - path = "/run/secrets/vault-token"; - }; - }; - }; - - template = [ - { - source = pkgs.writeText "consul.json.vtmpl" - '' - { - "encrypt": "{{ with secret "kv/data/do-1/toothpick/consul/encryption_key" }}{{ or .Data.data.key "" }}{{ end }}", - "acl": { - "tokens": { - "agent": "{{ with secret "kv/data/do-1/toothpick/consul/agent_token" }}{{ or .Data.data.secret "" }}{{ end }}", - "replication": "{{ with secret "kv/data/do-1/toothpick/consul/replication_token" }}{{ or .Data.data.secret "" }}{{ end }}", - "default": "{{ with secret "kv/data/do-1/toothpick/consul/anonymous_token" }}{{ or .Data.data.secret "" }}{{ end }}" - } - } - } - ''; - destination = "/run/secrets/consul.json"; - command = pkgs.writeShellScript "consul-command" - '' - sudo systemctl try-reload-or-restart hashicorp-consul.service - ''; - } - { - source = pkgs.writeText "nomad.json.vtmpl" - '' - { - "server": { - "encrypt": "{{ with secret "kv/data/do-1/toothpick/nomad/encryption_key" }}{{ or .Data.data.key "" }}{{ end }}" - }, - "acl": { - "replication_token": "{{ with secret "kv/data/do-1/toothpick/nomad/replication_token" }}{{ or .Data.data.secret "" }}{{ end }}" - }, - "vault": { - "token": "{{ with secret "kv/data/do-1/toothpick/nomad/vault_token" }}{{ or .Data.data.secret "" }}{{ end }}" - }, - "consul": { - "token": "{{ with secret "kv/data/do-1/toothpick/nomad/consul_token" }}{{ or .Data.data.secret "" }}{{ end }}" - } - } - ''; - destination = "/run/secrets/nomad.json"; - command = pkgs.writeShellScript "nomad-command" - '' - sudo systemctl try-reload-or-restart hashicorp-nomad.service - ''; - } - ]; - }; - }; -} diff --git a/nixos/systems/tweedledee.nix b/nixos/systems/tweedledee.nix deleted file mode 100644 index 77d47f0..0000000 --- a/nixos/systems/tweedledee.nix +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "tweedledee"; - module = { - pkgs, - config, - inputs, - roots, - ... - }: { - imports = [ - (roots.nixos + "/profiles/oracle-cloud.nix") - ]; - - home-manager.users."main" = - {...}: - { - home.stateVersion = "22.05"; - }; - - _module.args.nixinate = { - host = "tweedledee.redalder.org"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - magic_rb.hardware.tweedledum = true; - - networking.hostName = "tweedledee"; - system.stateVersion = "20.09"; - }; -} diff --git a/nixos/systems/tweedledum.nix b/nixos/systems/tweedledum.nix deleted file mode 100644 index 78862a1..0000000 --- a/nixos/systems/tweedledum.nix +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "tweedledum"; - module = { - pkgs, - config, - inputs, - roots, - ... - }: { - imports = [ - (roots.nixos + "/profiles/oracle-cloud.nix") - ]; - - home-manager.users."main" = - {...}: - { - home.stateVersion = "22.05"; - }; - - _module.args.nixinate = { - host = "tweedledum.redalder.org"; - sshUser = "main"; - buildOn = "local"; - substituteOnTarget = true; - hermetic = false; - nixOptions = [ - "--override-input secret path://$HOME/dotfiles/secret" - ]; - }; - - magic_rb.hardware.tweedledum = true; - - networking.hostName = "tweedledum"; - system.stateVersion = "20.09"; - }; -} diff --git a/nixos/systems/zfs-installation.nix b/nixos/systems/zfs-installation.nix deleted file mode 100644 index aa5f6b0..0000000 --- a/nixos/systems/zfs-installation.nix +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - system = "x86_64-linux"; - name = "heater"; - module = { - roots, - inputs, - pkgs, - secret, - lib, - config, - ... - }: - with lib; { - nix.registry = - flip mapAttrs inputs - ( - n: flake: {inherit flake;} - ); - - services.ssh.enable = true; - - users.users.main = { - isNormalUser = true; - extraGroups = [ "sudo" ]; - password = "toor"; - }; - - boot.initrd.systemd.enable = true; - boot.initrd.supportedFilesystems = [ "zfs" ]; - boot.supportedFilesystems = [ "zfs" ]; - boot.zfs.enableUnstable = true; - - networking = { - hostName = "zfs-test"; - useDHCP = false; - - firewall.enable = true; - hostId = "a9b2c221"; - - firewall = { - allowedTCPPorts = [22 25565]; - }; - }; - - # System - system.stateVersion = "22.05"; - }; -} diff --git a/org b/org deleted file mode 160000 index f3069e1..0000000 --- a/org +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f3069e1e78909dcb23eaf8a80305229bbcbfabde diff --git a/overlays/bootloadHID.nix b/overlays/bootloadHID.nix deleted file mode 100644 index d9ee22f..0000000 --- a/overlays/bootloadHID.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "bootloadHID"; - overlay = {bootloadHID}: final: prev: { - bootloadHID = prev.stdenv.mkDerivation { - pname = "bootloadHID"; - version = "2012-12-08"; - - src = bootloadHID; - - buildInputs = with prev; [ - libusb-compat-0_1 - ]; - - sourceRoot = "source/commandline"; - installPhase = '' - install -d $out/bin - install bootloadHID $out/bin - ''; - }; - }; -} diff --git a/overlays/bwrap-x.nix b/overlays/bwrap-x.nix deleted file mode 100644 index 9800827..0000000 --- a/overlays/bwrap-x.nix +++ /dev/null @@ -1,139 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "bwrap-x"; - overlay = {}: final: prev: { - bwrap-factorio = final.bwrap-x { - pkgs = with prev; [ - xorg.libX11 - xorg.libXext - xorg.libXinerama - xorg.libXrandr - xorg.libXcursor - pulseaudio - libglvnd - alsa-lib - ]; - name = "factorio"; - exec = "$@"; - }; - bwrap-x = - { defaultPackages ? (with prev; [ bashInteractive coreutils-full gawk gzip gnutar gnugrep glibc.bin ]) - , pkgs ? [] - , exec - , name - , bwrapArgsPost ? "" - , bwrapArgsPre ? "" - , script ? "" - , args ? [] - }: - with prev.lib; - prev.writeShellScriptBin name '' - nixpkgs="${prev.path}" - - store_paths=() - preload_libraries=() - - ${script} - - for package in ${concatStringsSep " " (pkgs ++ defaultPackages)} - do - for path in $(nix path-info -r $package) - do - store_paths+=("$path") - done - done - - for package in ${concatStringsSep " " (pkgs ++ defaultPackages)} - do - for path in $(nix build --no-link --print-out-paths $package) - do - if [ -e "$path/lib" ] - then - preload_libraries+=("$path/lib") - fi - done - done - - - if [ "$ENABLE_XORG" == "1" ] - then - for package in $(readlink /run/opengl-driver /run/opengl-driver-32) - do - for path in $(nix path-info -r $package) - do - store_paths+=("$path") - done - done - preload_libraries+=("/run/opengl-driver/lib" "/run/opengl-driver-32/lib") - fi - - preload_libraries_new="$(echo "''${preload_libraries[@]}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')" - store_paths_new="$(echo "''${store_paths[@]}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')" - - ${prev.bubblewrap}/bin/bwrap \ - --unshare-all \ - --ro-bind /bin/sh /bin/sh \ - --ro-bind /usr/bin/env /usr/bin/env \ - --ro-bind ${prev.glibc}/lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 \ - --ro-bind /nix/store /nix/store \ - `# $(for path in ''${store_paths_new[@]} ;` \ - `# do` \ - `# nix path-info $path -r | sed 's/\(.*\)/--ro-bind \1 \1/m' | tr '\n' ' ' ;` \ - `# done)` \ - --ro-bind /bin/sh /bin/sh \ - --setenv PATH \ - $(for path in ''${store_paths_new[@]} ; \ - do \ - echo $path | sed 's~\(.*\)~\1/bin~m' | tr '\n' ':' ; \ - done) \ - --tmpfs /tmp \ - --proc /proc \ - --dev /dev \ - \ - \ - $(for path in $BIND_PATHS ; \ - do \ - echo "--bind $path $path" ; \ - done) \ - $(for path in $BIND_RO_PATHS ; \ - do \ - echo "--ro-bind $path $path" ; \ - done) \ - `# $([ "$CWD" = "" ] && echo "--cwd $CWD")` \ - \ - \ - $([ "$ENABLE_PULSEAUDIO" == "1" ] && echo "${concatStringsSep " " [ - "--dev-bind /dev/snd /dev/snd" - "--ro-bind /etc/group /etc/group" - "--bind /run/user/1000/pulse/ /run/user/1000/pulse/" - ]}") \ - \ - \ - $([ "$ENABLE_XORG" == "1" ] && echo "${concatStringsSep " " [ - "--bind /tmp/.X11-unix/X0 /tmp/.X11-unix/X0" - "--ro-bind /home/main/.Xauthority /home/main/.Xauthority" - - "--bind /run/nvidia-xdriver-46a69d9a /run/nvidia-xdriver-46a69d9a" - "--ro-bind /run/opengl-driver-32 /run/opengl-driver-32" - "--ro-bind /run/opengl-driver /run/opengl-driver" - "--ro-bind /sys/dev/char /sys/dev/char" - "--ro-bind /sys/bus/pci /sys/bus/pci" - "--dev-bind /dev/dri /dev/dri" - "--ro-bind /sys/devices/pci0000:00 /sys/devices/pci0000:00" - "$(for dev in /dev/nvidia* ; do echo \"--dev-bind $dev $dev\" ; done)" - ]}") \ - \ - $([ "$ENABLE_NETWORK" == "1" ] && echo "${concatStringsSep " " [ - "--ro-bind /etc/ssl /etc/ssl" - "--ro-bind /etc/static/ssl /etc/static/ssl" - "--ro-bind /etc/resolv.conf /etc/resolv.conf" - "--share-net" - ]}") \ - --setenv LD_LIBRARY_PATH "$(echo "''${preload_libraries_new[@]}" | tr ' ' ':')" \ - ${bwrapArgsPost} \ - ${exec} ${concatStringsSep " " args} - ''; - }; -} diff --git a/overlays/emacs-ng.nix b/overlays/emacs-ng.nix deleted file mode 100644 index 4a30a28..0000000 --- a/overlays/emacs-ng.nix +++ /dev/null @@ -1,236 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "emacs-ng"; - overlay = { - emacs, - vtermModule, - }: final: prev: - with prev.lib; let - inherit (prev) callPackage stdenv; - - hunspellWithDicts = cfg: - stdenv.mkDerivation { - name = (appendToName "with-dicts" cfg.hunspell.package).name; - buildInputs = [prev.makeWrapper]; - buildCommand = '' - makeWrapper \ - ${cfg.hunspell.package.bin}/bin/hunspell $out/bin/hunspell \ - --prefix DICPATH : ${makeSearchPath "share/hunspell" cfg.hunspell.dictionaries} - ''; - meta = removeAttrs cfg.hunspell.package.meta ["outputsToInstall"]; - }; - in { - - libvterm-emacs = stdenv.mkDerivation { - name = "vterm-emacs"; - src = vtermModule; - buildInputs = with prev; [cmake libtool glib.dev libvterm-neovim]; - cmakeFlags = [ - "-DEMACS_SOURCE=${emacs}" - "-DUSE_SYSTEM_LIBVTERM=ON" - ]; - installPhase = '' - mkdir -p $out/lib - install ../vterm-module.so $out/lib - ''; - }; - - emacs-magicrb = - callPackage - (module: - let - mkPkgOption = name: - mkOption { - description = "`${name}` package."; - default = prev.${name}; - type = types.package; - }; - - evaled = - evalModules - { - modules = - [module] - ++ singleton - ({config, ...}: { - options = { - pkgs = { - gcc = mkOption { - description = "`gcc` package."; - default = prev.libgccjit.stdenv.cc; - type = types.package; - }; - gnumake = mkPkgOption "gnumake"; - emacs = mkPkgOption "emacs"; - giflib = mkPkgOption "giflib"; - librsvg = mkPkgOption "librsvg"; - glib-networking = mkPkgOption "glib-networking"; - webkitgtk = mkPkgOption "webkitgtk"; - xorg = mkOption { - description = "`xorg` package set."; - default = prev.xorg; - type = with types; attrsOf package; - }; - makeWrapper = mkPkgOption "makeWrapper"; - libvterm-emacs = mkOption { - description = "`libvterm-emacs` package."; - default = final.libvterm-emacs; - type = types.package; - }; - tree-sitter = mkOption { - description = "`tree-sitter` package."; - default = prev.tree-sitter; - type = types.package; - }; - }; - - march = mkOption { - description = '' - Optimize for a specific architecture. - ''; - type = with types; nullOr str; - default = null; - }; - - additionalPackages = mkOption { - description = '' - Additional packages to add statically to the Emacs closure, requires a - restart of Emacs for changes to take effect. - ''; - type = with types; listOf package; - default = []; - }; - - environment = mkOption { - description = '' - Set additional environment variables. - ''; - type = with types; attrsOf (oneOf [str path]); - default = {}; - }; - - hunspell = { - enable = mkEnableOption "Enable hunspell and dictionaries"; - package = mkPkgOption "hunspell"; - dictionaries = mkOption { - description = '' - Dictionaries included with Hunspell. - ''; - type = with types; listOf package; - default = []; - }; - }; - - output = { - base = mkOption { - readOnly = true; - type = types.package; - description = '' - Emacs base output without additional packages available. - ''; - }; - - bundle = mkOption { - readOnly = true; - type = types.package; - description = '' - Emacs bundle with additional packages. - ''; - }; - }; - }; - - config = { - additionalPackages = - (optional config.hunspell.enable (hunspellWithDicts config)) - ++ [ ]; - - output.base = - (config.pkgs.emacs.override - { - withX = false; - withPgtk = true; - inherit (prev) - gtk3-x11 - gtk3 - gsettings-desktop-schemas; - - withSQLite3 = true; - nativeComp = true; - - srcRepo = true; - inherit (prev) - autoreconfHook - texinfo; - - withWebP = true; - }) - .overrideAttrs - (old: { - version = "30.0.50"; - src = emacs; - - configureFlags = [ - "--disable-build-details" - "--with-native-compilation" - "--with-treesit" - - "--with-xpm=yes" - "--with-jpeg=yes" - "--with-png=yes" - "--with-gif=yes" - "--with-tiff=yes" - "--with-json=yes" - "--with-cairo" - "--without-x" - "--with-pgtk" - "--with-modules" - "--prefix=\${out}" - ]; - - NIX_CFLAGS_COMPILE = "-O2 -pipe ${optionalString (config.march != null) ("-march=" + config.march)}"; - - buildInputs = - old.buildInputs - ++ (with config.pkgs; - [ - giflib librsvg glib-networking - webkitgtk xorg.libXpm tree-sitter - ]); - - makeFlags = - old.makeFlags - or [] - ++ [ - "NATIVE_FULL_AOT=1" - ]; - }); - - output.bundle = with config.pkgs; - with config.output; - stdenv.mkDerivation { - inherit (base) pname version; - - phases = ["buildPhase"]; - - nativeBuildInputs = [makeWrapper]; - - buildPhase = '' - mkdir -p $out/bin - ${xorg.lndir}/bin/lndir -silent ${base} $out - wrapProgram $out/bin/emacs \ - --set EMACSLOADPATH ${base}/share/emacs/site-lisp:${libvterm-emacs}/lib: \ - --prefix PATH : ${makeBinPath config.additionalPackages} \ - ${concatStringsSep " " (mapAttrsToList (k: v: "--set " + k + " " + v) config.environment)} - ''; - }; - }; - }); - }; - in - evaled.config.output) - {}; - }; -} diff --git a/overlays/emacs-rofi/default.nix b/overlays/emacs-rofi/default.nix deleted file mode 100644 index 8d7cee0..0000000 --- a/overlays/emacs-rofi/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "emacs-rofi"; - overlays = []; - overlay = {}: final: prev: { - emacs-rofi = final.writeShellScriptBin "emacs-rofi" (builtins.readFile ./emacs-rofi); - }; -} diff --git a/overlays/emacs-rofi/emacs-rofi b/overlays/emacs-rofi/emacs-rofi deleted file mode 100644 index 9e2800a..0000000 --- a/overlays/emacs-rofi/emacs-rofi +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: shell-script; -*- -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -tmp=$(mktemp) -tee > $tmp -emacs -Q --batch --eval $"(progn (require 'server) (princ (format \"%s\\n\" (server-eval-at \"server\" '(completing-read-frame-popup-file \"$1\" \"$tmp\" $2 $3)))))" -rm $tmp diff --git a/overlays/emacsclient-remote/default.nix b/overlays/emacsclient-remote/default.nix deleted file mode 100644 index 9c1fa8c..0000000 --- a/overlays/emacsclient-remote/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "emacsclient-remote"; - overlay = {}: final: prev: - with final; { - magic_rb = - prev.magic_rb - or {} - // { - emacsclient-remote = - prev.writeShellScriptBin - "emacsclient-remote" (builtins.readFile ./emacsclient-remote); - }; - }; -} diff --git a/overlays/emacsclient-remote/emacsclient-remote b/overlays/emacsclient-remote/emacsclient-remote deleted file mode 100644 index 6ae74df..0000000 --- a/overlays/emacsclient-remote/emacsclient-remote +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -# Open file on a remote Emacs server. -# https://andy.wordpress.com/2013/01/03/automatic-emacsclient/ with added sudo. - -params=() -sudo=0 -local=0 - -host=$(echo $SSH_CONNECTION | cut -d' ' -f3) -port=$(echo $SSH_CONNECTION | cut -d' ' -f4) - -for p in "${@}"; do - if [[ "${p}" == "-n" ]]; then - params+=( "${p}" ) - elif [[ "${p}" == "-c" ]]; then - params+=( "${p}" ) - elif [[ "${p:0:1}" == "+" ]]; then - params+=( "${p}" ) - elif [[ "${p}" == "--sudo" ]]; then - sudo=1 - elif [[ "${p}" == "--local" ]]; then - # Use local server, for use with --sudo. - local=1 - else - # Setting field separator to newline so that filenames with spaces will - # not be split up into 2 array elements. - OLDIFS=${IFS} - IFS=$'\n' - - if [[ $(id -u) -eq 0 || ${sudo} -eq 1 ]]; then - if [[ ${local} -eq 0 ]]; then - params+=( "/ssh:${USER}@${host}#${port}|sudo::"$(realpath -m "${p}") ) - else - params+=( "/sudo:localhost:"$(realpath -m "${p}") ) - fi - else - params+=( "/ssh:${USER}@${host}#${port}:"$(realpath "${p}") ) - fi - - IFS=${OLDIFS} - fi -done - -"emacsclient-$(uname -m)" -s ~/.ssh/emacs-server "${params[@]}" diff --git a/overlays/gpg-key/default.nix b/overlays/gpg-key/default.nix deleted file mode 100644 index f488467..0000000 --- a/overlays/gpg-key/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "gpg-key-rb"; - overlays = ["nixng"]; - overlay = {}: final: prev: { - gpg-key-rb = final.writeSubstitutedShellScriptBin { - name = "gpg-key"; - file = ./gpg-key; - substitutes = with prev; { - inherit cryptsetup busybox findutils gnupg sudo; - }; - }; - }; -} diff --git a/overlays/gpg-key/gpg-key b/overlays/gpg-key/gpg-key deleted file mode 100644 index 43fa180..0000000 --- a/overlays/gpg-key/gpg-key +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -# -*- mode: shell-script; -*- - -export PATH=@findutils@/bin:@busybox@/bin:@cryptsetup@/bin:@gnupg@/bin:@sudo@/bin - -command="$1" - -if [ "$(id -u)" != "0" ] -then - echo "You must this script as root." - exit 1 -fi - -set -e -case "$command" in - "open") - cryptsetup open /dev/disk/by-uuid/5b9ffbde-4b39-4645-8d9f-1ffac72c6724 addhe - mkdir -p /mnt/key - - mount /dev/mapper/addhe /mnt/key - sudo -u $SUDO_USER gpg-agent --daemon - ;; - "close") - sudo -u $SUDO_USER pkill gpg-agent - - umount /mnt/key - cryptsetup close addhe - - rm -r /mnt/key - if [ -n "$(find /mnt -maxdepth 0 -empty)" ] - then - rm -r /mnt - fi - ;; - *) - cat < -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "hidapitester"; - overlay = {hidapitester}: final: prev: { - hidapitester = prev.stdenv.mkDerivation { - pname = "hidapitester"; - version = "0.2"; - - buildInputs = with prev; [ - udev - ]; - - nativeBuildInputs = with prev; [ - pkg-config - ]; - - unpackPhase = '' - runHook preUnpack - - install -d /build/source/hidapi - install -d /build/source/hidapitester - - cp -r ${prev.hidapi.src}/. /build/source/hidapi - cp -r ${hidapitester}/. /build/source/hidapitester - - chmod -R 755 /build/source - - runHook postUnpack - ''; - - HIDAPI_DIR = "/build/source/hidapi"; - sourceRoot = "/build/source/hidapitester"; - - installPhase = '' - install -d $out/bin - install hidapitester $out/bin - ''; - }; - }; -} diff --git a/overlays/ical2org.nix b/overlays/ical2org.nix deleted file mode 100644 index 36b1161..0000000 --- a/overlays/ical2org.nix +++ /dev/null @@ -1,74 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "ical2org"; - overlay = - { ical2org }: - final: - prev: - { - x-wr-timezone = with prev; - python3.pkgs.buildPythonPackage rec { - pname = "x_wr_timezone"; - version = "0.0.5"; - - src = python3.pkgs.fetchPypi { - inherit pname version; - sha256 = "sha256-wFyzS5tYpGB6eI2whtyuV2ZyjkuU4GcocNxVk6bhP+Y="; - }; - - propagatedBuildInputs = with python3.pkgs; [ - pytz - icalendar - pygments - restructuredtext_lint - pytest - ]; - - meta = with lib; {}; - }; - - recurring-ical-events = with prev; - python3.pkgs.buildPythonPackage rec { - pname = "recurring_ical_events"; - version = "1.0.2b0"; - - src = python3.pkgs.fetchPypi { - inherit pname version; - sha256 = "sha256-aoQU7rxRJvqe3PLHPto5T2rCvFSkmqfiClwCL6SRjk0="; - }; - - propagatedBuildInputs = with python3.pkgs; [ - pytz - python-dateutil - final.x-wr-timezone - tzdata - pytest-cov - pbr - ]; - - meta = with lib; {}; - }; - - ical2orgpy = with prev; - python3.pkgs.buildPythonApplication rec { - pname = "ical2orgpy"; - version = "0.4.0"; - - src = ical2org; - - PBR_VERSION="1.2.3"; - propagatedBuildInputs = with python3.pkgs; [ - click - future - icalendar - pytz - tzlocal - final.recurring-ical-events - ]; - - meta = with prev.lib; {}; - }; - }; -} diff --git a/overlays/mainsail/default.nix b/overlays/mainsail/default.nix deleted file mode 100644 index 99358bb..0000000 --- a/overlays/mainsail/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "mainsail"; - overlay = {}: final: prev: { - mainsail = final.callPackage ./mainsail.nix {}; - }; -} diff --git a/overlays/mainsail/mainsail.nix b/overlays/mainsail/mainsail.nix deleted file mode 100644 index c570666..0000000 --- a/overlays/mainsail/mainsail.nix +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - fetchurl, - lib, - unzip, -}: -with lib; - fetchurl { - url = "https://github.com/mainsail-crew/mainsail/releases/download/v2.2.1/mainsail.zip"; - sha256 = "sha256-GpL1vEJZGNaP88zltiuOv0TE/vuc59FVk8HPcaA69ho="; - downloadToTemp = true; - recursiveHash = true; - name = "mainsail"; - postFetch = '' - mkdir -p $out - ${unzip}/bin/unzip -d $out $downloadedFile - ''; - } diff --git a/overlays/nil.nix b/overlays/nil.nix deleted file mode 100644 index ecb42fa..0000000 --- a/overlays/nil.nix +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "nil"; - overlay = {nil}: - nil.overlays.nil; -} diff --git a/overlays/nixng.nix b/overlays/nixng.nix deleted file mode 100644 index 2782d75..0000000 --- a/overlays/nixng.nix +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "nixng"; - overlay = {nixng}: nixng.overlays.default; -} diff --git a/overlays/nomad-driver-containerd-nix.nix b/overlays/nomad-driver-containerd-nix.nix deleted file mode 100644 index da4895a..0000000 --- a/overlays/nomad-driver-containerd-nix.nix +++ /dev/null @@ -1,15 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "nomad-driver-containerd-nix"; - overlay = {nomad-driver-containerd-nix}: - final: - prev: - { - nomad-driver-containerd-nix = - (nomad-driver-containerd-nix.overlay final prev).nomad-driver-containerd-nix.overrideAttrs (old: - { vendorSha256 = "sha256-xLQZzs5WzdWUndKhc4hkVqijewfYY9CipAPCgi39a7M="; } - ); - }; -} diff --git a/overlays/screenshot/default.nix b/overlays/screenshot/default.nix deleted file mode 100644 index 5e0db2b..0000000 --- a/overlays/screenshot/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "screenshot"; - overlays = ["nixng"]; - overlay = {}: final: prev: { - magic_rb = - prev.magic_rb - or {} - // { - screenshot = final.writeSubstitutedShellScriptBin { - name = "screenshot"; - file = ./screenshot; - substitutes = with prev; { - inherit busybox scrot xclip; - }; - }; - }; - }; -} diff --git a/overlays/screenshot/screenshot b/overlays/screenshot/screenshot deleted file mode 100644 index 3eb584c..0000000 --- a/overlays/screenshot/screenshot +++ /dev/null @@ -1,20 +0,0 @@ -# -*- mode: shell-script; -*- -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -export PATH=@scrot@/bin:@xclip@/bin:@busybox@/bin - -OPT="${1:-screen}" - -case "$OPT" in - screen) - scrot '/tmp/%F_%T_$wx$h.png' -e 'mkdir -p ~/screenshot/ ; mv $f ~/screenshot ; xclip -selection clipboard -target image/png -i ~/screenshot/`basename $f`' - ;; - select) - scrot '/tmp/%F_%T_$wx$h.png' -f -s -e 'mkdir -p ~/screenshot/ ; mv $f ~/screenshot ; xclip -selection clipboard -target image/png -i ~/screenshot/`basename $f`' - ;; - focused) - scrot '/tmp/%F_%T_$wx$h.png' -f -e 'mkdir -p ~/screenshot/ ; mv $f ~/screenshot ; xclip -selection clipboard -target image/png -i ~/screenshot/`basename $f`' - ;; -esac diff --git a/overlays/slovensko-eid.nix b/overlays/slovensko-eid.nix deleted file mode 100644 index d486c7c..0000000 --- a/overlays/slovensko-eid.nix +++ /dev/null @@ -1,126 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "slovensko-eid"; - overlays = [ "bwrap-x" ]; - overlay = {}: final: prev: { - slovensko-eid = let - dlauncher = prev.stdenv.mkDerivation { - pname = "slovensko-dlauncher"; - version = "unknown"; - - src = prev.fetchurl { - url = "https://download.disigcdn.sk/cdn/products/websigner2/disig-web-signer.debian_amd64.deb"; - sha256 = "sha256-ryn6Z/4h/ZKpWFq2tYiH3YYmXoAD8t7M8PhIJXCeuv0="; - }; - nativeBuildInputs = with prev; [ - unar - ]; - - phases = [ "unpackPhase" ]; - - unpackPhase = '' - mkdir -p $out - ar p $src data.tar.xz | tar -xJ -C $out - ''; - }; - unwrapped = prev.stdenv.mkDerivation { - pname = "slovensko-eid"; - version = "unknown"; - - builtInputs = with prev; [ gnutar gzip binutils xz ]; - src = prev.fetchurl { - url = "https://eidas.minv.sk/downloadservice/eidklient/linux/eID_klient_x86_64.tar.gz"; - sha256 = "sha256-v62vIZt7pvzbJtvRe8d3Yaf78P/qMgM4lsC3uRDh3PY="; - }; - - phases = ["unpackPhase" "installPhase"]; - - unpackPhase = '' - tar xpf $src - ''; - - installPhase = '' - ls -lah . - cp -r eID_klient-x86_64.AppImage $out - ''; - }; - - wrapped = prev.appimageTools.wrapType2 { # or wrapType1 - name = "patchwork"; - src = unwrapped; - extraPkgs = pkgs: with prev; [ - pcsclite.out - libglvnd - gcc-unwrapped.lib - zlib - pcsclite.out - xorg.libxcb - xorg.libX11 - xorg.libXcursor - dbus.lib - lzlib - zlib - # openssl_1_1.out - libgcrypt - libsForQt5.qt5.qtsvg - libsForQt5.qt5.qtbase.out - ]; - }; - in - # dlauncher; - final.bwrap-x { - pkgs = with prev; [ - libglvnd - gcc-unwrapped.lib - zlib - pcsclite.out - xorg.libxcb - xorg.libX11 - xorg.libXcursor - dbus.lib - lzlib - zlib - # openssl_1_1.out - libgcrypt - libsForQt5.qt5.qtsvg - libsForQt5.qt5.qtbase.out - ]; - # --ro-bind ${unwrapped}/lib/eac_mw_klient/ /usr/lib/eac_mw_klient/ \ - # --ro-bind ${unwrapped}/bin/EAC_MW_klient /usr/bin/EAC_MW_klient \ - bwrapArgsPost = '' - --ro-bind /etc/resolv.conf /etc/resolv.conf \ - --ro-bind /run/pcscd/ /run/pcscd \ - ''; - script = '' - export ENABLE_XORG=1 ENABLE_NETWORK=1 QT_DEBUG_PLUGINS=1 QT_QPA_PLATFORM_PLUGIN_PATH=${unwrapped}/lib/eac_mw_klient/platforms/ - export BIND_PATHS="$BIND_PATHS /etc/localtime" - preload_libraries+=("${unwrapped}/lib/eac_mw_klient") - preload_libraries+=("${dlauncher}/opt/disig/websigner/lib") - ''; - # exec = "${prev.strace}/bin/strace"; - exec = (prev.writeShellScript "eid-bwrap" '' - set -xe - - function killstuff { - jobs -p | ${prev.findutils}/bin/xargs kill - } - - trap killstuff SIGINT - echo $LD_LIBRARY_PATH - - # ${prev.librewolf}/bin/librewolf & - # mkdir -p $HOME/.local/share/Disig/WebSigner/Logs - # touch $HOME/.local/share/Disig/WebSigner/Logs/WebSignerLog.txt - # ${prev.strace}/bin/strace -f ${prev.glibc}/lib64/ld-linux-x86-64.so.2 ${dlauncher}/opt/disig/websigner/bin/WebSigner - # cat $HOME/.local/share/Disig/WebSigner/Logs/WebSignerLog.txt - # exit 1 - # ${prev.appimage-run.override { extraPkgs = p: with p; [ pcsclite.out ]; }}/bin/appimage-run ${unwrapped}/eID_klient-x86_64.AppImage - ${prev.strace}/bin/strace -f ${wrapped}/bin/patchwork - killstuff - ''); - name = "eslovensko-eid"; - }; - }; -} diff --git a/overlays/uboot-clara-hd.nix b/overlays/uboot-clara-hd.nix deleted file mode 100644 index b8aa17d..0000000 --- a/overlays/uboot-clara-hd.nix +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "uboot-clara-hd"; - overlay = {}: final: prev: { - # magic_rb = prev.magic_rb or {} // { - # uboot-clara-hd = with prev; - # let crossPkgs = - # import prev.src - # { crossSystem.config = "arm-linux-gnueabihf"; - # }; - # in - # stdenv.mkDerivation { - # pname = "uboot-clara-hd"; - # version = "??"; - # src = fetchFromGitHub - # { owner = "akemnade"; - # repo = "u-boot-fslc"; - # rev = "2021.04+fslc"; - # sha256 = "sha256-P4aT6BX875sSIRLrk6BKfgkdBGRD8UbIINRf6PdG4hA"; - # }; - # nativeBuildInputs = [ bison flex crossPkgs.stdenv.cc ]; - # makeFlags = "ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6sllclarahd_defconfig"; - # }; - # }; - }; -} diff --git a/overlays/udp-over-tcp.nix b/overlays/udp-over-tcp.nix deleted file mode 100644 index fecd435..0000000 --- a/overlays/udp-over-tcp.nix +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "udp-over-tcp"; - overlay = {udp-over-tcp}: - final: - prev: - { - udp-over-tcp = - prev.rustPlatform.buildRustPackage { - pname = "udp-over-tcp"; - version = "v0.2.0"; - - src = udp-over-tcp; - - buildFeatures = [ "clap" ]; - cargoBuildFlags = [ "--bin" "udp2tcp" "--bin" "tcp2udp" ]; - - cargoSha256 = "sha256-Fn0AlnTzStJn+vSWCBwd3sAJG9SU7EEVc/reVYZmTp0="; - verifyCargoDeps = true; - }; - }; -} diff --git a/overlays/zfs-relmount.nix b/overlays/zfs-relmount.nix deleted file mode 100644 index ec17072..0000000 --- a/overlays/zfs-relmount.nix +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later -{ - name = "zfs-relmount"; - overlay = {}: final: prev: { - zfs-relmount = - prev.writeShellScriptBin "zfs-relmount" - (builtins.readFile ./zfs-relmount.sh); - }; -} diff --git a/overlays/zfs-relmount.sh b/overlays/zfs-relmount.sh deleted file mode 100644 index b5048c7..0000000 --- a/overlays/zfs-relmount.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2022 Richard Brežák -# -# SPDX-License-Identifier: LGPL-3.0-or-later - -function recurse_children() -{ - local volume="${1}" - local dir="${2}" - local relmount="${3}" - local children="${4}" - local action="${5}" - - for child in $children - do - if [ "${child}" == "${volume}" ] - then - continue - fi - - recursive_perform "${child}" "${dir}/$(basename "${child}")" "${action}" - done -} - -function recursive_perform() -{ - local volume="${1}" - local dir="${2}" - local action="${3}" - - local relmount="$(zfs get -Ho value :relmount "${volume}")" - local children="$(zfs list -Hrd 1 "${volume}" -o name | tr '\n' ' ')" - - if ! [ -z "${relmount}" ] && [ "${relmount}" != "-" ] - then - case "${relmount}" in - "yes") - eval "${action}" - recurse_children "${volume}" "${dir}" "${relmount}" "${children}" "${action}" - ;; - "pass") - recurse_children "${volume}" "${dir}" "${relmount}" "${children}" "${action}" - ;; - "*") - ;; - esac - fi -} - -action="${1}" -shift 1 - -case $action in - "mount") - zfs_src="${1}" - dst_dir="${2}" - - recursive_perform "${zfs_src}" "${dst_dir}" 'mount -o X-mount.mkdir -t zfs "${volume}" "${dir}"' - ;; - "mount-snapshot") - zfs_src="${1}" - dst_dir="${2}" - snapshot="${3}" - - recursive_perform "${zfs_src}" "${dst_dir}" 'mount -o X-mount.mkdir -t zfs "${volume}"@'"${snapshot}"' "${dir}"' - ;; - "umount") - zfs_src="${1}" - dst_dir="${2}" - - recursive_perform "${zfs_src}" "${dst_dir}" 'umount -t zfs "${dir}"' - ;; - "snapshot") - root="${1}" - snapshot="${2}" - - recursive_perform "${root}" "${root}" 'zfs snapshot "${volume}"@'"${snapshot}" - ;; - "*") - ;; -esac diff --git a/redalder.org.crt b/redalder.org.crt deleted file mode 100644 index ab1a54a..0000000 --- a/redalder.org.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFwTCCA6mgAwIBAgIUdhaeqmTGr7jMEQaqJM/5Obsh1+UwDQYJKoZIhvcNAQEN -BQAwVTELMAkGA1UEBhMCU0sxETAPBgNVBAgMCFNsb3Zha2lhMREwDwYDVQQKDAhS -ZWRBbGRlcjEgMB4GCSqGSIb3DQEJARYRcm9vdEByZWRhbGRlci5vcmcwHhcNMjEw -OTIwMTUzNTU4WhcNMjMwOTIwMTUzNTU4WjBVMQswCQYDVQQGEwJTSzERMA8GA1UE -CAwIU2xvdmFraWExETAPBgNVBAoMCFJlZEFsZGVyMSAwHgYJKoZIhvcNAQkBFhFy -b290QHJlZGFsZGVyLm9yZzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -ALiKZEiQN6IDZlYBto3jQl1VU//mVwiY1qI/jmz+aL4fTq3OnQxAak1AqvaIWcCe -UsWaVnLaVRnpPe1qIhMmYswXUrj1mr5KwxVCD3Lq+4pvjFuJJi34SQuSNk0R1A6x -VC9gC0OPka3cLN63Wfn4TrFDs00x7WZMtb+iA381qXycWXVQ3jwi3aVSDAEj10m8 -dnzDU0Q0wKcsfIqjfGpO9tQ9D55f2/2EETCkW04d+X2RzqjTSB6oqI8wgWuxR9LY -uy59TfEySmb8tHQNJdTIWX6arpne4wyXguiTMfXuJG8lyWcyNZwV/TqrF7oL1T1U -nE5LbtCYzMUfPX7ub9YOpN7Wsv0gBcMXItheu7eau0OzRlAk4mvTLTfcSmKgbmQQ -CduQ5QtzyHZPtMdxwvnKtSPjt/g+b7r/7uTky63VethArnUiLmj8MZ/Ls/lj3qWo -k8KWjLPuF9qgo6++e2gi9kz5gtxl63QEAkLWKXR39aMPH6rLyQ76hhhfc/4W0yLT -F42d2+6ouCdfdBgOq/1oiWX/a9KP+cMb7X++RkQi8edgfNiKNqK5P5UmKSwYAx6d -P5qwPjDMNC+NmjnAK+MFZWqJsGNJZaLREgX4P4A9EYoBs6xYa1VRLqXFNL9LfLZv -8gBpeN2qFSxWPrZMtiJBLg9cE5queNjX82/t6YUx58qZAgMBAAGjgYgwgYUwHQYD -VR0OBBYEFPlDPcXPlZ2JKxciEhJWXfcE7v6TMB8GA1UdIwQYMBaAFPlDPcXPlZ2J -KxciEhJWXfcE7v6TMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMCIG -A1UdEQQbMBmCCWxvY2FsaG9zdIIMcmVkYWxkZXIub3JnMA0GCSqGSIb3DQEBDQUA -A4ICAQCj3J0siN5jqq5IGnDAS5cF/Xo5FSKicuCcQm3jqTkHtJfZeS/9ZWzFdU/b -ubHegEiioyy1Q6oWk0QKu/SkTi/EX2XLTVmHdSvlNkbwvnTpyodTYmjnYtFa4QpG -cMIetR3qiiZDGRn4iFu9s3Au5Vl7n15V8ejH+h7NaJWVIiLDyysQzMfNz3Qi4rZ0 -0eBS0/X3wwtu9Xc6ySFdO76CaFJGnDQyRQF0jU1L3q4K2pkw9EeVWbnOfszlc69F -ev8Ehdmytc+SihUEE018z28ZkSD2+ATmNAUQFHhosD6wXUshSSsQoFQztwFFGt/e -BD/xiaOFK8OOT/0aSoSM7h/hhjIcJUG8sTuXWqOiJIlPRqwKikiVN1kmVUBgBw8Y -SmUVi5w+53ZF0ft0zCU8yGMZwFJoZVly/WQ95LXAC/aFpGq9D+P2mxUo9yEpa/wt -8dFYIrxKzHLAqoqWX3G74hXZuDjdFQqmvqR603dilR7mgh6xbA3OVHrIKCClmNky -L8vExiz2SlMXSN429ZYGeuLNk/bgg0BvaeAuzFt+X4F8+bwD8EN0ARg17I+EgyL9 -GRklrrYL3yFcoxhOFzvYbdnCMIrGvFJgpY3r3sZT138gh7w7kRavgPbQh5aZC9At -G47bVTQvu8BxsuBk0ITkPvtajVkbLgFa/siWB6m3vjmNyRP6jw== ------END CERTIFICATE----- diff --git a/redalder.org.crt.license b/redalder.org.crt.license deleted file mode 100644 index 1f11187..0000000 --- a/redalder.org.crt.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2022 Richard Brežák - -SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/secret b/secret deleted file mode 160000 index 36790fb..0000000 --- a/secret +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 36790fbf7b4fb19860b2f7e3b28dc41512f601d8 diff --git a/terranix/blowhole.nix b/terranix/blowhole.nix deleted file mode 100644 index 3424640..0000000 --- a/terranix/blowhole.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ tflib, config, ... }: -let - inherit (tflib) - tf; - - paths.consul = { - encryption_key = "homelab-1/blowhole/consul/encryption_key"; - agent_token = "homelab-1/blowhole/consul/agent_token"; - anonymous_token = "homelab-1/blowhole/consul/anonymous_token"; - }; - - paths.nomad = { - encryption_key = "homelab-1/blowhole/nomad/encryption_key"; - vault_token = "homelab-1/blowhole/nomad/vault_token"; - consul_token = "homelab-1/blowhole/nomad/consul_token"; - }; - - vaultKvMount = config.resource."vault_mount"."kv".path; - vaultConsulMount = config.resource."vault_consul_secret_backend"."consul".path; -in -{ - prefab.consulAgent."blowhole" = { - datacenter = "homelab-1"; - - inherit vaultKvMount; - - paths = { - encryptionKey = paths.consul.encryption_key; - agentToken = paths.consul.agent_token; - anonymousToken = paths.consul.anonymous_token; - }; - encryptionKey = tf "random_id.homelab-1_consul_encryption_key.b64_std"; - - anonymousToken = { - secret = tf "data.consul_acl_token_secret_id.anonymous.secret_id"; - accessor = tf "consul_acl_token.anonymous.id"; - }; - }; - - prefab.nomadServer."blowhole" = { - datacenters = [ "homelab-1" ]; - - inherit vaultKvMount; - - encryptionKey = tf "random_id.nomad_encryption_key.b64_std"; - - paths = { - encryptionKey = paths.nomad.encryption_key; - vaultToken = paths.nomad.vault_token; - consulToken = paths.nomad.consul_token; - }; - }; - - resource."vault_policy"."vault-agent-blowhole" = { - name = "blowhole-id_ed_camera"; - - policy = '' - path "${vaultKvMount}/data/homelab-1/blowhole/id_ed_camera" { - capabilities = ["read"] - } - - path "${vaultKvMount}/data/homelab-1/blowhole/hostapd/wpa_psk" { - capabilities = ["read"] - } - - path "${vaultConsulMount}/creds/${tf "module.blowhole.envoy_grafana.name"}" { - capabilities = ["read"] - } - - path "${vaultConsulMount}/creds/${tf "module.blowhole.envoy_blowhole.name"}" { - capabilities = ["read"] - } - - path "${vaultConsulMount}/creds/${tf "module.blowhole.envoy_klipper.name"}" { - capabilities = ["read"] - } - - path "${vaultKvMount}/data/homelab-1/blowhole/monitor/telegraf" { - capabilities = ["read"] - } - - path "${vaultKvMount}/data/homelab-1/blowhole/monitor/grafana" { - capabilities = ["read"] - } - ''; - }; - - prefab.pushApproles."blowhole" = { - host = "10.64.2.1"; - user = "main"; - - policies = [ - config.resource."vault_policy"."blowhole_consul".name - config.resource."vault_policy"."blowhole_nomad".name - config.resource."vault_policy"."pki_inra_update".name - config.resource."vault_policy"."vault-agent-blowhole".name - ]; - - metadata = { - "ip_address" = "blowhole.in.redalder.org"; - }; - - approlePath = tf "vault_auth_backend.approle.path"; - }; -} diff --git a/terranix/default.nix b/terranix/default.nix deleted file mode 100644 index 48377e6..0000000 --- a/terranix/default.nix +++ /dev/null @@ -1,147 +0,0 @@ -{ config, tflib, lib, ... }: -let - paths.toothpick.consul = { - encryption_key = "do-1/toothpick/consul/encryption_key"; - agent_token = "do-1/toothpick/consul/agent_token"; - anonymous_token = "do-1/toothpick/consul/anonymous_token"; - replication_token = "do-1/toothpick/consul/replication_token"; - }; - - paths.toothpick.nomad = { - encryption_key = "do-1/toothpick/nomad/encryption_key"; - vault_token = "do-1/toothpick/nomad/vault_token"; - consul_token = "do-1/toothpick/nomad/consul_token"; - replication_token = "do-1/toothpick/nomad/replication_token"; - }; - - inherit (tflib) - tf - ; - inherit (lib) - singleton - ; -in -{ - provider."vault" = { - address = "https://vault.in.redalder.org:8200"; - }; - - provider."consul" = { - address = "http://10.64.2.1:8500"; - }; - - provider."nomad" = { - address = "http://10.64.2.1:4646"; - }; - - provider."influxdb-v2" = { - url = "http://influx.in.redalder.org"; - }; - - imports = [ - ./modules/push_approles.nix - ./modules/consul_agent.nix - ./modules/nomad_server.nix - ./pki.nix - ./blowhole.nix - ./toothpick.nix - ]; - - terraform.backend."consul" = { - address = "10.64.2.1:8500"; - scheme = "http"; - path = "terraform/dotfiles"; - }; - - terraform.required_providers = { - influxdb-v2 = { - source = "MagicRB/influxdb-v2"; - }; - }; - - resource."vault_auth_backend"."approle" = { - type = "approle"; - - tune = singleton { - max_lease_ttl = "90000s"; - listing_visibility = "unauth"; - allowed_response_headers = null; - audit_non_hmac_request_keys = null; - audit_non_hmac_response_keys = null; - default_lease_ttl = null; - passthrough_request_headers = null; - token_type = null; - }; - }; - - resource."vault_mount"."kv" = { - path = "kv"; - type = "kv"; - options.version = "2"; - description = "KV Version 2 secret engine mount"; - }; - - resource."vault_kv_secret_backend_v2"."config" = { - mount = config.resource."vault_mount"."kv".path; - max_versions = 5; - }; - - resource."consul_acl_token"."vault_management_token" = { - description = "Vault management token"; - policies = ["global-management"]; - local = false; - }; - - data."consul_acl_token_secret_id"."vault_management_token" = { - accessor_id = tf "consul_acl_token.vault_management_token.id"; - }; - - resource."vault_consul_secret_backend"."consul" = { - path = "consul"; - description = "Manages the Consul backend"; - - address = "10.64.2.1:8500"; - token = tf "data.consul_acl_token_secret_id.vault_management_token.secret_id"; - }; - - resource."vault_token_auth_backend_role"."nomad_cluster" = { - role_name = "nomad-cluster"; - disallowed_policies = ["nomad-server"]; - orphan = true; - token_period = "259200"; - renewable = true; - token_explicit_max_ttl = "0"; - }; - - resource."random_id"."nomad_encryption_key" = { - byte_length = 32; - }; - - resource."random_id"."homelab-1_consul_encryption_key" = { - byte_length = 32; - }; - - resource."random_id"."do-1_consul_encryption_key" = { - byte_length = 32; - }; - - resource."consul_acl_policy"."anonymous" = { - name = "consul-anonymous"; - rules = '' - service_prefix "" { policy = "read" } - node_prefix "" { policy = "read" } - ''; - }; - - resource."consul_acl_token"."anonymous" = { - description = "Consul anonymous token"; - policies = [ - config.resource.consul_acl_policy.anonymous.name - ]; - local = false; - }; - - data."consul_acl_token_secret_id"."anonymous" = { - accessor_id = tf "consul_acl_token.anonymous.id"; - }; -} diff --git a/terranix/modules/consul_agent.nix b/terranix/modules/consul_agent.nix deleted file mode 100644 index 3127114..0000000 --- a/terranix/modules/consul_agent.nix +++ /dev/null @@ -1,228 +0,0 @@ -{ config, pkgs, lib, tflib, ... }: -let - cfg = config.prefab.consulAgent; - inherit (lib) - mkOption - types - mapAttrsToList - fix - optionalString - optionalAttrs - singleton - mkMerge - flip - ; - inherit (tflib) - tf; - - submoduleOptions = { - datacenter = mkOption { - description = '' - ''; - type = types.str; - }; - - replicationDatacenters = mkOption { - description = '' - ''; - type = with types; listOf str; - }; - - encryptionKey = mkOption { - description = '' - DO NOT hardcode the secret in Nix, generate it with Terraform - and let Terraform substitute it. - ''; - type = types.str; - }; - - anonymousToken = mkOption { - description = '' - DO NOT hardcode the secret in Nix, generate it with Terraform - and let Terraform substitute it. - ''; - type = types.submodule { - options.secret = mkOption { - description = ''''; - type = types.str; - }; - - options.accessor = mkOption { - description = ''''; - type = types.str; - }; - }; - }; - - paths = { - encryptionKey = mkOption { - description = '' - ''; - type = types.str; - }; - agentToken = mkOption { - description = '' - ''; - type = types.str; - }; - replicationToken = mkOption { - description = '' - ''; - type = with types; nullOr str; - default = null; - }; - anonymousToken = mkOption { - description = '' - ''; - type = types.str; - }; - }; - - vaultKvMount = mkOption { - description = '' - ''; - type = types.str; - }; - }; -in -{ - options.prefab.consulAgent = mkOption { - description = '' - ''; - type = with types; attrsOf (submodule { options = submoduleOptions; }); - default = {}; - }; - - config.resource = mkMerge - (flip mapAttrsToList cfg (hostname: value: - fix (self: { - "consul_acl_policy"."${hostname}_agent" = { - name = "${hostname}-consul-agent"; - rules = '' - node "${hostname}" { - policy = "write" - } - agent "${hostname}" { - policy = "write" - } - service_prefix "" { - policy = "write" - } - ''; - }; - - "consul_acl_token"."${hostname}_consul_agent" = { - description = "Consul agent token on ${hostname}"; - node_identities = singleton { - node_name = hostname; - datacenter = value.datacenter; - }; - local = false; - }; - - "vault_kv_secret_v2"."${hostname}_consul_encryption_key" = { - mount = value.vaultKvMount; - name = value.paths.encryptionKey; - delete_all_versions = true; - data_json = builtins.toJSON { - key = value.encryptionKey; - }; - }; - - "vault_kv_secret_v2"."${hostname}_consul_anonymous_token" = { - mount = value.vaultKvMount; - name = value.paths.anonymousToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = value.anonymousToken.secret; - accessor = value.anonymousToken.accessor; - }; - }; - - "vault_kv_secret_v2"."${hostname}_consul_agent" = { - mount = value.vaultKvMount; - name = value.paths.agentToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = tf "data.consul_acl_token_secret_id.${hostname}_consul_agent.secret_id"; - accessor = tf "consul_acl_token.${hostname}_consul_agent.id"; - }; - }; - - "vault_policy"."${hostname}_consul" = { - name = "${hostname}_consul_agent"; - - policy = '' - path "${value.vaultKvMount}/data/${value.paths.encryptionKey}" { - capabilities = ["read"] - } - - path "${value.vaultKvMount}/data/${value.paths.agentToken}" { - capabilities = ["read"] - } - - ${optionalString (value.paths.replicationToken != null) '' - path "${value.vaultKvMount}/data/${value.paths.replicationToken}" { - capabilities = ["read"] - } - ''} - - path "${value.vaultKvMount}/data/${value.paths.anonymousToken}" { - capabilities = ["read"] - } - ''; - }; - })) ++ - (flip mapAttrsToList cfg (hostname: value: - (optionalAttrs (value.paths.replicationToken != null) { - "consul_acl_policy"."${hostname}_replication" = { - name = "${hostname}_consul_replication"; - datacenters = value.replicationDatacenters; - rules = '' - acl = "write" - - operator = "write" - - service_prefix "" { - policy = "read" - intentions = "read" - } - ''; - }; - - "consul_acl_token"."${hostname}_consul_replication" = { - description = "Consul replication token on ${hostname}"; - policies = [ - (tf "consul_acl_policy.${hostname}_replication.name") - ]; - local = false; - }; - - "vault_kv_secret_v2"."${hostname}_consul_replication" = { - mount = value.vaultKvMount; - name = value.paths.replicationToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = tf "data.consul_acl_token_secret_id.${hostname}_consul_replication.secret_id"; - accessor = tf "consul_acl_token.${hostname}_consul_replication.id"; - }; - }; - }) - ))); - - config.data = mkMerge - (flip mapAttrsToList cfg (hostname: value: - { - "consul_acl_token_secret_id"."${hostname}_consul_agent" = { - accessor_id = tf "consul_acl_token.${hostname}_consul_agent.id"; - }; - } - ) ++ - flip mapAttrsToList cfg (hostname: value: - (optionalAttrs (value.paths.replicationToken != null) { - "consul_acl_token_secret_id"."${hostname}_consul_replication" = { - accessor_id = tf "consul_acl_token.${hostname}_consul_replication.id"; - }; - }) - )); -} diff --git a/terranix/modules/nomad_server.nix b/terranix/modules/nomad_server.nix deleted file mode 100644 index ea6fe2d..0000000 --- a/terranix/modules/nomad_server.nix +++ /dev/null @@ -1,256 +0,0 @@ -{ config, pkgs, lib, tflib, ... }: -let - cfg = config.prefab.nomadServer; - inherit (lib) - mapAttrsToList - foldAttrs - mergeAttrs - fix - flip - mkOption - types - optionalString - optionalAttrs - mkMerge - ; - - inherit ((a: builtins.break a) tflib) - tf - ; - - submoduleOptions = { - datacenters = mkOption { - description = '' - ''; - type = with types; listOf str; - }; - - encryptionKey = mkOption { - description = '' - DO NOT hardcode the secret in Nix, generate it with Terraform - and let Terraform substitute it. - ''; - type = types.str; - }; - - paths = { - encryptionKey = mkOption { - description = '' - ''; - type = types.str; - }; - replicationToken = mkOption { - description = '' - ''; - type = with types; nullOr str; - default = null; - }; - vaultToken = mkOption { - description = '' - ''; - type = types.str; - }; - consulToken = mkOption { - description = '' - ''; - type = types.str; - }; - }; - - vaultKvMount = mkOption { - description = '' - ''; - type = types.str; - }; - }; -in -{ - options.prefab.nomadServer = mkOption { - description = '' - ''; - type = with types; attrsOf (submodule { options = submoduleOptions; }); - default = {}; - }; - - config.resource = mkMerge - (flip mapAttrsToList cfg (hostname: value: - fix (self: { - "vault_policy"."${hostname}_nomad" = { - name = "${hostname}-nomad-server-agent"; - - policy = '' - path "${value.vaultKvMount}/data/${value.paths.encryptionKey}" { - capabilities = ["read"] - } - - path "${value.vaultKvMount}/data/${value.paths.vaultToken}" { - capabilities = ["read"] - } - - path "${value.vaultKvMount}/data/${value.paths.consulToken}" { - capabilities = ["read"] - } - - ${optionalString (value.paths.replicationToken != null) '' - path "${value.vaultKvMount}/data/${value.paths.replicationToken}" { - capabilities = ["read"] - } - ''} - ''; - }; - - "vault_kv_secret_v2"."${hostname}_nomad_encryption_key" = { - mount = value.vaultKvMount; - name = value.paths.encryptionKey; - delete_all_versions = true; - data_json = builtins.toJSON { - key = value.encryptionKey; - }; - }; - - "consul_acl_policy"."${hostname}_nomad_server" = { - name = "${hostname}_nomad_server"; - rules = '' - agent_prefix "" { - policy = "read" - } - - node_prefix "" { - policy = "read" - } - - service_prefix "" { - policy = "write" - } - - acl = "write" - ''; - }; - - "consul_acl_token"."${hostname}_nomad_server" = { - description = "Consul token for nomad_server on ${hostname}"; - policies = [ - (tf "consul_acl_policy.${hostname}_nomad_server.name") - ]; - local = false; - }; - - "vault_kv_secret_v2"."${hostname}_nomad_server_consul" = { - mount = value.vaultKvMount; - name = value.paths.consulToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = tf "data.consul_acl_token_secret_id.${hostname}_nomad_server.secret_id"; - accessor = tf "consul_acl_token.${hostname}_nomad_server.accessor_id"; - }; - }; - - "vault_policy"."${hostname}_nomad_server" = { - name = "${hostname}-nomad-server"; - - policy = '' - # Allow creating tokens under "nomad-cluster" token role. The token role name - # should be updated if "nomad-cluster" is not used. - path "auth/token/create/nomad-cluster" { - capabilities = ["update"] - } - - # Allow looking up "nomad-cluster" token role. The token role name should be - # updated if "nomad-cluster" is not used. - path "auth/token/roles/nomad-cluster" { - capabilities = ["read"] - } - - # Allow looking up the token passed to Nomad to validate the token has the - # proper capabilities. This is provided by the "default" policy. - path "auth/token/lookup-self" { - capabilities = ["read"] - } - - # Allow looking up incoming tokens to validate they have permissions to access - # the tokens they are requesting. This is only required if - # `allow_unauthenticated` is set to false. - path "auth/token/lookup" { - capabilities = ["update"] - } - - # Allow revoking tokens that should no longer exist. This allows revoking - # tokens for dead tasks. - path "auth/token/revoke-accessor" { - capabilities = ["update"] - } - - # Allow checking the capabilities of our own token. This is used to validate the - # token upon startup. Note this requires update permissions because the Vault API - # is a POST - path "sys/capabilities-self" { - capabilities = ["update"] - } - - # Allow our own token to be renewed. - path "auth/token/renew-self" { - capabilities = ["update"] - } - ''; - }; - - "vault_token_auth_backend_role"."${hostname}_nomad_server" = { - role_name = "${hostname}_nomad_server"; - allowed_policies = [ - (tf "vault_policy.${hostname}_nomad_server.name") - ]; - orphan = true; - renewable = true; - }; - - "vault_token"."${hostname}_nomad_server" = { - policies = [ - (tf "vault_policy.${hostname}_nomad_server.name") - ]; - renewable = true; - ttl = "24h"; - explicit_max_ttl = 0; - role_name = tf "vault_token_auth_backend_role.${hostname}_nomad_server.role_name"; - display_name = "${hostname}-nomad-server-Vault-token"; - }; - - "vault_kv_secret_v2"."${hostname}_nomad_server_vault" = { - mount = value.vaultKvMount; - name = value.paths.vaultToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = tf "vault_token.${hostname}_nomad_server.client_token"; - }; - }; - - })) ++ - (flip mapAttrsToList cfg (hostname: value: - (optionalAttrs (value.paths.replicationToken != null) - { - "nomad_acl_token"."${hostname}_replication" = { - name = "${hostname} replication token"; - type = "management"; - }; - - "vault_kv_secret_v2"."${hostname}_nomad_replication" = { - mount = value.vaultKvMount; - name = value.paths.replicationToken; - delete_all_versions = true; - data_json = builtins.toJSON { - secret = tf "nomad_acl_token.${hostname}_replication.secret_id"; - accessor = tf "nomad_acl_token.${hostname}_replication.id"; - }; - }; - } - ) - ))); - - config.data = mkMerge - (flip mapAttrsToList cfg (hostname: value: - { - "consul_acl_token_secret_id"."${hostname}_nomad_server" = { - accessor_id = tf "consul_acl_token.${hostname}_nomad_server.id"; - }; - })); - -} diff --git a/terranix/modules/push_approles.nix b/terranix/modules/push_approles.nix deleted file mode 100644 index ee975d7..0000000 --- a/terranix/modules/push_approles.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ config, pkgs, lib, tflib, ... }: -let - cfg = config.prefab.pushApproles; - inherit (lib) - mkOption - mdDoc - types - mapAttrsToList - mkMerge - flip - ; - - inherit (tflib) - tf - ; - metadataType = pkgs.formats.json {}; - submoduleOptions = { - policies = mkOption { - description = mdDoc '' - Vault policies added to the approle generated. - ''; - type = with types; listOf str; - default = []; - }; - - host = mkOption { - description = mdDoc '' - The address of the machine, either IP address, domain name or any other identificator accepted by `ssh`. - ''; - type = types.str; - }; - - user = mkOption { - description = mdDoc '' - The user to connect as. - ''; - type = types.str; - }; - - metadata = mkOption { - description = mdDoc '' - ''; - type = metadataType.type; - default = {}; - }; - - approlePath = mkOption { - description = mdDoc '' - ''; - type = types.str; - }; - }; -in -{ - options.prefab.pushApproles = mkOption { - description = '' - ''; - type = with types; attrsOf (submodule { options = submoduleOptions; }); - default = {}; - }; - - config.resource = mkMerge - (flip mapAttrsToList cfg (hostname: value: - { - "vault_approle_auth_backend_role"."system-${hostname}" = { - backend = value.approlePath; - role_name = hostname; - token_policies = value.policies; - }; - - "vault_approle_auth_backend_role_secret_id"."system-${hostname}" = { - backend = value.approlePath; - role_name = tf "vault_approle_auth_backend_role.system-${hostname}.role_name"; - - metadata = builtins.toJSON value.metadata; - }; - - "null_resource"."approles-${hostname}" = { - triggers = { - secret_id = tf "vault_approle_auth_backend_role_secret_id.system-${hostname}.secret_id"; - role_id = tf "data.vault_approle_auth_backend_role_id.system-${hostname}.role_id"; - }; - - connection = { - inherit (value) - host - user; - }; - - provisioner = { - "remote-exec" = { - inline = [ - "echo \${vault_approle_auth_backend_role_secret_id.system-${hostname}.secret_id} > /var/secrets/approle.secretid" - "echo \${data.vault_approle_auth_backend_role_id.system-${hostname}.role_id} > /var/secrets/approle.roleid" - ]; - }; - }; - }; - })); - - config.data = mkMerge - (flip mapAttrsToList cfg (hostname: value: - { - "vault_approle_auth_backend_role_id"."system-${hostname}" = { - backend = value.approlePath; - role_name = tf "vault_approle_auth_backend_role.system-${hostname}.role_name"; - }; - })); -} diff --git a/terranix/pki.nix b/terranix/pki.nix deleted file mode 100644 index 4113e85..0000000 --- a/terranix/pki.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, ... }: -{ - resource."vault_mount"."pki_inra" = { - path = "pki-inra"; - type = "pki"; - description = "in.redalder.org"; - default_lease_ttl_seconds = 8640000; - max_lease_ttl_seconds = 8640000; - }; - - resource."vault_policy"."pki_inra_update" = { - name = "pki-inra-update"; - - policy = '' - path "${config.resource."vault_mount"."pki_inra".path}/config/ca" { - capabilities = ["update"] - } - ''; - }; - - resource."vault_pki_secret_backend_config_urls"."example" = { - backend = config.resource."vault_mount"."pki_inra".path; - issuing_certificates = [ - "https://vault.in.redalder.org:8200/v1/pki/ca" - ]; - crl_distribution_points = [ - "https://vault.in.redalder.org:8200/v1/pki_int/crl" - ]; - }; - - resource."vault_pki_secret_backend_role"."test_role" = { - backend = config.resource."vault_mount"."pki_inra".path; - name = "test_role"; - ttl = 3600; - allow_ip_sans = true; - key_type = "rsa"; - key_bits = 4096; - allowed_domains = ["test.in.redalder.org"]; - allow_subdomains = false; - }; -} diff --git a/terranix/toothpick.nix b/terranix/toothpick.nix deleted file mode 100644 index 53af8e8..0000000 --- a/terranix/toothpick.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ tflib, config, ... }: -let - inherit (tflib) - tf; - - paths.consul = { - encryption_key = "do-1/toothpick/consul/encryption_key"; - agent_token = "do-1/toothpick/consul/agent_token"; - anonymous_token = "do-1/toothpick/consul/anonymous_token"; - replication_token = "do-1/toothpick/consul/replication_token"; - }; - - paths.nomad = { - encryption_key = "do-1/toothpick/nomad/encryption_key"; - vault_token = "do-1/toothpick/nomad/vault_token"; - consul_token = "do-1/toothpick/nomad/consul_token"; - replication_token = "do-1/toothpick/nomad/replication_token"; - }; - - vaultKvMount = config.resource."vault_mount"."kv".path; -in -{ - prefab.consulAgent."toothpick" = { - datacenter = "do-1"; - replicationDatacenters = [ "homelab-1" ]; - - inherit vaultKvMount; - - paths = { - encryptionKey = paths.consul.encryption_key; - agentToken = paths.consul.agent_token; - anonymousToken = paths.consul.anonymous_token; - replicationToken = paths.consul.replication_token; - }; - encryptionKey = tf "random_id.do-1_consul_encryption_key.b64_std"; - - anonymousToken = { - secret = tf "data.consul_acl_token_secret_id.anonymous.secret_id"; - accessor = tf "consul_acl_token.anonymous.id"; - }; - }; - - prefab.nomadServer."toothpick" = { - datacenters = [ "do-1" ]; - - inherit vaultKvMount; - - encryptionKey = tf "random_id.nomad_encryption_key.b64_std"; - - paths = { - encryptionKey = paths.nomad.encryption_key; - vaultToken = paths.nomad.vault_token; - consulToken = paths.nomad.consul_token; - replicationToken = paths.nomad.replication_token; - }; - }; - - prefab.pushApproles."toothpick" = { - host = "10.64.0.1"; - user = "main"; - - policies = [ - (tf "vault_policy.toothpick_consul.name") - (tf "vault_policy.toothpick_nomad.name") - ]; - - metadata = { - "ip_address" = "redalder.org"; - }; - - approlePath = tf "vault_auth_backend.approle.path"; - }; -}