commit e8613514eb2f167278a3ba8c0f9ed16c0b098a28 Author: Madeleine Date: Tue Dec 19 19:08:55 2023 +0000 initial commit (because syncthing) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62d8881 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +*/result diff --git a/README.md b/README.md new file mode 100644 index 0000000..673a289 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Maddie's NixFiles +A Nix flake for my system configuration - WIP. + +## Structure +- `./maddie` - A folder for my home-manager configs (aka my user) + - `./maddie/macos` - Specifically macOS (darwin) home configuration + - `./maddie/nixos` - Specifically NixOS home configuration + - `./maddie/common` - Home configuration available on all systems +- `./systems` - A folder for my system-wide configs + - `./systems/mmacbookpro/` - System configuration for my MacBook Pro (M.MacBookPro) + - `./systems/mdesktop` - System configuration for my desktop (M.Desktop) +- `overlays.nix` - A file for my nixpkgs overlays + +## Many thanks +- ❤️ Thanks to @Minion3665 who helped me make this config diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e898a61 --- /dev/null +++ b/flake.lock @@ -0,0 +1,67 @@ +{ + "nodes": { + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1702110869, + "narHash": "sha256-hgbzPjIMLYJf3Ekq9qZCpDcIZn1BZmOp7d6PMkIWknU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7db6291d95693374d408f4877c265ec7481f222b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1701693815, + "narHash": "sha256-7BkrXykVWfkn6+c1EhFA3ko4MLi3gVG0p9G96PNnKTM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "09ec6a0881e1a36c29d67497693a67a16f4da573", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d0bbf6d --- /dev/null +++ b/flake.nix @@ -0,0 +1,81 @@ +{ + description = "Maddie's Nix configurations"; + + inputs = { + # Home manager + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + darwin.url = "github:LnL7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, home-manager, darwin }: + let + username = "maddie"; + utils = import ./utils nixpkgs; + + nixpkgs_x86_64 = import nixpkgs { + config.allowUnfree = true; + config.allowUnsupportedSystem = false; + config.allowBroken = false; + config.permittedInsecurePackages = [ + "libgcrypt-1.8.10" + "libxls-1.6.2" + ]; + overlays = import ./overlays.nix; + system = "x86_64-linux"; + }; + + nixpkgs_aarch64_darwin = import nixpkgs { + config.allowUnfree = true; + config.allowUnsupportedSystem = false; + config.allowBroken = false; + overlays = import ./overlays.nix; + system = "aarch64-darwin"; + }; + + nixpkgs_aarch64_linux = import nixpkgs { + config.allowUnfree = true; + config.allowUnsupportedSystem = false; + config.allowBroken = false; + overlays = import ./overlays.nix; + system = "aarch64-linux"; + }; + in + { + nixosConfigurations."MDesktop" = nixpkgs.lib.nixosSystem + { + specialArgs = { inherit username; }; + pkgs = nixpkgs_x86_64; + system = "x86_64-linux"; + modules = [ + home-manager.nixosModules.home-manager + { + home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/nixos; + home-manager.extraSpecialArgs = { inherit username; pkgs = nixpkgs_x86_64; }; + } + ] ++ utils.nixFilesIn ./systems/mdesktop; + }; + + darwinConfigurations."MMacBookPro" = darwin.lib.darwinSystem + { + pkgs = nixpkgs_aarch64_darwin; + specialArgs = { inherit username; }; + system = "aarch64-darwin"; + modules = [ + home-manager.darwinModules.home-manager + { + home-manager.useUserPackages = true; + home-manager.users.${username}.imports = utils.nixFilesIn ./maddie/common ++ utils.nixFilesIn ./maddie/macos; + home-manager.extraSpecialArgs = { inherit username; pkgs = nixpkgs_aarch64_darwin; }; + } + ] ++ utils.nixFilesIn ./systems/mmacbookpro; + }; + + formatter.x86_64-linux = nixpkgs_x86_64.legacyPackages.x86_64-linux.nixpkgs-fmt; + formatter.aarch64-darwin = nixpkgs_aarch64_darwin.legacyPackages.aarch64-darwin.nixpkgs-fmt; + formatter.aarch64-linux = nixpkgs_aarch64_linux.legacyPackages.aarch64-linux.nixpkgs-fmt; + }; +} + diff --git a/maddie/common/browser.nix b/maddie/common/browser.nix new file mode 100644 index 0000000..21fd758 --- /dev/null +++ b/maddie/common/browser.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + amfora + lynx + ]; +} diff --git a/maddie/common/btop.nix b/maddie/common/btop.nix new file mode 100644 index 0000000..4de9137 --- /dev/null +++ b/maddie/common/btop.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + programs.btop = { + enable = true; + settings = { + color_theme = "TTY"; + theme_background = false; + truecolor = true; + }; + }; +} diff --git a/maddie/common/code.nix b/maddie/common/code.nix new file mode 100644 index 0000000..049d6f6 --- /dev/null +++ b/maddie/common/code.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + go # Go + ]; +} diff --git a/maddie/common/editor.nix b/maddie/common/editor.nix new file mode 100644 index 0000000..2781118 --- /dev/null +++ b/maddie/common/editor.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + # Misc editors + home.packages = with pkgs; [ + vis + ]; +} diff --git a/maddie/common/emacs.nix b/maddie/common/emacs.nix new file mode 100644 index 0000000..2486e96 --- /dev/null +++ b/maddie/common/emacs.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tree-sitter + emacs29 + ]; + + xdg.configFile."emacs/init.el" = { + source = ./emacs/init.el; + }; + xdg.configFile."emacs/early-init.el" = { + source = ./emacs/early-init.el; + }; + xdg.configFile."emacs/emacs.png" = { + source = ./emacs/emacs.png; + }; +} diff --git a/maddie/common/emacs/.#init 2.el b/maddie/common/emacs/.#init 2.el new file mode 120000 index 0000000..ad3dac6 --- /dev/null +++ b/maddie/common/emacs/.#init 2.el @@ -0,0 +1 @@ +maddie@MMacBookPro.1240 \ No newline at end of file diff --git a/maddie/common/emacs/early-init.el b/maddie/common/emacs/early-init.el new file mode 100644 index 0000000..e69de29 diff --git a/maddie/common/emacs/emacs.png b/maddie/common/emacs/emacs.png new file mode 100644 index 0000000..37f4bf2 Binary files /dev/null and b/maddie/common/emacs/emacs.png differ diff --git a/maddie/common/emacs/init.el b/maddie/common/emacs/init.el new file mode 100644 index 0000000..de7f95c --- /dev/null +++ b/maddie/common/emacs/init.el @@ -0,0 +1,238 @@ +;; MELPA +(package-initialize) +(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) + +;; Evil +(use-package evil + :ensure t + :init + (setq evil-want-keybinding nil) + :config + (evil-set-undo-system 'undo-redo) + (evil-mode 1)) + +;; Evil collection +(use-package evil-collection + :ensure t + :after evil + :config + (setq evil-collection-mode-list '(dashboard dired)) + (evil-collection-init)) + +;; Dashboard +(use-package dashboard + :ensure t + :init ;; tweak dashboard config before loading it + (setq dashboard-set-heading-icons t) + (setq dashboard-set-file-icons t) + (setq dashboard-banner-logo-title "Welcome back to Emacs, Maddie!") + (setq dashboard-startup-banner 'logo) ;; use standard emacs logo as banner + ;;(setq dashboard-startup-banner "~/.config/emacs/emacs.png") ;; use custom image as banner + (setq dashboard-center-content nil) ;; set to 't' for centered content + (setq dashboard-items '((recents . 5) + (agenda . 5 ) + (bookmarks . 3) + ;; (projects . 3) + (registers . 3))) + :config + (dashboard-setup-startup-hook) + (dashboard-modify-heading-icons '((recents . "file-text") + (bookmarks . "book")))) + +;; Command completion +(use-package vertico + :ensure t + :config + (vertico-mode 1)) + +;; Rust +(use-package rust-mode + :ensure t) + +;; Nix +(use-package nix-mode + :ensure t) + +;; Git +(use-package magit + :ensure t + :bind (("C-x g" . magit-status) + ("C-x C-g" . magit-status))) + +;; Markdown mode +(use-package markdown-mode + :ensure t) + +;; Treemacs +(use-package treemacs + :ensure t + :defer t + :init + (with-eval-after-load 'winum + (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) + :config + (progn + (setq treemacs-collapse-dirs (if treemacs-python-executable 3 0) + treemacs-deferred-git-apply-delay 0.5 + treemacs-directory-name-transformer #'identity + treemacs-display-in-side-window t + treemacs-eldoc-display 'simple + treemacs-file-event-delay 2000 + treemacs-file-extension-regex treemacs-last-period-regex-value + treemacs-file-follow-delay 0.2 + treemacs-file-name-transformer #'identity + treemacs-follow-after-init t + treemacs-expand-after-init t + treemacs-find-workspace-method 'find-for-file-or-pick-first + treemacs-git-command-pipe "" + treemacs-goto-tag-strategy 'refetch-index + treemacs-header-scroll-indicators '(nil . "^^^^^^") + treemacs-hide-dot-git-directory t + treemacs-indentation 2 + treemacs-indentation-string " " + treemacs-is-never-other-window nil + treemacs-max-git-entries 5000 + treemacs-missing-project-action 'ask + treemacs-move-forward-on-expand nil + treemacs-no-png-images nil + treemacs-no-delete-other-windows t + treemacs-project-follow-cleanup nil + treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory) + treemacs-position 'left + treemacs-read-string-input 'from-child-frame + treemacs-recenter-distance 0.1 + treemacs-recenter-after-file-follow nil + treemacs-recenter-after-tag-follow nil + treemacs-recenter-after-project-jump 'always + treemacs-recenter-after-project-expand 'on-distance + treemacs-litter-directories '("/node_modules" "/.venv" "/.cask") + treemacs-project-follow-into-home nil + treemacs-show-cursor nil + treemacs-show-hidden-files t + treemacs-silent-filewatch nil + treemacs-silent-refresh nil + treemacs-sorting 'alphabetic-asc + treemacs-select-when-already-in-treemacs 'move-back + treemacs-space-between-root-nodes t + treemacs-tag-follow-cleanup t + treemacs-tag-follow-delay 1.5 + treemacs-text-scale nil + treemacs-user-mode-line-format nil + treemacs-user-header-line-format nil + treemacs-wide-toggle-width 70 + treemacs-width 35 + treemacs-width-increment 1 + treemacs-width-is-initially-locked t + treemacs-workspace-switch-cleanup nil) + + (treemacs-resize-icons 22) + (treemacs-follow-mode t) + (treemacs-filewatch-mode t) + (treemacs-fringe-indicator-mode 'always) + (when treemacs-python-executable + (treemacs-git-commit-diff-mode t)) + + (treemacs-hide-gitignored-files-mode nil)) + :bind + (:map global-map + ("M-0" . treemacs-select-window) + ("C-x t 1" . treemacs-delete-other-windows) + ("C-x t t" . treemacs) + ("C-x t d" . treemacs-select-directory) + ("C-x t B" . treemacs-bookmark) + ("C-x t C-t" . treemacs-find-file) + ("C-x t M-t" . treemacs-find-tag))) + +(use-package treemacs-evil + :after (treemacs evil) + :ensure t) + +;; Keybindings +(use-package general + :ensure t + :config + (general-evil-setup t)) + +(nvmap :prefix "SPC" + "b b" '(ibuffer :which-key "Ibuffer") + "b c" '(clone-indirect-buffer-other-window :which-key "Clone indirect buffer other window") + "b k" '(kill-current-buffer :which-key "Kill current buffer") + "b n" '(next-buffer :which-key "Next buffer") + "b p" '(previous-buffer :which-key "Previous buffer") + "b B" '(ibuffer-list-buffers :which-key "Ibuffer list buffers") + "b K" '(kill-buffer :which-key "Kill buffer")) + +;; Set backup and autosave directories +(setq backup-directory-alist + `(("." . "~/.local/share/emacs/backups"))) +(setq auto-save-file-name-transforms + `((".*" "~/.local/share/emacs/auto-save-list/" t))) + +;; Disable the bell +(setq visible-bell nil + ring-bell-function #'ignore) + +;; Font +(set-face-attribute 'default nil + :font "Iosevka Nerd Font" + :height 150 + :weight 'medium) +(add-to-list 'default-frame-alist '(font . "Iosevka Nerd Font-13")) + +;; UI +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +(column-number-mode 1) +(global-display-line-numbers-mode 1) +(setq display-line-numbers-type 'relative) +(setq inhibit-startup-screen t) +(setq dired-listing-switches "-alh") + +;; Editor +(setq scroll-preserve-screen-position nil) +(setq scroll-conservatively 101) +(setq default-tab-width 2) + +;; Themes +(use-package gruber-darker-theme + :ensure t) +(use-package atom-one-dark-theme + :ensure t) +(load-theme 'gruber-darker t) + +;; Setting garbage collection threshold +(setq gc-cons-threshold 402653184 + gc-cons-percentage 0.6) + +;; Profile emacs startup +(add-hook 'emacs-startup-hook + (lambda () + (message "*** Emacs loaded in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) + +;; Silence compiler warnings as they can be pretty disruptive +(if (boundp 'comp-deferred-compilation) + (setq comp-deferred-compilation nil) + (setq native-comp-deferred-compilation nil)) +;; In noninteractive sessions, prioritize non-byte-compiled source files to +;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time +;; to skip the mtime checks on every *.elc file. +(setq load-prefer-newer noninteractive) + +(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. + '(package-selected-packages + '(markdown-mode atom-one-dark-theme treemacs-evil treemacs gruber-darker-theme gruber-darker nix-mode vertico evil evil-collection dashboard general))) +(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. + ) diff --git a/maddie/common/esa.nix b/maddie/common/esa.nix new file mode 100644 index 0000000..7d4167b --- /dev/null +++ b/maddie/common/esa.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + programs.eza = { + enable = true; + enableAliases = true; + extraOptions = [ + "--group-directories-first" + "--time-style=long-iso" + "--git" + "-h" + "-g" + ]; + icons = true; + }; +} diff --git a/maddie/common/fetch.nix b/maddie/common/fetch.nix new file mode 100644 index 0000000..b32cf64 --- /dev/null +++ b/maddie/common/fetch.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pridefetch # System stats with pride flags + neofetch # Generic system stats + pfetch # Simple system stats + ]; +} diff --git a/maddie/common/git.nix b/maddie/common/git.nix new file mode 100644 index 0000000..9272d76 --- /dev/null +++ b/maddie/common/git.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + gh + git-review + ]; + + home.file.".local/bin/git-sync" = { + source = ./git/git-sync.sh; + executable = true; + }; + + programs.git = { + enable = true; + lfs.enable = true; + + userName = "Madeleine"; + userEmail = "maddie@spyhoodle.me"; + signing = { + key = "FA50688B9EB6D8AA070C8241C296DE8C9053683F"; + signByDefault = true; + gpgPath = "/run/current-system/sw/bin/gpg"; + }; + + aliases = { + graph = "log --graph --oneline --decorate"; + unstage = "reset HEAD --"; + co = "checkout"; + br = "branch"; + ci = "commit"; + st = "status"; + ps = "push"; + }; + + extraConfig = { + init.defaultBranch = "development"; + pull.rebase = "merges"; + core.sshCommand = "/run/current-system/sw/bin/ssh"; + }; + + ignores = [ + "**/.DS_Store" + "**/._.DS_Store" + ".DS_Store" + "._.DS_Store" + "**/*.swp" + "*.swp" + ]; + }; +} diff --git a/maddie/common/git/git-sync.sh b/maddie/common/git/git-sync.sh new file mode 100644 index 0000000..14e18d8 --- /dev/null +++ b/maddie/common/git/git-sync.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +git add . +git commit -am "$(date -I)" +git pull +git push diff --git a/maddie/common/helix.nix b/maddie/common/helix.nix new file mode 100644 index 0000000..b67c29c --- /dev/null +++ b/maddie/common/helix.nix @@ -0,0 +1,21 @@ +{ config, ... }: + +{ + programs.helix = { + enable = true; + /* languages = [ + { + name = "rust"; + auto-format = true; + } + ]; */ + settings = { + theme = "onedark"; + keys.normal = { + space.space = "file_picker"; + space.w = ":w"; + space.q = ":q"; + }; + }; + }; +} diff --git a/maddie/common/htop.nix b/maddie/common/htop.nix new file mode 100644 index 0000000..729222c --- /dev/null +++ b/maddie/common/htop.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + programs.htop = { + enable = true; + package = pkgs.htop-vim; + settings = { + hide_kernel_threads = 1; + hide_userland_threads = 1; + highlight_base_name = 1; + show_cpu_usage = 1; + show_cpu_frequency = 1; + show_cpu_temperature = 1; + degree_fahrenheit = 0; + enable_mouse = 1; + tree_view = 1; + }; + }; +} diff --git a/maddie/common/java.nix b/maddie/common/java.nix new file mode 100644 index 0000000..8780cc6 --- /dev/null +++ b/maddie/common/java.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + jdk8 + ]; +} diff --git a/maddie/common/kakoune.nix b/maddie/common/kakoune.nix new file mode 100644 index 0000000..fbc26ec --- /dev/null +++ b/maddie/common/kakoune.nix @@ -0,0 +1,77 @@ +{ config, pkgs, ... }: + +{ + programs.kakoune = { + enable = true; + config = { + numberLines = { + enable = true; + relative = true; + + }; + scrollOff.lines = 3; + showWhitespace.enable = false; + tabStop = 4; + colorScheme = "one-dark"; + ui = { + statusLine = "top"; + assistant = "cat"; + enableMouse = true; + setTitle = true; + }; + hooks = [ + { + name = "WinSetOption"; + option = "filetype=nix"; + commands = '' + set-option window indentwidth 2 + set-option window formatcmd nixpkgs-fmt + ''; + } + ]; + }; + plugins = with pkgs.kakounePlugins; [ + kakoune-rainbow + powerline-kak + auto-pairs-kak + pkgs.kak-lsp + ]; + extraConfig = '' + # Tabs + hook global InsertChar \t %{ exec -draft h@ } + add-highlighter global/ show-whitespaces -tab '│' -tabpad '╌' + + # Kak-LSP + eval %sh{kak-lsp --kakoune -s $kak_session} + lsp-enable + + # Modeline + declare-option bool lsp_enabled false + declare-option -hidden str lsp_modeline_progress "" + define-command -hidden -params 6 -override lsp-handle-progress %{ + set-option global lsp_modeline_progress %sh{ + if ! "$6"; then + echo "$2\$\{5:+" ($5%)"}\$\{4:+": $4"}" + fi + } + } + + declare-option -hidden str modeline_git_branch + hook global WinDisplay .* %{ + set-option window modeline_git_branch %sh{ + branch=$(git -C "\$\{kak_buffile%/*}" rev-parse --abbrev-ref HEAD 2>/dev/null) + if [ -n "$branch" ]; then + printf "$branch " + fi + } + } + + set-option global modelinefmt '%opt{lsp_modeline_progress} {StatusLine}{string}%opt{modeline_git_branch}{type}%sh{ [ -n "$kak_opt_filetype" ] && echo "$kak_opt_filetype " }{default}%val{bufname}{{context_info}}{default} {{mode_info}} {meta}%val{cursor_line}:%val{cursor_char_column}' + ''; + }; + + xdg.configFile."kak/colors" = { + source = ./kakoune/colors; + recursive = true; + }; +} diff --git a/maddie/common/kakoune/colors/one-dark-16.kak b/maddie/common/kakoune/colors/one-dark-16.kak new file mode 100644 index 0000000..ec8da3d --- /dev/null +++ b/maddie/common/kakoune/colors/one-dark-16.kak @@ -0,0 +1,93 @@ +# CODE + +set-face global value yellow +set-face global type yellow +set-face global variable red +set-face global module yellow +set-face global function blue +set-face global string green +set-face global keyword magenta +set-face global operator white +set-face global attribute cyan +set-face global comment white+d +set-face global documentation white+d +set-face global meta cyan +set-face global builtin yellow + +# MARKUP + +set-face global title yellow +set-face global header green +set-face global mono cyan +set-face global block magenta +set-face global link blue +set-face global bullet yellow +set-face global list white + +# BUILTIN + +set-face global Default white +set-face global PrimarySelection black,blue +set-face global SecondarySelection black,green +set-face global PrimaryCursor black,white +set-face global SecondaryCursor black,cyan +set-face global PrimaryCursorEol black,red +set-face global SecondaryCursorEol black,red +set-face global LineNumbers white +set-face global LineNumberCursor yellow +set-face global LineNumbersWrapped black +set-face global MenuForeground blue +set-face global MenuBackground default +set-face global MenuInfo green +set-face global Information default +set-face global Error red +set-face global StatusLine default +set-face global StatusLineMode yellow +set-face global StatusLineInfo blue +set-face global StatusLineValue white +set-face global StatusCursor black,blue +set-face global Prompt blue +set-face global MatchingChar +bu +set-face global BufferPadding black +set-face global Whitespace white+d + +# PLUGINS + +# kak-lsp +set-face global InlayHint +d@type +set-face global parameter +i@variable +set-face global enum cyan +set-face global InlayDiagnosticError red +set-face global InlayDiagnosticWarning yellow +set-face global InlayDiagnosticInfo blue +set-face global InlayDiagnosticHint white +set-face global LineFlagError red +set-face global LineFlagWarning yellow +set-face global LineFlagInfo blue +set-face global LineFlagHint white +set-face global DiagnosticError +u +set-face global DiagnosticWarning +u +set-face global DiagnosticInfo +u +set-face global DiagnosticHint +u +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors yellow magenta blue } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} diff --git a/maddie/common/kakoune/colors/one-dark.kak b/maddie/common/kakoune/colors/one-dark.kak new file mode 100644 index 0000000..f7e719e --- /dev/null +++ b/maddie/common/kakoune/colors/one-dark.kak @@ -0,0 +1,117 @@ +# One Dark + +declare-option str fg "abb2bf" +declare-option str bg "282c34" +declare-option str subbg "373c47" + +declare-option str lightred "e06c75" +declare-option str darkred "be5046" +declare-option str green "98c379" +declare-option str lightorange "e5c07b" +declare-option str darkorange "d19a66" +declare-option str blue "61afef" +declare-option str magenta "c678dd" +declare-option str cyan "56b6c2" + +declare-option str comment "5c6370" +declare-option str hint "ffffff" + +declare-option str cursoralpha "80" +declare-option str selectionalpha "40" + +# Menus do not support transparency, so we must hardcode the selection + sub bg colors +declare-option str menuselection "405770" + +# CODE + +set-face global value "rgb:%opt{darkorange}" +set-face global type "rgb:%opt{lightorange}" +set-face global variable "rgb:%opt{lightred}" +set-face global module "rgb:%opt{lightorange}" +set-face global function "rgb:%opt{blue}" +set-face global string "rgb:%opt{green}" +set-face global keyword "rgb:%opt{magenta}" +set-face global operator "rgb:%opt{fg}" +set-face global attribute "rgb:%opt{cyan}" +set-face global comment "rgb:%opt{comment}" +set-face global documentation "rgb:%opt{comment}" +set-face global meta "rgb:%opt{cyan}" +set-face global builtin "rgb:%opt{lightorange}" + +# MARKUP + +set-face global title "rgb:%opt{darkorange}" +set-face global header "rgb:%opt{green}" +set-face global mono "rgb:%opt{cyan}" +set-face global block "rgb:%opt{magenta}" +set-face global link "rgb:%opt{blue}" +set-face global bullet "rgb:%opt{lightorange}" +set-face global list "rgb:%opt{fg}" + +# BUILTIN + +set-face global Default "rgb:%opt{fg},rgb:%opt{bg}" +set-face global PrimarySelection "default,rgba:%opt{blue}%opt{selectionalpha}" +set-face global SecondarySelection "default,rgba:%opt{green}%opt{selectionalpha}" +set-face global PrimaryCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global SecondaryCursor "default,rgba:%opt{green}%opt{cursoralpha}" +set-face global PrimaryCursorEol "default,rgba:%opt{lightred}%opt{cursoralpha}" +set-face global SecondaryCursorEol "default,rgba:%opt{darkorange}%opt{cursoralpha}" +set-face global LineNumbers "rgb:%opt{comment}" +set-face global LineNumberCursor "rgb:%opt{darkorange}" +set-face global LineNumbersWrapped "rgb:%opt{bg},rgb:%opt{bg}" +set-face global MenuForeground "rgb:%opt{fg},rgb:%opt{menuselection}" +set-face global MenuBackground "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global MenuInfo "rgb:%opt{green}" +set-face global Information "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global Error "rgb:%opt{lightred}" +set-face global StatusLine "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global StatusLineMode "rgb:%opt{darkorange}" +set-face global StatusLineInfo "rgb:%opt{blue}" +set-face global StatusLineValue "rgb:%opt{fg}" +set-face global StatusCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global Prompt "rgb:%opt{blue}" +set-face global MatchingChar "default,rgb:%opt{subbg}" +set-face global BufferPadding "rgb:%opt{bg},rgb:%opt{bg}" +set-face global Whitespace "rgb:%opt{comment}" + +# PLUGINS + +# kak-lsp +set-face global InlayHint "+d@type" +set-face global parameter "+i@variable" +set-face global enum "rgb:%opt{cyan}" +set-face global InlayDiagnosticError "rgb:%opt{lightred}" +set-face global InlayDiagnosticWarning "rgb:%opt{lightorange}" +set-face global InlayDiagnosticInfo "rgb:%opt{blue}" +set-face global InlayDiagnosticHint "rgb:%opt{hint}" +set-face global LineFlagError "rgb:%opt{lightred}" +set-face global LineFlagWarning "rgb:%opt{lightorange}" +set-face global LineFlagInfo "rgb:%opt{blue}" +set-face global LineFlagHint "rgb:%opt{hint}" +set-face global DiagnosticError ",,rgb:%opt{lightred}+c" +set-face global DiagnosticWarning ",,rgb:%opt{lightorange}+c" +set-face global DiagnosticInfo ",,rgb:%opt{blue}+c" +set-face global DiagnosticHint ",,rgb:%opt{hint}+u" +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors "rgb:%opt{lightorange}" "rgb:%opt{magenta}" "rgb:%opt{blue}" } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} diff --git a/maddie/common/kakoune/colors/one-darker-16.kak b/maddie/common/kakoune/colors/one-darker-16.kak new file mode 100644 index 0000000..6d5dc56 --- /dev/null +++ b/maddie/common/kakoune/colors/one-darker-16.kak @@ -0,0 +1,101 @@ +# CODE + +set-face global value yellow +set-face global type yellow +set-face global variable white +set-face global module yellow +set-face global function blue +set-face global string green +set-face global keyword magenta +set-face global operator red +set-face global attribute cyan +set-face global comment white+d +set-face global documentation white+d +set-face global meta cyan +set-face global builtin yellow + +# MARKUP + +set-face global title yellow +set-face global header green +set-face global mono cyan +set-face global block magenta +set-face global link blue +set-face global bullet yellow +set-face global list white + +# BUILTIN + +set-face global Default white +set-face global PrimarySelection black,blue +set-face global SecondarySelection black,green +set-face global PrimaryCursor black,white +set-face global SecondaryCursor black,cyan +set-face global PrimaryCursorEol black,red +set-face global SecondaryCursorEol black,red +set-face global LineNumbers white +set-face global LineNumberCursor yellow +set-face global LineNumbersWrapped black +set-face global MenuForeground blue +set-face global MenuBackground default +set-face global MenuInfo green +set-face global Information default +set-face global Error red +set-face global StatusLine default +set-face global StatusLineMode yellow +set-face global StatusLineInfo blue +set-face global StatusLineValue white +set-face global StatusCursor black,blue +set-face global Prompt blue +set-face global MatchingChar +bu +set-face global BufferPadding black +set-face global Whitespace white+d + +# PLUGINS + +# kak-lsp +set-face global InlayHint +d@type +set-face global parameter +i@variable +set-face global enum cyan +set-face global InlayDiagnosticError red +set-face global InlayDiagnosticWarning yellow +set-face global InlayDiagnosticInfo blue +set-face global InlayDiagnosticHint white +set-face global LineFlagError red +set-face global LineFlagWarning yellow +set-face global LineFlagInfo blue +set-face global LineFlagHint white +set-face global DiagnosticError +u +set-face global DiagnosticWarning +u +set-face global DiagnosticInfo +u +set-face global DiagnosticHint +u +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors yellow magenta blue } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} + +# Hardcoded selection + bg colors +# set-face global PrimarySelection default,rgb:2a3f53 +# set-face global SecondarySelection default,rgb:384435 +# set-face global PrimaryCursor default,rgb:3c6487 +# set-face global SecondaryCursor default,rgb:586e4c +# set-face global PrimaryCursorEol default,rgb:7c434a +# set-face global SecondaryCursorEol default,rgb:7c434a diff --git a/maddie/common/kakoune/colors/one-darker.kak b/maddie/common/kakoune/colors/one-darker.kak new file mode 100644 index 0000000..f92265b --- /dev/null +++ b/maddie/common/kakoune/colors/one-darker.kak @@ -0,0 +1,125 @@ +# One Darker +# This theme is a personalized implementation of One Dark. +# Changes include: +# - Darker background color +# - Variables are white instead of red +# - Operators are red instead of white +# - Comments are more visible + +# COLORS + +declare-option str fg "abb2bf" +declare-option str bg "181a1f" +declare-option str subbg "272b33" + +declare-option str lightred "e06c75" +declare-option str darkred "be5046" +declare-option str green "98c379" +declare-option str lightorange "e5c07b" +declare-option str darkorange "d19a66" +declare-option str blue "61afef" +declare-option str magenta "c678dd" +declare-option str cyan "56b6c2" + +declare-option str comment "70798a" +declare-option str hint "ffffff" + +declare-option str cursoralpha "80" +declare-option str selectionalpha "40" + +# Menus do not support transparency, so we must hardcode the selection + sub bg colors +declare-option str menuselection "344b61" + +# CODE + +set-face global value "rgb:%opt{darkorange}" +set-face global type "rgb:%opt{lightorange}" +set-face global variable "rgb:%opt{fg}" +set-face global module "rgb:%opt{lightorange}" +set-face global function "rgb:%opt{blue}" +set-face global string "rgb:%opt{green}" +set-face global keyword "rgb:%opt{magenta}" +set-face global operator "rgb:%opt{lightred}" +set-face global attribute "rgb:%opt{cyan}" +set-face global comment "rgb:%opt{comment}" +set-face global documentation "rgb:%opt{comment}" +set-face global meta "rgb:%opt{cyan}" +set-face global builtin "rgb:%opt{lightorange}" + +# MARKUP + +set-face global title "rgb:%opt{darkorange}" +set-face global header "rgb:%opt{green}" +set-face global mono "rgb:%opt{cyan}" +set-face global block "rgb:%opt{magenta}" +set-face global link "rgb:%opt{blue}" +set-face global bullet "rgb:%opt{lightorange}" +set-face global list "rgb:%opt{fg}" + +# BUILTIN + +set-face global Default "rgb:%opt{fg},rgb:%opt{bg}" +set-face global PrimarySelection "default,rgba:%opt{blue}%opt{selectionalpha}" +set-face global SecondarySelection "default,rgba:%opt{green}%opt{selectionalpha}" +set-face global PrimaryCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global SecondaryCursor "default,rgba:%opt{green}%opt{cursoralpha}" +set-face global PrimaryCursorEol "default,rgba:%opt{lightred}%opt{cursoralpha}" +set-face global SecondaryCursorEol "default,rgba:%opt{darkorange}%opt{cursoralpha}" +set-face global LineNumbers "rgb:%opt{comment}" +set-face global LineNumberCursor "rgb:%opt{darkorange}" +set-face global LineNumbersWrapped "rgb:%opt{bg},rgb:%opt{bg}" +set-face global MenuForeground "rgb:%opt{fg},rgb:%opt{menuselection}" +set-face global MenuBackground "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global MenuInfo "rgb:%opt{green}" +set-face global Information "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global Error "rgb:%opt{lightred}" +set-face global StatusLine "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global StatusLineMode "rgb:%opt{darkorange}" +set-face global StatusLineInfo "rgb:%opt{blue}" +set-face global StatusLineValue "rgb:%opt{fg}" +set-face global StatusCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global Prompt "rgb:%opt{blue}" +set-face global MatchingChar "default,rgb:%opt{subbg}" +set-face global BufferPadding "rgb:%opt{bg},rgb:%opt{bg}" +set-face global Whitespace "rgb:%opt{comment}" + +# PLUGINS + +# kak-lsp +set-face global InlayHint "+d@type" +set-face global parameter "+i@variable" +set-face global enum "rgb:%opt{cyan}" +set-face global InlayDiagnosticError "rgb:%opt{lightred}" +set-face global InlayDiagnosticWarning "rgb:%opt{lightorange}" +set-face global InlayDiagnosticInfo "rgb:%opt{blue}" +set-face global InlayDiagnosticHint "rgb:%opt{hint}" +set-face global LineFlagError "rgb:%opt{lightred}" +set-face global LineFlagWarning "rgb:%opt{lightorange}" +set-face global LineFlagInfo "rgb:%opt{blue}" +set-face global LineFlagHint "rgb:%opt{hint}" +set-face global DiagnosticError ",,rgb:%opt{lightred}+c" +set-face global DiagnosticWarning ",,rgb:%opt{lightorange}+c" +set-face global DiagnosticInfo ",,rgb:%opt{blue}+c" +set-face global DiagnosticHint ",,rgb:%opt{hint}+u" +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors "rgb:%opt{lightorange}" "rgb:%opt{magenta}" "rgb:%opt{blue}" } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} diff --git a/maddie/common/kakoune/colors/one-light-16.kak b/maddie/common/kakoune/colors/one-light-16.kak new file mode 100644 index 0000000..60e1689 --- /dev/null +++ b/maddie/common/kakoune/colors/one-light-16.kak @@ -0,0 +1,93 @@ +# CODE + +set-face global value yellow +set-face global type yellow +set-face global variable red +set-face global module yellow +set-face global function blue +set-face global string green +set-face global keyword magenta +set-face global operator black +set-face global attribute cyan +set-face global comment black+d +set-face global documentation black+d +set-face global meta cyan +set-face global builtin yellow + +# MARKUP + +set-face global title yellow +set-face global header green +set-face global mono cyan +set-face global block magenta +set-face global link blue +set-face global bullet yellow +set-face global list white + +# BUILTIN + +set-face global Default black +set-face global PrimarySelection black,blue +set-face global SecondarySelection black,green +set-face global PrimaryCursor black,white +set-face global SecondaryCursor black,cyan +set-face global PrimaryCursorEol black,red +set-face global SecondaryCursorEol black,red +set-face global LineNumbers black +set-face global LineNumberCursor yellow +set-face global LineNumbersWrapped white +set-face global MenuForeground blue +set-face global MenuBackground default +set-face global MenuInfo green +set-face global Information default +set-face global Error red +set-face global StatusLine default +set-face global StatusLineMode yellow +set-face global StatusLineInfo blue +set-face global StatusLineValue white +set-face global StatusCursor black,blue +set-face global Prompt blue +set-face global MatchingChar +bu +set-face global BufferPadding white +set-face global Whitespace black+d + +# PLUGINS + +# kak-lsp +set-face global InlayHint +d@type +set-face global parameter +i@variable +set-face global enum cyan +set-face global InlayDiagnosticError red +set-face global InlayDiagnosticWarning yellow +set-face global InlayDiagnosticInfo blue +set-face global InlayDiagnosticHint white +set-face global LineFlagError red +set-face global LineFlagWarning yellow +set-face global LineFlagInfo blue +set-face global LineFlagHint white +set-face global DiagnosticError +u +set-face global DiagnosticWarning +u +set-face global DiagnosticInfo +u +set-face global DiagnosticHint +u +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors yellow magenta blue } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} diff --git a/maddie/common/kakoune/colors/one-light.kak b/maddie/common/kakoune/colors/one-light.kak new file mode 100644 index 0000000..79e6ca1 --- /dev/null +++ b/maddie/common/kakoune/colors/one-light.kak @@ -0,0 +1,117 @@ +# One Light + +declare-option str fg "4b4c54" +declare-option str bg "fafafa" +declare-option str subbg "e6e6e6" + +declare-option str lightred "e45649" +declare-option str darkred "ca1243" +declare-option str green "50a14f" +declare-option str lightorange "c18401" +declare-option str darkorange "986801" +declare-option str blue "4078f2" +declare-option str magenta "a626a4" +declare-option str cyan "0184bc" + +declare-option str comment "a0a1a7" +declare-option str hint "000000" + +declare-option str cursoralpha "80" +declare-option str selectionalpha "40" + +# Menus do not support transparency, so we must hardcode the selection + sub bg colors +declare-option str menuselection "bbc9e8" + +# CODE + +set-face global value "rgb:%opt{darkorange}" +set-face global type "rgb:%opt{lightorange}" +set-face global variable "rgb:%opt{lightred}" +set-face global module "rgb:%opt{lightorange}" +set-face global function "rgb:%opt{blue}" +set-face global string "rgb:%opt{green}" +set-face global keyword "rgb:%opt{magenta}" +set-face global operator "rgb:%opt{fg}" +set-face global attribute "rgb:%opt{cyan}" +set-face global comment "rgb:%opt{comment}" +set-face global documentation "rgb:%opt{comment}" +set-face global meta "rgb:%opt{cyan}" +set-face global builtin "rgb:%opt{lightorange}" + +# MARKUP + +set-face global title "rgb:%opt{darkorange}" +set-face global header "rgb:%opt{green}" +set-face global mono "rgb:%opt{cyan}" +set-face global block "rgb:%opt{magenta}" +set-face global link "rgb:%opt{blue}" +set-face global bullet "rgb:%opt{lightorange}" +set-face global list "rgb:%opt{fg}" + +# BUILTIN + +set-face global Default "rgb:%opt{fg},rgb:%opt{bg}" +set-face global PrimarySelection "default,rgba:%opt{blue}%opt{selectionalpha}" +set-face global SecondarySelection "default,rgba:%opt{green}%opt{selectionalpha}" +set-face global PrimaryCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global SecondaryCursor "default,rgba:%opt{green}%opt{cursoralpha}" +set-face global PrimaryCursorEol "default,rgba:%opt{lightred}%opt{cursoralpha}" +set-face global SecondaryCursorEol "default,rgba:%opt{darkorange}%opt{cursoralpha}" +set-face global LineNumbers "rgb:%opt{comment}" +set-face global LineNumberCursor "rgb:%opt{darkorange}" +set-face global LineNumbersWrapped "rgb:%opt{bg},rgb:%opt{bg}" +set-face global MenuForeground "rgb:%opt{fg},rgb:%opt{menuselection}" +set-face global MenuBackground "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global MenuInfo "rgb:%opt{green}" +set-face global Information "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global Error "rgb:%opt{lightred}" +set-face global StatusLine "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global StatusLineMode "rgb:%opt{darkorange}" +set-face global StatusLineInfo "rgb:%opt{blue}" +set-face global StatusLineValue "rgb:%opt{fg}" +set-face global StatusCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global Prompt "rgb:%opt{blue}" +set-face global MatchingChar "default,rgb:%opt{subbg}" +set-face global BufferPadding "rgb:%opt{bg},rgb:%opt{bg}" +set-face global Whitespace "rgb:%opt{comment}" + +# PLUGINS + +# kak-lsp +set-face global InlayHint "+d@type" +set-face global parameter "+i@variable" +set-face global enum "rgb:%opt{cyan}" +set-face global InlayDiagnosticError "rgb:%opt{lightred}" +set-face global InlayDiagnosticWarning "rgb:%opt{lightorange}" +set-face global InlayDiagnosticInfo "rgb:%opt{blue}" +set-face global InlayDiagnosticHint "rgb:%opt{hint}" +set-face global LineFlagError "rgb:%opt{lightred}" +set-face global LineFlagWarning "rgb:%opt{lightorange}" +set-face global LineFlagInfo "rgb:%opt{blue}" +set-face global LineFlagHint "rgb:%opt{hint}" +set-face global DiagnosticError ",,rgb:%opt{lightred}+c" +set-face global DiagnosticWarning ",,rgb:%opt{lightorange}+c" +set-face global DiagnosticInfo ",,rgb:%opt{blue}+c" +set-face global DiagnosticHint ",,rgb:%opt{hint}+u" +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors "rgb:%opt{lightorange}" "rgb:%opt{magenta}" "rgb:%opt{blue}" } + +# For backwards compatibility +define-command -override -hidden one-enable-fancy-underlines %{ + echo -debug "one-enable-fancy-underlines is deprecated - curly underlines are enabled by default" +} diff --git a/maddie/common/latex.nix b/maddie/common/latex.nix new file mode 100644 index 0000000..938e7a7 --- /dev/null +++ b/maddie/common/latex.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + #texliveFull + texlive.combined.scheme-full + ]; +} diff --git a/maddie/common/lf.nix b/maddie/common/lf.nix new file mode 100644 index 0000000..79bb0ee --- /dev/null +++ b/maddie/common/lf.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + programs.lf = { + enable = true; + previewer.source = ./lf/scope; + settings = { + relativenumber = true; + number = true; + hidden = false; + preview = true; + icons = true; + }; + }; + + xdg.configFile = { + "lf/icons" = { + source = ./lf/icons; + }; + }; + + home.packages = with pkgs; [ + ueberzug + file + ]; +} diff --git a/maddie/common/lf/icons b/maddie/common/lf/icons new file mode 100644 index 0000000..82bcd50 --- /dev/null +++ b/maddie/common/lf/icons @@ -0,0 +1,93 @@ +di  +fi  +tw  +ow  +ln  +or  +ex  +*.txt  +*.mom  +*.me  +*.ms  +*.avif  +*.png  +*.webp  +*.ico  +*.gif  +*.tif  +*.tiff  +*.jpg  +*.jpe  +*.jpeg  +*.heif  +*.svg  +*.xcf  +*.gpg  +*.pdf  +*.djvu  +*.epub  +*.csv  +*.xlsx  +*.tex  +*.md  +*.mp3  +*.opus  +*.ogg  +*.m4a  +*.flac  +*.wav  +*.mkv  +*.mp4  +*.webm  +*.mpeg  +*.avi  +*.mov  +*.mpg  +*.wmv  +*.m4b  +*.flv  +*.zip  +*.rar  +*.7z  +*.tar  +*.gz  +*.z64 󰺷 +*.v64 󰺷 +*.n64 󰺷 +*.gdi 󰺷 +*.gba 󱎓 +*.nes 󰺶 +*.exe  +*.1  +*.nfo  +*.info  +*.log  +*.iso  +*.img  +*.bib  +*.part 󰋮 +*.torrent  +*.gitignore  +*.jar  +*.java  +*.r  +*.R  +*.rmd  +*.Rmd  +*.m  +*.rs  +*.go  +*.c  +*.cpp  +*.h  +*.py  +*.js  +*.json  +*.ts 󰛦 +*.sh  +*.html  +*.css  +*.xml  +*.php  +*.nix  +*.vim  diff --git a/maddie/common/lf/scope b/maddie/common/lf/scope new file mode 100644 index 0000000..c648d66 --- /dev/null +++ b/maddie/common/lf/scope @@ -0,0 +1,52 @@ +#!/usr/bin/env sh + +# File preview handler for lf. + +set -C -f +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +image() { + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + else + mediainfo "$6" + fi +} + +ifub() { + [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +} + +# Note that the cache file name is a function of file information, meaning if +# an image appears in multiple places across the machine, it will not have to +# be regenerated once seen. + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; + text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/* ) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + image "$CACHE" "$2" "$3" "$4" "$5" "$1" + ;; + */pdf) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + */epub+zip|*/mobi*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + application/*zip) atool --list -- "$1" ;; + *opendocument*) odt2txt "$1" ;; + application/pgp-encrypted) gpg -d -- "$1" ;; +esac +exit 1 diff --git a/maddie/common/lsp.nix b/maddie/common/lsp.nix new file mode 100644 index 0000000..303b745 --- /dev/null +++ b/maddie/common/lsp.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + nodejs + sumneko-lua-language-server + nodePackages.bash-language-server + nodePackages.vim-language-server + nodePackages.pyright + /* rust-analyzer */ + rnix-lsp + universal-ctags + ]; +} diff --git a/maddie/common/media.nix b/maddie/common/media.nix new file mode 100644 index 0000000..1d72376 --- /dev/null +++ b/maddie/common/media.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + imagemagick # Manipulates images + libheif # Manage .heif files from phones + ffmpeg # Video manipulator + ]; +} diff --git a/maddie/common/mommy.nix b/maddie/common/mommy.nix new file mode 100644 index 0000000..d78da2a --- /dev/null +++ b/maddie/common/mommy.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + programs.zsh.initExtra = '' + precmd() { [ $? -ne 0 ] && $HOME/.local/bin/mommy -n } + ''; + + home.file.".local/bin/mommy" = { + source = ./mommy/shell-mommy.sh; + executable = true; + }; +} diff --git a/maddie/common/mommy/shell-mommy.sh b/maddie/common/mommy/shell-mommy.sh new file mode 100644 index 0000000..ac215eb --- /dev/null +++ b/maddie/common/mommy/shell-mommy.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env sh + +usage() { printf "usage: $0 [-pn]\n -p: positive response\n -n: negative response\n"; } +[ $# -eq 0 ] && usage && exit 0; + +[ -z "$MOMMYS_LITTLE" ] && MOMMYS_LITTLE="girl" +[ -z "$MOMMYS_PRONOUN" ] && MOMMYS_PRONOUN="her" +[ -z "$MOMMYS_ROLE" ] && MOMMYS_ROLE="mommy" +[ -z "$MOMMY_COLOR" ] && MOMMY_COLOR='\e[38;5;217m' +COLOR_RESET='\e[0m' + +negative() { + RESPONSES=( + "do you need $MOMMYS_ROLE's help~? ❤️" + "don't give up, my love~ ❤️" + "don't worry, $MOMMYS_ROLE is here to help you~ ❤️" + "I believe in you, my sweet $MOMMYS_LITTLE~ ❤️" + "it's okay to make mistakes, my dear~ ❤️" + "just a little further, sweetie~ ❤️" + "let's try again together, okay~? ❤️" + "$MOMMYS_ROLE believes in you, and knows you can overcome this~ ❤️" + "$MOMMYS_ROLE believes in you~ ❤️" + "$MOMMYS_ROLE is always here for you, no matter what~ ❤️" + "$MOMMYS_ROLE is here to help you through it~ ❤️" + "$MOMMYS_ROLE is proud of you for trying, no matter what the outcome~ ❤️" + "$MOMMYS_ROLE knows it's tough, but you can do it~ ❤️" + "$MOMMYS_ROLE knows $MOMMYS_PRONOUN little $MOMMYS_LITTLE can do better~ ❤️" + "$MOMMYS_ROLE knows you can do it, even if it's tough~ ❤️" + "$MOMMYS_ROLE knows you're feeling down, but you'll get through it~ ❤️" + "$MOMMYS_ROLE knows you're trying your best~ ❤️" + "$MOMMYS_ROLE loves you, and is here to support you~ ❤️" + "$MOMMYS_ROLE still loves you no matter what~ ❤️" + "you're doing your best, and that's all that matters to $MOMMYS_ROLE~ ❤️" + "$MOMMYS_ROLE is always here to encourage you~ ❤️" + ) +} + +positive() { + RESPONSES=( + "*pats your head*" + "awe, what a good $MOMMYS_LITTLE~\n$MOMMYS_ROLE knew you could do it~ ❤️" + "good $MOMMYS_LITTLE~\n$MOMMYS_ROLE's so proud of you~ ❤️" + "keep up the good work, my love~ ❤️" + "$MOMMYS_ROLE is proud of the progress you've made~ ❤️" + "$MOMMYS_ROLE is so grateful to have you as $MOMMYS_PRONOUN little $MOMMYS_LITTLE~ ❤️" + "I'm so proud of you, my love~ ❤️" + "$MOMMYS_ROLE is so proud of you~ ❤️" + "$MOMMYS_ROLE loves seeing $MOMMYS_PRONOUN little $MOMMYS_LITTLE succeed~ ❤️" + "$MOMMYS_ROLE thinks $MOMMYS_PRONOUN little $MOMMYS_LITTLE earned a big hug~ ❤️" + "that's a good $MOMMYS_LITTLE~ ❤️" + "you did an amazing job, my dear~ ❤️" + "you're such a smart cookie~ ❤️" + ) +} + +mommy_says() { + says=$1 + printf "$MOMMY_COLOR$says$COLOR_RESET\n" +} + +random() { + [ $1 == "positive" ] && positive + [ $1 == "negative" ] && negative + + index=$(($RANDOM % ${#RESPONSES[@]})) + response="${RESPONSES[$index]}" + + mommy_says "$response" +} + +while getopts "pn" options; do + case $options in + p) random "positive" ;; + n) random "negative" ;; + *) usage; exit 1 ;; + esac +done diff --git a/maddie/common/neovim.nix b/maddie/common/neovim.nix new file mode 100644 index 0000000..ef2b662 --- /dev/null +++ b/maddie/common/neovim.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + programs.neovim = { + enable = true; + defaultEditor = true; + }; + + xdg.configFile."nvim" = { + source = ./neovim; + recursive = true; + }; +} diff --git a/maddie/common/neovim/.gitignore b/maddie/common/neovim/.gitignore new file mode 100644 index 0000000..8cb205e --- /dev/null +++ b/maddie/common/neovim/.gitignore @@ -0,0 +1 @@ +plugin diff --git a/maddie/common/neovim/LICENSE b/maddie/common/neovim/LICENSE new file mode 100644 index 0000000..f608636 --- /dev/null +++ b/maddie/common/neovim/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 SpyHoodle + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/maddie/common/neovim/README.md b/maddie/common/neovim/README.md new file mode 100644 index 0000000..e509bf7 --- /dev/null +++ b/maddie/common/neovim/README.md @@ -0,0 +1,22 @@ +# Maddie's NeoVim config +A clean, fast, feature-rich IDE layer for my needs in [NeoVim](https://neovim.io/).
+Written in Lua, designed for NeoVim v0.7.0 or higher. + +## Some highlights + - Written entirely in Lua, making it clean and modern for NeoVim + - Uses [impatient.nvim](https://github.com/lewis6991/impatient.nvim) which greatly improves startup performance + - Uses the latest NeoVim LSP features & tree-sitter for highlighting + - Neat, small and structured files that are easy to read with some commenting + - Helpful features for programming such as highlighting indents & whitespaces + - Features for writing prose and taking notes, such as [vimwiki](https://github.com/vimwiki/vimwiki) and [orgmode](https://github.com/nvim-orgmode/orgmode) + - Extensible Lua written NeoVim specific package manager from [packer.nvim](https://github.com/wbthomason/packer.nvim) + - Modern standard Lua plugins such as [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) and [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua) + - Fixed scrolling in terminals like st with patches and smooth scrolling + - Extra configuration for [Neovide](https://github.com/neovide/neovide), a graphical NeoVim client + - Shortcuts for tabs & splits with the leader key as space + - System clipboard, mouse and scrolling support + +## Work in progress! +I'm constantly updating and changing this configuration, by adding new plugins and settings.
+I likely won't make changes to make the config more acceptable and general to the public.
+Made with ❤️ and 🏳️‍⚧️. diff --git a/maddie/common/neovim/init.lua b/maddie/common/neovim/init.lua new file mode 100644 index 0000000..68daca1 --- /dev/null +++ b/maddie/common/neovim/init.lua @@ -0,0 +1,253 @@ +-- Basic vim config +require('basics') +require('keymaps') +require('colours') + +-- Packages +return require('packer').startup(function(use) + -- Neovim package manager + use 'wbthomason/packer.nvim' + + -- Atom's One Dark theme + use 'navarasu/onedark.nvim' + + -- Gruvbox theme + use 'ellisonleao/gruvbox.nvim' + + -- VSCode theme + use 'Mofiqul/vscode.nvim' + + -- Everforest theme + use 'sainnhe/everforest' + + -- Smooth scrolling + use 'psliwka/vim-smoothie' + + -- Comments in any language + use 'tpope/vim-commentary' + + -- Surrounding + use 'tpope/vim-surround' + + -- Repeating + use 'tpope/vim-repeat' + + -- Vim-wiki + use 'vimwiki/vimwiki' + + -- Rainbow brackets + use 'p00f/nvim-ts-rainbow' + + -- Git bindings + use 'tpope/vim-fugitive' + + -- Latex + use 'lervag/vimtex' + + -- Easy alignment + use 'junegunn/vim-easy-align' + + + -- Transparent background + use { + 'xiyaowong/nvim-transparent', + config = function() + vim.g.transparent_enabled = false + end + } + + -- Zen mode + use { + "folke/zen-mode.nvim", + config = function() + require('zen-mode').setup() + end + } + + -- Autosaving + use { + 'pocco81/auto-save.nvim', + config = function() + require('auto-save').setup({ + enabled = true, + execution_message = { + message = function() + return ('>w< autosaved at ' .. vim.fn.strftime('%H:%M:%S')) + end, + cleaning_interval = 1250 + }, + trigger_events = { 'InsertLeave', 'TextChanged' } + }) + end + } + + -- Git signs + use { + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup() + end + } + + -- Github Copilot + use { + 'zbirenbaum/copilot.lua', + event = { 'VimEnter' }, + config = function() + vim.defer_fn(function() + require('copilot').setup() + end, 100) + end + } + + -- Liveshare + use { + 'jbyuki/instant.nvim', + config = function() + vim.g.instant_username = "Maddie" + end + } + + -- Fuzzy finder + use { + 'nvim-telescope/telescope.nvim', + requires = { 'nvim-lua/plenary.nvim' } + } + + -- Auto-pairs + use { + 'windwp/nvim-autopairs', + config = function() + require('nvim-autopairs').setup() + end + } + + -- Highlight whitespaces + use { + 'ntpeters/vim-better-whitespace', + config = function() + vim.g.better_whitespace_filetypes_blacklist = { 'startify' } + end + } + + -- Highlight indents + use { + 'nathanaelkane/vim-indent-guides', + config = function() + vim.g.indent_guides_enable_on_vim_startup = 1 + vim.g.indent_guides_exclude_filetypes = { 'help', 'NvimTree', 'startify' } + end + } + + -- Color hex codes + use { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup() + end + } + + -- Statusbar line + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true }, + config = function() + require('lualine').setup() + end + } + + -- File browser + use { + 'kyazdani42/nvim-tree.lua', + requires = { 'kyazdani42/nvim-web-devicons' }, + config = function() + require('nvim-tree').setup() + end + } + + -- Org-mode + use { + 'nvim-orgmode/orgmode', + config = function() + require('orgmode').setup() + require('orgmode').setup_ts_grammar() + end + } + + -- Speedup neovim startup + use { + 'lewis6991/impatient.nvim', + config = function() + require('impatient') + end + } + + -- Rust tools + use 'neovim/nvim-lspconfig' + use { + 'simrat39/rust-tools.nvim', + config = function() + require('rust-tools').setup() + end + } + + + -- -- Language Server Protocol + -- use { + -- 'neovim/nvim-lspconfig', + -- config = function() + -- require('lspconfig').pyright.setup{} + -- require('lspconfig').rnix.setup{} + -- require('lspconfig').bashls.setup{} + -- require('lspconfig').vimls.setup{} + -- require('lspconfig').sumneko_lua.setup { + -- settings = { + -- Lua = { + -- diagnostics = { + -- globals = { 'vim' } + -- } + -- } + -- } + -- } + -- end + -- } + + -- Code completion + use 'L3MON4D3/LuaSnip' + use 'rafamadriz/friendly-snippets' + use 'zbirenbaum/copilot-cmp' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-nvim-lua' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use { + 'hrsh7th/nvim-cmp', + requires = { 'kyazdani42/nvim-web-devicons' }, + config = function() + require('plugins.cmp') + end + } + + -- Treesitter for highlighting + use { + 'nvim-treesitter/nvim-treesitter', + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { 'cpp', 'lua', 'go', 'rust', 'python', 'nix', 'vim', 'markdown', 'html', 'css' }, + sync_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + rainbow = { + enable = true, + extended_mode = true + }, + indent = { + enable = true; + } + } + end + } +end) diff --git a/maddie/common/neovim/lua/basics.lua b/maddie/common/neovim/lua/basics.lua new file mode 100644 index 0000000..56e9f2b --- /dev/null +++ b/maddie/common/neovim/lua/basics.lua @@ -0,0 +1,36 @@ +-- Vim settings +vim.g.mapleader = ' ' +vim.o.encoding = 'utf8' +vim.o.background = 'dark' +vim.o.relativenumber = true +vim.o.number = true +vim.o.wrap = false +vim.o.expandtab = true +vim.o.incsearch = true +vim.o.scrolloff = 5 +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.cursorline = true +vim.o.ignorecase = true +vim.o.swapfile = false +vim.o.undofile = true +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.errorbells = false +vim.o.termguicolors = true +vim.o.showmode = false +vim.o.showtabline = 1 +vim.o.signcolumn = 'auto' +vim.o.clipboard = 'unnamedplus' +vim.o.mouse = 'a' +vim.o.go = 'a' + +-- Netrw +vim.g["netrw_banner"] = 0 +vim.g["netrw_liststyle"] = 3 +vim.g["netrw_winsize"] = 25 + +-- Neovide +vim.o.guifont = 'JetBrainsMono Nerd Font:h12' +vim.g.neovide_cursor_vfx_mode = 'railgun' +vim.g.neovide_remember_window_size = true diff --git a/maddie/common/neovim/lua/colours.lua b/maddie/common/neovim/lua/colours.lua new file mode 100644 index 0000000..344eaf8 --- /dev/null +++ b/maddie/common/neovim/lua/colours.lua @@ -0,0 +1 @@ +vim.cmd([[colorscheme onedark]]) diff --git a/maddie/common/neovim/lua/keymaps.lua b/maddie/common/neovim/lua/keymaps.lua new file mode 100644 index 0000000..745fc15 --- /dev/null +++ b/maddie/common/neovim/lua/keymaps.lua @@ -0,0 +1,59 @@ +-- Neat variables +local opts = { noremap = true, silent = true } +local term_opts = { silent = true } +local keymap = vim.api.nvim_set_keymap + +-- Custom/special keymaps +keymap('n', 'c', ':sp :term :resize 20N i', term_opts) +keymap('n', 'r', ':luafile %:PackerSync', term_opts) +keymap('n', 'h', ':nohl', term_opts) +keymap('n', 'z', ':ZenMode:set wrap:set linebreak', term_opts) +keymap('n', 'Z', ':ZenMode:set nowrap:set nolinebreak', term_opts) +keymap('n', '', ':Telescope colorscheme', term_opts) +keymap('n', '', ':wqa', term_opts) +keymap('n', '', ':w', term_opts) +keymap('n', 'U', ':redo', term_opts) + +-- Window management +keymap('n', 'vs', ':vs', opts) +keymap('n', 'hs', ':sp', opts) +keymap('n', 'tn', ':tabnew', opts) +keymap('n', 'th', ':tabprev', opts) +keymap('n', 'tj', ':tabprev', opts) +keymap('n', 'tk', ':tabnext', opts) +keymap('n', 'tl', ':tabnext', opts) +keymap('n', 'to', ':tabo', opts) +keymap('n', 'tc', ':tabc', opts) + +-- Window navigation +keymap('n', '', 'w', opts) +keymap('n', '', 'h', opts) +keymap('n', '', 'j', opts) +keymap('n', '', 'k', opts) +keymap('n', '', 'l', opts) + +-- Buffer navigation +keymap('n', '', ':bnext', opts) +keymap('n', '', ':bprevious', opts) + +-- Stay in visual mode when indenting +keymap('v', '<', '', '>gv', opts) + +-- When moving up or down, move physical lines not file lines +keymap('n', 'j', 'gj', opts) +keymap('n', 'k', 'gk', opts) + +-- NvimTree +keymap('n', '', ':NvimTreeToggle', term_opts) + +-- Telescope +keymap('n', '', 'lua require("telescope.builtin").find_files()', opts) +keymap('n', 'ff', 'lua require("telescope.builtin").find_files()', opts) +keymap('n', 'fg', 'lua require("telescope.builtin").live_grep()', opts) +keymap('n', 'fb', 'lua require("telescope.builtin").buffers()', opts) +keymap('n', 'fh', 'lua require("telescope.builtin").help_tags()', opts) + +-- Easy alignment +keymap('n', 'ga', ':EasyAlign', opts) +keymap('v', 'ga', ':EasyAlign', opts) diff --git a/maddie/common/neovim/lua/plugins/cmp.lua b/maddie/common/neovim/lua/plugins/cmp.lua new file mode 100644 index 0000000..224eccb --- /dev/null +++ b/maddie/common/neovim/lua/plugins/cmp.lua @@ -0,0 +1,117 @@ +local cmp = require('cmp') +local luasnip = require('luasnip') +require('luasnip.loaders.from_vscode').lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", + copilot = "[Copilot]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "copilot" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, + cmp.config.window.bordered() +} diff --git a/maddie/common/neovim/spell/en.utf-8.add b/maddie/common/neovim/spell/en.utf-8.add new file mode 100644 index 0000000..6f1ee5d --- /dev/null +++ b/maddie/common/neovim/spell/en.utf-8.add @@ -0,0 +1,6 @@ +macOS +JS +add evelyne +evelyne +camhs +Vernova diff --git a/maddie/common/neovim/spell/en.utf-8.add.spl b/maddie/common/neovim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..44abfca Binary files /dev/null and b/maddie/common/neovim/spell/en.utf-8.add.spl differ diff --git a/maddie/common/newsboat.nix b/maddie/common/newsboat.nix new file mode 100644 index 0000000..55d3320 --- /dev/null +++ b/maddie/common/newsboat.nix @@ -0,0 +1,19 @@ +{ config, ...}: + +{ + programs.newsboat = { + enable = true; + urls = [ + { + title = "Gitea - Evelyne"; + tags = [ "git" ]; + url = "https://git.spyhoodle.me/evelyne.rss"; + } + { + title = "Gitea - Maddie"; + tags = [ "git" ]; + url = "https://git.spyhoodle.me/maddie.rss"; + } + ]; + }; +} diff --git a/maddie/common/passwords.nix b/maddie/common/passwords.nix new file mode 100644 index 0000000..c43e87d --- /dev/null +++ b/maddie/common/passwords.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + programs.password-store = { + enable = true; + settings = { + PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store"; + }; + }; + + home.sessionVariables = { + PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store"; + }; +} diff --git a/maddie/common/processes.nix b/maddie/common/processes.nix new file mode 100644 index 0000000..8ef33c9 --- /dev/null +++ b/maddie/common/processes.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + xorg.xkill # Kill X11 programs with mouse + killall # Kill programs + ]; +} diff --git a/maddie/common/python.nix b/maddie/common/python.nix new file mode 100644 index 0000000..d1ef2f3 --- /dev/null +++ b/maddie/common/python.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +let + packages = ps: with ps; [ + numpy + matplotlib + tkinter + pillow + psycopg + passlib + pyotp + aiosmtplib + argon2_cffi + python-dotenv + python-lsp-server + openrgb-python + pdftotext + ]; +in +{ + home.packages = [ + (pkgs.python311.withPackages packages) + ]; +} diff --git a/maddie/common/rust.nix b/maddie/common/rust.nix new file mode 100644 index 0000000..e31bc39 --- /dev/null +++ b/maddie/common/rust.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + rustup + ]; + + home = { + sessionVariables = { + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + }; + sessionPath = [ "${config.home.sessionVariables.CARGO_HOME}/bin" ]; + }; +} diff --git a/maddie/common/shell.nix b/maddie/common/shell.nix new file mode 100644 index 0000000..535e3af --- /dev/null +++ b/maddie/common/shell.nix @@ -0,0 +1,62 @@ +{ config, ... }: + +{ + home = { + # Aliases + shellAliases = { + # Core Programs + cp = "cp -iv"; + mv = "mv -iv"; + rm = "rm -vI"; + mkd = "mkdir -pv"; + c = "clear"; + e = "exit"; + + # CLI Shortcuts + v = "nvim"; + vi = "nvim"; + ka = "killall"; + xw = "xwallpaper"; + nf = "neofetch"; + tf = "pridefetch -f trans"; + pf = "pfetch"; + i = "inertia"; + + # System shortcuts + heif-convert-dir = "for file in *.heic; do heif-convert -q 100 $file \${file/%.heic/.jpg}; done"; + unfuck-wifi = "doas systemctl restart wpa_supplicant.service"; + search = "f=$(fzf) && cd \"$f\" 2>/dev/null || xdg-open \"$f\" >/dev/null 2>&1"; + cdt = "cd $(mktemp -d)"; + sx = "startx ~/.xprofile"; + sdn = "doas shutdown -h now"; + kys = "kill $(pidof '$@')"; + + # Nix system shortucts + nix-system-update = "nix flake update $NIXFILES && doas nixos-rebuild switch --flake $NIXFILES"; + + # For colour + btop = "btop --utf-force"; + grep = "grep --color=auto"; + diff = "diff --color=auto"; + }; + + # Environment variables + sessionVariables = { + # Locale + LANG = "en_GB.UTF-8"; + LC_ALL = "en_GB.UTF-8"; + + # Define nixfiles location + NIXFILES = "$HOME/Development/Personal/NixFiles"; + + # Java windows + _JAVA_AWT_WM_NONREPARENTING = 1; + }; + + # Default $PATH + sessionPath = [ + # Add ~/.local/bin to $PATH + "$HOME/.local/bin" + ]; + }; +} diff --git a/maddie/common/smart-home.nix b/maddie/common/smart-home.nix new file mode 100644 index 0000000..a13660e --- /dev/null +++ b/maddie/common/smart-home.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + home-assistant-cli + ]; +} diff --git a/maddie/common/ssh.nix b/maddie/common/ssh.nix new file mode 100644 index 0000000..eb0e8a6 --- /dev/null +++ b/maddie/common/ssh.nix @@ -0,0 +1,26 @@ +{ config, pkgs, username, ... }: + +{ + # SSH + programs.ssh = { + enable = true; + matchBlocks = { + lambda = { + identityFile = "~/.ssh/id_ed25519_sk"; + hostname = "home.spyhoodle.me"; + user = "maddie"; + }; + pinea = { + identityFile = "~/.ssh/id_ed25519_sk"; + hostname = "ssh.pinea.dev"; + user = "maddie"; + }; + clicks = { + identityFile = "~/.ssh/clickscodes"; + hostname = "git.clicks.codes"; + port = 29418; + user = "maddie"; + }; + }; + }; +} diff --git a/maddie/common/ssh/maddie.pub b/maddie/common/ssh/maddie.pub new file mode 100644 index 0000000..5494a06 --- /dev/null +++ b/maddie/common/ssh/maddie.pub @@ -0,0 +1,3 @@ +sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIA1jTkcMhBQQoYqNVLofrNnTbB8RCyzSYmdsnPeoOineAAAABHNzaDo= spy@luna (yubikey) +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBO9WsQUnglNetqekCoA6WT0wYNxpUVyNxuktPOHJPBCLJmU9P+YErE915vj4HlYcuOW9UhVajQzLQTcelgs/O8w= M.iPad (Termius) +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD44bc9OdsIxwNBkdIN5Ce+Wer2gWi+QRcFdOV7+ScIo1QS29wkQJxU90ItcKwqiv+oTBlipV2NSH/YroBSHhQI= M.iPad (Secure ShellFish) diff --git a/maddie/common/tmux.nix b/maddie/common/tmux.nix new file mode 100644 index 0000000..5324f76 --- /dev/null +++ b/maddie/common/tmux.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + programs.tmux = { + enable = true; + clock24 = true; + mouse = true; + terminal = "screen-256color"; + }; +} diff --git a/maddie/common/xdg.nix b/maddie/common/xdg.nix new file mode 100644 index 0000000..6506006 --- /dev/null +++ b/maddie/common/xdg.nix @@ -0,0 +1,21 @@ +{ config, ... }: + +{ + home = { + sessionVariables = { + # Force use of XDG Dir Spec + CUDA_CACHE_PATH = "${config.xdg.cacheHome}/nv"; + LESSHISTFILE = "${config.xdg.configHome}/less/history"; + LESSKEY = "${config.xdg.configHome}/less/keys"; + WINEPREFIX = "${config.xdg.dataHome}/wine"; + _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${config.xdg.configHome}/java"; + }; + + shellAliases = { + # Force use of XDG Dir Spec + wget = "wget --hsts-file='${config.xdg.dataHome}/wget-hsts'"; + rxrdb = "xrdb -load '${config.xdg.configHome}/.config/X11/xresources'"; + nvidia-settings = "nvidia-settings --config='${config.xdg.configHome}'/nvidia/settings"; + }; + }; +} diff --git a/maddie/common/yt-dlp.nix b/maddie/common/yt-dlp.nix new file mode 100644 index 0000000..f5d31ca --- /dev/null +++ b/maddie/common/yt-dlp.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + programs.yt-dlp.enable = true; + home.packages = with pkgs; [ + flac + ]; + + home.file.".local/bin/ytdlp-music" = { + source = ./yt-dlp/ytdlp-music.sh; + executable = true; + }; +} diff --git a/maddie/common/yt-dlp/ytdlp-music.sh b/maddie/common/yt-dlp/ytdlp-music.sh new file mode 100755 index 0000000..d22fb3e --- /dev/null +++ b/maddie/common/yt-dlp/ytdlp-music.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +printf "YT URL: " && read url +printf "Title: " && read title +printf "Artist: " && read artist +printf "Album: " && read album + +# Download file from youtube +yt-dlp -x --no-playlist --embed-thumbnail --no-embed-metadata --audio-quality 0 --audio-format flac -o "$title.flac" "$url" + +# Set metadata flags +metaflac --set-tag="TITLE=$title" --set-tag="ARTIST=$artist" --set-tag="ALBUM=$album" "$title.flac" + +# Export thumbnail +metaflac --export-picture-to="$title.png" "$title.flac" + +# Convert png to jpg +mogrify -format jpg "$title.png" +rm -rf "$title.png" + +# Convert to square +convert "$title.jpg" -gravity center -crop 1:1 "$title.jpg" + +# Move the files to the correct directory +mv "$title.flac" "$title.jpg" $HOME/Music/Library/Liked diff --git a/maddie/common/zsh.nix b/maddie/common/zsh.nix new file mode 100644 index 0000000..3f48bf6 --- /dev/null +++ b/maddie/common/zsh.nix @@ -0,0 +1,123 @@ +{ config, pkgs, lib, ... }: + +{ + programs.zsh = { + # Use the zsh shell + enable = true; + + # Basic config settings + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + autocd = true; + /* defaultKeymap = "vicmd"; */ + dotDir = ".config/zsh"; + history = { + size = 9999999; + expireDuplicatesFirst = true; + extended = true; + path = "${config.xdg.cacheHome}/zsh/history"; + }; + + # Zsh init extras + initExtra = '' + # Disable Ctrl-S to freeze terminal + stty stop undef + + # Tab completion + zstyle ':completion:*' menu select # Use a menu + _comp_options+=(globdots) # Include hidden files + + # Change cursor shape for different vi modes + export KEYTIMEOUT=1 + function zle-keymap-select () { + case $KEYMAP in + vicmd) echo -ne '\e[1 q';; # block + viins|main) echo -ne '\e[5 q';; # beam + esac + } + zle -N zle-keymap-select + zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" + } + zle -N zle-line-init + echo -ne '\e[5 q' # Use beam shape cursor on startup. + preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + ''; + }; + + programs.starship = { + # Use the starship prompt + enable = true; + enableZshIntegration = true; + + settings = { + format = lib.concatStrings [ + # Directory + "$directory" + + # VCS + "$git_branch" + "$git_commit" + "$git_state" + "$git_metrics" + "$git_status" + "$hg_branch" + + # Languages + "$package" + "$c" + "$rust" + "$golang" + "$haskell" + "$python" + "$java" + "$kotlin" + "$lua" + "$dart" + "$nim" + "$nodejs" + "$swift" + "$zig" + "$nix_shell" + "$conda" + "$spack" + + # Prompt line + "$line_break" + "$username" + "$hostname" + "$localip" + "$cmd_duration" + "$memory_usage" + "$jobs" + "$character" + ]; + + # Prompt character + character = { + success_symbol = "-> [λ](bold purple)"; + error_symbol = "-> [λ](bold red)"; + vimcmd_symbol = "-> [λ](bold green)"; + }; + + # When in a deep directory or git repo + directory.truncation_symbol = ".../"; + + # Git widgets + git_metrics.disabled = false; + git_status = { + ahead = "->"; + behind = "<-"; + diverged = "<->"; + renamed = ">>"; + deleted = "x"; + }; + + # Enable other starship widgets + memory_usage.disabled = false; + localip.disabled = false; + }; + }; +} diff --git a/maddie/macos/home.nix b/maddie/macos/home.nix new file mode 100644 index 0000000..ea16015 --- /dev/null +++ b/maddie/macos/home.nix @@ -0,0 +1,10 @@ +{ config, username, pkgs, lib, ... }: + +{ + programs.home-manager.enable = true; + home = { + inherit username; + homeDirectory = lib.mkForce "/Users/${username}"; + stateVersion = "23.05"; + }; +} diff --git a/maddie/macos/iterm2.nix b/maddie/macos/iterm2.nix new file mode 100644 index 0000000..44dbc1f --- /dev/null +++ b/maddie/macos/iterm2.nix @@ -0,0 +1,510 @@ +{ config, username, ... }: + +{ + targets.darwin.defaults."com.googlecode.iterm2" = { + "PreventEscapeSequenceFromClearingHistory" = 0; + "NoSyncHaveExplainedHowToAddTouchbarControls" = 1; + "NoSyncTipsDisabled" = 1; + "SoundForEsc" = 0; + "VisualIndicatorForEsc" = 0; + "Custom Color Presets" = { + "One Dark" = { + "Ansi 0 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.168627455830574"; + "Color Space" = "sRGB"; + "Green Component" = "0.1450980454683304"; + "Red Component" = "0.1294117718935013"; + }; + "Ansi 1 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "Ansi 10 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4745098054409027"; + "Color Space" = "sRGB"; + "Green Component" = "0.7647058963775635"; + "Red Component" = "0.5960784554481506"; + }; + "Ansi 11 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4823529422283173"; + "Color Space" = "sRGB"; + "Green Component" = "0.7529411911964417"; + "Red Component" = "0.8980392217636108"; + }; + "Ansi 12 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Ansi 13 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.8666666746139526"; + "Color Space" = "sRGB"; + "Green Component" = "0.4705882370471954"; + "Red Component" = "0.7764706015586853"; + }; + "Ansi 14 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7607843279838562"; + "Color Space" = "sRGB"; + "Green Component" = "0.7137255072593689"; + "Red Component" = "0.3372549116611481"; + }; + "Ansi 15 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Ansi 2 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4745098054409027"; + "Color Space" = "sRGB"; + "Green Component" = "0.7647058963775635"; + "Red Component" = "0.5960784554481506"; + }; + "Ansi 3 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4823529422283173"; + "Color Space" = "sRGB"; + "Green Component" = "0.7529411911964417"; + "Red Component" = "0.8980392217636108"; + }; + "Ansi 4 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Ansi 5 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.8666666746139526"; + "Color Space" = "sRGB"; + "Green Component" = "0.4705882370471954"; + "Red Component" = "0.7764706015586853"; + }; + "Ansi 6 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7607843279838562"; + "Color Space" = "sRGB"; + "Green Component" = "0.7137255072593689"; + "Red Component" = "0.3372549116611481"; + }; + "Ansi 7 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Ansi 8 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4627451002597809"; + "Color Space" = "sRGB"; + "Green Component" = "0.4627451002597809"; + "Red Component" = "0.4627451002597809"; + }; + "Ansi 9 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "Background Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.168627455830574"; + "Color Space" = "sRGB"; + "Green Component" = "0.1450980454683304"; + "Red Component" = "0.1294117718935013"; + }; + "Badge Color" = { + "Alpha Component" = "0.5"; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "Bold Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Guide Color" = { + "Alpha Component" = "0.1764705882352941"; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Text Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Foreground Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Link Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Selected Text Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Selection Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.2666666805744171"; + "Color Space" = "sRGB"; + "Green Component" = "0.2196078449487686"; + "Red Component" = "0.196078434586525"; + }; + }; + }; + "Default Bookmark Guid" = "B038731D-3A7A-44EC-A1C5-8777EB3270A7"; + GlobalTouchBarMap = { + "touchbar:0C8EAB5C-C453-4AEA-9DA6-05D596F01730" = { + Action = 12; + Label = "❄️"; + Text = "nix shell\\n"; + Version = 1; + }; + "touchbar:2DDE7A3B-26B0-4748-AED2-A453238DFF5C" = { + Action = 12; + Label = "🗑️"; + Text = "clear\\n"; + Version = 1; + }; + "touchbar:5527C3C6-A03F-4CA5-B7C1-A9B52CC89BED" = { + Action = 12; + Label = "⬆️"; + Text = "git push\\n"; + Version = 1; + }; + "touchbar:A34F65B2-B5FE-4B8F-904C-BFF3D76D352F" = { + Action = 12; + Label = "✍️"; + Text = "git add .; git commit\\n"; + Version = 1; + }; + "touchbar:B8063C42-FFC8-4735-9A1B-7B5F4D477D90" = { + Action = 12; + Label = "🧐"; + Text = "git status\\n"; + Version = 1; + }; + "touchbar:E6F32724-CABD-4079-BC0E-95C2BB50BEB7" = { + Action = 12; + Label = "⬇️"; + Text = "git pull\\n"; + Version = 1; + }; + "NSTouchBarConfig: full screen" = { + CurrentItems = [ + "touchbar:B8063C42-FFC8-4735-9A1B-7B5F4D477D90/v0" + "touchbar:A34F65B2-B5FE-4B8F-904C-BFF3D76D352F/v0" + "touchbar:5527C3C6-A03F-4CA5-B7C1-A9B52CC89BED/v0" + "touchbar:E6F32724-CABD-4079-BC0E-95C2BB50BEB7/v0" + "NSTouchBarItemIdentifierFlexibleSpace" + "touchbar:0C8EAB5C-C453-4AEA-9DA6-05D596F01730/v0" + "touchbar:2DDE7A3B-26B0-4748-AED2-A453238DFF5C/v0" + "NSTouchBarItemIdentifierOtherItemsProxy" + ]; + DefaultItems = [ + "iTermTouchBarIdentifierManPage" + "iTermTouchBarIdentifierColorPreset" + "iTermTouchBarIdentifierFunctionKeys" + "NSTouchBarItemIdentifierFlexibleSpace" + "NSTouchBarItemIdentifierOtherItemsProxy" + "iTermTouchBarIdentifierAddMark" + "iTermTouchBarIdentifierPreviousMark" + "iTermTouchBarIdentifierNextMark" + ]; + }; + "NSTouchBarConfig: regular" = { + CurrentItems = [ + "touchbar:B8063C42-FFC8-4735-9A1B-7B5F4D477D90/v0" + "touchbar:A34F65B2-B5FE-4B8F-904C-BFF3D76D352F/v0" + "touchbar:5527C3C6-A03F-4CA5-B7C1-A9B52CC89BED/v0" + "touchbar:E6F32724-CABD-4079-BC0E-95C2BB50BEB7/v0" + "NSTouchBarItemIdentifierFlexibleSpace" + "touchbar:0C8EAB5C-C453-4AEA-9DA6-05D596F01730/v0" + "touchbar:2DDE7A3B-26B0-4748-AED2-A453238DFF5C/v0" + "NSTouchBarItemIdentifierOtherItemsProxy" + ]; + DefaultItems = [ + "iTermTouchBarIdentifierManPage" + "iTermTouchBarIdentifierColorPreset" + "iTermTouchBarIdentifierFunctionKeys" + "NSTouchBarItemIdentifierFlexibleSpace" + "NSTouchBarItemIdentifierOtherItemsProxy" + "iTermTouchBarIdentifierAddMark" + "iTermTouchBarIdentifierPreviousMark" + "iTermTouchBarIdentifierNextMark" + ]; + }; + "New Bookmarks" = [{ + "Ansi 0 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.168627455830574"; + "Color Space" = "sRGB"; + "Green Component" = "0.1450980454683304"; + "Red Component" = "0.1294117718935013"; + }; + "Ansi 1 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "Ansi 10 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4745098054409027"; + "Color Space" = "sRGB"; + "Green Component" = "0.7647058963775635"; + "Red Component" = "0.5960784554481506"; + }; + "Ansi 11 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4823529422283173"; + "Color Space" = "sRGB"; + "Green Component" = "0.7529411911964417"; + "Red Component" = "0.8980392217636108"; + }; + "Ansi 12 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Ansi 13 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.8666666746139526"; + "Color Space" = "sRGB"; + "Green Component" = "0.4705882370471954"; + "Red Component" = "0.7764706015586853"; + }; + "Ansi 14 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7607843279838562"; + "Color Space" = "sRGB"; + "Green Component" = "0.7137255072593689"; + "Red Component" = "0.3372549116611481"; + }; + "Ansi 15 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Ansi 2 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4745098054409027"; + "Color Space" = "sRGB"; + "Green Component" = "0.7647058963775635"; + "Red Component" = "0.5960784554481506"; + }; + "Ansi 3 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4823529422283173"; + "Color Space" = "sRGB"; + "Green Component" = "0.7529411911964417"; + "Red Component" = "0.8980392217636108"; + }; + "Ansi 4 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Ansi 5 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.8666666746139526"; + "Color Space" = "sRGB"; + "Green Component" = "0.4705882370471954"; + "Red Component" = "0.7764706015586853"; + }; + "Ansi 6 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7607843279838562"; + "Color Space" = "sRGB"; + "Green Component" = "0.7137255072593689"; + "Red Component" = "0.3372549116611481"; + }; + "Ansi 7 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Ansi 8 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4627451002597809"; + "Color Space" = "sRGB"; + "Green Component" = "0.4627451002597809"; + "Red Component" = "0.4627451002597809"; + }; + "Ansi 9 Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "BM Growl" = 1; + "Background Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.168627455830574"; + "Color Space" = "sRGB"; + "Green Component" = "0.1450980454683304"; + "Red Component" = "0.1294117718935013"; + }; + "Background Image Location" = ""; + "Badge Color" = { + "Alpha Component" = "0.5"; + "Blue Component" = "0.4588235318660736"; + "Color Space" = "sRGB"; + "Green Component" = "0.4235294163227081"; + "Red Component" = "0.8784313797950745"; + }; + "Blinking Cursor" = 0; + Blur = 1; + "Blur Radius" = "49.63241356382979"; + "Bold Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Character Encoding" = 4; + "Close Sessions On End" = 1; + Columns = 80; + Command = ""; + "Cursor Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Guide Color" = { + "Alpha Component" = "0.1764705882352941"; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Text Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Cursor Type" = 1; + "Custom Command" = "No"; + "Custom Directory" = "No"; + "Default Bookmark" = "No"; + "Description" = "Default"; + "Disable Window Resizing" = 1; + "Flashing Bell" = 0; + "Foreground Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Guid" = "B038731D-3A7A-44EC-A1C5-8777EB3270A7"; + "Horizontal Spacing" = 1; + "Icon" = 0; + "Idle Code" = 0; + "Link Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.9372549057006836"; + "Color Space" = "sRGB"; + "Green Component" = "0.686274528503418"; + "Red Component" = "0.3803921639919281"; + }; + "Mouse Reporting" = 1; + "Name" = "Default"; + "Non Ascii Font" = "Monaco 12"; + "Non-ASCII Anti Aliased" = 1; + "Normal Font" = "JetBrainsMonoNerdFontComplete-Regular 12"; + "Option Key Sends" = 0; + "Prompt Before Closing 2" = 0; + "Right Option Key Sends" = 0; + "Rows" = 25; + "Screen" = "-1"; + "Scrollback Lines" = 1000; + "Selected Text Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.7490196228027344"; + "Color Space" = "sRGB"; + "Green Component" = "0.6980392336845398"; + "Red Component" = "0.6705882549285889"; + }; + "Selection Color" = { + "Alpha Component" = 1; + "Blue Component" = "0.2666666805744171"; + "Color Space" = "sRGB"; + "Green Component" = "0.2196078449487686"; + "Red Component" = "0.196078434586525"; + }; + "Send Code When Idle" = 0; + "Shortcut" = ""; + "Silence Bell" = 1; + "Sync Title" = 0; + "Terminal Type" = "xterm-256color"; + "Transparency" = "0.3756482712765958"; + "Unlimited Scrollback" = 0; + "Use Bold Font" = 1; + "Use Bright Bold" = 1; + "Use Italic Font" = 1; + "Use Non-ASCII Font" = 0; + "Vertical Spacing" = 1; + "Visual Bell" = 1; + "Window Type" = 0; + "Working Directory" = "/Users/${username}"; + }]; + }; + }; +} diff --git a/maddie/macos/ssh.nix b/maddie/macos/ssh.nix new file mode 100644 index 0000000..ce604c6 --- /dev/null +++ b/maddie/macos/ssh.nix @@ -0,0 +1,9 @@ +{ config, username, ... }: + +{ + # Use Secretive as the ssh IdentityAgent on all hosts + programs.ssh.extraConfig = '' + Host * + IdentityAgent /Users/${username}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh + ''; +} diff --git a/maddie/macos/tower.nix b/maddie/macos/tower.nix new file mode 100644 index 0000000..d32da96 --- /dev/null +++ b/maddie/macos/tower.nix @@ -0,0 +1,33 @@ +{ config, ... }: + +{ + targets.darwin.defaults."com.fournova.Tower3" = { + "GTUserDefaultsAppAppearance" = 0; + "GTUserDefaultsAutoFetchTimeInterval" = 0; + "GTUserDefaultsBodyLineWrappingMode" = "soft"; + "GTUserDefaultsCommitOptionSignOff" = 0; + "GTUserDefaultsDarkTheme" = "Default"; + "GTUserDefaultsDefaultTerminalApplication" = "com.googlecode.iterm2"; + "GTUserDefaultsDetailHeaderExpanded" = 1; + "GTUserDefaultsDialogueOptionPullUseRebase" = 0; + "GTUserDefaultsDiffWarningThreshold" = 20000; + "GTUserDefaultsGettingStartedPassed" = 1; + "GTUserDefaultsGitBinary" = "/usr/bin/git"; + "GTUserDefaultsHideWindowTitle" = 0; + "GTUserDefaultsHistoryVerifiesGPGSignatures" = 1; + "GTUserDefaultsHistoryVerifiesGPGSignaturesInitialActivation" = 1; + "GTUserDefaultsLastApplicationVersion" = 351; + "GTUserDefaultsLightTheme" = "Default"; + "GTUserDefaultsMigrationsAzureDevOpsServerHostURLMigration" = 1; + "GTUserDefaultsMigrationsCommitViewSizeMigration" = 1; + "GTUserDefaultsRepositoryFinderInitialized" = 1; + "GTUserDefaultsUpdatesReleaseChannel" = "stable"; + "GTUserDefaultsUpdatesReleaseChannelReset" = 1; + "GTUserDefaultsUserProfilesInitialized" = 1; + "MSAppCenter310AppCenterUserDefaultsMigratedKey" = 1; + "MSAppCenter310CrashesUserDefaultsMigratedKey" = 1; + "NSNavLastRootDirectory" = "~/Documents/Education/Notes"; + "NSNavPanelExpandedSizeForOpenMode" = "{800, 611}"; + "NSNavPanelMediaBrowserTypeForOpenModeKey" = 1; + }; +} diff --git a/maddie/nixos/android.nix b/maddie/nixos/android.nix new file mode 100644 index 0000000..e00eb5a --- /dev/null +++ b/maddie/nixos/android.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + android-studio + ]; +} diff --git a/maddie/nixos/audio.nix b/maddie/nixos/audio.nix new file mode 100644 index 0000000..733995a --- /dev/null +++ b/maddie/nixos/audio.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pulsemixer # TUI sound mixer + playerctl # Manages media players + pamixer # CLI sound mixer + cava # Music visualiser + ]; + + home.file.".local/bin/volume" = { + source = ./audio/volume.sh; + executable = true; + }; +} diff --git a/maddie/nixos/audio/volume.sh b/maddie/nixos/audio/volume.sh new file mode 100755 index 0000000..0ed16d6 --- /dev/null +++ b/maddie/nixos/audio/volume.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh + +COMMAND="$@" +[ -z $COMMAND ] && echo "usage: volume [up|down|mute]" && exit 1 + +if [ $COMMAND = "up" ]; then + pamixer --allow-boost -i 5 +elif [ $COMMAND = "down" ]; then + pamixer --allow-boost -d 5 +elif [ $COMMAND = "mute" ]; then + pamixer -t +else + echo "volume: command not found" && exit 1 +fi + +MUTED="$(pamixer --get-mute)" +if [ $MUTED = "true" ]; then + MUTE_CHAR="!" +else + MUTE_CHAR="" +fi + +VOLUME=$(pamixer --get-volume) +echo "$VOLUME""$MUTE_CHAR" > /tmp/volume.fifo diff --git a/maddie/nixos/awesome.nix b/maddie/nixos/awesome.nix new file mode 100644 index 0000000..8ca6e2f --- /dev/null +++ b/maddie/nixos/awesome.nix @@ -0,0 +1,7 @@ +{ config, ... }: + +{ + xsession.windowManager.awesome = { + enable = true; + }; +} diff --git a/maddie/nixos/bosskey.nix b/maddie/nixos/bosskey.nix new file mode 100644 index 0000000..439baed --- /dev/null +++ b/maddie/nixos/bosskey.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + slock + ]; + + home.file.".local/bin/bosskey" = { + source = ./bosskey/bosskey.sh; + executable = true; + }; +} diff --git a/maddie/nixos/bosskey/bosskey.sh b/maddie/nixos/bosskey/bosskey.sh new file mode 100755 index 0000000..3b16303 --- /dev/null +++ b/maddie/nixos/bosskey/bosskey.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +while getopts "lrpm:u:" options; do + case $options in + m) + devices=$OPTARG + if echo "$devices" | grep "mic" &>/dev/null; then + # Mute the microphone + pamixer --default-source --mute + fi + if echo "$devices" | grep "vol" &>/dev/null; then + # Mute the volume + pamixer --mute + fi + ;; + + u) + devices=$OPTARG + if echo "$devices"| grep "mic" &>/dev/null; then + # Mute the microphone + pamixer --default-source --unmute + fi + if echo "$devices" | grep "vol" &>/dev/null; then + # Unmute the volume + pamixer --unmute + fi + ;; + + p) + # Pause any playing media + playerctl pause + ;; + + l) + # Lock the screen using slock(1) + slock + ;; + esac +done diff --git a/maddie/nixos/calculator.nix b/maddie/nixos/calculator.nix new file mode 100644 index 0000000..fb1cf64 --- /dev/null +++ b/maddie/nixos/calculator.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + nodePackages.insect + ]; +} diff --git a/maddie/nixos/chromium.nix b/maddie/nixos/chromium.nix new file mode 100644 index 0000000..30bc36a --- /dev/null +++ b/maddie/nixos/chromium.nix @@ -0,0 +1,29 @@ +{ config, ... }: + +{ + programs.chromium = { + enable = true; + commandLineArgs = [ + "--enable-logging=stderr" + "--ignore-gpu-blocklist" + ]; + extensions = [ + # Dark Reader + { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } + # uBlock Origin + { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } + # I still don't care about cookies + { id = "edibdbjcniadpccecjdfdjjppcpchdlm"; } + # NoScript + { id = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; } + # Reddit Enhancement Suite + { id = "kbmfpngjjgdllneeigpgjifpgocmfgmb"; } + # Old Reddit Redirect + { id = "dneaehbmnbhcippjikoajpoabadpodje"; } + # Return Youtube Dislike + { id = "gebbhagfogifgggkldgodflihgfeippi"; } + # Vimium + { id = "dbepggeogbaibhgnhhndojpepiihcmeb"; } + ]; + }; +} diff --git a/maddie/nixos/cider.nix b/maddie/nixos/cider.nix new file mode 100644 index 0000000..3f44907 --- /dev/null +++ b/maddie/nixos/cider.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + cider + ]; +} diff --git a/maddie/nixos/dmenu.nix b/maddie/nixos/dmenu.nix new file mode 100644 index 0000000..7b06b42 --- /dev/null +++ b/maddie/nixos/dmenu.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + dmenu + ]; + + home.file.".local/bin/dmenu" = { + source = ./dmenu; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/dmenu" + ]; +} diff --git a/maddie/nixos/dmenu/dmenu-bluetooth b/maddie/nixos/dmenu/dmenu-bluetooth new file mode 100755 index 0000000..0eb5a07 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-bluetooth @@ -0,0 +1,317 @@ +#!/bin/sh +# _ _ _ _ _ _ +# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__ +# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \ +# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | | +# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_| +# +# Author: Nick Clyde (clydedroid) +# dmenu support by: Layerex +# +# A script that generates a dmenu menu that uses bluetoothctl to +# connect to bluetooth devices and display status info. +# +# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu) +# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl) +# +# Depends on: +# Arch repositories: dmenu, bluez-utils (contains bluetoothctl) + +# Constants +divider="---------" +goback="Back" + +# Checks if bluetooth controller is powered on +power_on() { + if bluetoothctl show | grep -F -q "Powered: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles power state +toggle_power() { + if power_on; then + bluetoothctl power off + show_menu + else + if rfkill list bluetooth | grep -F -q 'blocked: yes'; then + rfkill unblock bluetooth && sleep 3 + fi + bluetoothctl power on + show_menu + fi +} + +# Checks if controller is scanning for new devices +scan_on() { + if bluetoothctl show | grep -F -q "Discovering: yes"; then + echo "Scan: on" + return 0 + else + echo "Scan: off" + return 1 + fi +} + +# Toggles scanning state +toggle_scan() { + if scan_on; then + kill "$(pgrep -F -f "bluetoothctl scan on")" + bluetoothctl scan off + show_menu + else + bluetoothctl scan on & + echo "Scanning..." + sleep 5 + show_menu + fi +} + +# Checks if controller is able to pair to devices +pairable_on() { + if bluetoothctl show | grep -F -q "Pairable: yes"; then + echo "Pairable: on" + return 0 + else + echo "Pairable: off" + return 1 + fi +} + +# Toggles pairable state +toggle_pairable() { + if pairable_on; then + bluetoothctl pairable off + show_menu + else + bluetoothctl pairable on + show_menu + fi +} + +# Checks if controller is discoverable by other devices +discoverable_on() { + if bluetoothctl show | grep -F -q "Discoverable: yes"; then + echo "Discoverable: on" + return 0 + else + echo "Discoverable: off" + return 1 + fi +} + +# Toggles discoverable state +toggle_discoverable() { + if discoverable_on; then + bluetoothctl discoverable off + show_menu + else + bluetoothctl discoverable on + show_menu + fi +} + +# Checks if a device is connected +device_connected() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Connected: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles device connection +toggle_connection() { + if device_connected "$1"; then + bluetoothctl disconnect "$1" + # device_menu "$device" + else + bluetoothctl connect "$1" + # device_menu "$device" + fi +} + +# Checks if a device is paired +device_paired() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Paired: yes"; then + echo "Paired: yes" + return 0 + else + echo "Paired: no" + return 1 + fi +} + +# Toggles device paired state +toggle_paired() { + if device_paired "$1"; then + bluetoothctl remove "$1" + device_menu "$device" + else + bluetoothctl pair "$1" + device_menu "$device" + fi +} + +# Checks if a device is trusted +device_trusted() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Trusted: yes"; then + echo "Trusted: yes" + return 0 + else + echo "Trusted: no" + return 1 + fi +} + +# Toggles device connection +toggle_trust() { + if device_trusted "$1"; then + bluetoothctl untrust "$1" + device_menu "$device" + else + bluetoothctl trust "$1" + device_menu "$device" + fi +} + +# Prints a short string with the current bluetooth status +# Useful for status bars like polybar, etc. +print_status() { + if power_on; then + printf '' + + mapfile -t paired_devices < <(bluetoothctl paired-devices | grep -F Device | cut -d ' ' -f 2) + counter=0 + + for device in "${paired_devices[@]}"; do + if device_connected "$device"; then + device_alias="$(bluetoothctl info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)" + + if [ $counter -gt 0 ]; then + printf ", %s" "$device_alias" + else + printf " %s" "$device_alias" + fi + + ((counter++)) + fi + done + printf "\n" + else + echo "" + fi +} + +# A submenu for a specific device that allows connecting, pairing, and trusting +device_menu() { + device=$1 + + # Get device name and mac address + device_name="$(echo "$device" | cut -d ' ' -f 3-)" + mac="$(echo "$device" | cut -d ' ' -f 2)" + + # Build options + if device_connected "$mac"; then + connected="Connected: yes" + else + connected="Connected: no" + fi + paired=$(device_paired "$mac") + trusted=$(device_trusted "$mac") + options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit" + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "$device_name")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$connected") + toggle_connection "$mac" + ;; + "$paired") + toggle_paired "$mac" + ;; + "$trusted") + toggle_trust "$mac" + ;; + "$goback") + show_menu + ;; + esac +} + +# Opens a dmenu menu with current bluetooth status and options to connect +show_menu() { + # Get menu options + if power_on; then + power="Power: on" + + # Human-readable names of devices, one per line + # If scan is off, will only list paired devices + devices=$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-) + + # Get controller flags + scan=$(scan_on) + pairable=$(pairable_on) + discoverable=$(discoverable_on) + + # Options passed to dmenu + options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit" + else + power="Power: off" + options="$power\nExit" + fi + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "Bluetooth")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$power") + toggle_power + ;; + "$scan") + toggle_scan + ;; + "$discoverable") + toggle_discoverable + ;; + "$pairable") + toggle_pairable + ;; + *) + device=$(bluetoothctl devices | grep -F "$chosen") + # Open a submenu if a device is selected + if [[ $device ]]; then device_menu "$device"; fi + ;; + esac +} + +original_args=("$@") + +# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This +# allows the user to set fonts, sizes, colours, etc. +run_dmenu() { + dmenu "${original_args[@]}" -i -p "$1" +} + +case "$1" in + --status) + print_status + ;; + *) + show_menu + ;; +esac diff --git a/maddie/nixos/dmenu/dmenu-code b/maddie/nixos/dmenu/dmenu-code new file mode 100755 index 0000000..7636af2 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-code @@ -0,0 +1,3 @@ +#!/bin/sh + +st -e 'zsh' -c 'cd ~/Documents/Code/"$(exa -lh --icons ~/Documents/Code | tail -n +2 | dmenu -l 30 | sed "s|.* ||")"; zsh' diff --git a/maddie/nixos/dmenu/dmenu-kdeconnect b/maddie/nixos/dmenu/dmenu-kdeconnect new file mode 100755 index 0000000..092b7e5 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-kdeconnect @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +NOTIFICATIONS_TITLE="KDE Connect" +NOTIFICATIONS_EXPIRE_TIME=1000 +notify-send "$NOTIFICATIONS_TITLE" "Getting devices..." --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + +# Get available devices +devices="$(kdeconnect-cli -a)" +[ -z "$devices" ] && notify-send "$NOTIFICATIONS_TITLE" "No devices available" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + +# Let the user choose a device +device="$(echo "$devices" | sed 's/-\ //' | sed 's/:.*//' | dmenu -i -p "Devices:")" + +if [ $? -eq 0 ] +then + # Send files to a device + 📂File() { + file="$(zenity --file-selection)" + kdeconnect-cli -n "$device" --share "$file" + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Shared file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Failed to share file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Ping a device + 📳Ping() { + kdeconnect-cli -n "$device" --ping + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Pinged device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Unable to ping device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Make a device ring + ☎️Ring() { + kdeconnect-cli -n "$device" --ring + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Ringed device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Unable to ring device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Show functions in dmenu and run the chosen function + func="$(declare -F | awk '{print $3}' | dmenu -i -p "$device":)" + [ -z "$func" ] || "$func" +fi diff --git a/maddie/nixos/dmenu/dmenu-man b/maddie/nixos/dmenu/dmenu-man new file mode 100755 index 0000000..33b3060 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-man @@ -0,0 +1,2 @@ +#!/bin/sh +man -t $(man -k . | dmenu -l 30 | awk '{print $1}') | ps2pdf - - | zathura - diff --git a/maddie/nixos/dmenu/dmenu-mount b/maddie/nixos/dmenu/dmenu-mount new file mode 100755 index 0000000..3cb1f81 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-mount @@ -0,0 +1,67 @@ +#!/bin/sh + +# Gives a dmenu prompt to mount unmounted drives and Android phones. If +# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll +# be prompted to give a mountpoint from already existsing directories. If you +# input a novel directory, it will prompt you to create that directory. + +getmount() { \ + [ -z "$chosen" ] && exit 1 + # shellcheck disable=SC2086 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 + test -z "$mp" && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; + esac + notify-send "💻 USB mounting" "$chosen mounted to $mp." + } + +mountandroid() { \ + chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 + chosen="$(echo "$chosen" | cut -d : -f 1)" + getmount "$HOME -maxdepth 3 -type d" + simple-mtpfs --device "$chosen" "$mp" + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 + simple-mtpfs --device "$chosen" "$mp" + notify-send "🤖 Android Mounting" "Android device mounted to $mp." + } + +asktype() { \ + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 + case $choice in + USB) mountusb ;; + Android) mountandroid ;; + esac + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" + +if [ -z "$usbdrives" ]; then + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/maddie/nixos/dmenu/dmenu-mpc b/maddie/nixos/dmenu/dmenu-mpc new file mode 100755 index 0000000..5b7b3e9 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-mpc @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +playing=$(mpc current) +[ -z "$playing" ] && playing="Stopped" + +▶️play() { mpc play ;} +⏸️pause() { mpc pause ;} +⏭️next() { mpc next ;} +⏮️prev() { mpc prev ;} +⏹️stop() { mpc stop ;} +🔄update() { mpc update ;} + +func="$(declare -F | awk '{print $3}' | dmenu -i -p "$playing":)" +[ -z "$func" ] || "$func" diff --git a/maddie/nixos/dmenu/dmenu-pass b/maddie/nixos/dmenu/dmenu-pass new file mode 100755 index 0000000..76d92ab --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-pass @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu=dmenu-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +fi diff --git a/maddie/nixos/dmenu/dmenu-power b/maddie/nixos/dmenu/dmenu-power new file mode 100755 index 0000000..64e3bdf --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-power @@ -0,0 +1,9 @@ +#!/bin/sh + +poweroff() { systemctl shutdown ;} +restart() { killall -HUP dwm ;} +reboot() { system reboot ;} +lock() { bosskey ;} + +func="$(declare -F | awk '{print $3}' | dmenu -i -p "Power:")" +[ -z "$func" ] || "$func" diff --git a/maddie/nixos/dmenu/dmenu-unicode b/maddie/nixos/dmenu/dmenu-unicode new file mode 100755 index 0000000..18ee0a5 --- /dev/null +++ b/maddie/nixos/dmenu/dmenu-unicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/emoji-list | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/maddie/nixos/drawterm.nix b/maddie/nixos/drawterm.nix new file mode 100644 index 0000000..16ca2db --- /dev/null +++ b/maddie/nixos/drawterm.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + drawterm + ]; +} diff --git a/maddie/nixos/dunst.nix b/maddie/nixos/dunst.nix new file mode 100644 index 0000000..05198be --- /dev/null +++ b/maddie/nixos/dunst.nix @@ -0,0 +1,44 @@ +{ config, pkgs, ... }: + +{ + services.dunst = { + enable = true; + settings = { + global = { + # Style + format = "%s\n%b"; + font = "Iosevka 10"; + width = 370; + height = 370; + offset = "0x50"; + padding = 5; + frame_width = 2; + + # Location + monitor = 0; + origin = "bottom-center"; + }; + + urgency_low = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#2C323D"; + timeout = 3; + }; + + urgency_normal = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#2C323D"; + timeout = 5; + }; + + urgency_critical = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#E06C75"; + timeout = 10; + }; + }; + }; +} diff --git a/maddie/nixos/dwm.nix b/maddie/nixos/dwm.nix new file mode 100644 index 0000000..305b7cf --- /dev/null +++ b/maddie/nixos/dwm.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + dwm # Suckless dynamic window manager + ]; +} diff --git a/maddie/nixos/files.nix b/maddie/nixos/files.nix new file mode 100644 index 0000000..cff192e --- /dev/null +++ b/maddie/nixos/files.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + ncdu_2 # Disk space manager + clifm # TUI file manager + ]; +} diff --git a/maddie/nixos/games.nix b/maddie/nixos/games.nix new file mode 100644 index 0000000..a5f6f14 --- /dev/null +++ b/maddie/nixos/games.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + gzdoom # Modern doom runner + pcsx2 # PS2 Emulator + ]; +} diff --git a/maddie/nixos/gcolor2.nix b/maddie/nixos/gcolor2.nix new file mode 100644 index 0000000..e6f1cb5 --- /dev/null +++ b/maddie/nixos/gcolor2.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + gcolor2 # Color viewer and eyedropper + ]; +} diff --git a/maddie/nixos/gtk.nix b/maddie/nixos/gtk.nix new file mode 100644 index 0000000..3b68a35 --- /dev/null +++ b/maddie/nixos/gtk.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + gtk = { + enable = true; + font = { + package = pkgs.iosevka; + name = "Iosevka"; + size = 10; + }; + theme = { + package = pkgs.lounge-gtk-theme; + name = "Lounge-night-compact"; + }; + iconTheme = { + package = pkgs.whitesur-icon-theme; + name = "WhiteSur-dark"; + }; + }; + + home.packages = with pkgs; [ + gnome.zenity + libsForQt5.breeze-gtk + ]; +} diff --git a/maddie/nixos/home.nix b/maddie/nixos/home.nix new file mode 100644 index 0000000..c70266e --- /dev/null +++ b/maddie/nixos/home.nix @@ -0,0 +1,10 @@ +{ config, username, ... }: + +{ + programs.home-manager.enable = true; + home = { + inherit username; + homeDirectory = "/home/${username}"; + stateVersion = "22.11"; + }; +} diff --git a/maddie/nixos/jetbrains.nix b/maddie/nixos/jetbrains.nix new file mode 100644 index 0000000..00ba844 --- /dev/null +++ b/maddie/nixos/jetbrains.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + jetbrains.clion + jetbrains.goland + jetbrains.webstorm + jetbrains.datagrip + jetbrains.rust-rover + jetbrains.pycharm-professional + ]; +} diff --git a/maddie/nixos/kdeconnect.nix b/maddie/nixos/kdeconnect.nix new file mode 100644 index 0000000..32be6dc --- /dev/null +++ b/maddie/nixos/kdeconnect.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + services.kdeconnect.enable = true; + + home.file.".xprofile".text = '' + # Start kdeconnect when entering a graphical session + systemctl restart --user kdeconnect.service & + ''; +} diff --git a/maddie/nixos/librewolf.nix b/maddie/nixos/librewolf.nix new file mode 100644 index 0000000..b38aaed --- /dev/null +++ b/maddie/nixos/librewolf.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + programs.librewolf = { + enable = true; + settings = { + "browser.uidensity" = 1; + "webgl.disabled" = false; + "privacy.resistFingerprinting" = true; + }; + }; +} diff --git a/maddie/nixos/messaging.nix b/maddie/nixos/messaging.nix new file mode 100644 index 0000000..0a97090 --- /dev/null +++ b/maddie/nixos/messaging.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + schildichat-desktop # Matrix client, fork of element + signal-desktop # Signal client + cinny-desktop # Pretty matrix client + discord-canary # Discord client + ripcord # Better discord client + nheko # Better matrix client + ]; +} diff --git a/maddie/nixos/minecraft.nix b/maddie/nixos/minecraft.nix new file mode 100644 index 0000000..8614dd9 --- /dev/null +++ b/maddie/nixos/minecraft.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + prismlauncher # Minecraft launcher + minecraft # Actual minecraft + /*jdk # Needed for running minecraft servers */ + ]; +} diff --git a/maddie/nixos/mpd.nix b/maddie/nixos/mpd.nix new file mode 100644 index 0000000..03e84c5 --- /dev/null +++ b/maddie/nixos/mpd.nix @@ -0,0 +1,41 @@ +{ config, pkgs, username, ... }: + +{ + services.mpd = { + enable = true; + musicDirectory = "${config.home.homeDirectory}/Music"; + extraConfig = '' + auto_update "yes" + + audio_output { + type "pipewire" + name "PipeWire Sound Server" + } + + audio_output { + type "fifo" + name "Visualizer feed" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; + + services.mpdris2 = { + enable = true; + multimediaKeys = true; + notifications = true; + }; + + home.packages = with pkgs; [ + mpc_cli + ]; + + programs.ncmpcpp = { + enable = true; + settings = { + ncmpcpp_directory = "${config.home.homeDirectory}/.local/share/ncmpcpp"; + lyrics_directory = "${config.home.homeDirectory}/.local/share/lyrics"; + }; + }; +} diff --git a/maddie/nixos/mpv.nix b/maddie/nixos/mpv.nix new file mode 100644 index 0000000..9841efd --- /dev/null +++ b/maddie/nixos/mpv.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + programs.mpv = { + enable = true; + config = { + loop-file = "inf"; + }; + }; +} diff --git a/maddie/nixos/neovide.nix b/maddie/nixos/neovide.nix new file mode 100644 index 0000000..e8e0759 --- /dev/null +++ b/maddie/nixos/neovide.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + neovide + ]; +} diff --git a/maddie/nixos/nsxiv.nix b/maddie/nixos/nsxiv.nix new file mode 100644 index 0000000..8b538c9 --- /dev/null +++ b/maddie/nixos/nsxiv.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + nsxiv + ]; + xdg.configFile."nsxiv" = { + source = ./nsxiv; + }; + xresources.properties = { + "Nsxiv.window.foreground" = "#D6DEEB"; + "Nsxiv.window.background" = "#1E2127"; + "Nsxiv.bar.background" = "#2C323D"; + "Nsxiv.bar.foreground" = "#D6DEEB"; + }; +} diff --git a/maddie/nixos/nsxiv/exec/key-handler b/maddie/nixos/nsxiv/exec/key-handler new file mode 100755 index 0000000..70c7593 --- /dev/null +++ b/maddie/nixos/nsxiv/exec/key-handler @@ -0,0 +1,14 @@ +#!/bin/sh +while read file +do + case "$1" in + "d") + rm -rf $file ;; + "r") + convert -rotate 90 "$file" "$file" ;; + "y") + echo -n "$file" | xclip -selection clipboard ;; + "w") + xwallpaper --zoom "$file" && kill $(pidof nsxiv);; + esac +done diff --git a/maddie/nixos/obs-studio.nix b/maddie/nixos/obs-studio.nix new file mode 100644 index 0000000..07f8a87 --- /dev/null +++ b/maddie/nixos/obs-studio.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.obs-studio.enable = true; +} diff --git a/maddie/nixos/office.nix b/maddie/nixos/office.nix new file mode 100644 index 0000000..892c7b1 --- /dev/null +++ b/maddie/nixos/office.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + texlive.combined.scheme-full # LaTeX + libreoffice # Documents suite + thunderbird # Email client + obsidian # Notes app + sc-im # TUI spreadsheet + anki # Flashcard app + ]; +} diff --git a/maddie/nixos/openrgb.nix b/maddie/nixos/openrgb.nix new file mode 100644 index 0000000..b783e0d --- /dev/null +++ b/maddie/nixos/openrgb.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + openrgb-with-all-plugins + ]; + + home.file.".xprofile".text = '' + # Set RGB perhipherals to white + ${pkgs.openrgb}/bin/openrgb -c white -m static & + + # Set Razer Chroma HDK to white + ${pkgs.openrgb}/bin/openrgb --device 1 -c white & + + # Start my razer keyboard script + ${pkgs.python3Full}/bin/python ${config.home.homeDirectory}/Documents/Code/Razer/system.py & + ''; +} diff --git a/maddie/nixos/osu.nix b/maddie/nixos/osu.nix new file mode 100644 index 0000000..f7fedd5 --- /dev/null +++ b/maddie/nixos/osu.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + osu-lazer-bin + ]; +} diff --git a/maddie/nixos/pcmanfm.nix b/maddie/nixos/pcmanfm.nix new file mode 100644 index 0000000..e235e38 --- /dev/null +++ b/maddie/nixos/pcmanfm.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pcmanfm + ]; + + xdg.configFile."pcmanfm" = { + source = ./pcmanfm; + }; +} diff --git a/maddie/nixos/pcmanfm/default/pcmanfm.conf b/maddie/nixos/pcmanfm/default/pcmanfm.conf new file mode 100644 index 0000000..79dfed0 --- /dev/null +++ b/maddie/nixos/pcmanfm/default/pcmanfm.conf @@ -0,0 +1,26 @@ +[config] +bm_open_method=0 + +[volume] +mount_on_startup=1 +mount_removable=1 +autorun=1 + +[ui] +always_show_tabs=0 +max_tab_chars=32 +win_width=1000 +win_height=696 +splitter_pos=189 +media_in_new_tab=0 +desktop_folder_new_win=0 +change_tab_on_drop=1 +close_on_unmount=1 +focus_previous=0 +side_pane_mode=places +view_mode=list +show_hidden=0 +sort=name;descending; +toolbar=newtab;navigation;home; +show_statusbar=1 +pathbar_mode_buttons=0 diff --git a/maddie/nixos/picom.nix b/maddie/nixos/picom.nix new file mode 100644 index 0000000..7f99365 --- /dev/null +++ b/maddie/nixos/picom.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + home.file.".xprofile".text = '' + # Import xorg environment into systemd for the picom service to work + systemctl --user import-environment XAUTHORITY DISPLAY & + + # Restart picom after importing the xorg environment + systemctl --user restart picom & + ''; + services.picom = { + enable = true; + fade = true; + fadeSteps = [ + 0.1 + 0.1 + ]; + opacityRules = [ + "90:class_g = 'st-256color'" + "90:class_g = 'tabbed-trans'" + ]; + shadow = true; + vSync = true; + }; +} diff --git a/maddie/nixos/popcorntime.nix b/maddie/nixos/popcorntime.nix new file mode 100644 index 0000000..2bac960 --- /dev/null +++ b/maddie/nixos/popcorntime.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + popcorntime + ]; +} diff --git a/maddie/nixos/qt.nix b/maddie/nixos/qt.nix new file mode 100644 index 0000000..4c695f2 --- /dev/null +++ b/maddie/nixos/qt.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: + +{ + home.packages = with pkgs; [ + libsForQt5.breeze-qt5 + ]; + + qt = { + enable = true; + style = { + package = pkgs.libsForQt5.breeze-qt5; + name = "Breeze"; + }; + }; + + home.sessionVariables = { + QT_STYLE_OVERRIDE = "Breeze"; + }; +} diff --git a/maddie/nixos/screenshot.nix b/maddie/nixos/screenshot.nix new file mode 100644 index 0000000..31e3134 --- /dev/null +++ b/maddie/nixos/screenshot.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tesseract5 # Gets text from images + maim # X11 screenshot tool + ]; + + home.file.".local/bin/sss" = { + source = ./screenshot/sss.sh; + executable = true; + }; +} diff --git a/maddie/nixos/screenshot/sss.sh b/maddie/nixos/screenshot/sss.sh new file mode 100755 index 0000000..efe43ee --- /dev/null +++ b/maddie/nixos/screenshot/sss.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env sh + +# Configuration variables +SST_PIC_DIR="$HOME/Pictures/Screenshots" + +while getopts "sctd:" options; do + case $options in + s) + echo "sswm: save mode" + name=$(date --iso-8601=minutes) + maim -s -u -f png > $SST_PIC_DIR/$name.png + echo "sswm: imaged saved as $SST_PIC_DIR/$name.png" + ;; + c) + echo "sswm: copy mode" + maim -s -u -f png | xclip -selection clipboard -t image/png + echo "sswm: image copied to clipboard" + ;; + t) + echo "sswm: text mode" + maim -s -u -f png "$IMAGE" + [ $? -ne 0 ] && exit 1 + + tesseract "$IMAGE" "${TEXT//\.txt/}" 2> /dev/null + sed -i 's/\x0c//' "$TEXT" + + if [ $(wc -l < $TEXT) -eq 0 ]; then + echo "sswm: no text detected" + else + truncate -s -1 $TEXT + xclip -selection clipboard < "$TEXT" + echo "sswm: text copied to clipboard" + fi + ;; + d) + echo "sswm: delay "$OPTARG"s..." + sleep $OPTARG + ;; + esac +done diff --git a/maddie/nixos/secrets.nix b/maddie/nixos/secrets.nix new file mode 100644 index 0000000..fced800 --- /dev/null +++ b/maddie/nixos/secrets.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + services.pass-secret-service = { + enable = true; + storePath = "${config.xdg.dataHome}/password-store"; + }; + + home.file.".xprofile".text = '' + # Restart pass-secret-service as it tends to start failed + systemctl restart --user pass-secret-service.service & + ''; +} diff --git a/maddie/nixos/slstatus.nix b/maddie/nixos/slstatus.nix new file mode 100644 index 0000000..a5e9af4 --- /dev/null +++ b/maddie/nixos/slstatus.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + slstatus + ]; + + home.file.".xprofile".text = '' + # Start slstatus + ${pkgs.slstatus}/bin/slstatus & + ''; + + home.file.".local/bin/statusbar" = { + source = ./statusbar; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/statusbar" + ]; +} diff --git a/maddie/nixos/statusbar/sb-clock b/maddie/nixos/statusbar/sb-clock new file mode 100755 index 0000000..d39f8db --- /dev/null +++ b/maddie/nixos/statusbar/sb-clock @@ -0,0 +1,3 @@ +#!/bin/sh + +echo " $(date "+%a %d %b")  $(date "+%I:%M:%S%p")" diff --git a/maddie/nixos/statusbar/sb-cpu b/maddie/nixos/statusbar/sb-cpu new file mode 100755 index 0000000..0e63fbb --- /dev/null +++ b/maddie/nixos/statusbar/sb-cpu @@ -0,0 +1,6 @@ +#!/bin/sh + +cpu=$(top -b -n2 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f\n", prefix, 100 - v }' | awk '{print int($0)}') +icon="" + +echo "$icon $cpu%" diff --git a/maddie/nixos/statusbar/sb-disk b/maddie/nixos/statusbar/sb-disk new file mode 100755 index 0000000..9ae903d --- /dev/null +++ b/maddie/nixos/statusbar/sb-disk @@ -0,0 +1,7 @@ +#!/bin/sh + +disk=$(df -h "/" | awk ' /[0-9]/ {print $3 "/" $2}') +percent=$(df -h "/" | egrep -o '[0-9]+%' | awk '{print int($0)}') +icon="" + +echo "$icon $disk" diff --git a/maddie/nixos/statusbar/sb-forecast b/maddie/nixos/statusbar/sb-forecast new file mode 100755 index 0000000..685be80 --- /dev/null +++ b/maddie/nixos/statusbar/sb-forecast @@ -0,0 +1,35 @@ +#!/bin/sh + +# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. + +# If we have internet, get a weather report from wttr.in and store it locally. +# You could set up a shell alias to view the full file in a pager in the +# terminal if desired. This function will only be run once a day when needed. +weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} + +# Some very particular and terse stream manipulation. We get the maximum +# precipitation chance and the daily high and low from the downloaded file and +# display them with coresponding emojis. +showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | + grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} + +case BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; + 2) getforecast && showweather ;; + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +☔: Chance of rain/snow +🥶: Daily low +🌞: Daily high" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# The test if our forcecast is updated to the day. If it isn't download a new +# weather report from wttr.in with the above function. +[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforecast + +showweather diff --git a/maddie/nixos/statusbar/sb-iplocate b/maddie/nixos/statusbar/sb-iplocate new file mode 100755 index 0000000..02adab8 --- /dev/null +++ b/maddie/nixos/statusbar/sb-iplocate @@ -0,0 +1,10 @@ +#!/bin/sh + +# Gets your public ip address checks which country you are in and +# displays that information in the statusbar +# +# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ + +ifinstalled "geoip" || exit +addr="$(curl ifconfig.me 2>/dev/null)" || exit +grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/maddie/nixos/statusbar/sb-kernel b/maddie/nixos/statusbar/sb-kernel new file mode 100755 index 0000000..6619a05 --- /dev/null +++ b/maddie/nixos/statusbar/sb-kernel @@ -0,0 +1,5 @@ +#!/bin/sh + +kernel=$(uname -r) +icon="" +echo "$icon $kernel" diff --git a/maddie/nixos/statusbar/sb-memory b/maddie/nixos/statusbar/sb-memory new file mode 100755 index 0000000..2ff0c4e --- /dev/null +++ b/maddie/nixos/statusbar/sb-memory @@ -0,0 +1,7 @@ +#!/bin/sh + +mem=$(free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.2f/%2.2f", ( $3 / 1024), ($2 / 1024))}') +percent=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }' | awk '{print int($0)}') +icon="" + +echo "$icon $mem""GB" diff --git a/maddie/nixos/statusbar/sb-temp b/maddie/nixos/statusbar/sb-temp new file mode 100755 index 0000000..bbbd63d --- /dev/null +++ b/maddie/nixos/statusbar/sb-temp @@ -0,0 +1,13 @@ +#!/bin/sh + +temp=$(sensors | awk '/Core 0/ {print $3}' | awk '{print int($0)}') + +if [ $temp -ge 70 ]; then + icon="" +elif [ $temp -ge 50 ]; then + icon="" +elif [ $temp -ge 0 ]; then + icon="" +fi + +echo "$icon $temp°C" diff --git a/maddie/nixos/statusbar/sb-uptime b/maddie/nixos/statusbar/sb-uptime new file mode 100755 index 0000000..28046d5 --- /dev/null +++ b/maddie/nixos/statusbar/sb-uptime @@ -0,0 +1,6 @@ +#!/bin/sh + +uptime=$(uptime | awk '{print $3}' | sed 's/,//') +icon="" + +echo "$icon $uptime" diff --git a/maddie/nixos/statusbar/sb-volume b/maddie/nixos/statusbar/sb-volume new file mode 100755 index 0000000..f75b83d --- /dev/null +++ b/maddie/nixos/statusbar/sb-volume @@ -0,0 +1,15 @@ +#!/bin/sh + +vol="$(pamixer --get-volume)" + +if [ $(pamixer --get-mute) = true ]; then + icon="" +elif [ "$vol" -ge "50" ]; then + icon="" +elif [ "$vol" -gt "0" ]; then + icon="" +elif [ "$vol" -eq "0" ]; then + icon="" +fi + +echo "$icon $vol%" diff --git a/maddie/nixos/steam.nix b/maddie/nixos/steam.nix new file mode 100644 index 0000000..0594128 --- /dev/null +++ b/maddie/nixos/steam.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + steam + steam-run + ]; + + home.file.".local/bin/steam-killer" = { + source = ./steam/steam-killer.sh; + executable = true; + }; +} diff --git a/maddie/nixos/steam/steam-killer.sh b/maddie/nixos/steam/steam-killer.sh new file mode 100755 index 0000000..93b501b --- /dev/null +++ b/maddie/nixos/steam/steam-killer.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +while true +do + echo "[sk] killing steamwebhelper" + { kill $(pidof steamwebhelper) && echo "[fhs] killed!"; } || echo "[fhs] failed!" + echo "[sk] waiting 0.5 seconds..." + sleep 0.5 +done diff --git a/maddie/nixos/syncplay.nix b/maddie/nixos/syncplay.nix new file mode 100644 index 0000000..9d89535 --- /dev/null +++ b/maddie/nixos/syncplay.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + #syncplay + ]; +} diff --git a/maddie/nixos/tabbed.nix b/maddie/nixos/tabbed.nix new file mode 100644 index 0000000..fc0f1fc --- /dev/null +++ b/maddie/nixos/tabbed.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tabbed + ]; + + home.file.".local/bin/tabbed" = { + source = ./tabbed; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/tabbed" + ]; +} diff --git a/maddie/nixos/tabbed/tabbed-st b/maddie/nixos/tabbed/tabbed-st new file mode 100755 index 0000000..0a751c8 --- /dev/null +++ b/maddie/nixos/tabbed/tabbed-st @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +picom-trans -w $(tabbed $@ -d -n "tabbed-trans" -r 2 st -w '') -o 90 diff --git a/maddie/nixos/terminal.nix b/maddie/nixos/terminal.nix new file mode 100644 index 0000000..aaa4690 --- /dev/null +++ b/maddie/nixos/terminal.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + cool-retro-term # Retro-style terminal + kitty # Used for testing + st # Suckless terminal + ]; +} diff --git a/maddie/nixos/tor.nix b/maddie/nixos/tor.nix new file mode 100644 index 0000000..e2a7d4c --- /dev/null +++ b/maddie/nixos/tor.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tor-browser-bundle-bin + ]; +} diff --git a/maddie/nixos/uxplay.nix b/maddie/nixos/uxplay.nix new file mode 100644 index 0000000..4c7e6f9 --- /dev/null +++ b/maddie/nixos/uxplay.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + uxplay + ]; +} diff --git a/maddie/nixos/virtualisation.nix b/maddie/nixos/virtualisation.nix new file mode 100644 index 0000000..68b90f2 --- /dev/null +++ b/maddie/nixos/virtualisation.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + virt-manager # Manages QEMU virtual machines + bottles # GTK interface for wine + wine # Windows emulation + ]; +} diff --git a/maddie/nixos/wezterm.nix b/maddie/nixos/wezterm.nix new file mode 100644 index 0000000..fcb9406 --- /dev/null +++ b/maddie/nixos/wezterm.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + programs.wezterm = { + enable = true; + extraConfig = '' + return { + color_scheme = 'OneDark (base16)', + hide_tab_bar_if_only_one_tab = true, + window_close_confirmation = 'NeverPrompt' + } + ''; + }; +} diff --git a/maddie/nixos/xdg.nix b/maddie/nixos/xdg.nix new file mode 100644 index 0000000..500e533 --- /dev/null +++ b/maddie/nixos/xdg.nix @@ -0,0 +1,59 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + xdg-utils + xdg-user-dirs + ]; + + xdg = { + enable = true; + userDirs.enable = true; + desktopEntries = { + "browser" = { + name = "Web Browser"; + type = "Application"; + exec = "${pkgs.librewolf}/bin/librewolf %f"; + }; + "image" = { + name = "Image Viewer"; + type = "Application"; + exec = "${pkgs.nsxiv}/bin/nsxiv -a %f"; + }; + "text" = { + name = "Text Editor"; + type = "Application"; + exec = "${pkgs.st}/bin/st -e ${pkgs.neovim}/bin/nvim %u"; + }; + "pdf" = { + name = "PDF Reader"; + type = "Application"; + exec = "${pkgs.zathura}/bin/zathura %u"; + }; + }; + mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = "pdf.desktop"; + "x-scheme-handler/http" = "browser.desktop"; + "x-scheme-handler/https" = "browser.desktop"; + "image/png" = "image.desktop"; + "image/jpeg" = "image.desktop"; + "image/jpg" = "image.desktop"; + "image/gif" = "image.desktop"; + "video/mp4" = "mpv.desktop"; + "text/plain" = "text.desktop"; + "text/html" = "browser.desktop"; + }; + }; + }; + + home = { + sessionVariables = { + # Default programs + EDITOR = "nvim"; + TERMINAL = "st"; + BROWSER = "librewolf"; + }; + }; +} diff --git a/maddie/nixos/xorg.nix b/maddie/nixos/xorg.nix new file mode 100644 index 0000000..7035e6e --- /dev/null +++ b/maddie/nixos/xorg.nix @@ -0,0 +1,68 @@ +{ config, pkgs, ... }: + +{ + # Run startx on tty1 + /* programs.zsh.profileExtra = '' + # If on /dev/tty1 then run startx automatically + if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + sleep 2 + exec ${pkgs.xorg.xinit}/bin/startx + fi + ''; */ + + # Attempt to set keyboard layout + home.keyboard = { + layout = "gb"; + options = [ + "caps:escape" + ]; + }; + + # Attempt to set cursor + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + package = pkgs.apple-cursor; + name = "macOS-BigSur"; + size = 24; + }; + + # Force use of XDG Dir Spec + home.sessionVariables = { + /* XAUTHORITY = "${config.xdg.runtimeDir}/Xauthority"; */ + XCOMPOSECACHE = "${config.xdg.cacheHome}/x11/xcompose"; + }; + + # Install notify-send + home.packages = with pkgs; [ + libnotify + ]; + + # Set global font + xresources.properties = { + "*.font" = "Iosevka:pixelsize=12:antialias=true:autohint=true"; + }; + + # Configure ~/.xprofile + programs.feh.enable = true; + home.file.".xprofile".text = '' + # Monitor configuration + # ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --noprimary --mode 2560x1440 --pos 2560x0 --rotate right + # ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --primary --mode 2560x1440 --pos 0x560 + + # Apply wallpaper + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill "$HOME/Pictures/Wallpapers/NixOS/nix-wallpaper-waterfall.png" + + # Refresh xresources + ${pkgs.xorg.xrdb}/bin/xrdb "$HOME/.Xresources" + + # Speed up repeated keypresses + ${pkgs.xorg.xset}/bin/xset r rate 300 50 + + # Set keyboard map and remap caps to escape + ${pkgs.xorg.setxkbmap}/bin/setxkbmap -layout gb -option caps:escape + + # Start the window manager + ${pkgs.openssh}/bin/ssh-agent ${pkgs.dwm}/bin/dwm + ''; +} diff --git a/maddie/nixos/yubikey.nix b/maddie/nixos/yubikey.nix new file mode 100644 index 0000000..f898774 --- /dev/null +++ b/maddie/nixos/yubikey.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + yubioath-flutter + ]; +} diff --git a/maddie/nixos/zathura.nix b/maddie/nixos/zathura.nix new file mode 100644 index 0000000..6430428 --- /dev/null +++ b/maddie/nixos/zathura.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.zathura.enable = true; +} diff --git a/overlays.nix b/overlays.nix new file mode 100644 index 0000000..650b24c --- /dev/null +++ b/overlays.nix @@ -0,0 +1,68 @@ +[ + # My build of suckless dwm + (final: prev: { + dwm = prev.dwm.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "dwm"; + rev = "a06076bfb9324af6c4122d9cc5b0904778013350"; + sha256 = "sha256-KGqbff/i9fG0B/gMrdnwevRElL6r8lbYCloWp/NPx+0="; + }; + }); + st = prev.st.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "st"; + rev = "22e582e5acf6e4eb52c57df51f59f84bbb7d2f13"; + sha256 = "sha256-ko4be6N/igCMo28/as/AWKMYswm/jIH1ILeVoi2Gpx8="; + }; + buildInputs = oldAttrs.buildInputs ++ [ final.harfbuzz ]; + }); + dmenu = prev.dmenu.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "dmenu"; + rev = "1b12798a3762807697227e9e40be29408df59ee9"; + sha256 = "sha256-wnVNqNCUpJTqHXfst9DiBaq/gzVwhlq07VM9CixczRc="; + }; + }); + slstatus = prev.slstatus.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "slstatus"; + rev = "2546de2a4c5ab34d96fb31f75d3a8b7d6840005e"; + sha256 = "sha256-aoEd4GGA+jkoxvJlRlXqMiaxM8mZe4Jt5CtKKtnu+rQ="; + }; + }); + slock = prev.slock.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "slock"; + rev = "8c5d321b641961237f747d3e68f52b163d673634"; + sha256 = "sha256-y+6VU3jXbUOyhUcyPC7CDGjyWLSJcCkhYiHscVib7j4="; + }; + buildInputs = oldAttrs.buildInputs ++ [ final.xorg.libXpm ]; + }); + tabbed = prev.tabbed.overrideAttrs (oldAttrs: { + src = final.fetchFromGitea { + domain = "git.spyhoodle.me"; + owner = "maddie"; + repo = "tabbed"; + rev = "1001f193fd076cba12bd1ec9f113c144b37d8689"; + sha256 = "sha256-M5LrFplGfzCdhLTutsPNmox69brvAm2BlXnyza9kGxQ="; + }; + }); + ncmpcpp = prev.ncmpcpp.override { + visualizerSupport = true; + clockSupport = false; + }; + nerdfonts = prev.nerdfonts.override { + fonts = [ "Iosevka" "JetBrainsMono" "Terminus" ]; + }; + }) +] diff --git a/systems/mdesktop/android.nix b/systems/mdesktop/android.nix new file mode 100644 index 0000000..b9fd5f2 --- /dev/null +++ b/systems/mdesktop/android.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.adb.enable = true; +} diff --git a/systems/mdesktop/audio.nix b/systems/mdesktop/audio.nix new file mode 100644 index 0000000..329fa97 --- /dev/null +++ b/systems/mdesktop/audio.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/systems/mdesktop/avahi.nix b/systems/mdesktop/avahi.nix new file mode 100644 index 0000000..f28d394 --- /dev/null +++ b/systems/mdesktop/avahi.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + services.avahi = { + enable = true; + nssmdns = true; + publish = { + enable = true; + addresses = true; + workstation = true; + userServices = true; + }; + }; +} diff --git a/systems/mdesktop/bluetooth.nix b/systems/mdesktop/bluetooth.nix new file mode 100644 index 0000000..fae0e1d --- /dev/null +++ b/systems/mdesktop/bluetooth.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + hardware.bluetooth.enable = true; + services.blueman.enable = true; +} diff --git a/systems/mdesktop/boot.nix b/systems/mdesktop/boot.nix new file mode 100644 index 0000000..96a141a --- /dev/null +++ b/systems/mdesktop/boot.nix @@ -0,0 +1,37 @@ +{ config, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # Setup bootloader + boot.loader.systemd-boot = { + enable = true; + consoleMode = "max"; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.initrd.systemd.enable = true; + + # Setup crypto keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + # Enable LUKS boot devices + boot.initrd.luks.devices."luks-c180a121-376a-432e-a661-f4be3cc23dfa".device = "/dev/disk/by-uuid/c180a121-376a-432e-a661-f4be3cc23dfa"; + boot.initrd.luks.devices."luks-16dda63d-9dce-4ef2-9da6-ee458ba3c44c".device = "/dev/disk/by-uuid/16dda63d-9dce-4ef2-9da6-ee458ba3c44c"; + boot.initrd.luks.devices."luks-c180a121-376a-432e-a661-f4be3cc23dfa".keyFile = "/crypto_keyfile.bin"; + + # Kernel settings + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.kernelParams = [ "video=2560x1440@180" ]; + boot.extraModulePackages = [ ]; + + # Use the linux-zen kernel + boot.kernelPackages = pkgs.linuxPackages_zen; +} diff --git a/systems/mdesktop/cpu.nix b/systems/mdesktop/cpu.nix new file mode 100644 index 0000000..dcb9255 --- /dev/null +++ b/systems/mdesktop/cpu.nix @@ -0,0 +1,6 @@ +{ config, lib, ... }: + +{ + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/mdesktop/disks.nix b/systems/mdesktop/disks.nix new file mode 100644 index 0000000..b78af9a --- /dev/null +++ b/systems/mdesktop/disks.nix @@ -0,0 +1,24 @@ +{ config, ... }: + +{ + fileSystems."/" = + { + device = "/dev/disk/by-uuid/0eecf0db-00f9-48db-9d62-0ade3f3edd90"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = + { + device = "/dev/disk/by-uuid/0042-9914"; + fsType = "vfat"; + }; + + fileSystems."/mnt/data" = + { + device = "/dev/disk/by-uuid/5c0f035b-fe9e-4c7f-a137-34b0168e1dde"; + fsType = "ext4"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/9be243bf-4f48-42e3-9827-bba2ef04ffa4"; }]; +} diff --git a/systems/mdesktop/doas.nix b/systems/mdesktop/doas.nix new file mode 100644 index 0000000..6aa5f72 --- /dev/null +++ b/systems/mdesktop/doas.nix @@ -0,0 +1,13 @@ +{ config, username, ... }: + +{ + security.sudo.enable = false; + security.doas = { + enable = true; + extraRules = [{ + users = [ "${username}" ]; + keepEnv = true; + persist = true; + }]; + }; +} diff --git a/systems/mdesktop/firewall.nix b/systems/mdesktop/firewall.nix new file mode 100644 index 0000000..1abda33 --- /dev/null +++ b/systems/mdesktop/firewall.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + # Disable the firewall altogether + networking.firewall.enable = false; +} diff --git a/systems/mdesktop/fonts.nix b/systems/mdesktop/fonts.nix new file mode 100644 index 0000000..e1b02f6 --- /dev/null +++ b/systems/mdesktop/fonts.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + fonts.packages = with pkgs; [ + nerdfonts + font-awesome + source-sans + source-han-sans + source-han-serif + source-han-code-jp + terminus_font + ]; +} diff --git a/systems/mdesktop/gpg.nix b/systems/mdesktop/gpg.nix new file mode 100644 index 0000000..dd75311 --- /dev/null +++ b/systems/mdesktop/gpg.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + # programs.gnupg.package = pkgs.gnupg22; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = false; + pinentryFlavor = "gtk2"; + }; +} diff --git a/systems/mdesktop/locale.nix b/systems/mdesktop/locale.nix new file mode 100644 index 0000000..0b0581e --- /dev/null +++ b/systems/mdesktop/locale.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + # Time zone + time.timeZone = "Europe/London"; + + # Internationalisation properties + i18n.defaultLocale = "en_GB.UTF-8"; + console = { + font = "${pkgs.terminus_font}/share/consolefonts/ter-v12n.psf.gz"; + keyMap = "uk"; + }; +} diff --git a/systems/mdesktop/man.nix b/systems/mdesktop/man.nix new file mode 100644 index 0000000..7e1051b --- /dev/null +++ b/systems/mdesktop/man.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + documentation.man = { + enable = true; + generateCaches = true; + }; +} diff --git a/systems/mdesktop/networking.nix b/systems/mdesktop/networking.nix new file mode 100644 index 0000000..43364f7 --- /dev/null +++ b/systems/mdesktop/networking.nix @@ -0,0 +1,17 @@ +{ config, lib, ... }: + +{ + # DHCP + networking.useDHCP = lib.mkDefault true; + + # Hostname + networking.hostName = "MDesktop"; + + # Enable wireless support & configuration + networking.wireless.enable = true; + networking.wireless.networks = { + "BT-C5CPMR_5GEXT" = { + psk = "hN3LtFrkp36bXc"; + }; + }; +} diff --git a/systems/mdesktop/nix-ld.nix b/systems/mdesktop/nix-ld.nix new file mode 100644 index 0000000..b5d5b9f --- /dev/null +++ b/systems/mdesktop/nix-ld.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.nix-ld.enable = true; +} diff --git a/systems/mdesktop/nix.nix b/systems/mdesktop/nix.nix new file mode 100644 index 0000000..533f7e9 --- /dev/null +++ b/systems/mdesktop/nix.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + # Enable flakes and nix-command + nix = { + package = pkgs.nixVersions.stable; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + options = "--delete-older-than 7d"; + }; + }; +} diff --git a/systems/mdesktop/nixos.nix b/systems/mdesktop/nixos.nix new file mode 100644 index 0000000..f9a9339 --- /dev/null +++ b/systems/mdesktop/nixos.nix @@ -0,0 +1,6 @@ +{ config, lib, ... }: + +{ + system.stateVersion = "23.05"; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/systems/mdesktop/noise-supression.nix b/systems/mdesktop/noise-supression.nix new file mode 100644 index 0000000..c101b60 --- /dev/null +++ b/systems/mdesktop/noise-supression.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: + +let + json = pkgs.formats.json {}; + pw_rnnoise_config = { + "context.modules"= [ + { "name" = "libpipewire-module-filter-chain"; + "args" = { + "node.description" = "Noise Canceling source"; + "media.name" = "Noise Canceling source"; + "filter.graph" = { + "nodes" = [ + { + "type" = "ladspa"; + "name" = "rnnoise"; + "plugin" = "${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"; + "label" = "noise_suppressor_stereo"; + "control" = { + "VAD Threshold (%)" = 50.0; + }; + } + ]; + }; + "audio.position" = [ "FL" "FR" ]; + "capture.props" = { + "node.name" = "effect_input.rnnoise"; + "node.passive" = true; + }; + "playback.props" = { + "node.name" = "effect_output.rnnoise"; + "media.class" = "Audio/Source"; + }; + }; + } + ]; + }; +in +{ + environment.systemPackages = with pkgs; [ + rnnoise + rnnoise-plugin + ]; + + environment.etc."pipewire/pipewire.conf.d/99-input-denoising.conf" = { + source = json.generate "99-input-denoising.conf" pw_rnnoise_config; + }; +} diff --git a/systems/mdesktop/nvidia.nix b/systems/mdesktop/nvidia.nix new file mode 100644 index 0000000..14bfe78 --- /dev/null +++ b/systems/mdesktop/nvidia.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + hardware.opengl.enable = true; + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + hardware.nvidia.open = false; + hardware.nvidia.modesetting.enable = false; + services.xserver.videoDrivers = [ "nvidia" ]; + + # Fix tauri applications with nvidia drivers + environment.sessionVariables = { + "WEBKIT_DISABLE_COMPOSITING_MODE" = "1"; + }; + + hardware.opengl.extraPackages = [ + (pkgs.runCommand "nvidia-icd" { } '' + mkdir -p $out/share/vulkan/icd.d + cp ${pkgs.linuxPackages.nvidia_x11}/share/vulkan/icd.d/nvidia_icd.x86_64.json $out/share/vulkan/icd.d/nvidia_icd.json + '') + ]; +} diff --git a/systems/mdesktop/openrazer.nix b/systems/mdesktop/openrazer.nix new file mode 100644 index 0000000..4175987 --- /dev/null +++ b/systems/mdesktop/openrazer.nix @@ -0,0 +1,9 @@ +{ config, username, ... }: + +{ + hardware.openrazer = { + enable = true; + users = [ "${username}" ]; + devicesOffOnScreensaver = false; + }; +} diff --git a/systems/mdesktop/openrgb.nix b/systems/mdesktop/openrgb.nix new file mode 100644 index 0000000..d112498 --- /dev/null +++ b/systems/mdesktop/openrgb.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + services.hardware.openrgb = { + enable = true; + package = pkgs.openrgb-with-all-plugins; + }; +} diff --git a/systems/mdesktop/packages.nix b/systems/mdesktop/packages.nix new file mode 100644 index 0000000..8562890 --- /dev/null +++ b/systems/mdesktop/packages.nix @@ -0,0 +1,50 @@ +{ config, pkgs, ... }: + +{ + # System-wide packages + # I want these available for all users at all times + environment.systemPackages = with pkgs; [ + # Xorg packages + xorg.xinit + xorg.xkill + xorg.xprop + xorg.xwininfo + xorg.xrandr + xdotool + xclip + + # Processes + killall + appimage-run + + # Filesystems + dosfstools + btrfs-progs + ntfs3g + exfatprogs + libimobiledevice + ifuse + + # Archives + zip + unrar + unzip + p7zip + + # Cli tools + ripgrep + wget + fzf + bat + + # XDG + xdg-utils + xdg-user-dirs + + # Git + git + + # Compiler + gcc + ]; +} diff --git a/systems/mdesktop/security.nix b/systems/mdesktop/security.nix new file mode 100644 index 0000000..65a4e9a --- /dev/null +++ b/systems/mdesktop/security.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + programs.slock.enable = true; + security.wrappers.slock.source = "${pkgs.slock.out}/bin/slock"; +} diff --git a/systems/mdesktop/services.nix b/systems/mdesktop/services.nix new file mode 100644 index 0000000..291c999 --- /dev/null +++ b/systems/mdesktop/services.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + # Misc services + services.usbmuxd.enable = true; +} diff --git a/systems/mdesktop/ssh.nix b/systems/mdesktop/ssh.nix new file mode 100644 index 0000000..6727c8e --- /dev/null +++ b/systems/mdesktop/ssh.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + programs.ssh.hostKeyAlgorithms = [ "sk-ssh-ed25519@openssh.com" "ssh-ed25519" "ecdsa-sha2-nistp256" ]; +} diff --git a/systems/mdesktop/syncthing.nix b/systems/mdesktop/syncthing.nix new file mode 100644 index 0000000..ab6dd0e --- /dev/null +++ b/systems/mdesktop/syncthing.nix @@ -0,0 +1,48 @@ +{ config, username, ... }: + +{ + services.syncthing = { + enable = true; + user = "${username}"; + group = "users"; + dataDir = "/home/${username}"; + configDir = "/home/${username}/.config/syncthing"; + guiAddress = "0.0.0.0:8384"; + overrideFolders = true; + overrideDevices = true; + settings = { + devices = { + "M.Phone.Pixel" = { id = "WMGWVOU-DFZQSZO-46XQJQA-Q5XD5ZB-NDXK5SP-LXNAADH-Z2KJN4P-4P4UXA5"; }; + "M.MacBookPro" = { id = "A5HRCSI-RWYZ6GG-SCBZ2OJ-PG6T7VP-WKDN2VP-CNXIQ3B-VCJ7ZHO-MTV63QP"; }; + "Lambda" = { id = "ZYNSFWR-F3ZNDDT-66TSJWB-PRP3KQK-IWTTABU-GGWT5DL-RWC7VAE-LI5AXQQ"; }; + }; + folders = { + "Documents" = { + path = "/home/${username}/Documents"; + devices = [ "M.Phone.Pixel" "M.MacBookPro" ]; + }; + "Pictures" = { + path = "/home/${username}/Pictures"; + devices = [ "M.Phone.Pixel" "M.MacBookPro" ]; + }; + "Videos" = { + path = "/home/${username}/Videos"; + devices = [ "M.Phone.Pixel" "M.MacBookPro" ]; + }; + "Music" = { + path = "/home/${username}/Music"; + devices = [ "M.Phone.Pixel" "M.MacBookPro" ]; + }; + "Android Camera" = { + id = "pixel_7_pro_2qyx-photos"; + path = "/home/${username}/Pictures/DCIM"; + devices = [ "M.Phone.Pixel" "M.MacBookPro" ]; + }; + ".Hidden" = { + path = "/home/${username}/.Hidden"; + devices = [ "M.Phone.Pixel" ]; + }; + }; + }; + }; +} diff --git a/systems/mdesktop/systemd.nix b/systems/mdesktop/systemd.nix new file mode 100644 index 0000000..93db17e --- /dev/null +++ b/systems/mdesktop/systemd.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + # Stop systemd from hanging for ages + systemd.extraConfig = '' + DefaultTimeoutStopSec=10s + ''; +} diff --git a/systems/mdesktop/users.nix b/systems/mdesktop/users.nix new file mode 100644 index 0000000..d7fe3bd --- /dev/null +++ b/systems/mdesktop/users.nix @@ -0,0 +1,11 @@ +{ config, pkgs, username, ... }: + +{ + users.users.${username} = { + isNormalUser = true; + shell = pkgs.zsh; + description = "Madeleine"; + extraGroups = [ "adbusers" "dialout" "libvirtd" "plugdev" ]; + openssh.authorizedKeys.keyFiles = [ ../../maddie/common/ssh/maddie.pub ]; + }; +} diff --git a/systems/mdesktop/virtualisation.nix b/systems/mdesktop/virtualisation.nix new file mode 100644 index 0000000..dad25d2 --- /dev/null +++ b/systems/mdesktop/virtualisation.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; +} diff --git a/systems/mdesktop/xorg.nix b/systems/mdesktop/xorg.nix new file mode 100644 index 0000000..186640b --- /dev/null +++ b/systems/mdesktop/xorg.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + services.xserver = { + # Enable X11 windowing system + enable = true; + + # Set X11 keymap as GB + layout = "gb"; + xkbOptions = "eurosign:e"; + + displayManager = { + # Use startx for starting window managers + startx.enable = true; + }; + }; +} diff --git a/systems/mdesktop/yubikey.nix b/systems/mdesktop/yubikey.nix new file mode 100644 index 0000000..32d847a --- /dev/null +++ b/systems/mdesktop/yubikey.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + services.pcscd.enable = true; + services.udev.packages = [ pkgs.yubikey-personalization pkgs.android-udev-rules ]; + security.pam = { + services = { + login.u2fAuth = true; + doas.u2fAuth = true; + }; + yubico = { + enable = true; + mode = "challenge-response"; + control = "optional"; + }; + }; + + /* environment.systemPackages = with pkgs; [ */ + /* yubioath-flutter */ + /* yubikey-personalization */ + /* ]; */ +} diff --git a/systems/mdesktop/zsh.nix b/systems/mdesktop/zsh.nix new file mode 100644 index 0000000..3aab6fb --- /dev/null +++ b/systems/mdesktop/zsh.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + }; + users.defaultUserShell = pkgs.zsh; +} diff --git a/systems/mmacbookpro/apps.nix b/systems/mmacbookpro/apps.nix new file mode 100644 index 0000000..1e68e50 --- /dev/null +++ b/systems/mmacbookpro/apps.nix @@ -0,0 +1,73 @@ +{ config, ... }: + +{ + homebrew = { + enable = true; + onActivation = { + autoUpdate = true; + cleanup = "zap"; + }; + taps = [ + { + name = "kde-mac/kde"; + clone_target = "https://invent.kde.org/packaging/homebrew-kde.git"; + force_auto_update = true; + } + ]; + casks = [ + # Media + "syncplay" + "mpv" + + # Messaging + "signal" + "element" + + # Games + "minecraft" + "prismlauncher" + "tetrio" + "osu" + + # Design + "sketch" + + # Development + "pycharm" + "webstorm" + "clion" + "goland" + "datagrip" + "rustrover" + "fleet" + "tower" + "secretive" + "sf-symbols" + "iterm2" + "emacs" + + # Learning + "anki" + "obsidian" + + # Tools + "boop" + "syncthing" + "haptickey" + "kdeconnect" + "hazeover" + "yubico-authenticator" + ]; + masApps = { + "Codye" = 1516894961; + "Wireguard" = 1451685025; + "Xcode" = 497799835; + "One Thing" = 1604176982; + "Today" = 6443714928; + "Wipr" = 1320666476; + "Vinegar" = 1591303229; + "Noir" = 1592917505; + /* "Element X" = 1631335820; */ + }; + }; +} diff --git a/systems/mmacbookpro/dock.nix b/systems/mmacbookpro/dock.nix new file mode 100644 index 0000000..f1436b3 --- /dev/null +++ b/systems/mmacbookpro/dock.nix @@ -0,0 +1,54 @@ +{ config, pkgs, username, ... }: + +{ + system.defaults = { + dock = { + # Don't show recent applications + show-recents = false; + # Set the dock size + tilesize = 55; + # Bottom right hot corner - Quick Nnote + wvous-br-corner = 14; + # Disable these hot corners + wvous-bl-corner = 1; + wvous-tl-corner = 1; + wvous-tr-corner = 1; + }; + }; + + # Set the applications and folders on the dock + local.dock.entries = [ + # Applications + { path = "/System/Applications/Launchpad.app/"; } + { path = "/Applications/Things3.app/"; } + { path = "/Applications/RustRover.app/"; } + { path = "/Applications/PyCharm.app/"; } + { path = "/Applications/Emacs.app/"; } + { path = "/Applications/iTerm.app/"; } + { path = "/Applications/Obsidian.app/"; } + { path = "/Applications/Tower.app/"; } + { path = "/Applications/Sketch.app/"; } + { path = "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app"; } + { path = "/System/Applications/Calendar.app/"; } + { path = "/System/Applications/Notes.app/"; } + { path = "/System/Applications/Freeform.app/"; } + { path = "/System/Applications/FindMy.app/"; } + { path = "/System/Applications/Music.app/"; } + { path = "/System/Applications/Mail.app/"; } + { path = "/System/Applications/Messages.app/"; } + { path = "/System/Applications/FaceTime.app/"; } + { path = "/Applications/Element.app/"; } + + # Folders + { + path = "/Users/${username}/Documents/"; + section = "others"; + options = "--sort name --display folder"; + } + { + path = "/Users/${username}/Downloads/"; + section = "others"; + options = "--sort dateadded"; + } + ]; +} diff --git a/systems/mmacbookpro/finder.nix b/systems/mmacbookpro/finder.nix new file mode 100644 index 0000000..27c6aca --- /dev/null +++ b/systems/mmacbookpro/finder.nix @@ -0,0 +1,15 @@ +{ config, ... }: + +{ + system.defaults = { + finder = { + AppleShowAllExtensions = true; + ShowPathbar = true; + ShowStatusBar = true; + FXDefaultSearchScope = "SCcf"; + FXPreferredViewStyle = "Nlsv"; + FXEnableExtensionChangeWarning = false; + }; + NSGlobalDomain.AppleShowAllExtensions = true; + }; +} diff --git a/systems/mmacbookpro/fonts.nix b/systems/mmacbookpro/fonts.nix new file mode 100644 index 0000000..3ad636f --- /dev/null +++ b/systems/mmacbookpro/fonts.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + fonts.fonts = with pkgs; [ + font-awesome + nerdfonts + ]; + + fonts.fontDir.enable = true; +} diff --git a/systems/mmacbookpro/gpg.nix b/systems/mmacbookpro/gpg.nix new file mode 100644 index 0000000..238bdc5 --- /dev/null +++ b/systems/mmacbookpro/gpg.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + programs.gnupg.agent = { + enable = true; + }; + + environment.systemPackages = with pkgs; [ + gnupg + ]; +} diff --git a/systems/mmacbookpro/keyboard.nix b/systems/mmacbookpro/keyboard.nix new file mode 100644 index 0000000..586b270 --- /dev/null +++ b/systems/mmacbookpro/keyboard.nix @@ -0,0 +1,20 @@ +{ config, ... }: + +{ + system.keyboard = { + enableKeyMapping = true; + remapCapsLockToEscape = true; + }; + + system.defaults.NSGlobalDomain = { + # Speed up key repeat + InitialKeyRepeat = 14; + KeyRepeat = 1; + # In general, have Apple not mess with our text + NSAutomaticCapitalizationEnabled = false; + NSAutomaticDashSubstitutionEnabled = false; + NSAutomaticPeriodSubstitutionEnabled = false; + NSAutomaticQuoteSubstitutionEnabled = null; + NSAutomaticSpellingCorrectionEnabled = false; + }; +} diff --git a/systems/mmacbookpro/networking.nix b/systems/mmacbookpro/networking.nix new file mode 100644 index 0000000..c938cc4 --- /dev/null +++ b/systems/mmacbookpro/networking.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + networking = { + computerName = "MacBook Pro"; + hostName = "MMacBookPro"; + }; +} diff --git a/systems/mmacbookpro/nix.nix b/systems/mmacbookpro/nix.nix new file mode 100644 index 0000000..45ba453 --- /dev/null +++ b/systems/mmacbookpro/nix.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +{ + # Enable flakes and nix-command + nix = { + package = pkgs.nixVersions.stable; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + options = "--delete-older-than 7d"; + }; + extraOptions = lib.optionalString (pkgs.system == "aarch64-darwin") '' + extra-platforms = x86_64-darwin aarch64-darwin + ''; + }; + services.nix-daemon.enable = true; +} diff --git a/systems/mmacbookpro/packages.nix b/systems/mmacbookpro/packages.nix new file mode 100644 index 0000000..4405bf0 --- /dev/null +++ b/systems/mmacbookpro/packages.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + # Processes + killall + + # Filesystems + dosfstools + + # Archives + zip + unzip + unrar + p7zip + + # Cli tools + ripgrep + wget + fzf + bat + + # Git + git + ]; +} diff --git a/systems/mmacbookpro/setDock.nix b/systems/mmacbookpro/setDock.nix new file mode 100644 index 0000000..3401be2 --- /dev/null +++ b/systems/mmacbookpro/setDock.nix @@ -0,0 +1,68 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.local.dock; + stdenv = pkgs.stdenv; + dockutil = pkgs.dockutil; +in +{ + options = { + local.dock.enable = mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; + + local.dock.entries = mkOption + { + description = "Entries on the Dock"; + type = with types; listOf (submodule { + options = { + path = lib.mkOption { type = str; }; + section = lib.mkOption { + type = str; + default = "apps"; + }; + options = lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; + }; + + config = + mkIf (cfg.enable) + ( + let + normalize = path: if hasSuffix ".app" path then path + "/" else path; + entryURI = path: "file://" + (builtins.replaceStrings + [" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"] + ["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"] + (normalize path) + ); + wantURIs = concatMapStrings + (entry: "${entryURI entry.path}\n") + cfg.entries; + createEntries = concatMapStrings + (entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n") + cfg.entries; + in + { + system.activationScripts.postUserActivation.text = '' + echo >&2 "Setting up the Dock..." + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + ''; + } + ); +} diff --git a/systems/mmacbookpro/settings.nix b/systems/mmacbookpro/settings.nix new file mode 100644 index 0000000..aa595d5 --- /dev/null +++ b/systems/mmacbookpro/settings.nix @@ -0,0 +1,74 @@ +{ config, ... }: + +{ + system.defaults = { + CustomUserPreferences = { + NSGlobalDomain = { + # Set system accent and highlight color to purple + AppleAccentColor = 5; + AppleHighlightColor = "0.968627 0.831373 1.000000 Purple"; + # Make the menu bar always visible + AppleMenuBarVisibleInFullscreen = 1; + }; + "com.apple.desktopservices" = { + # Don't write .DS_Store files to network or usb drives + DSDontWriteNetworkStores = true; + DSDontWriteUSBStores = true; + }; + # Magic Mouse + "com.apple.AppleMultitouchMouse" = { + # Enable right click + MouseButtonMode = "TwoButton"; + # Enable horizontal scrolling + MouseHorizontalScroll = 1; + # Enable one finger double tap for smart zoom + MouseOneFingerDoubleTapGesture = 1; + # Enable two finger tap for mission control + MouseTwoFingerDoubleTapGesture = 3; + # Enable two finger swipe to pan spaces + MouseTwoFingerHorizSwipeGesture = 2; + }; + # Trackpad + "com.apple.AppleMultitouchTrackpad" = { + # Don't secondary click on the corner of the trackpad + TrackpadCornerSecondaryClick = 0; + # Four/Five finger pinch for launchpad + TrackpadFourFingerPinchGesture = 2; + TrackpadFiveFingerPinchGesture = 2; + # Three/Four fingers swipe horizontally to pan spaces + TrackpadThreeFingerHorizSwipeGesture = 2; + TrackpadFourFingerHorizSwipeGesture = 2; + # Three/Four finger swipe vertically to activate mission control and app expose + TrackpadThreeFingerVertSwipeGesture = 2; + TrackpadFourFingerVertSwipeGesture = 2; + # Swipe two fingers from the right edge to open notification centre + TrackpadTwoFingerFromRightEdgeSwipeGesture = 3; + }; + }; + }; + + system.defaults = { + NSGlobalDomain = { + # Automatically enable dark theme at night + AppleInterfaceStyleSwitchesAutomatically = true; + # Use the metric system throughout macOS + AppleMetricUnits = 1; + # Always start with save dialog panels expanded + NSNavPanelExpandedStateForSaveMode = true; + NSNavPanelExpandedStateForSaveMode2 = true; + }; + loginwindow = { + # Disable using a guest user account + GuestEnabled = false; + }; + menuExtraClock = { + # Show seconds and date on menu bar clock + ShowSeconds = true; + ShowDate = 1; + }; + }; + + # Enable Touch ID for sudo + security.pam.enableSudoTouchIdAuth = true; +} + diff --git a/systems/mmacbookpro/ssh.nix b/systems/mmacbookpro/ssh.nix new file mode 100644 index 0000000..5d08ff7 --- /dev/null +++ b/systems/mmacbookpro/ssh.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + openssh + ]; +} diff --git a/systems/mmacbookpro/sudo.nix b/systems/mmacbookpro/sudo.nix new file mode 100644 index 0000000..d523187 --- /dev/null +++ b/systems/mmacbookpro/sudo.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + security.pam.enableSudoTouchIdAuth = true; +} diff --git a/systems/mmacbookpro/zsh.nix b/systems/mmacbookpro/zsh.nix new file mode 100644 index 0000000..2a5ba4c --- /dev/null +++ b/systems/mmacbookpro/zsh.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + enableSyntaxHighlighting = true; + enableCompletion = true; + }; + environment.loginShell = pkgs.zsh; +} diff --git a/utils/default.nix b/utils/default.nix new file mode 100644 index 0000000..04a7376 --- /dev/null +++ b/utils/default.nix @@ -0,0 +1,28 @@ +pkgs_or_lib: +let + is_pkgs = pkgs_or_lib ? lib; + lib = if is_pkgs then pkgs_or_lib.lib else pkgs_or_lib; + utils = lib.pipe ./. [ + (import ./nixFilesInWithName.nix lib) + (builtins.map (file: rec { + name = lib.removeSuffix ".nix" file.name; + func = import file.path; + accepts_pkgs = builtins.hasAttr "pkgs" (builtins.functionArgs func); + value = + if accepts_pkgs then + func + (builtins.intersectAttrs (builtins.functionArgs func) { + inherit + lib utils; pkgs = pkgs_or_lib; + }) + else if is_pkgs + then func lib + else + func pkgs_or_lib; + include = file.name != "default.nix" && (!accepts_pkgs || is_pkgs); + })) + (builtins.filter (utility: utility.include)) + builtins.listToAttrs + ]; +in +utils diff --git a/utils/nixFilesIn.nix b/utils/nixFilesIn.nix new file mode 100644 index 0000000..e85fa1c --- /dev/null +++ b/utils/nixFilesIn.nix @@ -0,0 +1,2 @@ +# Modified from http://chriswarbo.net/projects/nixos/useful_hacks.html +lib: dir: map (name: dir + "/${name}") (lib.attrNames (lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) (builtins.readDir dir))) diff --git a/utils/nixFilesInWithName.nix b/utils/nixFilesInWithName.nix new file mode 100644 index 0000000..760b7cf --- /dev/null +++ b/utils/nixFilesInWithName.nix @@ -0,0 +1,8 @@ +# Modified from http://chriswarbo.net/projects/nixos/useful_hacks.html +lib: dir: +map + (name: { + inherit name; + path = dir + "/${name}"; + }) + (lib.attrNames (lib.filterAttrs (name: type: lib.hasSuffix ".nix" name && type == "regular") (builtins.readDir dir)))