diff --git a/common/home-manager/default.nix b/common/home-manager/default.nix new file mode 100644 index 0000000..8f5c79b --- /dev/null +++ b/common/home-manager/default.nix @@ -0,0 +1,33 @@ +{ ... }: + +{ + imports = [ + # explicit xe.* + ./emacs + ./fish + ./htop.nix + ./k8s.nix + ./keybase.nix + ./luakit + ./neofetch.nix + ./powershell + #./sway + ./tmux.nix + ./urxvt.nix + ./vim + #./zathura + ./weechat + + # implicit + ./pastebins + ]; + + nixpkgs.config = { + allowBroken = true; + allowUnfree = true; + + manual.manpages.enable = true; + }; + + systemd.user.startServices = true; +} diff --git a/common/home-manager/emacs/default.nix b/common/home-manager/emacs/default.nix new file mode 100644 index 0000000..d44882c --- /dev/null +++ b/common/home-manager/emacs/default.nix @@ -0,0 +1,425 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let cfg = config.within.emacs; +in { + options.within.emacs.enable = mkEnableOption "emacs without spacemacs support"; + imports = [ ./emacs-init.nix ]; + + config = mkIf cfg.enable { + home.file."bin/e" = { + text = '' + #!/bin/sh + emacsclient $@ + ''; + executable = true; + }; + + services.emacs.enable = true; + programs.emacs = { + enable = true; + + init = { + enable = true; + + recommendedGcSettings = true; + + prelude = let + fontSize = if pkgs.stdenv.isDarwin then "15" else "14"; + emacsFont = '' + (when window-system + (set-frame-font "Hack ${fontSize}")) + ''; + in emacsFont + '' + (require 'bind-key) + + (setq inhibit-startup-screen t) + + (menu-bar-mode -1) + + (electric-pair-mode) + + (recentf-mode 1) + (setq recentf-max-menu-items 25) + (setq recentf-max-saved-items 25) + (global-set-key "\C-x\ \C-r" 'recentf-open-files) + + (when window-system + (dolist (mode + '(tool-bar-mode + tooltip-mode + scroll-bar-mode + menu-bar-mode + blink-cursor-mode)) + (funcall mode 0))) + + (add-hook 'text-mode-hook 'auto-fill-mode) + + (setq delete-old-versions -1 ) ; delete excess backup versions silently + (setq version-control t ) ; use version control + (setq vc-make-backup-files t ) ; make backups file even when in version controlled dir + (setq backup-directory-alist `(("." . "~/.emacs.d/backups")) ) ; which directory to put backups file + (setq vc-follow-symlinks t ) ; don't ask for confirmation when opening symlinked file + (setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)) ) ;transform backups file name + (setq inhibit-startup-screen t ) ; inhibit useless and old-school startup screen + (setq ring-bell-function 'ignore ) ; silent bell when you make a mistake + (setq coding-system-for-read 'utf-8 ) ; use utf-8 by default + (setq coding-system-for-write 'utf-8 ) + (setq sentence-end-double-space nil) ; sentence SHOULD end with only a point. + (setq default-fill-column 80) ; toggle wrapping text at the 80th character + + (defun chomp (str) + "Chomp leading and tailing whitespace from STR." + (while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" + str) + (setq str (replace-match "" t t str))) + str) + (setq gofmt-command "goimports") + (defun eshell/e (arg) + "opens a given file in emacs from eshell" + (find-file arg)) + + (defun eshell/eh (arg) + "opens a file in emacs from shell horizontally" + (split-window-vertically) + (other-window 1) + (find-file arg)) + + (defun eshell/ev (arg) + "opens a file in emacs from shell vertically" + (split-window-horizontally) + (other-window 1) + (find-file arg)) + + (set-frame-parameter (selected-frame) 'alpha '(85 . 85)) + (add-to-list 'default-frame-alist '(alpha . (85 . 85))) + ''; + + usePackageVerbose = true; + + usePackage = { + company = { + enable = true; + diminish = [ "company-mode" ]; + config = '' + (company-mode) + ''; + }; + + dockerfile-mode = { enable = true; }; + + counsel = { + enable = true; + + bindStar = { + "M-x" = "counsel-M-x"; + "C-x C-f" = "counsel-find-file"; + "C-x C-r" = "counsel-recentf"; + "C-c f" = "counsel-git"; + "C-c s" = "counsel-git-grep"; + "C-c /" = "counsel-rg"; + "C-c l" = "counsel-locate"; + "M-y" = "counsel-yank-pop"; + }; + + general = '' + (general-nmap + :prefix "SPC" + "SPC" '(counsel-M-x :which-key "M-x") + "ff" '(counsel-find-file :which-key "find file") + "s" '(:ignore t :which-key "search") + "sc" '(counsel-unicode-char :which-key "find character")) + ''; + }; + + cython-mode = { enable = true; }; + + direnv = { + enable = true; + config = '' + (direnv-mode) + ''; + }; + + better-defaults.enable = true; + + evil = { + enable = true; + init = '' + (setq evil-want-C-i-jump nil) + ''; + config = '' + (evil-mode 1) + ''; + }; + + evil-surround = { + enable = true; + config = '' + (global-evil-surround-mode 1) + ''; + }; + + evil-collection = { + enable = true; + after = [ "evil" ]; + }; + + evil-magit = { + enable = true; + after = [ "magit" ]; + }; + + flycheck = { + enable = true; + diminish = [ "flycheck-mode" ]; + config = '' + (global-flycheck-mode) + ''; + }; + + go-mode = { enable = true; }; + + lsp-mode = { + enable = true; + command = [ "lsp" ]; + hook = [ + "(go-mode . lsp)" + "(rust-mode . lsp)" + "(lsp-mode . lsp-enable-which-key-integration)" + ]; + config = '' + (setq lsp-rust-server 'rust-analyzer) + ''; + }; + + lsp-ui = { + enable = true; + after = [ "lsp" ]; + command = [ "lsp-ui-mode" ]; + }; + + lsp-ivy = { + enable = true; + after = [ "lsp" "ivy" ]; + command = [ "lsp-ivy-workspace-symbol" ]; + }; + + nlinum-relative = { + enable = true; + after = [ "evil" ]; + config = '' + (nlinum-relative-setup-evil) + (add-hook 'prog-mode-hook 'nlinum-relative-mode) + (add-hook 'org-mode-hook 'nlinum-relative-mode) + ''; + }; + + general = { + enable = true; + after = [ "evil" "which-key" ]; + config = '' + (general-evil-setup) + + (general-mmap + ":" 'evil-ex + ";" 'evil-repeat-find-char) + + (general-create-definer my-leader-def + :prefix "SPC") + + (general-create-definer my-local-leader-def + :prefix "SPC m") + + (general-nmap + :prefix "SPC" + "b" '(:ignore t :which-key "buffer") + "bd" '(kill-this-buffer :which-key "kill buffer") + + "f" '(:ignore t :which-key "file") + "ff" '(find-file :which-key "find") + "fs" '(save-buffer :which-key "save") + + "m" '(:ignore t :which-key "mode") + + "t" '(:ignore t :which-key "toggle") + "tf" '(toggle-frame-fullscreen :which-key "fullscreen") + "wv" '(split-window-horizontally :which-key "split vertical") + "ws" '(split-window-vertically :which-key "split horizontal") + "wk" '(evil-window-up :which-key "up") + "wj" '(evil-window-down :which-key "down") + "wh" '(evil-window-left :which-key "left") + "wl" '(evil-window-right :which-key "right") + "wd" '(delete-window :which-key "delete") + + "q" '(:ignore t :which-key "quit") + "qq" '(save-buffers-kill-emacs :which-key "quit")) + ''; + }; + + ivy = { + enable = true; + demand = true; + diminish = [ "ivy-mode" ]; + config = '' + (ivy-mode 1) + (setq ivy-use-virtual-buffers t + ivy-hight 20 + ivy-count-format "(%d/%d) " + ivy-initial-inputs-alist nil) + ''; + general = '' + (general-nmap + :prefix "SPC" + "bb" '(ivy-switch-buffer :which-key "switch buffer") + "fr" '(ivy-recentf :which-key "recent file")) + ''; + }; + + magit = { + enable = true; + + general = '' + (general-nmap + :prefix "SPC" + "g" '(:ignore t :which-key "Git") + "gs" 'magit-status) + ''; + }; + + markdown-mode = { + enable = true; + command = [ "markdown-mode" "gfm-mode" ]; + mode = [ + ''("README\\.md\\'" . gfm-mode)'' + ''("\\.md\\'" . markdown-mode)'' + ''("\\.markdown\\'" . markdown-mode)'' + ]; + }; + + nix = { enable = true; }; + + nix-mode = { + enable = true; + mode = [ ''"\\.nix\\'"'' ]; + bindLocal = { nix-mode-map = { "C-i" = "nix-indent-line"; }; }; + }; + + nix-prettify-mode = { + enable = true; + config = '' + (nix-prettify-global-mode) + ''; + }; + + nix-drv-mode = { + enable = true; + mode = [ ''"\\.drv\\'"'' ]; + }; + + projectile = { + enable = true; + after = [ "ivy" ]; + diminish = [ "projectile-mode" ]; + config = '' + (projectile-mode 1) + (progn + (setq projectile-enable-caching t) + (setq projectile-require-project-root nil) + (setq projectile-completion-system 'ivy) + (add-to-list 'projectile-globally-ignored-files ".DS_Store")) + ''; + general = '' + (general-nmap + :prefix "SPC" + "p" '(:ignore t :which-key "Project") + "pf" '(projectile-find-file :which-key "Find in project") + "pl" '(projectile-switch-project :which-key "Switch project")) + ''; + }; + + protobuf-mode = { enable = true; }; + + swiper = { + enable = true; + + bindStar = { "C-s" = "swiper"; }; + + general = '' + (general-nmap + :prefix "SPC" + "ss" '(swiper :which-key "swiper")) + ''; + }; + + which-key = { + enable = true; + diminish = [ "which-key-mode" ]; + config = '' + (which-key-mode) + (which-key-setup-side-window-right-bottom) + (setq which-key-sort-order 'which-key-key-order-alpha + which-key-side-window-max-width 0.33 + which-key-idle-delay 0.05) + ''; + }; + + gruvbox-theme = { + enable = true; + config = '' + (setq custom-safe-themes t) + (add-hook 'after-init-hook (lambda () (load-theme 'gruvbox t))) + ''; + }; + + dhall-mode = { + enable = true; + mode = [ ''"\\.dhall\\'"'' ]; + }; + + moonscript = { + enable = true; + mode = [ ''"\\.moon\\'"'' ]; + }; + + rust-mode = { + enable = true; + mode = [ ''"\\.rs\\'"'' ]; + }; + + toml-mode = { + enable = true; + mode = [ ''"\\.toml\\'"'' ]; + }; + + zig-mode = { + enable = true; + mode = [ ''"\\.zig\\'"'' ]; + }; + + nov = { + enable = true; + mode = [ ''"\\.epub\\'"'' ]; + }; + + web-mode = { + enable = true; + mode = [ ''"\\.html\\'"'' ''"\\.tmpl\\'"'' ]; + }; + + ob.enable = true; + org-download.enable = true; + org.enable = true; + org-mime.enable = true; + org-pomodoro.enable = true; + org-projectile.enable = true; + + weechat.enable = true; + systemd.enable = true; + terraform-mode.enable = true; + }; + }; + }; + }; +} diff --git a/common/home-manager/emacs/emacs-init.nix b/common/home-manager/emacs/emacs-init.nix new file mode 100644 index 0000000..2677e86 --- /dev/null +++ b/common/home-manager/emacs/emacs-init.nix @@ -0,0 +1,460 @@ +# Copyright (c) 2019 Robert Helgesson +# +# 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. +# +# Vendored from: https://gitlab.com/rycee/nur-expressions/blob/master/hm-modules/emacs-init.nix + +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.emacs.init; + + packageFunctionType = mkOptionType { + name = "packageFunction"; + description = "function from epkgs to package"; + check = isFunction; + merge = mergeOneOption; + }; + + usePackageType = types.submodule ({ name, config, ... }: { + options = { + enable = mkEnableOption "Emacs package ${name}"; + + package = mkOption { + type = types.either (types.str // { description = "name of package"; }) + packageFunctionType; + default = name; + description = '' + The package to use for this module. Either the package name + within the Emacs package set or a function taking the Emacs + package set and returning a package. + ''; + }; + + defer = mkOption { + type = types.either types.bool types.ints.positive; + default = false; + description = '' + The setting. + ''; + }; + + demand = mkOption { + type = types.bool; + default = false; + description = '' + The setting. + ''; + }; + + diminish = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + The entries to use for . + ''; + }; + + chords = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { + "jj" = "ace-jump-char-mode"; + "jk" = "ace-jump-word-mode"; + }; + description = '' + The entries to use for . + ''; + }; + + mode = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + The entries to use for . + ''; + }; + + after = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + The entries to use for . + ''; + }; + + bind = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { + "M-" = "drag-stuff-up"; + "M-" = "drag-stuff-down"; + }; + description = '' + The entries to use for . + ''; + }; + + bindLocal = mkOption { + type = types.attrsOf (types.attrsOf types.str); + default = { }; + example = { + helm-command-map = { "C-c h" = "helm-execute-persistent-action"; }; + }; + description = '' + The entries to use for local keymaps in . + ''; + }; + + bindStar = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { + "M-" = "drag-stuff-up"; + "M-" = "drag-stuff-down"; + }; + description = '' + The entries to use for . + ''; + }; + + bindKeyMap = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { "C-c p" = "projectile-command-map"; }; + description = '' + The entries to use for . + ''; + }; + + command = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + The entries to use for . + ''; + }; + + config = mkOption { + type = types.lines; + default = ""; + description = '' + Code to place in the section. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Additional lines to place in the use-package configuration. + ''; + }; + + general = mkOption { + type = types.lines; + default = ""; + description = '' + Code to place in the section. + ''; + }; + + hook = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + The entries to use for . + ''; + }; + + init = mkOption { + type = types.lines; + default = ""; + description = '' + The entries to use for . + ''; + }; + + assembly = mkOption { + type = types.lines; + readOnly = true; + internal = true; + description = "The final use-package code."; + }; + }; + + config = mkIf config.enable { + assembly = let + quoted = v: ''"${escape [ ''"'' ] v}"''; + mkBindHelper = cmd: prefix: bs: + optionals (bs != { }) ([ ":${cmd} (${prefix}" ] + ++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs ++ [ ")" ]); + + mkAfter = vs: optional (vs != [ ]) ":after (${toString vs})"; + mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})"; + mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})"; + mkMode = map (v: ":mode ${v}"); + mkBind = mkBindHelper "bind" ""; + mkBindStar = mkBindHelper "bind*" ""; + mkBindLocal = bs: + let mkMap = n: v: mkBindHelper "bind" ":map ${n}" v; + in flatten (mapAttrsToList mkMap bs); + mkBindKeyMap = mkBindHelper "bind-keymap" ""; + mkChords = mkBindHelper "chords" ""; + mkHook = map (v: ":hook ${v}"); + mkDefer = v: + if isBool v then + optional v ":defer t" + else + [ ":defer ${toString v}" ]; + mkDemand = v: optional v ":demand t"; + extraAfter = optional (config.general != "") "general"; + in concatStringsSep "\n " ([ "(use-package ${name}" ] + ++ mkAfter (config.after ++ extraAfter) ++ mkBind config.bind + ++ mkBindStar config.bindStar ++ mkBindKeyMap config.bindKeyMap + ++ mkBindLocal config.bindLocal ++ mkChords config.chords + ++ mkCommand config.command ++ mkDefer config.defer + ++ mkDemand config.demand ++ mkDiminish config.diminish + ++ mkHook config.hook ++ mkMode config.mode + ++ optionals (config.init != "") [ ":init" config.init ] + ++ optionals (config.config != "") [ ":config" config.config ] + ++ optionals (config.general != "") [ ":general" config.general ] + ++ optional (config.extraConfig != "") config.extraConfig) + ")"; + }; + }); + + usePackageStr = name: pkgConfStr: '' + (use-package ${name} + ${pkgConfStr}) + ''; + + mkRecommendedOption = type: extraDescription: + mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether to enable recommended ${type} settings. + '' + optionalString (extraDescription != "") '' + + ${extraDescription} + ''; + }; + + # Recommended GC settings. + gcSettings = '' + (defun hm/reduce-gc () + "Reduce the frequency of garbage collection." + (setq gc-cons-threshold 402653184 + gc-cons-percentage 0.6)) + + (defun hm/restore-gc () + "Restore the frequency of garbage collection." + (setq gc-cons-threshold 16777216 + gc-cons-percentage 0.1)) + + ;; Make GC more rare during init and while minibuffer is active. + (eval-and-compile #'hm/reduce-gc) + (add-hook 'minibuffer-setup-hook #'hm/reduce-gc) + + ;; But make it more regular after startup and after closing minibuffer. + (add-hook 'emacs-startup-hook #'hm/restore-gc) + (add-hook 'minibuffer-exit-hook #'hm/restore-gc) + + ;; Avoid unnecessary regexp matching while loading .el files. + (defvar hm/file-name-handler-alist file-name-handler-alist) + (setq file-name-handler-alist nil) + + (defun hm/restore-file-name-handler-alist () + "Restores the file-name-handler-alist variable." + (setq file-name-handler-alist hm/file-name-handler-alist) + (makunbound 'hm/file-name-handler-alist)) + + (add-hook 'emacs-startup-hook #'hm/restore-file-name-handler-alist) + ''; + + # Whether the configuration makes use of `:diminish`. + hasDiminish = any (p: p.diminish != [ ]) (attrValues cfg.usePackage); + + # Whether the configuration makes use of `:bind`. + hasBind = + any (p: p.bind != { } || p.bindStar != { }) (attrValues cfg.usePackage); + + # Whether the configuration makes use of `:chords`. + hasChords = any (p: p.chords != { }) (attrValues cfg.usePackage); + + # Whether the configuration makes use of `:diminish`. + hasGeneral = any (p: p.general != "") (attrValues cfg.usePackage); + + usePackageSetup = '' + (eval-when-compile + (require 'package) + + (setq package-archives nil + package-enable-at-startup nil + package--init-file-ensured t) + + (require 'use-package) + + ;; To help fixing issues during startup. + (setq use-package-verbose ${ + if cfg.usePackageVerbose then "t" else "nil" + })) + '' + optionalString hasDiminish '' + ;; For :diminish in (use-package). + (require 'diminish) + '' + optionalString hasBind '' + ;; For :bind in (use-package). + (require 'bind-key) + '' + optionalString hasChords '' + ;; For :chords in (use-package). + (use-package use-package-chords + :config (key-chord-mode 1)) + '' + optionalString hasGeneral '' + ;; For :general in (use-package). + (use-package general + :config + (general-evil-setup)) + ''; + + initFile = '' + ;;; hm-init.el --- Emacs configuration à la Home Manager. + ;; + ;; -*- lexical-binding: t; -*- + ;; + ;;; Commentary: + ;; + ;; A configuration generated from a Nix based configuration by + ;; Home Manager. + ;; + ;;; Code: + + ${optionalString cfg.startupTimer '' + ;; Remember when configuration started. See bottom for rest of this. + ;; Idea taken from http://writequit.org/org/settings.html. + (defconst emacs-start-time (current-time)) + ''} + + ${optionalString cfg.recommendedGcSettings gcSettings} + + ${cfg.prelude} + + ${usePackageSetup} + '' + concatStringsSep "\n\n" (map (getAttr "assembly") + (filter (getAttr "enable") (attrValues cfg.usePackage))) + '' + + ${cfg.postlude} + + ${optionalString cfg.startupTimer '' + ;; Make a note of how long the configuration part of the start took. + (let ((elapsed (float-time (time-subtract (current-time) + emacs-start-time)))) + (message "Loading settings...done (%.3fs)" elapsed)) + ''} + + (provide 'hm-init) + ;; hm-init.el ends here + ''; + +in { + options.programs.emacs.init = { + enable = mkEnableOption "Emacs configuration"; + + recommendedGcSettings = mkRecommendedOption "garbage collection" '' + This will reduce garbage collection frequency during startup and + while the minibuffer is active. + ''; + + startupTimer = mkEnableOption "Emacs startup duration timer"; + + prelude = mkOption { + type = types.lines; + default = ""; + description = '' + Configuration lines to add in the beginning of + init.el. + ''; + }; + + postlude = mkOption { + type = types.lines; + default = ""; + description = '' + Configuration lines to add in the end of + init.el. + ''; + }; + + usePackageVerbose = mkEnableOption "verbose use-package mode"; + + usePackage = mkOption { + type = types.attrsOf usePackageType; + default = { }; + example = literalExample '' + { + dhall-mode = { + mode = [ '''"\\.dhall\\'"''' ]; + }; + } + ''; + description = '' + Attribute set of use-package configurations. + ''; + }; + }; + + config = mkIf (config.programs.emacs.enable && cfg.enable) { + programs.emacs.extraPackages = epkgs: + let + getPkg = v: + if isFunction v then + [ (v epkgs) ] + else + optional (isString v && hasAttr v epkgs) epkgs.${v}; + + packages = concatMap (v: getPkg (v.package)) + (builtins.attrValues cfg.usePackage); + in [ + ((epkgs.trivialBuild { + pname = "hm-init"; + version = "0"; + src = pkgs.writeText "hm-init.el" initFile; + packageRequires = lists.unique ([ epkgs.use-package ] ++ packages + ++ optional hasBind epkgs.bind-key + ++ optional hasDiminish epkgs.diminish + ++ optional hasChords epkgs.use-package-chords + ++ optional hasGeneral epkgs.general); + preferLocalBuild = true; + allowSubstitutes = false; + }).overrideAttrs (attr: { + buildPhase = '' + runHook preBuild + runHook postBuild + ''; + })) + ]; + + home.file.".emacs.d/init.el".text = '' + (require 'hm-init) + (provide 'init) + ''; + }; +} diff --git a/common/home-manager/fish/default.nix b/common/home-manager/fish/default.nix new file mode 100644 index 0000000..1d9fa40 --- /dev/null +++ b/common/home-manager/fish/default.nix @@ -0,0 +1,71 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let + dquot = "''"; + cfg = config.within.fish; +in { + options.within.fish.enable = mkEnableOption "fish config"; + + config = mkIf cfg.enable { + programs.fish.enable = true; + + home.file = { + ".config/fish/functions/fish_greeting.fish".text = '' + function fish_greeting;end + ''; + + ".config/fish/functions/fish_prompt.fish".source = ./fish_prompt.fish; + ".config/fish/functions/fish_right_prompt.fish".source = + ./fish_right_prompt.fish; + ".config/fish/conf.d/ssh-agent.fish".source = ./ssh-agent.fish; + + # global fish config + ".config/fish/conf.d/cadey.fish".text = '' + alias edit "emacsclient -t -c -a ${dquot}" + alias e "edit" + + set -gx GOPATH $HOME/go + set -gx PATH $PATH $HOME/go/bin $HOME/bin + + set -gx GO111MODULE on + + set -gx PATH $PATH $HOME/.local/bin + + set -gx PATH $PATH $HOME/.luarocks/bin + + set -gx PATH $PATH $HOME/.cargo/bin + + set -gx WASMER_DIR $HOME/.wasmer + set -gx WASMER_CACHE_DIR $WASMER_DIR/cache + set -gx PATH $PATH $WASMER_DIR/bin $WASMER_DIR/globals/wapm_packages/.bin + + set -gx EDITOR vim + ''; + + ".config/fish/conf.d/colors.fish".text = '' + switch $TERM + case '*xte*' + set -gx TERM xterm-256color + case '*scree*' + set -gx TERM screen-256color + case '*rxvt*' + set -gx TERM rxvt-unicode-256color + end + ''; + + ".config/fish/conf.d/gpg.fish".text = '' + # Set GPG TTY + set -x GPG_TTY (tty) + ''; + }; + + home.packages = [ pkgs.fishPlugins.foreign-env ]; + + programs.fish.shellAliases = { + pbcopy = "${pkgs.xclip}/bin/xclip -selection clipboard"; + pbpaste = "${pkgs.xclip}/bin/xclip -selection clipboard -o"; + }; + }; +} diff --git a/common/home-manager/fish/fish_prompt.fish b/common/home-manager/fish/fish_prompt.fish new file mode 100644 index 0000000..c48cf11 --- /dev/null +++ b/common/home-manager/fish/fish_prompt.fish @@ -0,0 +1,217 @@ +#!/usr/bin/fish +# +# kawasaki.theme +# +# A theme for the fish shell. +# +# Copyright (c) 2016 Beau Hastings. +# License: GNU General Public License v2 +# +# Author: Beau Hastings +# + +function __default_var + set -q $argv[1]; or set -gx $argv +end + +# +# Notes: +# To use the theme's virtualenv prompt indicator you should add the following to your init.fish (https://github.com/oh-my-fish/oh-my-fish#dotfiles) +# set --export VIRTUAL_ENV_DISABLE_PROMPT 1 + +# Override default options +# +## Display the local time +#set -g theme_display_time yes +# +## Display the user's current group +#set -g theme_display_group no +# +## Display git branch status +#set -g theme_display_git no +# +## Display job count +#set -g theme_display_jobs no +# +## By default job count won't display if there are no jobs +#set -g theme_display_jobs_always yes +# +## Don't display if the current working directory is readable/writable +#set -g theme_display_rw no +# +## Don't display virtualenv +#set -g theme_display_virtualenv no +# + +# Colors +# TODO: consider displaying colors in the following order: cyan, green, yellow, orange, purple +# +__default_var theme_color_error red +__default_var theme_color_superuser red +__default_var theme_color_user white +__default_var theme_color_group 666666 +__default_var theme_color_host brgreen +__default_var theme_color_separator brblack +__default_var theme_color_bracket brblue +__default_var theme_color_normal normal +__default_var theme_color_time 666666 +__default_var theme_color_path brwhite +__default_var theme_color_prompt white +__default_var theme_color_virtualenv bryellow + +__default_var theme_color_status_prefix brblue +__default_var theme_color_status_jobs brgreen +__default_var theme_color_status_rw brwhite + +__default_var theme_prompt_char_normal '$' +__default_var theme_prompt_char_superuser '#' +__default_var theme_prompt_char "$theme_prompt_char_normal" + +__default_var theme_prompt_superuser_glyph \u2605 +__default_var theme_prompt_userhost_separator ':' + +__default_var theme_prompt_segment_separator_char ' ' +__default_var theme_prompt_segment_separator_color normal + +__default_var theme_prompt_status_jobs_char '%' +__default_var theme_prompt_status_rw_char '.' +__default_var theme_prompt_status_separator_char '/' + +__default_var theme_prompt_virtualenv_char_begin '(' +__default_var theme_prompt_virtualenv_char_end ')' +__default_var theme_prompt_virtualenv_color_char_begin normal +__default_var theme_prompt_virtualenv_color_char_end normal + +__default_var theme_display_time_format '+%I:%M' + +#__default_var __fish_git_prompt_color_prefix +#__default_var __fish_git_prompt_color_suffix +#__default_var __fish_git_prompt_color_bare +__default_var __fish_git_prompt_color_merging red +__default_var __fish_git_prompt_color_branch brblue +#__default_var __fish_git_prompt_color_flags +#__default_var __fish_git_prompt_color_upstream +# +#__fish_git_prompt_describe_style default|contains|describe|branch +__default_var __fish_git_prompt_showcolorhints yes +__default_var __fish_git_prompt_show_informative_status yes +__default_var __fish_git_prompt_char_stateseparator ' ' + +# Unofficial fish_git_prompt settings +__default_var __fish_git_prompt_char_branch_begin '' +__default_var __fish_git_prompt_char_branch_end '' +__default_var __fish_git_prompt_color_branch_begin bryellow +__default_var __fish_git_prompt_color_branch_end bryellow + + +function __theme_print_git_status + [ "$theme_display_git" = 'no' ]; and return + set -l git_prompt (__fish_git_prompt | command sed -e 's/^ (//' -e 's/)$//') + + [ "$git_prompt" = "" ]; and return + + print_colored $__fish_git_prompt_char_branch_begin $__fish_git_prompt_color_branch_begin + printf '%s' $git_prompt + print_colored $__fish_git_prompt_char_branch_end $__fish_git_prompt_color_branch_end +end +function __theme_print_jobs + [ "$theme_display_jobs" = 'no' ]; and return + set -l num_jobs (jobs -c | command wc -l) + + if [ $num_jobs -gt 0 -o "$theme_display_jobs_always" = "yes" ] + print_colored "$theme_prompt_status_jobs_char" $theme_color_status_prefix + print_colored "$theme_prompt_status_separator_char" $theme_color_separator + print_colored "$num_jobs" $theme_color_status_jobs + end +end +function __theme_print_prompt_char + print_colored $theme_prompt_char $theme_color_prompt +end +function __theme_print_pwd + print_colored (prompt_pwd) $theme_color_path +end +function __theme_print_pwd_rw + [ "$theme_display_rw" = 'no' ]; and return; + set -l rw_chars + + if [ -r . ]; set rw_chars r; end + if [ -w . ]; set rw_chars $rw_chars"w"; end + + print_colored $theme_prompt_status_rw_char $theme_color_status_prefix + print_colored $theme_prompt_status_separator_char $theme_color_separator + print_colored $rw_chars $theme_color_status_rw +end +function __theme_print_superuser + if [ (command id -u) = "0" ] + set theme_prompt_char "$theme_prompt_char_superuser" + print_colored $theme_prompt_superuser_glyph $theme_color_superuser + else + set theme_prompt_char "$theme_prompt_char_normal" + end +end +function __theme_print_time + [ "$theme_display_time" = 'yes' ]; or return; + print_colored (command date $theme_display_time_format) $theme_color_time +end +function __theme_print_userhost + echo -ns (__theme_print_superuser) $USER (__theme_reset_color) + + if [ "$theme_display_group" != 'no' ] + print_colored $theme_prompt_userhost_separator $theme_color_separator + print_colored (id -gn) $theme_color_group + end + + print_colored "@" $theme_color_separator + print_colored (prompt_hostname) $theme_color_host +end +function __theme_print_virtualenv + [ "$theme_display_virtualenv" = 'no' -o -z "$VIRTUAL_ENV" ]; and return + + set -l basename (basename "$VIRTUAL_ENV") + + # special case for Aspen magic directories (http://www.zetadev.com/software/aspen/) + if test "$basename" = "__" + set basename (basename (dirname "$VIRTUAL_ENV")) + end + + print_colored $theme_prompt_virtualenv_char_begin $theme_prompt_virtualenv_color_char_begin + print_colored $basename $theme_color_virtualenv + print_colored $theme_prompt_virtualenv_char_end $theme_prompt_virtualenv_color_char_end +end +function __theme_reset_color + set_color $theme_color_normal +end +function print_colored + set -l bgcolor normal + set -l fgcolor normal + set -l text + + if contains -- -b in $argv[1] + set bgcolor $argv[2] + set fgcolor $argv[-1] + set text $argv[3..-2] + else + set fgcolor $argv[-1] + set text $argv[1..-2] + end + + printf '%s%s%s' (set_color -b $bgcolor $fgcolor) (string join " " $text) (__theme_reset_color) +end +function fish_prompt + set -l sep (set_color $theme_prompt_segment_separator_color)$theme_prompt_segment_separator_char(__theme_reset_color) + set -l line1 (string join "$sep" \ + (__theme_print_time) \ + (__theme_print_userhost) \ + (__theme_print_pwd) \ + (__theme_print_git_status) \ + (__theme_print_jobs) \ + (__theme_print_pwd_rw) \ + ) + set -l line2 (string join " " \ + (__theme_print_virtualenv) \ + (__theme_print_prompt_char)\ + ) + + echo "$line1" + echo "$line2 " +end diff --git a/common/home-manager/fish/fish_right_prompt.fish b/common/home-manager/fish/fish_right_prompt.fish new file mode 100644 index 0000000..0e1ea31 --- /dev/null +++ b/common/home-manager/fish/fish_right_prompt.fish @@ -0,0 +1,7 @@ +function fish_right_prompt + set -l st $status + + if [ $status != 0 ] + echo (set_color $theme_color_error) ↵ $st(set_color $theme_color_normal) + end +end diff --git a/common/home-manager/fish/fish_variables b/common/home-manager/fish/fish_variables new file mode 100644 index 0000000..09e78aa --- /dev/null +++ b/common/home-manager/fish/fish_variables @@ -0,0 +1,29 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR fish_color_autosuggestion:555\x1ebrblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:--bold +SETUVAR fish_color_comment:990000 +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:009900 +SETUVAR fish_color_error:ff0000 +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:00a6b2 +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:999900 +SETUVAR fish_color_redirection:00afff +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_description:B3A06D\x1eyellow +SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR theme_display_group:no \ No newline at end of file diff --git a/common/home-manager/fish/ssh-agent.fish b/common/home-manager/fish/ssh-agent.fish new file mode 100644 index 0000000..8afd3ae --- /dev/null +++ b/common/home-manager/fish/ssh-agent.fish @@ -0,0 +1,49 @@ +#!/usr/bin/fish +# +# Fish script to run ssh-agent correctly, i.e. only start a new one when +# necessary. Drop it into ~/.config/fish/conf.d and forget about it. +# +# Uses ps and kill, everything else is done inside fish. +# +# Requires fish 2.3 for the string manipulation. +# +# Works with Fedora 26 and CentOS 7, for CentOS 6 you'll need a third party +# repo for fish anyway so make sure it's recent enough. +# +if status --is-interactive + + # Load the SSH environment variables + if test -f ~/.ssh/environment + source ~/.ssh/environment + end + + # Check the environment variables are present + if test \( "$SSH_AGENT_PID" != "" \) -a \( "$SSH_AUTH_SOCK" != "" \) -a \( -S "$SSH_AUTH_SOCK" \) + # Check it's not pointing at GNOME askpass + if string match -rv "/run/user/.*" "$SSH_AUTH_SOCK" >/dev/null + # Check the agent's actually running + if ps -p "$SSH_AGENT_PID" >/dev/null + set -e SSH_ASKPASS + exit + end + end + end + + # If we get this far, something is wrong + # Kill the existing agent process if possible + if test "$SSH_AGENT_PID" != "" + kill -s TERM "$SSH_AGENT_PID" 2>/dev/null + end + + # Start up a new agent, set the environment variables, and store them + # in the file for other shell instances + set a (ssh-agent) >/dev/null + set s (string match -r '.*=[^;]*' $a) + rm ~/.ssh/environment 2> /dev/null + for l in $s + set v (string replace -r '=' ' ' $l) + eval "set -x" $v + echo "set -x " $v >> ~/.ssh/environment + ssh-add 2> /dev/null + end +end diff --git a/common/home-manager/htop.nix b/common/home-manager/htop.nix new file mode 100644 index 0000000..1e49299 --- /dev/null +++ b/common/home-manager/htop.nix @@ -0,0 +1,11 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.within.htop; +in { + options.within.htop.enable = mkEnableOption "htop"; + config = mkIf cfg.enable { + programs.htop.enable = true; + }; +} diff --git a/common/home-manager/k8s.nix b/common/home-manager/k8s.nix new file mode 100644 index 0000000..3dbd79f --- /dev/null +++ b/common/home-manager/k8s.nix @@ -0,0 +1,18 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.within.k8s; +in { + options.within.k8s.enable = mkEnableOption "Kubernetes tools"; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + # cluster management tool + kubectl + kubectx + k9s + + # kubernetes in docker + kind + ]; +};} diff --git a/common/home-manager/keybase.nix b/common/home-manager/keybase.nix new file mode 100644 index 0000000..fe66422 --- /dev/null +++ b/common/home-manager/keybase.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.within.keybase; +in { + options.within.keybase = { + enable = mkEnableOption "Enable keybase/kbfs support"; + gui = mkEnableOption "Enable keybase gui installation"; + }; + + config = mkIf cfg.enable { + services.keybase.enable = true; + services.kbfs.enable = true; + + home.packages = if cfg.gui then [ pkgs.keybase-gui ] else [ pkgs.keybase ]; + }; +} diff --git a/common/home-manager/luakit/default.nix b/common/home-manager/luakit/default.nix new file mode 100644 index 0000000..2cae4b8 --- /dev/null +++ b/common/home-manager/luakit/default.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let cfg = config.within.luakit; +in { + options.within.luakit.enable = mkEnableOption "enables luakit in userspace"; + + config = mkIf cfg.enable { + home = { + packages = [ pkgs.luakit ]; + file = { + ".local/share/luakit/newtab.html".source = ./start.html; + ".config/luakit/theme-dark.lua".source = ./theme-dark.lua; + ".config/luakit/userconf.lua".text = '' + local settings = require "settings" + settings.window.home_page = "luakit://newtab/" + + -- Load library of useful functions for luakit + local lousy = require "lousy" + + lousy.theme.init(lousy.util.find_config("theme-dark.lua")) + assert(lousy.theme.get(), "failed to load theme") + ''; + }; + }; + }; +} diff --git a/common/home-manager/luakit/start.html b/common/home-manager/luakit/start.html new file mode 100644 index 0000000..31de685 --- /dev/null +++ b/common/home-manager/luakit/start.html @@ -0,0 +1,176 @@ + + + + +
+
+ + diff --git a/common/home-manager/luakit/theme-dark.lua b/common/home-manager/luakit/theme-dark.lua new file mode 100644 index 0000000..97a0438 --- /dev/null +++ b/common/home-manager/luakit/theme-dark.lua @@ -0,0 +1,86 @@ +------------------------------- +-- Dark gruvbox luakit theme -- +------------------------------- + +local theme = {} + +-- Default settings +theme.font = "9pt Hack" +theme.fg = "#ebdbb2" +theme.bg = "#282828" + +-- General colours +theme.success_fg = "#b8bb26" +theme.loaded_fg = "#83a598" +theme.error_fg = theme.fg +theme.error_bg = "#cc241d" + +-- Warning colours +theme.warning_fg = "fb4934" +theme.warning_bg = theme.bg + +-- Notification colours +theme.notif_fg = "#a89984" +theme.notif_bg = theme.bg + +-- Menu colours +theme.menu_fg = theme.fg +theme.menu_bg = "#504945" +theme.menu_selected_fg = theme.menu_bg +theme.menu_selected_bg = "#83a598" +theme.menu_title_bg = "#3c3836" +theme.menu_primary_title_fg = theme.fg +theme.menu_secondary_title_fg = theme.fg + +theme.menu_disabled_fg = "#928374" +theme.menu_disabled_bg = theme.menu_bg +theme.menu_enabled_fg = theme.menu_fg +theme.menu_enabled_bg = theme.menu_bg +theme.menu_active_fg = "#b8bb26" +theme.menu_active_bg = theme.menu_bg + +-- Proxy manager +theme.proxy_active_menu_fg = theme.fg +theme.proxy_active_menu_bg = theme.bg +theme.proxy_inactive_menu_fg = '#928374' +theme.proxy_inactive_menu_bg = theme.bg + +-- Statusbar specific +theme.sbar_fg = theme.fg +theme.sbar_bg = theme.bg + +-- Downloadbar specific +theme.dbar_fg = theme.fg +theme.dbar_bg = theme.bg +theme.dbar_error_fg = "#fb4934" + +-- Input bar specific +theme.ibar_fg = theme.fg +theme.ibar_bg = theme.bg + +-- Tab label +theme.tab_fg = theme.fg +theme.tab_bg = "#504945" +theme.tab_hover_bg = "#3c3836" +theme.tab_ntheme = "#a89984" +theme.selected_fg = theme.fg +theme.selected_bg = theme.bg +theme.selected_ntheme = "#a89984" +theme.loading_fg = theme.loaded_fg +theme.loading_bg = theme.loaded_bg + +theme.selected_private_tab_bg = "#b16296" +theme.private_tab_bg = "#8f3f71" + +-- Trusted/untrusted ssl colours +theme.trust_fg = "#b8bb26" +theme.notrust_fg = "#fb4934" + +-- General colour pairings +theme.ok = { fg = theme.fg, bg = theme.bg } +theme.warn = { fg = "#fb4934", bg = theme.bg } +theme.error = { fg = theme.fg, bg = "#cc241d" } + +return theme + +-- vim: et:sw=4:ts=8:sts=4:tw=80 diff --git a/common/home-manager/neofetch.nix b/common/home-manager/neofetch.nix new file mode 100644 index 0000000..c45d72a --- /dev/null +++ b/common/home-manager/neofetch.nix @@ -0,0 +1,100 @@ +{ lib, pkgs, config, ... }: + +with lib; + +let cfg = config.within.neofetch; +in { + options.within.neofetch.enable = mkEnableOption "la'o neofetch bau la lojban"; + config = mkIf cfg.enable { + home.file.".config/neofetch/config.conf".text = '' + # See this wiki page for more info: + # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info + print_info() { + info title + info underline + + info "samcmu" distro + info "skami" model + info "samcmuralju" kernel + info "akti temci" uptime + info "bakfu" packages + info "calku" shell + info "tilcfu" resolution + info "cankyuijde ralju" wm + info "cakselsampla" term + info "samkroxo" cpu + info "vidnyskami" gpu + info "datnyvaugunma" memory + #info "elsa" song + + info cols + } + + kernel_shorthand="on" + distro_shorthand="off" + os_arch="on" + uptime_shorthand="on" + memory_percent="off" + package_managers="on" + shell_path="off" + shell_version="on" + speed_type="bios_limit" + speed_shorthand="off" + cpu_brand="on" + cpu_speed="on" + cpu_cores="logical" + cpu_temp="off" + gpu_brand="on" + gpu_type="all" + refresh_rate="off" + gtk_shorthand="off" + gtk2="on" + gtk3="on" + public_ip_host="http://ident.me" + public_ip_timeout=2 + disk_show=('/') + disk_subtitle="mount" + music_player="amarok" + song_format="%title% - %artist%" + song_shorthand="off" + + mpc_args=() + colors=(distro) + bold="on" + underline_enabled="on" + underline_char="-" + separator=":" + block_range=(0 15) + color_blocks="on" + block_width=3 + block_height=1 + bar_char_elapsed="-" + bar_char_total="=" + bar_border="on" + bar_length=15 + bar_color_elapsed="distro" + bar_color_total="distro" + cpu_display="off" + memory_display="off" + battery_display="off" + disk_display="off" + image_backend="ascii" + image_source="auto" + ascii_distro="auto" + ascii_colors=(distro) + ascii_bold="on" + image_loop="off" + thumbnail_dir=$HOME/tmp + crop_mode="normal" + crop_offset="center" + image_size="auto" + gap=3 + yoffset=0 + xoffset=0 + background_color= + stdout="off" + ''; + + home.packages = with pkgs; [ neofetch ]; + }; +} diff --git a/common/home-manager/pastebins/clbin b/common/home-manager/pastebins/clbin new file mode 100755 index 0000000..c552a52 --- /dev/null +++ b/common/home-manager/pastebins/clbin @@ -0,0 +1,3 @@ +#!/bin/sh + +curl -F 'clbin=<-' https://clbin.com diff --git a/common/home-manager/pastebins/default.nix b/common/home-manager/pastebins/default.nix new file mode 100644 index 0000000..8140690 --- /dev/null +++ b/common/home-manager/pastebins/default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: + +{ + home.file = { + "bin/clbin" = { + source = ./clbin; + executable = true; + }; + + "bin/ix" = { + source = ./ix; + executable = true; + }; + + "bin/sprunge" = { + source = ./sprunge; + executable = true; + }; + }; +} diff --git a/common/home-manager/pastebins/ix b/common/home-manager/pastebins/ix new file mode 100755 index 0000000..a263fd9 --- /dev/null +++ b/common/home-manager/pastebins/ix @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# Examples: +# ix hello.txt # paste file (name/ext will be set). +# echo Hello world. | ix # read from STDIN (won't set name/ext). +# ix -n 1 self_destruct.txt # paste will be deleted after one read. +# ix -i ID hello.txt # replace ID, if you have permission. +# ix -d ID + +ix() { + local opts + local OPTIND + [ -f "$HOME/.netrc" ] && opts='-n' + while getopts ":hd:i:n:" x; do + case $x in + h) echo "ix [-d ID] [-i ID] [-n N] [opts]"; return;; + d) $echo curl $opts -X DELETE ix.io/$OPTARG; return;; + i) opts="$opts -X PUT"; local id="$OPTARG";; + n) opts="$opts -F read:1=$OPTARG";; + esac + done + shift $(($OPTIND - 1)) + [ -t 0 ] && { + local filename="$1" + shift + [ "$filename" ] && { + curl $opts -F f:1=@"$filename" $* ix.io/$id + return + } + echo "^C to cancel, ^D to send." + } + curl $opts -F f:1='<-' $* ix.io/$id +} + +ix $* \ No newline at end of file diff --git a/common/home-manager/pastebins/sprunge b/common/home-manager/pastebins/sprunge new file mode 100755 index 0000000..48301e7 --- /dev/null +++ b/common/home-manager/pastebins/sprunge @@ -0,0 +1,3 @@ +#!/bin/sh + +curl -F 'sprunge=<-' http://sprunge.us diff --git a/common/home-manager/powershell/default.nix b/common/home-manager/powershell/default.nix new file mode 100644 index 0000000..09856b9 --- /dev/null +++ b/common/home-manager/powershell/default.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.within.powershell; +in { + options.within.powershell.enable = mkEnableOption "enables powershell config"; + config = mkIf cfg.enable { + home.packages = [ pkgs.powershell ]; + home.file.".config/powershell/Microsoft.PowerShell_profile.ps1".source = + ./profile.ps1; + }; +} diff --git a/common/home-manager/powershell/profile.ps1 b/common/home-manager/powershell/profile.ps1 new file mode 100644 index 0000000..8e2745d --- /dev/null +++ b/common/home-manager/powershell/profile.ps1 @@ -0,0 +1,25 @@ +if (Get-InstalledModule -Name posh-git) { + Import-Module posh-git +} +else { + Set-PSRepository -name PSGallery -InstallationPolicy Trusted + Install-Module posh-git -Scope CurrentUser -Force -Repository PSGallery + Import-Module posh-git +} + +$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = [ConsoleColor]::Magenta +$GitPromptSettings.DefaultPromptPath.ForegroundColor = [ConsoleColor]::Orange +$GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n' + +function global:PromptWriteErrorInfo() { + if ($global:GitPromptValues.DollarQuestion) { return } + + if ($global:GitPromptValues.LastExitCode) { + "`e[31m(" + $global:GitPromptValues.LastExitCode + ") `e[0m" + } + else { + "`e[31m! `e[0m" + } +} + +$global:GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n$(PromptWriteErrorInfo)' diff --git a/common/home-manager/sway/default.nix b/common/home-manager/sway/default.nix new file mode 100644 index 0000000..2c38168 --- /dev/null +++ b/common/home-manager/sway/default.nix @@ -0,0 +1,212 @@ +{ config, nixosConfig, pkgs, lib, ... }: +with lib; +let + cfg = nixosConfig.within.sway; + nanpa = pkgs.tulpa.dev.cadey.nanpa; +in { + config = mkIf cfg.enable { + wayland.windowManager.sway = { + enable = true; + wrapperFeatures.gtk = true; + # emulate my dwm config + config = with pkgs; + let + focused = rec { + border = "#d3869b"; + background = border; + text = "#32302f"; + }; + active = rec { + border = "#b16286"; + background = border; + text = "#32302f"; + }; + in { + terminal = "${pkgs.st}/bin/st"; + bars = [{ + fonts = [ "Primihi 11" "Hack 10" ]; + colors = { + background = "#282828"; + statusline = "#ebdbb2"; + separator = "#666666"; + focusedWorkspace = focused; + activeWorkspace = active; + inactiveWorkspace = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + urgentWorkspace = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + bindingMode = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + }; + command = "${pkgs.sway}/bin/swaybar"; + hiddenState = "hide"; + mode = "dock"; + position = "top"; + statusCommand = if cfg.i3status then + "${pkgs.i3status}/bin/i3status" + else + "${pkgs.tulpa.dev.cadey.cabytcini}/bin/cabytcinysuhei"; + workspaceButtons = true; + workspaceNumbers = false; + trayOutput = "primary"; + }]; + colors = { + focused = rec { + background = "#d3869b"; + border = "#bdae93"; + text = "#32302f"; + indicator = "#2e9ef4"; + childBorder = "#3d3285"; + }; + focusedInactive = rec { + background = "#b16286"; + border = "#bdae93"; + text = "#ebdbb2"; + indicator = "#b57614"; + childBorder = "#3d3285"; + }; + unfocused = rec { + background = "#8f3f71"; + border = "#bdae93"; + text = "#ebdbb2"; + indicator = "#b57614"; + childBorder = "#3d3285"; + }; + }; + floating = { + criteria = + [ { title = "Steam - Update News"; } { class = "Pavucontrol"; } ]; + titlebar = true; + }; + focus = { followMouse = "yes"; }; + fonts = [ "Primihi 12" "Hack 10" ]; + gaps = { + horizontal = 3; + vertical = 3; + inner = 3; + smartBorders = "on"; + smartGaps = true; + }; + workspaceAutoBackAndForth = true; + keybindings = + let modifier = config.wayland.windowManager.sway.config.modifier; + in lib.mkOptionDefault { + "${modifier}+Shift+Return" = + "exec ${pkgs.st}/bin/st"; + "${modifier}+Shift+c" = "kill"; + "${modifier}+p" = + "exec ${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu -nb '#1d2021' -nf '#ebdbb2' -sb '#b16286' -sf '#fbf1c7' | ${pkgs.findutils}/bin/xargs swaymsg exec --"; + "${modifier}+t" = "layout toggle split"; + "${modifier}+f" = "layout tabbed"; + "${modifier}+u" = "layout stacking"; + "${modifier}+e" = "exec $HOME/bin/e"; + + "${modifier}+s" = "exec grim"; + "${modifier}+Shift+s" = "exec slurp | grim -g -"; + + "${modifier}+1" = "exec ${nanpa}/bin/nanpac switch 1"; + "${modifier}+2" = "exec ${nanpa}/bin/nanpac switch 2"; + "${modifier}+3" = "exec ${nanpa}/bin/nanpac switch 3"; + "${modifier}+4" = "exec ${nanpa}/bin/nanpac switch 4"; + "${modifier}+5" = "exec ${nanpa}/bin/nanpac switch 5"; + "${modifier}+6" = "exec ${nanpa}/bin/nanpac switch 6"; + "${modifier}+7" = "exec ${nanpa}/bin/nanpac switch 7"; + "${modifier}+8" = "exec ${nanpa}/bin/nanpac switch 8"; + "${modifier}+9" = "exec ${nanpa}/bin/nanpac switch 9"; + + "${modifier}+m" = "focus output DP-1"; + "${modifier}+k" = "focus output HDMI-A-1"; + + "${modifier}+Shift+1" = "exec ${nanpa}/bin/nanpac move 1"; + "${modifier}+Shift+2" = "exec ${nanpa}/bin/nanpac move 2"; + "${modifier}+Shift+3" = "exec ${nanpa}/bin/nanpac move 3"; + "${modifier}+Shift+4" = "exec ${nanpa}/bin/nanpac move 4"; + "${modifier}+Shift+5" = "exec ${nanpa}/bin/nanpac move 5"; + "${modifier}+Shift+6" = "exec ${nanpa}/bin/nanpac move 6"; + "${modifier}+Shift+7" = "exec ${nanpa}/bin/nanpac move 7"; + "${modifier}+Shift+8" = "exec ${nanpa}/bin/nanpac move 8"; + "${modifier}+Shift+9" = "exec ${nanpa}/bin/nanpac move 9"; + + "${modifier}+Shift+0" = "sticky toggle"; + + "${modifier}+Shift+minus" = "move scratchpad"; + "${modifier}+minus" = "scratchpad show"; + }; + output = nixosConfig.cadey.sway.output; + startup = [ + { + command = "systemctl --user restart waybar"; + always = true; + } + { command = "mako -c ${./mako.conf}"; } + { command = "firefox"; } + { command = "Discord"; } + { + command = "systemctl --user restart nanpad"; + always = true; + } + { + command = + "systemctl --user restart xdg-desktop-portal xdg-desktop-portal-wlr"; + always = true; + } + ]; + window = { border = 1; }; + }; + extraSessionCommands = '' + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + }; + home.packages = with pkgs; [ + grim # for screenshots + slurp + swaylock + swayidle + wl-clipboard + mako # notification daemon + alacritty # Alacritty is the default terminal in the config + dmenu # Dmenu is the default in the config but i recommend wofi since its wayland native + ]; + home.file.".config/mako/config".source = ./mako.conf; + + systemd.user.services = { + nanpad = { + Unit.Description = "workspace nanpa daemon"; + Service = { + Type = "simple"; + ExecStart = "${nanpa}/bin/nanpad"; + }; + Install.WantedBy = [ "sway-session.target" ]; + }; + + xdg-desktop-portal = { + Unit.Description = "XDG Desktop Portal"; + Service.ExecStart = + "${pkgs.xdg-desktop-portal}/libexec/xdg-desktop-portal"; + Install.WantedBy = [ "sway-session.target" ]; + }; + + xdg-desktop-portal-wlr = { + Unit.Description = "XDG Desktop Portal for wlroots compositors"; + Service.ExecStart = + "${pkgs.xdg-desktop-portal-wlr}/libexec/xdg-desktop-portal-wlr"; + Install.WantedBy = [ "sway-session.target" ]; + }; + }; + }; +} diff --git a/common/home-manager/sway/mako.conf b/common/home-manager/sway/mako.conf new file mode 100644 index 0000000..4c45be2 --- /dev/null +++ b/common/home-manager/sway/mako.conf @@ -0,0 +1 @@ +max-visible=5 diff --git a/common/home-manager/tmux.nix b/common/home-manager/tmux.nix new file mode 100644 index 0000000..b716209 --- /dev/null +++ b/common/home-manager/tmux.nix @@ -0,0 +1,90 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.within.tmux; +in { + options.within.tmux = { + enable = mkEnableOption "set up tmux"; + shortcut = mkOption { + type = types.str; + description = "The tmux prefix key, default is C-s"; + default = "s"; + example = "a"; + }; + }; + config = mkIf cfg.enable { + programs.tmux = { + enable = true; + shortcut = cfg.shortcut; + baseIndex = 1; # Widows numbers begin with 1 + keyMode = "vi"; + customPaneNavigationAndResize = true; + aggressiveResize = true; + historyLimit = 100000; + resizeAmount = 5; + escapeTime = 0; + newSession = true; + + extraConfig = '' + # Fix environment variables + set-option -g update-environment "SSH_AUTH_SOCK \ + SSH_CONNECTION \ + DISPLAY" + # Mouse works as expected + set-option -g mouse on + # Use default shell + set-option -g default-shell ''${SHELL} + # Extra Vi friendly stuff + # y and p as in vim + bind Escape copy-mode + unbind p + bind p paste-buffer + bind-key -T copy-mode-vi 'v' send -X begin-selection + bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle + bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' + bind-key -T copy-mode-vi 'Space' send -X halfpage-down + bind-key -T copy-mode-vi 'Bspace' send -X halfpage-up + bind-key -T copy-mode-vi 'Escape' send -X cancel + # easy-to-remember split pane commands + bind v split-window -h -c "#{pane_current_path}" + bind h split-window -v -c "#{pane_current_path}" + bind c new-window -c "#{pane_current_path}" + unbind '"' + unbind % + + # default statusbar color + set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1 + + # default window title colors + set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1 + + # default window with an activity alert + set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3 + + # active window title colors + set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1 + + # pane border + set-option -g pane-active-border-style fg=colour250 #fg2 + set-option -g pane-border-style fg=colour237 #bg1 + + # message infos + set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1 + + # writing commands inactive + set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1 + + # pane number display + set-option -g display-panes-active-colour colour250 #fg2 + set-option -g display-panes-colour colour237 #bg1 + + # clock + set-window-option -g clock-mode-colour colour109 #blue + + # bell + set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg + ''; + }; + }; +} diff --git a/common/home-manager/urxvt.nix b/common/home-manager/urxvt.nix new file mode 100644 index 0000000..393ee49 --- /dev/null +++ b/common/home-manager/urxvt.nix @@ -0,0 +1,169 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + termDesktop = pkgs.writeTextFile { + name = "cadey-terminal.desktop"; + destination = "/share/applications/cadey-terminal.desktop"; + text = '' + [Desktop Entry] + Exec=/home/cadey/bin/term + Icon=utilities-terminal + Name[en_US]=Terminal + Name=Terminal + StartupNotify=true + Terminal=false + Type=Application + ''; + }; + + cfg = config.within.urxvt; +in { + options.within.urxvt.enable = + mkEnableOption "Enables urxvt as the default terminal"; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + rxvt-unicode + urxvt_font_size + urxvt_perl + urxvt_tabbedex + urxvt_vtwheel + anonymousPro + + # XXX HACK Terminal desktop file + termDesktop + ]; + + home.file."bin/term" = { + executable = true; + text = '' + #!/bin/sh + + ${pkgs.xorg.xrdb}/bin/xrdb -merge ~/.Xresources + + ${pkgs.rxvt-unicode}/bin/urxvtc "$@" + if [ $? -eq 2 ]; then + ${pkgs.rxvt-unicode}/bin/urxvtd -q -o -f + ${pkgs.rxvt-unicode}/bin/urxvtc "$@" + fi + ''; + }; + + xresources.extraConfig = '' + ! ----------------------------------------------------------------------------- + ! File: gruvbox-urxvt256.xresources + ! Description: Retro groove colorscheme generalized + ! Author: morhetz + ! Source: https://github.com/morhetz/gruvbox-generalized + ! Last Modified: 13 Dec 2013 + ! ----------------------------------------------------------------------------- + URxvt.color24: #076678 + URxvt.color66: #427b58 + URxvt.color88: #9d0006 + URxvt.color96: #8f3f71 + URxvt.color100: #79740e + URxvt.color108: #8ec07c + URxvt.color109: #83a598 + URxvt.color130: #af3a03 + URxvt.color136: #b57614 + URxvt.color142: #b8bb26 + URxvt.color167: #fb4934 + URxvt.color175: #d3869b + URxvt.color208: #fe8019 + URxvt.color214: #fabd2f + URxvt.color223: #ebdbb2 + URxvt.color228: #f2e5bc + URxvt.color229: #fbf1c7 + URxvt.color230: #f9f5d7 + URxvt.color234: #1d2021 + URxvt.color235: #282828 + URxvt.color236: #32302f + URxvt.color237: #3c3836 + URxvt.color239: #504945 + URxvt.color241: #665c54 + URxvt.color243: #7c6f64 + URxvt.color244: #928374 + URxvt.color245: #928374 + URxvt.color246: #a89984 + URxvt.color248: #bdae93 + URxvt.color250: #d5c4a1 + ''; + + xresources.properties = { + # colors + "*background" = "#32302f"; + "*foreground" = "#ebdbb2"; + "*color0" = "#282828"; + "*color1" = "#cc241d"; + "*color2" = "#98971a"; + "*color3" = "#d79921"; + "*color4" = "#458588"; + "*color5" = "#b16286"; + "*color6" = "#689d6a"; + "*color7" = "#a89984"; + "*color8" = "#928374"; + "*color9" = "#fb4934"; + "*color10" = "#b8bb26"; + "*color11" = "#fabd2f"; + "*color12" = "#83a598"; + "*color13" = "#d3869b"; + "*color14" = "#8ec07c"; + "*color15" = "#ebdbb2"; + + # extensions i use + "URxvt.perl-ext-common" = "default,clipboard,matcher,tabbedex,vtwheel"; + + # transparency + "URxvt*depth" = "32"; + + # URL opening + "URxvt.url-launcher" = "${pkgs.xdg_utils}/bin/xdg-open"; + "URxvt.keysym.C-Delete" = "perl:matcher:last"; + "URxvt.keysym.M-Delete" = "perl:matcher:list"; + "URxvt.matcher.button" = "1"; + + # Tabs + "URxvt.tabbedex.autohide" = "false"; + "URxvt.tabbedex.reopen-on-close" = "no"; + "URxvt.keysym.Control-t" = "perl:tabbedex:new_tab"; + "URxvt.keysym.Control-Tab" = "perl:tabbedex:next_tab"; + "URxvt.keysym.Control-Shift-Tab" = "perl:tabbedex:prev_tab"; + "URxvt.keysym.Control-Shift-Left" = "perl:tabbedex:move_tab_left"; + "URxvt.keysym.Control-Shift-Right" = "perl:tabbedex:move_tab_right"; + "URxvt.keysym.Control-Shift-R" = "perl:tabbedex:rename_tab"; + "URxvt.tabbedex.no-tabbedex-keys" = "true"; + "URxvt.tabbedex.new-button" = "yes"; + + # Clipboard + "URxvt.clipboard.autocopy" = "true"; + "URxvt.keysym.Shift-M-C" = "perl:clipboard:copy"; + "URxvt.keysym.Shift-M-V" = "perl:clipboard:paste"; + + # Hacks + "URxvt*skipBuiltinGlyphs" = "true"; + "URxvt.scrollBar" = "false"; + "URxvt.iso14755" = "false"; + "URxvt.iso14755_52" = "false"; + "URxvt.geometry" = "100x50"; + "URxvt.depth" = "32"; + "URxvt.background" = "[95]#32302f"; + + # Font + "URxvt.font" = "xft:Hack:size=9"; + }; + + systemd.user.services = { + urxvtd = { + Unit = { + Description = "Urxvt Terminal Daemon"; + Documentation = "man:urxvtd(1) man:urxvt(1)"; + }; + + Service = { ExecStart = [ "${pkgs.rxvt-unicode}/bin/urxvtd -o -q" ]; }; + + Install = { WantedBy = [ "default.target" ]; }; + }; + }; + }; +} diff --git a/common/home-manager/vim/default.nix b/common/home-manager/vim/default.nix new file mode 100644 index 0000000..ecc72aa --- /dev/null +++ b/common/home-manager/vim/default.nix @@ -0,0 +1,14 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.within.vim; +in { + options.within.vim.enable = mkEnableOption "Enables Within's vim config"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ vim ]; + + home.file.".vimrc".source = ./vimrc; + }; +} diff --git a/common/home-manager/vim/vimrc b/common/home-manager/vim/vimrc new file mode 100644 index 0000000..6ff8445 --- /dev/null +++ b/common/home-manager/vim/vimrc @@ -0,0 +1,91 @@ +" This is like my other vimrc except it needs no plugins + +colorscheme desert + +syntax on +filetype plugin indent on + +set whichwrap=<,>,[,],b, +set backspace=indent,eol,start +set ruler +set number +set cursorline +set cursorcolumn +set background=dark +set autoread + +" Leader +let mapleader = "," +let g:mapleader = "," +nmap w :w! + +" Highlight a line to read over later +nnoremap l ml:execute 'match Search /\%'.line('.').'l/' + +" Turn backup off, since most stuff is in SVN, git et.c anyway... +set nobackup +set nowb +set noswapfile + +" But also have C-like languages use C spacing +" Thanks much jdhore +set ai +au BufRead,BufNewFile *.c,*.h,*.cpp,*.cxx,*.hpp,*.cc,*.c++,*.hh,*.hxx,*.ipp,*.moc,*.tcc,*.inl set cindent +au BufRead,BufNewFile *.c,*.h,*.cpp,*.cxx,*.hpp,*.cc,*.c++,*.hh,*.hxx,*.ipp,*.moc,*.tcc,*.inl set tabstop=8 +au BufRead,BufNewFile *.c,*.h,*.cpp,*.cxx,*.hpp,*.cc,*.c++,*.hh,*.hxx,*.ipp,*.moc,*.tcc,*.inl set shiftwidth=8 +set cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs + +" Python spacing in python +autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 + +au Filetype lolcode setl et ts=4 sw=4 + +au BufRead APKBUILD setl noexpandtab softtabstop=0 tabstop=4 shiftwidth=4 nosmarttab + +" Show tabs +set list +set listchars=tab:>-,trail:~,extends:>,precedes:< + +" status line +set ls=2 +set statusline=%F%m%r%h%w\ >\ FORMAT=%{&ff}\ >\ TYPE=%Y\ >\ BUF=\#%n\ <\ POS=%04l,%04v\ <\ %p%%\ <\ LEN=%L + +" wildmenu +set wildmenu +set wildignore=*.o,*~,*.pyc + +" Delete extra spaces 4 at a time +:highlight ExtraWhitespace ctermbg=red guibg=red +:match ExtraWhitespace /\s\+$/ +:match ExtraWhitespace /\s\+$\| \+\ze\t/ + +" Paste macros +" Thanks to jdhore +map :set paste +map :set nopaste +imap :set paste +imap +set pastetoggle= +map gg=G:w + +" Lvimrc +" if .lvimrc exists in parent directory of loaded file, load it as config +let lvimrc_path = expand('%:p:h') . '/.lvimrc' +if filereadable(lvimrc_path) + execute 'so' lvimrc_path +endif + +" Color column definition +let &colorcolumn="80,100, 110" +highlight ColorColumn ctermbg=52 + +" Delete trailing white space on save, useful for Python and CoffeeScript ;) +func! DeleteTrailingWS() + exe "normal mz" + %s/\s\+$//ge + exe "normal `z" +endfunc +autocmd BufWrite *.py :call DeleteTrailingWS() + +" Spellchecking +map ss :setlocal spell! diff --git a/common/home-manager/wallpapers/thirdsword.png b/common/home-manager/wallpapers/thirdsword.png new file mode 100644 index 0000000..bb001b6 Binary files /dev/null and b/common/home-manager/wallpapers/thirdsword.png differ diff --git a/common/home-manager/weechat/default.nix b/common/home-manager/weechat/default.nix new file mode 100644 index 0000000..1524a8c --- /dev/null +++ b/common/home-manager/weechat/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, nixosConfig, lib, ... }: + +with lib; + +let cfg = config.within.weechat; +in { + options.within.weechat = { + enable = mkEnableOption "Enables weechat-headless"; + hostname = mkOption { + type = types.str; + description = "hostname to enable this on"; + default = "chrysalis"; + }; + }; + + config = mkIf cfg.enable (mkIf (nixosConfig.networking.hostName == cfg.hostname) { + systemd.user.services.weechat = { + Unit.Description = "weechat headless"; + Service.ExecStart = [ "${pkgs.weechat}/bin/weechat-headless --stdout" ]; + Install.WantedBy = [ "default.target" ]; + }; + }); +} diff --git a/common/home-manager/zathura/default.nix b/common/home-manager/zathura/default.nix new file mode 100644 index 0000000..45da9f1 --- /dev/null +++ b/common/home-manager/zathura/default.nix @@ -0,0 +1,15 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.xe.zathura; +in { + options.xe.zathura.enable = mkEnableOption "Zathura PDF/ePub reader"; + config = mkIf cfg.enable { + home = { + packages = with pkgs; [ zathura ]; + + file.".config/zathura/zathurarc".source = ./zathurarc; + }; + }; +} diff --git a/common/home-manager/zathura/zathurarc b/common/home-manager/zathura/zathurarc new file mode 100644 index 0000000..ca476a7 --- /dev/null +++ b/common/home-manager/zathura/zathurarc @@ -0,0 +1,44 @@ +## Gruvbox Dark +set notification-error-bg "#282828" # bg +set notification-error-fg "#fb4934" # bright:red +set notification-warning-bg "#282828" # bg +set notification-warning-fg "#fabd2f" # bright:yellow +set notification-bg "#282828" # bg +set notification-fg "#b8bb26" # bright:green + +set completion-bg "#504945" # bg2 +set completion-fg "#ebdbb2" # fg +set completion-group-bg "#3c3836" # bg1 +set completion-group-fg "#928374" # gray +set completion-highlight-bg "#83a598" # bright:blue +set completion-highlight-fg "#504945" # bg2 + +# Define the color in index mode +set index-bg "#504945" # bg2 +set index-fg "#ebdbb2" # fg +set index-active-bg "#83a598" # bright:blue +set index-active-fg "#504945" # bg2 + +set inputbar-bg "#282828" # bg +set inputbar-fg "#ebdbb2" # fg + +set statusbar-bg "#504945" # bg2 +set statusbar-fg "#ebdbb2" # fg + +set highlight-color "#fabd2f" # bright:yellow +set highlight-active-color "#fe8019" # bright:orange + +set default-bg "#282828" # bg +set default-fg "#ebdbb2" # fg +set render-loading true +set render-loading-bg "#282828" # bg +set render-loading-fg "#ebdbb2" # fg + +# Recolor book content's color +set recolor-lightcolor "#282828" # bg +set recolor-darkcolor "#ebdbb2" # fg +set recolor "true" +# set recolor-keephue true # keep original color + +# use CLIPBOARD, not PRIMARY +set selection-clipboard clipboard diff --git a/common/users/cadey.nix b/common/users/cadey.nix index 7a7df4f..0e79847 100644 --- a/common/users/cadey.nix +++ b/common/users/cadey.nix @@ -26,4 +26,5 @@ ]; }; users.users.root.openssh.authorizedKeys.keys = config.users.users.cadey.openssh.authorizedKeys.keys; + home-manager.users.cadey = (import ./cadey); } diff --git a/common/users/cadey/default.nix b/common/users/cadey/default.nix new file mode 100644 index 0000000..65088ff --- /dev/null +++ b/common/users/cadey/default.nix @@ -0,0 +1,55 @@ +{ pkgs, ... }: +let + name = "Xe"; + email = "me@christine.website"; + commitTemplate = pkgs.writeTextFile { + name = "cadey-commit-template"; + text = '' + Signed-off-by: ${name} <${email}> + ''; + }; +in { + imports = [ ../../home-manager ]; + + within = { + fish.enable = true; + htop.enable = true; + neofetch.enable = true; + powershell.enable = true; + tmux.enable = true; + vim.enable = true; + }; + + services.lorri.enable = true; + home.packages = with pkgs; [ cachix niv nixfmt mosh gist bind unzip ]; + + programs.direnv.enable = true; + programs.direnv.enableFishIntegration = true; + programs.direnv.nix-direnv.enable = true; + programs.direnv.nix-direnv.enableFlakes = true; + + programs.git = { + package = pkgs.gitAndTools.gitFull; + enable = true; + userName = name; + userEmail = email; + ignores = [ "*~" "*.swp" "*.#" ]; + delta.enable = true; + extraConfig = { + commit.template = "${commitTemplate}"; + core.editor = "vim"; + color.ui = "auto"; + credential.helper = "store --file ~/.git-credentials"; + format.signoff = true; + init.defaultBranch = "main"; + protocol.keybase.allow = "always"; + pull.rebase = "true"; + push.default = "current"; + + url = { + "git@github.com:".insteadOf = "https://github.com/"; + "git@ssh.tulpa.dev:".insteadOf = "https://tulpa.dev/"; + }; + }; + }; +} diff --git a/common/users/mai/default.nix b/common/users/mai/default.nix new file mode 100644 index 0000000..fdd0a80 --- /dev/null +++ b/common/users/mai/default.nix @@ -0,0 +1,33 @@ +{ config, pkgs, ... }: + +{ + imports = [ ../../home-manager ]; + + within = { + emacs.enable = true; + fish.enable = true; + tmux.enable = true; + tmux.shortcut = "a"; + vim.enable = true; + }; + + programs.direnv = { + enable = true; + enableFishIntegration = true; + nix-direnv = { + enable = true; + enableFlakes = true; + }; + }; + + nixpkgs.config = { + allowBroken = true; + allowUnfree = true; + + packageOverrides = import ../../../pkgs; + + manual.manpages.enable = true; + }; + + services.lorri.enable = true; +} diff --git a/common/users/other.nix b/common/users/other.nix index 6e078bd..bccf909 100644 --- a/common/users/other.nix +++ b/common/users/other.nix @@ -23,6 +23,8 @@ in { ]; }; + home-manager.users.mai = (import ./mai); + users.users.vic = { isNormalUser = true; extraGroups = [ "wheel" "libvirtd" "adbusers" "dialout" "within" ]; @@ -32,5 +34,7 @@ in { "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIChFSS2KUKbGYFrkbO2VwxuWqFkCSdzbxh68Edk+Pkss victo@Nami" ]; }; + + home-manager.users.vic = (import ./vic); }; } diff --git a/common/users/vic/default.nix b/common/users/vic/default.nix new file mode 100644 index 0000000..4fb2671 --- /dev/null +++ b/common/users/vic/default.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: + +{ + imports = [ ../../home-manager ]; + + within.powershell.enable = true; + within.vim.enable = true; + + home.packages = [ pkgs.vim ]; + + programs.git = { + enable = true; + userName = "Victor Fernandes"; + userEmail = "victorvalenca@gmail.com"; + ignores = [ "*~" "*.swp" "*.#" ]; + delta.enable = true; + extraConfig = { + core.editor = "vim"; + credential.helper = "store --file ~/.git-credentials"; + format.signoff = true; + init.defaultBranch = "main"; + pull.rebase = "true"; + + url = { + "git@github.com:".insteadOf = "https://github.com/"; + "git@ssh.tulpa.dev:".insteadOf = "https://tulpa.dev/"; + }; + }; + }; +}