diff options
-rw-r--r-- | lib/common.nix | 602 | ||||
-rw-r--r-- | lib/const.nix | 2 | ||||
-rw-r--r-- | lib/linux.nix | 164 | ||||
-rw-r--r-- | lib/polybar.nix | 148 | ||||
-rw-r--r-- | lib/theme.nix | 24 | ||||
-rw-r--r-- | lib/urxvt.nix | 24 | ||||
-rw-r--r-- | lib/vimrc | 327 | ||||
-rw-r--r-- | profiles/beryllium.nix | 85 | ||||
-rw-r--r-- | profiles/laptop.nix | 6 | ||||
-rw-r--r-- | profiles/workshop.nix | 6 |
10 files changed, 772 insertions, 616 deletions
diff --git a/lib/common.nix b/lib/common.nix index 7ddff12..3b61b81 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -63,319 +63,326 @@ in { fonts.fontconfig.enable = true; - programs = { - home-manager = { - enable = true; + programs.home-manager.enable = true; + + programs.bat = { + enable = true; + config = { theme = "catppuccin"; }; + themes = { + catppuccin = builtins.readFile (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "d714cc1d358ea51bfc02550dabab693f70cccea0"; + hash = "sha256-Q5B4NDrfCIK3UAMs94vdXnR42k4AXCqZz6sRn8bzmf4="; + } + "/themes/Catppuccin Latte.tmTheme"); }; + }; - starship = { - # export PS1='$(printf "%3.*s" $? $?)ϟ ' - enable = true; - settings = { - format = lib.concatStrings [ - #"$username" - "$hostname" - "$directory" - "$git_branch" - "$git_state" - "$git_status" - "$cmd_duration" - "$line_break" - "$character" - ]; - directory.style = "blue"; - character = { - success_symbol = "[ϟ](white)"; - error_symbol = "[ϟ](red)"; - }; - git_branch = { - format = "[$branch]($style)"; - style = "bright-black"; - }; - git_status = { - format = - ''[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)''; - style = "cyan"; - conflicted = ""; - untracked = ""; - modified = ""; - staged = ""; - renamed = ""; - deleted = ""; - stashed = "≡"; - }; - git_state = { - format = "\([$state( $progress_current/$progress_total)]($style)\) "; - style = "bright-black"; - }; - - cmd_duration = { - format = "[$duration]($style) "; - style = "yellow"; - }; + programs.starship = { + # export PS1='$(printf "%3.*s" $? $?)ϟ ' + enable = true; + settings = { + format = lib.concatStrings [ + #"$username" + "$hostname" + "$directory" + "$git_branch" + "$git_state" + "$git_status" + "$cmd_duration" + "$line_break" + "$character" + ]; + directory.style = "blue"; + character = { + success_symbol = "[ϟ](white)"; + error_symbol = "[ϟ](red)"; }; - }; - - readline = { - enable = true; - variables = { - keyseq-timeout = 1200; - colored-stats = true; - colored-completion-prefix = true; - expand-tilde = true; + git_branch = { + format = "[$branch]($style)"; + style = "bright-black"; }; - bindings = { - # wrap a command in '$(...| fzf)' - "\\C-xf" = ''"\C-e | fzf)\C-a(\C-a$\C-b\C-a"''; - "\\e\\C-f" = "dump-functions"; # help - "\\e\\C-o" = "dabbrev-expand"; # expand - "\\e\\C-v" = "dump-variables"; # help - "\\em" = "beginning-of-line"; - # emacs-like history navigation - "\\en" = "next-history"; - "\\ep" = "previous-history"; - # groq-specific stuff - "\\er" = "redraw-current-line"; - "\\C-xt" = ''"$(_bake_targets)\e\C-e\er"''; + git_status = { + format = + ''[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)''; + style = "cyan"; + conflicted = ""; + untracked = ""; + modified = ""; + staged = ""; + renamed = ""; + deleted = ""; + stashed = "≡"; }; - extraConfig = '' - $if Guile - "\C-o": "()\C-b" - $endif - ''; - }; - - fzf = { - enable = true; - enableBashIntegration = true; - defaultCommand = "rg --files"; - changeDirWidgetCommand = "fd --type d"; # M-c - changeDirWidgetOptions = ["--preview 'tree -C {} | head -100'"]; - fileWidgetCommand = "fd --type f"; - fileWidgetOptions = ["--preview 'head -n100 {}'"]; - historyWidgetOptions = ["--sort" "--exact"]; - tmux.enableShellIntegration = true; - tmux.shellIntegrationOptions = [ "-p 70%" ]; - }; - - git = { - enable = true; - userName = "Ben Sima"; - userEmail = "ben@bsima.me"; - ignores = [ "*~" "*.swp" ]; - package = pkgs.gitAndTools.gitFull; - signing = { - key = gpgid; - # for some reason this fails... - #gpgPath = - # let - # script = pkgs.writeScriptBin "my-ots-git-gpg-wrapper" '' - # #!/usr/bin/env bash - # set -euxo pipefail - # ${pkgs.opentimestamps-client}/bin/ots-git-gpg-wrapper --gpg-program ${pkgs.gnupg}/bin/gpg $@ - # ''; - # in - # "${script}/bin/my-ots-git-gpg-wrapper"; + git_state = { + format = "\([$state( $progress_current/$progress_total)]($style)\) "; + style = "bright-black"; }; - aliases = { - authors = "shortlog -s -n"; - slog = "log --stat"; - glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; - logbr = "log -r origin/HEAD..HEAD"; - mylog = ''!git log --author=$USER --decorate --pretty=format:"%Cred%h%Creset %s%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; - mrd = "!cat <(git shortlog origin/HEAD..HEAD) <(git diff --stat origin/HEAD...HEAD)"; - extend = "!git commit --fixup $1 && git rebase --autosquash $1~"; - mr = lib.concatStringsSep " " [ - "!git push" - "-o merge_request.create" - "-o merge_request.merge_when_pipeline_succeeds" - "-o merge_request.label=ReleaseUpdate::NotRequired" - "-o merge_request.assign=$USER" - # disable these two args bc gitlab just uses the commit message anyway - # ''-o merge_request.title="$(git log -n1 --format=%s)"'' - # ''-o merge_request.description="$(git log -n --format=%b)"'' - ]; - }; - extraConfig = { - commit.template = "${./git-commit-template}"; - commit.verbose = "true"; - fetch.showForcedUpdate = "false"; - init.defaultBranch = "main"; - log.date = "local"; - merge.tool = "fugitive"; - mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"''; - pull.rebase = "true"; - push.default = "current"; - remote.pushDefault = "origin"; - sendemail = { - #smtpuser = "ben@bsima.me"; - #smtpserverport = 587; - smtpserver = "${homedir}/bin/sendmail"; - chainreplyto = false; - composeencoding = "UTF-8"; - annotate = "yes"; - cccmd = "git-contacts"; - }; + + cmd_duration = { + format = "[$duration]($style) "; + style = "yellow"; }; }; + }; - jujutsu = { - enable = true; - enableBashIntegration = true; + programs.readline = { + enable = true; + variables = { + keyseq-timeout = 1200; + colored-stats = true; + colored-completion-prefix = true; + expand-tilde = true; }; - - tmux = { - enable = true; - aggressiveResize = false; - baseIndex = 0; - clock24 = true; - customPaneNavigationAndResize = false; - disableConfirmationPrompt = false; - escapeTime = 0; - historyLimit = 10000; - keyMode = "emacs"; - newSession = false; - resizeAmount = 5; - reverseSplit = false; - secureSocket = false; - sensibleOnTop = true; - #shell = "${pkgs.bash}/bin/bash"; - shortcut = "a"; - terminal = "xterm-256color"; - tmuxinator.enable = false; - tmuxp.enable = false; - - extraConfig = '' - # Automatically set window title - set-window-option -g automatic-rename on - set-option -g set-titles on - set -g xterm-keys on - setw -g mouse on - ## Panes - # Split panes - bind-key | split-window -h -c "#{pane_current_path}" - bind-key - split-window -v -c "#{pane_current_path}" - # Send/join panes - bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" - bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" - # Use Alt-vim keys without prefix key to switch panes - bind -n M-h select-pane -L - bind -n M-j select-pane -D - bind -n M-k select-pane -U - bind -n M-l select-pane -R - # Use Alt-vim capitalized keys without prefix key to resize panes - bind -n M-H resize-pane -L - bind -n M-J resize-pane -D - bind -n M-K resize-pane -U - bind -n M-L resize-pane -R - # Shift arrow to switch windows - bind -n S-Left previous-window - bind -n S-Right next-window - # Set current window pane to 80 columns - bind-key E resize-pane -x 80 - # cycle pane layout - bind-key N next-layout - bind-key P previous-layout - # Toggle synchronizing panes - bind-key y setw synchronize-panes - ## Text manipulation - # vim-like copy/paste - setw -g mode-keys vi - bind [ copy-mode - bind ] paste-buffer - # copy/paste with xclip - bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' - # select buffer to paste from - bind Space choose-buffer - # status line text - set -g status-left-length 30 - set -g status-left '#S | #(whoami)@#(hostname) | ' - set -g status-right '~%Y.%m.%d..%H.%M' - set -g renumber-windows on - # white-ish background with dark-grey text - set -g status-style bg=colour0,fg=colour13 - # highlight current window - set -g window-status-current-style fg=colour0,bg=colour13 - set -g window-status-format '#I) #W ' - set -g window-status-current-format '#I) #W ' - # special thing for groq's SFT thing - set -g update-environment "SFT_AUTH_SOCK SSH_AUTH_SOCK SSH_CONNECTION" - ''; - - plugins = with pkgs.tmuxPlugins; [ - extrakto - tmux-fzf - ]; + bindings = { + # wrap a command in '$(...| fzf)' + "\\C-xf" = ''"\C-e | fzf)\C-a(\C-a$\C-b\C-a"''; + "\\e\\C-f" = "dump-functions"; # help + "\\e\\C-o" = "dabbrev-expand"; # expand + "\\e\\C-v" = "dump-variables"; # help + "\\em" = "beginning-of-line"; + # emacs-like history navigation + "\\en" = "next-history"; + "\\ep" = "previous-history"; + # groq-specific stuff + "\\er" = "redraw-current-line"; + "\\C-xt" = ''"$(_bake_targets)\e\C-e\er"''; }; + extraConfig = '' + $if Guile + "\C-o": "()\C-b" + $endif + ''; + }; - urxvt = let font = name: size: "xft:${name}:size=${toString size}:ant"; in { - enable = true; - fonts = [ - (font "Fira Code" fontSize) - (font "FiraCodeNerdfont" fontSize) - "xft:Noto Emoji" - ]; - #keybindings = { - # # why don't any of these work? - # "Shift-Control-C" = "eval:selection_to_clipboard"; - # "Shift-Control-V" = "eval:paste_clipboard"; - # "Shift-Control-+" = "command:\033]710;${font 12}\007\033]711;${font 12}\007"; - # "Shift-Control--" = "command:\033]710;${font 8}\007\033]711;${font 8}\007"; - #}; - iso14755 = true; # unicode chars - #transparent = true; - #shading = 10; + programs.fzf = { + enable = true; + enableBashIntegration = true; + colors = { + # catppuccin-latte + # https://github.com/catppuccin/fzf + # TODO: use catppuccin/nix, and swtich based on xtheme + "bg+" = "#ccd0da"; + "bg" = "#eff1f5"; + "spinner" = "#dc8a78"; + "hl" = "#d20f39"; + "fg" = "#4c4f69"; + "header" = "#d20f39"; + "info" = "#8839ef"; + "pointer" = "#dc8a78 "; + "marker" = "#dc8a78"; + "fg+" = "#4c4f69"; + "prompt" = "#8839ef"; + "hl+" = "#d20f39"; }; + defaultCommand = "rg --files"; + changeDirWidgetCommand = "fd --type d"; # M-c + changeDirWidgetOptions = ["--preview 'tree -C {} | head -100'"]; + fileWidgetCommand = "fd --type f"; + fileWidgetOptions = ["--preview 'head -n100 {}'"]; + historyWidgetOptions = ["--sort" "--exact"]; + tmux.enableShellIntegration = true; + tmux.shellIntegrationOptions = [ "-p 70%" ]; + }; - direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; + programs.git = { + enable = true; + userName = "Ben Sima"; + userEmail = "ben@bsima.me"; + ignores = [ "*~" "*.swp" ]; + package = pkgs.gitAndTools.gitFull; + signing = { + key = gpgid; + # for some reason this fails... + #gpgPath = + # let + # script = pkgs.writeScriptBin "my-ots-git-gpg-wrapper" '' + # #!/usr/bin/env bash + # set -euxo pipefail + # ${pkgs.opentimestamps-client}/bin/ots-git-gpg-wrapper --gpg-program ${pkgs.gnupg}/bin/gpg $@ + # ''; + # in + # "${script}/bin/my-ots-git-gpg-wrapper"; }; - - vim = { - enable = true; - #vimAlias = true; - #viAlias = true; - #vimdiffAlias = true; - plugins = with pkgs.vimPlugins; [ - base16-vim - editorconfig-vim - vim-sensible - vim-fugitive - vim-colors-solarized - vim-sexp-mappings-for-regular-people - # vim-ripgrep # not in nixpkgs :( - rainbow_parentheses - vim-plug # just in case - vim-addon-local-vimrc - fzf-vim - (pkgs.vimUtils.buildVimPlugin { - pname = "photon.vim"; - version = "2022.03.14"; - src = pkgs.fetchFromGitHub { - owner = "axvr"; - repo = "photon.vim"; - rev = "32b42c8a12bf9588259b76f3df6807960e0d7386"; - sha256 = "sha256-kM7WP03uE20yr0nCusB3ncHzgtEYxqNzoNoQGen9p+o="; - }; - meta.homepage = "https://github.com/axvr/photon.vim"; - }) - (pkgs.vimUtils.buildVimPlugin { - pname = "skull-vim"; - version = "2022.03.14"; - src = pkgs.fetchFromGitHub { - owner = "kadekillary"; - repo = "skull-vim"; - rev = "abb9d7120c63aad6f9acc26d31c948a93f352e94"; - sha256 = "sha256-tu5aDRjHZtXKoyQBbMEhzjGrRl4GZD121ybs7oNylvs="; - }; - meta.homepage = "https://github.com/kadekillary/skull-vim"; - }) + aliases = { + authors = "shortlog -s -n"; + slog = "log --stat"; + glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; + logbr = "log -r origin/HEAD..HEAD"; + mylog = ''!git log --author=$USER --decorate --pretty=format:"%Cred%h%Creset %s%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; + mrd = "!cat <(git shortlog origin/HEAD..HEAD) <(git diff --stat origin/HEAD...HEAD)"; + extend = "!git commit --fixup $1 && git rebase --autosquash $1~"; + mr = lib.concatStringsSep " " [ + "!git push" + "-o merge_request.create" + "-o merge_request.merge_when_pipeline_succeeds" + "-o merge_request.label=ReleaseUpdate::NotRequired" + "-o merge_request.assign=$USER" + # disable these two args bc gitlab just uses the commit message anyway + # ''-o merge_request.title="$(git log -n1 --format=%s)"'' + # ''-o merge_request.description="$(git log -n --format=%b)"'' ]; - extraConfig = builtins.readFile ./vimrc; }; + extraConfig = { + commit.template = "${./git-commit-template}"; + commit.verbose = "true"; + fetch.showForcedUpdate = "false"; + init.defaultBranch = "main"; + log.date = "local"; + merge.tool = "fugitive"; + mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"''; + pull.rebase = "true"; + push.default = "current"; + remote.pushDefault = "origin"; + sendemail = { + #smtpuser = "ben@bsima.me"; + #smtpserverport = 587; + smtpserver = "${homedir}/bin/sendmail"; + chainreplyto = false; + composeencoding = "UTF-8"; + annotate = "yes"; + cccmd = "git-contacts"; + }; + }; + }; + programs.jujutsu = { + enable = true; + enableBashIntegration = true; + }; + + programs.tmux = { + enable = true; + aggressiveResize = false; + baseIndex = 0; + clock24 = true; + customPaneNavigationAndResize = false; + disableConfirmationPrompt = false; + escapeTime = 0; + historyLimit = 10000; + keyMode = "emacs"; + newSession = false; + resizeAmount = 5; + reverseSplit = false; + secureSocket = false; + sensibleOnTop = true; + #shell = "${pkgs.bash}/bin/bash"; + shortcut = "a"; + terminal = "xterm-256color"; + tmuxinator.enable = false; + tmuxp.enable = false; + extraConfig = '' + # Automatically set window title + set-window-option -g automatic-rename on + set-option -g set-titles on + set -g xterm-keys on + setw -g mouse on + ## Panes + # Split panes + bind-key | split-window -h -c "#{pane_current_path}" + bind-key - split-window -v -c "#{pane_current_path}" + # Send/join panes + bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" + bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" + # Use Alt-vim keys without prefix key to switch panes + bind -n M-h select-pane -L + bind -n M-j select-pane -D + bind -n M-k select-pane -U + bind -n M-l select-pane -R + # Use Alt-vim capitalized keys without prefix key to resize panes + bind -n M-H resize-pane -L + bind -n M-J resize-pane -D + bind -n M-K resize-pane -U + bind -n M-L resize-pane -R + # Shift arrow to switch windows + bind -n S-Left previous-window + bind -n S-Right next-window + # Set current window pane to 80 columns + bind-key E resize-pane -x 80 + # cycle pane layout + bind-key N next-layout + bind-key P previous-layout + # Toggle synchronizing panes + bind-key y setw synchronize-panes + ## Text manipulation + # vim-like copy/paste + setw -g mode-keys vi + bind [ copy-mode + bind ] paste-buffer + # copy/paste with xclip + bind-key -Tcopy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' + # select buffer to paste from + bind Space choose-buffer + # status line text + set -g status-left-length 30 + set -g status-left '#S | #(whoami)@#(hostname) | ' + set -g status-right '~%Y.%m.%d..%H.%M' + set -g renumber-windows on + # white-ish background with dark-grey text + set -g status-style bg=colour0,fg=colour13 + # highlight current window + set -g window-status-current-style fg=colour0,bg=colour13 + set -g window-status-format '#I) #W ' + set -g window-status-current-format '#I) #W ' + # special thing for groq's SFT thing + set -g update-environment "SFT_AUTH_SOCK SSH_AUTH_SOCK SSH_CONNECTION" + ''; + plugins = with pkgs.tmuxPlugins; [ + extrakto + tmux-fzf + ]; + }; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + programs.vim = { + enable = true; + #vimAlias = true; + #viAlias = true; + #vimdiffAlias = true; + plugins = with pkgs.vimPlugins; [ + base16-vim + catppuccin-vim + editorconfig-vim + vim-sensible + vim-fugitive + vim-sexp-mappings-for-regular-people + # vim-ripgrep # not in nixpkgs :( + rainbow_parentheses + vim-plug # just in case + vim-addon-local-vimrc + fzf-vim + (pkgs.vimUtils.buildVimPlugin { + pname = "photon.vim"; + version = "2022.03.14"; + src = pkgs.fetchFromGitHub { + owner = "axvr"; + repo = "photon.vim"; + rev = "32b42c8a12bf9588259b76f3df6807960e0d7386"; + sha256 = "sha256-kM7WP03uE20yr0nCusB3ncHzgtEYxqNzoNoQGen9p+o="; + }; + meta.homepage = "https://github.com/axvr/photon.vim"; + }) + (pkgs.vimUtils.buildVimPlugin { + pname = "skull-vim"; + version = "2022.03.14"; + src = pkgs.fetchFromGitHub { + owner = "kadekillary"; + repo = "skull-vim"; + rev = "abb9d7120c63aad6f9acc26d31c948a93f352e94"; + sha256 = "sha256-tu5aDRjHZtXKoyQBbMEhzjGrRl4GZD121ybs7oNylvs="; + }; + meta.homepage = "https://github.com/kadekillary/skull-vim"; + }) + ]; + extraConfig = builtins.readFile ./vimrc; + }; + + programs = { info.enable = true; man.enable = true; @@ -509,12 +516,11 @@ in { bind '"\C- ": "$(p)\e\C-e\er"' ''; shellAliases = { - q = "que"; - qd = ''que pub/bsnotify - <<< "done"''; ".." = "__HM_SESS_VARS_SOURCED= ."; day = "date +%a"; ddate = "date +%Y.%m.%d"; dday = "date +%A"; + dr = "direnv reload"; e = "emacsclient -nw"; # emacs in a terminal f = "fossil"; g = "git"; @@ -529,6 +535,8 @@ in { gs = "git status -sb"; hs = "NIX_PATH=$HOME/.nix-defexpr/channels$\{NIX_PATH:+:\}$NIX_PATH home-manager switch"; ll = "ls -lah"; + q = "que"; + qd = ''que pub/bsnotify - <<< "done"''; rm = "rm -i"; s = '' INITIAL_QUERY="" && \ diff --git a/lib/const.nix b/lib/const.nix index ce1f11b..be27d9d 100644 --- a/lib/const.nix +++ b/lib/const.nix @@ -1,5 +1,5 @@ { - fontSize = 14; + fontSize = 12; homedir = builtins.getEnv "HOME"; gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD"; } diff --git a/lib/linux.nix b/lib/linux.nix index e80b71f..ba0fbdf 100644 --- a/lib/linux.nix +++ b/lib/linux.nix @@ -2,24 +2,9 @@ let inherit (import ./const.nix) fontSize homedir gpgid; - base16-scheme = "atelier-sulphurpool"; - base16-scheme-filename = lib.strings.concatStrings (lib.strings.splitString "-" base16-scheme); - theme = lib.removeSuffix "\n" (builtins.readFile "${homedir}/.local/share/xtheme"); - xresourcesFile = "${pkgs.base16}/xresources/base16-${base16-scheme-filename}.${theme}.256.xresources"; - - # used in polybar and dunst - colors = { # derived from spacemacs - "dark" = { - highlight = "#5d4d7a"; - background = "#292b2e"; - foreground = "#b2b2b2"; - }; - "light" = { - highlight = "#67b11d"; - background = "#f6f1e1"; - foreground = "#655370"; - }; - }; + inherit (import ./theme.nix { inherit pkgs lib; }) + theme colors base16-scheme base16-scheme-filename + xresourcesFile; xmonadPackages = self: [ self.xmonad-contrib #self.taffybar # fails to build @@ -30,6 +15,10 @@ in { imports = [ ./common.nix + + # nix-channel --add https://github.com/catppuccin/nix/archive/main.tar.gz catppuccin + #<catppuccin/modules/home-manager> + ]; home = { pointerCursor = { @@ -100,6 +89,10 @@ in zathura ]; }; + + #catppuccin.flavor = "latte"; + #catppuccin.enable = true; + fonts.fontconfig.enable = true; gtk.enable = false; # this fails because of some missing service file @@ -140,141 +133,6 @@ in postExec = "${pkgs.notmuch}/bin/notmuch new"; }; - polybar = { - # https://github.com/0x746866/dots/blob/master/polybar/config - enable = true; - config = { - "bar/top" = { - background = colors."${theme}".background; - font-0 = "FiraSans:size=${toString fontSize}"; - font-1 = "Font Awesome 5:pixelsize=11;1"; - font-2 = "MaterialIcons:size=10:antialias=false;2"; - foreground = colors."${theme}".foreground; - height = "30"; - module-margin = 1; - modules-center = "date"; - modules-left = ["ewmh" "volume-bar"]; - modules-right = [ "battery" "cpu" "mem" "temp" ]; - monitor = "\${env:MONITOR:HDMI-2}"; - monitor-fallback = "\${env:MONITOR:eDP-1}"; - radius = 0; - separator = "|"; - tray-background = colors."${theme}".background; - tray-detached = false; - tray-maxsize = 16; - tray-offset-x = 0; - tray-offset-y = 0; - tray-padding = 0; - tray-position = "right"; - tray-scale = 1; - width = "100%"; - }; - "module/ewmh" = { - type = "internal/xworkspaces"; - label-active-foreground = "#fff"; - }; - "module/date" = { - type = "internal/date"; - internal = 5; - date = "%Y.%m.%d"; - time = "%H.%M"; - label = "%date%..%time%"; - }; - "module/battery" = { - type = "internal/battery"; - battery = "BAT0"; - adapter = "AC"; - full-at = 99; - }; - "module/volume-bar" = { - type = "internal/alsa"; - master-soundcard = "hw:1"; - bar-volume-font = 2; - bar-volume-width = 9; - format-volume = "<label-volume><bar-volume>"; - label-volume = " .) "; - label-muted = " .) mute"; - label-volume-foreground = colors.${theme}.foreground; - format-muted-foreground = colors.${theme}.foreground; - bar-volume-foreground-0 = colors.${theme}.foreground; - bar-volume-foreground-1 = colors.${theme}.foreground; - bar-volume-foreground-2 = colors.${theme}.foreground; - bar-volume-foreground-3 = colors.${theme}.foreground; - bar-volume-foreground-4 = colors.${theme}.foreground; - bar-volume-foreground-5 = colors.${theme}.foreground; - bar-volume-foreground-6 = colors.${theme}.foreground; - bar-volume-gradient = true; - bar-volume-indicator = "•"; - bar-volume-fill = "•"; - bar-volume-empty = "·"; - bar-volume-empty-foreground = colors.${theme}.foreground; - }; - "module/ethernet" = { - type = "internal/network"; - interface = "enp1s0"; - label-connected = "eth up: %upspeed:9% down: %downspeed%"; - label-disconnected = "no eth"; - }; - "module/wifi" = { - type = "internal/network"; - interface = "wlan1"; - label-connected = "wifi up: %upspeed% down: %downspeed%"; - label-disconnected = "no wifi"; - }; - "module/cpu" = { - type = "internal/cpu"; - interval = 3; - format-padding = 1; - format = "<label> <ramp-coreload>"; - label = " %percentage:2%%"; - ramp-coreload-0 = "▂"; - ramp-coreload-1 = "▃"; - ramp-coreload-2 = "▄"; - ramp-coreload-3 = "▅"; - ramp-coreload-4 = "▆"; - ramp-coreload-5 = "▇"; - ramp-coreload-0-foreground = colors.${theme}.foreground; - ramp-coreload-1-foreground = colors.${theme}.foreground; - ramp-coreload-2-foreground = colors.${theme}.foreground; - ramp-coreload-3-foreground = colors.${theme}.foreground; - ramp-coreload-4-foreground = colors.${theme}.foreground; - ramp-coreload-5-foreground = colors.${theme}.highlight; - }; - "module/temp" = { - type = "internal/temperature"; - interval = 3; - thermal-zone = 0; - warn-temperature = 70; - format = "<ramp> <label>"; - format-padding = 1; - label = "%temperature-c%"; - ramp-0 = "_"; - ramp-1 = "."; - ramp-2 = ":"; - ramp-3 = "|"; - ramp-4 = "!!"; - ramp-0-foreground = colors.${theme}.foreground; - ramp-1-foreground = colors.${theme}.foreground; - ramp-2-foreground = colors.${theme}.foreground; - ramp-3-foreground = colors.${theme}.foreground; - ramp-4-foreground = colors.${theme}.highlight; - format-warn = "<label-warn>"; - label-warn = " %temperature-c%"; - label-warn-padding = 1; - label-warn-foreground = colors.${theme}.highlight; - }; - "module/mem" = { - type = "internal/memory"; - interval = 3; - format = "<label>"; - label-padding = 1; - label = " |[]| %percentage_used%%"; - }; - }; - script = '' - polybar top & - ''; - }; dunst = { enable = true; diff --git a/lib/polybar.nix b/lib/polybar.nix new file mode 100644 index 0000000..3c454cb --- /dev/null +++ b/lib/polybar.nix @@ -0,0 +1,148 @@ +# https://github.com/0x746866/dots/blob/master/polybar/config +{ pkgs, lib, ... }: +let + inherit (import ./const.nix) fontSize homedir; + inherit (import ./theme.nix { inherit pkgs lib; }) + colors theme; +in { + services.polybar = { + config = { + + "bar/top" = { + background = colors."${theme}".background; + font-0 = "FiraSans:size=${toString fontSize}"; + font-1 = "Font Awesome 5:pixelsize=11;1"; + font-2 = "MaterialIcons:size=10:antialias=false;2"; + foreground = colors."${theme}".foreground; + height = "30"; + module-margin = 1; + modules-center = "date"; + modules-left = ["ewmh" "volume-bar"]; + modules-right = [ "battery" "cpu" "mem" "temp" ]; + radius = 0; + separator = "|"; + tray-background = colors."${theme}".background; + tray-detached = false; + tray-maxsize = 16; + tray-offset-x = 0; + tray-offset-y = 0; + tray-padding = 0; + tray-position = "right"; + tray-scale = 1; + width = "100%"; + }; + + "module/ewmh" = { + type = "internal/xworkspaces"; + label-active-foreground = "#fff"; + }; + + "module/date" = { + type = "internal/date"; + internal = 5; + date = "%Y.%m.%d"; + time = "%H.%M"; + label = "%date%..%time%"; + }; + + "module/battery" = { + type = "internal/battery"; + battery = "BAT0"; + adapter = "AC"; + full-at = 99; + }; + + "module/volume-bar" = { + type = "internal/alsa"; + master-soundcard = "hw:1"; + bar-volume-font = 2; + bar-volume-width = 9; + format-volume = "<label-volume><bar-volume>"; + label-volume = " .) "; + label-muted = " .) mute"; + label-volume-foreground = colors.${theme}.foreground; + format-muted-foreground = colors.${theme}.foreground; + bar-volume-foreground-0 = colors.${theme}.foreground; + bar-volume-foreground-1 = colors.${theme}.foreground; + bar-volume-foreground-2 = colors.${theme}.foreground; + bar-volume-foreground-3 = colors.${theme}.foreground; + bar-volume-foreground-4 = colors.${theme}.foreground; + bar-volume-foreground-5 = colors.${theme}.foreground; + bar-volume-foreground-6 = colors.${theme}.foreground; + bar-volume-gradient = true; + bar-volume-indicator = "•"; + bar-volume-fill = "•"; + bar-volume-empty = "·"; + bar-volume-empty-foreground = colors.${theme}.foreground; + }; + + "module/ethernet" = { + type = "internal/network"; + interface = "enp1s0"; + label-connected = "eth up: %upspeed:9% down: %downspeed%"; + label-disconnected = "no eth"; + }; + + "module/wifi" = { + type = "internal/network"; + interface = "wlan1"; + label-connected = "wifi up: %upspeed% down: %downspeed%"; + label-disconnected = "no wifi"; + }; + + "module/cpu" = { + type = "internal/cpu"; + interval = 3; + format-padding = 1; + format = "<label> <ramp-coreload>"; + label = " %percentage:2%%"; + ramp-coreload-0 = "▂"; + ramp-coreload-1 = "▃"; + ramp-coreload-2 = "▄"; + ramp-coreload-3 = "▅"; + ramp-coreload-4 = "▆"; + ramp-coreload-5 = "▇"; + ramp-coreload-0-foreground = colors.${theme}.foreground; + ramp-coreload-1-foreground = colors.${theme}.foreground; + ramp-coreload-2-foreground = colors.${theme}.foreground; + ramp-coreload-3-foreground = colors.${theme}.foreground; + ramp-coreload-4-foreground = colors.${theme}.foreground; + ramp-coreload-5-foreground = colors.${theme}.highlight; + }; + + "module/temp" = { + type = "internal/temperature"; + interval = 3; + thermal-zone = 0; + warn-temperature = 70; + format = "<ramp> <label>"; + format-padding = 1; + label = "%temperature-c%"; + ramp-0 = "_"; + ramp-1 = "."; + ramp-2 = ":"; + ramp-3 = "|"; + ramp-4 = "!!"; + ramp-0-foreground = colors.${theme}.foreground; + ramp-1-foreground = colors.${theme}.foreground; + ramp-2-foreground = colors.${theme}.foreground; + ramp-3-foreground = colors.${theme}.foreground; + ramp-4-foreground = colors.${theme}.highlight; + format-warn = "<label-warn>"; + label-warn = " %temperature-c%"; + label-warn-padding = 1; + label-warn-foreground = colors.${theme}.highlight; + }; + + "module/mem" = { + type = "internal/memory"; + interval = 3; + format = "<label>"; + label-padding = 1; + label = " |[ %percentage_used%% ]|"; + }; + + }; + }; +} + diff --git a/lib/theme.nix b/lib/theme.nix new file mode 100644 index 0000000..1020514 --- /dev/null +++ b/lib/theme.nix @@ -0,0 +1,24 @@ +{ pkgs, lib }: +let + inherit (import ./const.nix) homedir; +in rec { + theme = lib.removeSuffix "\n" (builtins.readFile "${homedir}/.local/share/xtheme"); + + base16-scheme = "atelier-sulphurpool"; + base16-scheme-filename = lib.strings.concatStrings (lib.strings.splitString "-" base16-scheme); + xresourcesFile = "${pkgs.base16}/xresources/base16-${base16-scheme-filename}.${theme}.256.xresources"; + + + colors = { # derived from spacemacs + "dark" = { + highlight = "#5d4d7a"; + background = "#292b2e"; + foreground = "#b2b2b2"; + }; + "light" = { + highlight = "#67b11d"; + background = "#f6f1e1"; + foreground = "#655370"; + }; + }; +} diff --git a/lib/urxvt.nix b/lib/urxvt.nix new file mode 100644 index 0000000..7fe2351 --- /dev/null +++ b/lib/urxvt.nix @@ -0,0 +1,24 @@ +{ ... }: +let + #inherit (import ./const.nix) fontSize; + fontSize = 10; +in { + programs.urxvt = let font = name: size: "xft:${name}:size=${toString size}:ant"; in { + enable = true; + fonts = [ + (font "Fira Code" fontSize) + (font "FiraCodeNerdfont" fontSize) + "xft:Noto Emoji" + ]; + #keybindings = { + # # why don't any of these work? + # "Shift-Control-C" = "eval:selection_to_clipboard"; + # "Shift-Control-V" = "eval:paste_clipboard"; + # "Shift-Control-+" = "command:\033]710;${font 12}\007\033]711;${font 12}\007"; + # "Shift-Control--" = "command:\033]710;${font 8}\007\033]711;${font 8}\007"; + #}; + iso14755 = true; # unicode chars + #transparent = true; + #shading = 10; + }; +} @@ -111,172 +111,173 @@ function! <SID>SynStack() echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunc -set background=dark +set background=light "let g:colors_name = 'bs_monochrome' -let s:white = ['White', 15] -let s:black = ['#0e1111', 16] -let s:dblack = ['#111111', 1] -let s:bgray = ['#181818', 233] -let s:lgray = ['LightGray', 255] -let s:cgray = ['#737373', 243] -let s:dgray = ['DarkGray', 248] -let s:sblue = ['LightBlue', 67] -let s:yellow = ['LightYellow', 226] -let s:red = ['DarkRed', 160] -let s:green = ['DarkGreen', 28] -let s:purple = ['LightMagenta', 13] - -let s:default_fg = s:lgray -let s:default_bg = s:black - -let s:italic = 'italic' -let s:bold = 'bold' -let s:underline = 'underline' -let s:none = 'NONE' - -let s:default_lst = [] -let s:default_str = '' - -if !exists("g:monochrome_italic_comments") - let g:monochrome_italic_comments = 0 -endif -let s:comment_attr = g:monochrome_italic_comments ? s:italic : s:none +"let s:white = ['White', 15] +"let s:black = ['#0e1111', 16] +"let s:dblack = ['#111111', 1] +"let s:bgray = ['#181818', 233] +"let s:lgray = ['LightGray', 255] +"let s:cgray = ['#737373', 243] +"let s:dgray = ['DarkGray', 248] +"let s:sblue = ['LightBlue', 67] +"let s:yellow = ['LightYellow', 226] +"let s:red = ['DarkRed', 160] +"let s:green = ['DarkGreen', 28] +"let s:purple = ['LightMagenta', 13] " -" A function for setting colors, if I want it... -function! s:hi(...) - let group = a:1 - let fg = get(a:, 2, s:default_fg) - let bg = get(a:, 3, s:default_bg) - let attr = get(a:, 4, s:default_str) - - let cmd = ['hi', group] - - if fg != s:default_lst - call add(cmd, 'guifg='.fg[0]) - call add(cmd, 'ctermfg='.fg[1]) - endif - - if bg != s:default_lst && bg != s:default_bg - call add(cmd, 'guibg='.bg[0]) - call add(cmd, 'ctermbg='.bg[1]) - endif - - if attr != s:default_str - call add(cmd, 'gui='.attr) - call add(cmd, 'cterm='.attr) - endif - - exec join(cmd, ' ') -endfunction - -call s:hi('Normal') -highlight clear Cursor -highlight clear CursorLine " clear the underline nonsense -call s:hi('Cursor', s:black, s:sblue) -call s:hi('lCursor', s:black, s:sblue) - -" these are the cross-hair colors -call s:hi('CursorLine', s:black, s:lgray, s:none) -call s:hi('CursorColumn', s:black, s:lgray, s:none) - -call s:hi('CursorLineNr', s:white, s:sblue, s:bold) -call s:hi('ColorColumn', s:lgray, s:dblack, s:none) -call s:hi('Search', s:black, s:purple) -call s:hi('Visual', s:black, s:green) -call s:hi('ErrorMsg', s:white, s:red) -call s:hi('StatusLine', s:black, s:purple) -call s:hi('StatusLineNC', s:black, s:purple) -call s:hi('VertSplit', s:black, s:purple) - -" Tildes at the bottom of a buffer, etc. -call s:hi('NonText', s:dgray) - -" Folding. -call s:hi('FoldColumn', s:dgray) -call s:hi('Folded') - -" Line numbers gutter. -call s:hi('LineNr', s:dgray) - -" Small arrow used for tabs. -call s:hi('SpecialKey', s:sblue, s:default_bg, s:bold) - -" File browsers. -call s:hi('Directory', s:white, s:default_bg, s:bold) - -" Help. -call s:hi('helpSpecial') -call s:hi('helpHyperTextJump', s:sblue, s:default_bg, s:underline) -call s:hi('helpNote') - -" Popup menu. -call s:hi('Pmenu', s:white, s:sblue) -call s:hi('PmenuSel', s:sblue, s:white) - -" Notes. -call s:hi('Todo', s:black, s:yellow, s:bold) - -" Signs. -call s:hi('SignColumn') - -" --- Languages --------------------------------------------------------------- -call s:hi('Statement', s:white, s:default_bg, s:bold) -call s:hi('PreProc', s:white, s:default_bg, s:bold) -call s:hi('String', s:sblue) -call s:hi('Comment', s:cgray, s:default_bg, s:comment_attr) -call s:hi('Constant') -call s:hi('Type', s:white, s:default_bg, s:bold) -call s:hi('Function', s:white) -call s:hi('Identifier') -call s:hi('Special') -call s:hi('MatchParen', s:black, s:lgray) -call s:hi('vimOption') -call s:hi('vimGroup') -call s:hi('vimHiClear') -call s:hi('vimHiGroup') -call s:hi('vimHiAttrib') -call s:hi('vimHiGui') -call s:hi('vimHiGuiFgBg') -call s:hi('vimHiCTerm') -call s:hi('vimHiCTermFgBg') -call s:hi('vimSynType') -hi link vimCommentTitle Comment -call s:hi('pythonEscape', s:sblue) -call s:hi('javaScriptFunction', s:white, s:default_bg, s:bold) -call s:hi('perlSharpBang', s:cgray) -call s:hi('perlStringStartEnd', s:sblue) -call s:hi('perlStringEscape', s:sblue) -call s:hi('perlMatchStartEnd', s:sblue) -call s:hi('elixirAlias', s:default_fg, s:default_bg, s:none) -call s:hi('elixirDelimiter', s:sblue) -call s:hi('elixirSelf', s:default_fg, s:default_bg, s:none) -" For ||, ->, etc. -call s:hi('elixirOperator') -" Module attributes like @doc or @type. -hi link elixirVariable Statement -" While rendered as comments in other languages, docstrings are strings, -" experimental. -hi link elixirDocString String -hi link elixirDocTest String -hi link elixirStringDelimiter String -call s:hi('rubyConstant') -call s:hi('rubySharpBang', s:cgray) -call s:hi('rubyStringDelimiter', s:sblue) -call s:hi('rubyStringEscape', s:sblue) -call s:hi('rubyRegexpEscape', s:sblue) -call s:hi('rubyRegexpAnchor', s:sblue) -call s:hi('rubyRegexpSpecial', s:sblue) - -" --- Diffs -------------------------------------------------------------------- -call s:hi('diffFile', s:cgray) -call s:hi('diffNewFile', s:cgray) -call s:hi('diffIndexLine', s:cgray) -call s:hi('diffLine', s:cgray) -call s:hi('diffSubname', s:cgray) -call s:hi('diffAdded', s:white, s:green) -call s:hi('diffRemoved', s:white, s:red) - +"let s:default_fg = s:lgray +"let s:default_bg = s:black +" +"let s:italic = 'italic' +"let s:bold = 'bold' +"let s:underline = 'underline' +"let s:none = 'NONE' +" +"let s:default_lst = [] +"let s:default_str = '' +" +"if !exists("g:monochrome_italic_comments") +" let g:monochrome_italic_comments = 0 +"endif +"let s:comment_attr = g:monochrome_italic_comments ? s:italic : s:none +"" +"" A function for setting colors, if I want it... +"function! s:hi(...) +" let group = a:1 +" let fg = get(a:, 2, s:default_fg) +" let bg = get(a:, 3, s:default_bg) +" let attr = get(a:, 4, s:default_str) +" +" let cmd = ['hi', group] +" +" if fg != s:default_lst +" call add(cmd, 'guifg='.fg[0]) +" call add(cmd, 'ctermfg='.fg[1]) +" endif +" +" if bg != s:default_lst && bg != s:default_bg +" call add(cmd, 'guibg='.bg[0]) +" call add(cmd, 'ctermbg='.bg[1]) +" endif +" +" if attr != s:default_str +" call add(cmd, 'gui='.attr) +" call add(cmd, 'cterm='.attr) +" endif +" +" exec join(cmd, ' ') +"endfunction +" +"call s:hi('Normal') +"highlight clear Cursor +"highlight clear CursorLine " clear the underline nonsense +"call s:hi('Cursor', s:black, s:sblue) +"call s:hi('lCursor', s:black, s:sblue) +" +"" these are the cross-hair colors +"call s:hi('CursorLine', s:black, s:lgray, s:none) +"call s:hi('CursorColumn', s:black, s:lgray, s:none) +" +"call s:hi('CursorLineNr', s:white, s:sblue, s:bold) +"call s:hi('ColorColumn', s:lgray, s:dblack, s:none) +"call s:hi('Search', s:black, s:purple) +"call s:hi('Visual', s:black, s:green) +"call s:hi('ErrorMsg', s:white, s:red) +"call s:hi('StatusLine', s:black, s:purple) +"call s:hi('StatusLineNC', s:black, s:purple) +"call s:hi('VertSplit', s:black, s:purple) +" +"" Tildes at the bottom of a buffer, etc. +"call s:hi('NonText', s:dgray) +" +"" Folding. +"call s:hi('FoldColumn', s:dgray) +"call s:hi('Folded') +" +"" Line numbers gutter. +"call s:hi('LineNr', s:dgray) +" +"" Small arrow used for tabs. +"call s:hi('SpecialKey', s:sblue, s:default_bg, s:bold) +" +"" File browsers. +"call s:hi('Directory', s:white, s:default_bg, s:bold) +" +"" Help. +"call s:hi('helpSpecial') +"call s:hi('helpHyperTextJump', s:sblue, s:default_bg, s:underline) +"call s:hi('helpNote') +" +"" Popup menu. +"call s:hi('Pmenu', s:white, s:sblue) +"call s:hi('PmenuSel', s:sblue, s:white) +" +"" Notes. +"call s:hi('Todo', s:black, s:yellow, s:bold) +" +"" Signs. +"call s:hi('SignColumn') +" +"" --- Languages --------------------------------------------------------------- +"call s:hi('Statement', s:white, s:default_bg, s:bold) +"call s:hi('PreProc', s:white, s:default_bg, s:bold) +"call s:hi('String', s:sblue) +"call s:hi('Comment', s:cgray, s:default_bg, s:comment_attr) +"call s:hi('Constant') +"call s:hi('Type', s:white, s:default_bg, s:bold) +"call s:hi('Function', s:white) +"call s:hi('Identifier') +"call s:hi('Special') +"call s:hi('MatchParen', s:black, s:lgray) +"call s:hi('vimOption') +"call s:hi('vimGroup') +"call s:hi('vimHiClear') +"call s:hi('vimHiGroup') +"call s:hi('vimHiAttrib') +"call s:hi('vimHiGui') +"call s:hi('vimHiGuiFgBg') +"call s:hi('vimHiCTerm') +"call s:hi('vimHiCTermFgBg') +"call s:hi('vimSynType') +"hi link vimCommentTitle Comment +"call s:hi('pythonEscape', s:sblue) +"call s:hi('javaScriptFunction', s:white, s:default_bg, s:bold) +"call s:hi('perlSharpBang', s:cgray) +"call s:hi('perlStringStartEnd', s:sblue) +"call s:hi('perlStringEscape', s:sblue) +"call s:hi('perlMatchStartEnd', s:sblue) +"call s:hi('elixirAlias', s:default_fg, s:default_bg, s:none) +"call s:hi('elixirDelimiter', s:sblue) +"call s:hi('elixirSelf', s:default_fg, s:default_bg, s:none) +"" For ||, ->, etc. +"call s:hi('elixirOperator') +"" Module attributes like @doc or @type. +"hi link elixirVariable Statement +"" While rendered as comments in other languages, docstrings are strings, +"" experimental. +"hi link elixirDocString String +"hi link elixirDocTest String +"hi link elixirStringDelimiter String +"call s:hi('rubyConstant') +"call s:hi('rubySharpBang', s:cgray) +"call s:hi('rubyStringDelimiter', s:sblue) +"call s:hi('rubyStringEscape', s:sblue) +"call s:hi('rubyRegexpEscape', s:sblue) +"call s:hi('rubyRegexpAnchor', s:sblue) +"call s:hi('rubyRegexpSpecial', s:sblue) +" +"" --- Diffs -------------------------------------------------------------------- +"call s:hi('diffFile', s:cgray) +"call s:hi('diffNewFile', s:cgray) +"call s:hi('diffIndexLine', s:cgray) +"call s:hi('diffLine', s:cgray) +"call s:hi('diffSubname', s:cgray) +"call s:hi('diffAdded', s:white, s:green) +"call s:hi('diffRemoved', s:white, s:red) + +colorscheme catppuccin_latte " load ~/.vimrc.local last for local overrides if filereadable(expand('~/.vimrc.local')) source ~/.vimrc.local diff --git a/profiles/beryllium.nix b/profiles/beryllium.nix index 91cfe05..170dee2 100644 --- a/profiles/beryllium.nix +++ b/profiles/beryllium.nix @@ -1,9 +1,16 @@ # beryllium server { pkgs, lib, ... }: -{ +let + inherit (import ../lib/const.nix) fontSize homedir gpgid; + inherit (import ../lib/theme.nix { inherit pkgs lib; }) + theme colors base16-scheme base16-scheme-filename + xresourcesFile; +in { imports = [ ../lib/linux.nix + ../lib/urxvt.nix + ../lib/polybar.nix ../lib/ssh.nix ../lib/packages.nix ../lib/emacs.nix @@ -19,4 +26,80 @@ }; programs.git.signing.signByDefault = lib.mkForce true; + + + programs.autorandr.enable = true; + programs.autorandr.hooks.postswitch.restart-polybar = + "systemctl --user restart polybar.service"; + programs.autorandr.hooks.postswitch.notify = + ''notify-send -i display "Display profile" "$AUTORANDR_CURRENT_PROFILE"''; + + programs.autorandr.profiles = let + # these fingerprints are almost the same because they are alsmost the same + # monitors, so be careful when changing these + fingerprint = { + DP-2 = # asus-left + "00ffffffffffff0006b3ca28305f010025200104b53e22783bad65ad50459f250e50542308008140818081c081009500b300d1c001014dd000a0f0703e80302035006d552100001a565e00a0a0a02950302035006d552100001e000000fd00283ca0a03c010a202020202020000000fc0041535553205647323839513141017102033ef154010304121305141f9007026061060e0f15161d1e2309070783010000e200d565030c001000681a00000101283c00e305e301e606070159521c023a801871382d40582c45006d552100001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014"; + DP-0 = # asus-right + "00ffffffffffff0006b3ba28c0f40300151f0104b53e22783bb4a5ad4f449e250f50542308008140818081c081009500b300d1c001014dd000a0f0703e80302035006d552100001a565e00a0a0a02950302035006d552100001e000000fd00283ca0a03c010a202020202020000000fc00415355532056473238390a2020019f02033af159010304121305141f9007025d5e5f6061060e0f15161d1e20482309070783010000e200d565030c001000e305e300e6060701565500023a801871382d40582c45006d552100001e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096"; + }; + DP-2 = { + enable = true; + primary = true; + position = "0x0"; + mode = "3840x2160"; + dpi = 331; + rate = "60.00"; + }; + DP-0 = { + enable = true; + primary = false; + position = "3840x0"; + mode = "3840x2160"; + dpi = 331; + rate = "60.00"; + }; + in { + default = { + inherit fingerprint; + config = { + inherit DP-2 DP-0; + }; + }; + }; + + services.random-background.enable = lib.mkForce true; + + services.polybar.enable = true; + services.polybar.config."bar/top".monitor = "DP-0"; + services.polybar.script = '' + polybar top & + polybar second & + ''; + services.polybar.config."bar/second" = { + background = colors."${theme}".background; + font-0 = "FiraSans:size=${toString fontSize}"; + font-1 = "Font Awesome 5:pixelsize=11;1"; + font-2 = "MaterialIcons:size=10:antialias=false;2"; + foreground = colors."${theme}".foreground; + height = "30"; + module-margin = 1; + modules-center = "date"; + modules-left = ["ewmh" "volume-bar"]; + modules-right = [ "battery" "cpu" "mem" "temp" ]; + monitor = "DP-2"; + radius = 0; + separator = "|"; + tray-background = colors."${theme}".background; + tray-detached = false; + tray-maxsize = 16; + tray-offset-x = 0; + tray-offset-y = 0; + tray-padding = 0; + tray-position = "right"; + tray-scale = 1; + width = "100%"; + }; } + + diff --git a/profiles/laptop.nix b/profiles/laptop.nix index 77bc792..8f80cc2 100644 --- a/profiles/laptop.nix +++ b/profiles/laptop.nix @@ -4,6 +4,7 @@ { imports = [ ../lib/common.nix + ../lib/urxvt.nix ../lib/linux.nix ../lib/emacs.nix ../lib/ssh.nix @@ -19,6 +20,11 @@ ]; }; + services.polybar.enable = true; + services.polybar.script = "polybar top &"; + srvices.polybar.config."bar/top".monitor = "\${env:MONITOR:HDMI-2}"; + srvices.polybar.config."bar/top".monitor-fallback = "\${env:MONITOR:eDP-1}"; + programs.autorandr.enable = true; programs.autorandr.hooks.postswitch = { diff --git a/profiles/workshop.nix b/profiles/workshop.nix index 003630d..84b8104 100644 --- a/profiles/workshop.nix +++ b/profiles/workshop.nix @@ -4,6 +4,8 @@ { imports = [ ../lib/linux.nix + ../lib/urxvt.nix + ../lib/polybar.nix ../lib/ssh.nix ../lib/packages.nix ../lib/emacs.nix @@ -18,7 +20,9 @@ ]; }; - services.polybar.config."bar/top".monitor = lib.mkForce "HDMI-1"; + services.polybar.config."bar/top".monitor = "HDMI-1"; + services.polybar.enable = true; + services.polybar.script = "polybar top &"; services.random-background.enable = lib.mkForce true; |