From 400794b28cae4f75479f0a95bcb0a55ebb80ef1f Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 12 May 2022 00:11:54 +0300 Subject: [PATCH] feat: more tmux configuring --- README.md | 9 +++- dotfiles/neovim/lua/my/plugins/idris.lua | 4 +- dotfiles/neovim/lua/my/plugins/init.lua | 2 +- dotfiles/tmux/tmux.conf | 8 ++++ flake.lock | 60 ++++++++++++------------ modules/applications/misc.nix | 2 +- modules/applications/neovim.nix | 4 -- modules/applications/rofi/default.nix | 4 +- modules/applications/shells/aliases.nix | 2 +- modules/applications/shells/fish.nix | 11 +++-- modules/applications/tmux.nix | 16 +++++++ modules/applications/vieb.nix | 2 +- modules/dev/default.nix | 2 +- modules/dev/idris.nix | 17 +++++-- modules/helpers.nix | 7 +-- modules/overlays/flakes.nix | 6 +++ modules/themes/catppuccin/default.nix | 35 ++++++++++---- modules/themes/githubVariant.nix | 7 +-- modules/themes/gtk.nix | 2 +- modules/themes/xresources.nix | 2 +- paths.nix | 2 +- 21 files changed, 133 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 2f0798c..5f4699b 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,11 @@ My flake based nixos configuration. To use this, just rebuild your system using ## TODO: -- make special separate dir for dotfiles. Would makes it easier to share them specifically +- get vieb to work +- easymotion for nvim +- configure tmux more + - figure out how to install fastcopy + - keep vim/nvim sessions around + - automatically save/restore state using continuum + - customize status bar +- clean out the mess I made for installing fish themes diff --git a/dotfiles/neovim/lua/my/plugins/idris.lua b/dotfiles/neovim/lua/my/plugins/idris.lua index 7251fb5..8a23048 100644 --- a/dotfiles/neovim/lua/my/plugins/idris.lua +++ b/dotfiles/neovim/lua/my/plugins/idris.lua @@ -14,7 +14,9 @@ local idrisChords = { } function M.setup() - require("idris2").setup({ + local idris2 = require("idris2") + + idris2.setup({ server = { on_attach = function(client, bufnr) lspconfig.on_attach(client, bufnr) diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index 5acf41f..e2f7a8b 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -19,7 +19,7 @@ function M.setup() require("my.plugins.vimtex").setup() require("my.plugins.telescope").setup() require("my.plugins.vimux").setup() - require("my.plugins.idris").setup() + -- require("my.plugins.idris").setup() require("my.plugins.lean").setup() require("my.plugins.vim-tmux-navigator").setup() require("my.plugins.lh-brackets").setup() diff --git a/dotfiles/tmux/tmux.conf b/dotfiles/tmux/tmux.conf index 0724254..a95d284 100644 --- a/dotfiles/tmux/tmux.conf +++ b/dotfiles/tmux/tmux.conf @@ -33,3 +33,11 @@ bind -T copy-mode-vi p paste-buffer bind -T copy-mode-vi V send-keys -X rectangle-toggle # Check if this works bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi y send-keys -X copy-selection + +# Copy to clipboard using fastcopy +set-option -g set-clipboard on +set-option -g @fastcopy-action 'tmux load-buffer -w -' +set-option -g @fastcopy-key a + +# Keep state around using resurrect +set -g @resurrect-processes '"./result/bin/qkm ./myConfig.json"' diff --git a/flake.lock b/flake.lock index 82b1d52..48de068 100644 --- a/flake.lock +++ b/flake.lock @@ -115,11 +115,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1641205782, - "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { @@ -161,11 +161,11 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", "owner": "numtide", "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", "type": "github" }, "original": { @@ -275,11 +275,11 @@ ] }, "locked": { - "lastModified": 1648834319, - "narHash": "sha256-i5Aj4Aw64D/A0X6XW5LxSS4XBnYj7gMz+kN4dpsbdk8=", + "lastModified": 1651519540, + "narHash": "sha256-3k6p8VsTwwRPQjE8rrMh+o2AZACZn/eeYJ7ivdQ/Iro=", "owner": "nix-community", "repo": "home-manager", - "rev": "0bdbdea2e26c984b096f4f7d10e3c88536a980b0", + "rev": "d93d56ab8c1c6aa575854a79b9d2f69d491db7d0", "type": "github" }, "original": { @@ -477,11 +477,11 @@ }, "locked": { "dir": "nix", - "lastModified": 1647852712, - "narHash": "sha256-glteo+r5qz/O9BirpK/ziigpYbGjZIY5UFuxsADC4qY=", + "lastModified": 1651937557, + "narHash": "sha256-gvQsenQrEsLxLFgUGJhJBIx3+t1dtLMMTVEO/yZ8nRg=", "owner": "kmonad", "repo": "kmonad", - "rev": "65b501defdd0049563752f8af8c8c57f5a1ae38b", + "rev": "c43a0180a3b9ca9c4ff4a283b17369fc4e8e46e2", "type": "github" }, "original": { @@ -517,11 +517,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1646712943, - "narHash": "sha256-FuYXH7g8OW8P+mAMLP/zx3zJOENtGIv5tLaOzKPP+is=", + "lastModified": 1652254318, + "narHash": "sha256-4LF4p4GuDJTVO2mqCAAZVwVI6tW8nSsoR8czPcoUU3M=", "owner": "neovim", "repo": "neovim", - "rev": "2783f4cc4a410cd3b73e8cdfbdf8c859c426c6c6", + "rev": "3a5abcd649f3637e3292dd595dd197e85d1a2272", "type": "github" }, "original": { @@ -540,11 +540,11 @@ ] }, "locked": { - "lastModified": 1646727299, - "narHash": "sha256-i18vMn+iXvPRAxPb96lEuEVkrQ75qKEZZomfo67JRJI=", + "lastModified": 1652257362, + "narHash": "sha256-qtESMLoS2B+dVDlJpCIDZHQYM8BfGk7o9VivDf8w81I=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "c26d33c2fbcf5f689a2592b2353f4f8765eea1da", + "rev": "5ab33071cc20422d0108c7e86d50cd8543e8475d", "type": "github" }, "original": { @@ -555,11 +555,11 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1646497237, - "narHash": "sha256-Ccpot1h/rV8MgcngDp5OrdmLTMaUTbStZTR5/sI7zW0=", + "lastModified": 1652172129, + "narHash": "sha256-8e2JMrswaKe02P8rYfvIMoc59pNuw6h/GYu8DBE1c+0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "062a0c5437b68f950b081bbfc8a699d57a4ee026", + "rev": "f419dc5763c2b3c5580e396dea065b6d8b58ee27", "type": "github" }, "original": { @@ -571,11 +571,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1646675913, - "narHash": "sha256-ZvGf51XpXM7JojKLZ5yI0XLUq8UOFX6AwZ3bhtdcpIo=", + "lastModified": 1652278321, + "narHash": "sha256-dvm5y9LkOtMeddK9eKzhhSK9d01yipfXISvQtGLBpU0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9b1c7ba323732ddc85a51850a7f10ecc5269b8e9", + "rev": "e88ce43c86ebd9dee39764c3b8e9851cab9bef62", "type": "github" }, "original": { @@ -587,11 +587,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1646470760, - "narHash": "sha256-dQISyucVCCPaFioUhy5ZgfBz8rOMKGI8k13aPDFTqEs=", + "lastModified": 1652252629, + "narHash": "sha256-SvT64apetqc8P5nYp1/fOZvUmHUPdPFUZbhSpKy+1aI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1fc7212a2c3992eedc6eedf498955c321ad81cc2", + "rev": "d2fc6856824cb87742177eefc8dd534bdb6c3439", "type": "github" }, "original": { @@ -764,11 +764,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1646576673, - "narHash": "sha256-zS5O7nW4sBzAa+hnEfI2P8J42XjfyEYrUU0VXnbvIIA=", + "lastModified": 1648995798, + "narHash": "sha256-+JVei13lElBfx/4XsS/zFplmAbU14zUIGjatGE6Ktrc=", "owner": "m15a", "repo": "nixpkgs-vim-extra-plugins", - "rev": "efe7a114effc4e242b3b8a848a6c86e1b552994b", + "rev": "5059176cb8f8c460c885f334883520972d1c05ae", "type": "github" }, "original": { diff --git a/modules/applications/misc.nix b/modules/applications/misc.nix index 5a9a7b6..fb637cc 100644 --- a/modules/applications/misc.nix +++ b/modules/applications/misc.nix @@ -43,7 +43,7 @@ discord # deluge # slack - # tdesktop # telegram for the desktop + tdesktop # telegram for the desktop zoom-us # teams diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 35072bd..f230eaa 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -37,8 +37,6 @@ in # haskellPackages.agda-language-server # agda nodePackages.typescript-language-server # typescript easy-purescript-nix.purescript-language-server # purescript - idris2 # idris2 lang - idris2-pkgs.lsp # idris2 sumneko-lua-language-server # lua rnix-lsp # nix haskell-language-server # haskell @@ -85,8 +83,6 @@ in presence-nvim # discord rich presence agda-nvim # agda support unicode-vim # better unicode support - nui-nvim # ui lib required by idris plugin - idris2-nvim # idris2 support lean-nvim # lean support kmonad # support for the kmonad config language lh-vim-lib # dependency for lh-brackets diff --git a/modules/applications/rofi/default.nix b/modules/applications/rofi/default.nix index 557acce..b35b047 100644 --- a/modules/applications/rofi/default.nix +++ b/modules/applications/rofi/default.nix @@ -13,11 +13,11 @@ in { home-manager.users.adrielus = { home.packages = [ rofi ]; - home.file.".local/share/rofi/themes/${theme.name}.rasi".text = builtins.readFile theme.rofi.theme; + home.file.".local/share/rofi/themes/${theme.name}.rasi".text = theme.rofi.theme or ""; xdg.configFile."rofi/config.rasi".text = '' @import "${./pre.rasi}" - ${theme.rofi.config} + ${theme.rofi.config or ""} ''; }; } diff --git a/modules/applications/shells/aliases.nix b/modules/applications/shells/aliases.nix index 3534f35..e374d98 100644 --- a/modules/applications/shells/aliases.nix +++ b/modules/applications/shells/aliases.nix @@ -19,7 +19,7 @@ battery = "acpi"; # Rebuuild nixos - rebuild = "sudo nixos-rebuild switch --flake ~/Projects/nixos-config/"; + rebuild = "sudo -u adrielus nixos-rebuild switch --flake ~/Projects/nixos-config/"; # Render git repo using gource "git-render" = "gource -f -s 1 -c 4 --key"; diff --git a/modules/applications/shells/fish.nix b/modules/applications/shells/fish.nix index 4bf072b..1de9193 100644 --- a/modules/applications/shells/fish.nix +++ b/modules/applications/shells/fish.nix @@ -3,8 +3,12 @@ let shellAliases = import ./aliases.nix; common = import ./common.nix; + globalTheme = pkgs.myThemes.current; theme = "dangerous"; themePackage = builtins.getAttr theme pkgs.myFishPlugins.themes; # Dynamically pick the theme path + + defaultDangerousColors = "000000 333333 666666 ff4ff0 0088ff ff6600 ff0000 ff0033 3300ff 0000ff 00ffff 00ff00"; + dangerousColors = globalTheme.fish.dangerousColors or defaultDangerousColors; in { users.defaultUserShell = pkgs.fish; @@ -33,9 +37,10 @@ in source $f end - # if [ "${theme}" = "dangerous" ] - set dangerous_colors 000000 333333 666666 ff4ff0 0088ff ff6600 ff0000 ff0033 3300ff 0000ff 00ffff 00ff00 - # end + + ${if theme == "dangerous" + then "set dangerous_colors ${dangerousColors}" + else ""} ${common.shellInit} ''; diff --git a/modules/applications/tmux.nix b/modules/applications/tmux.nix index fe60804..2842a63 100644 --- a/modules/applications/tmux.nix +++ b/modules/applications/tmux.nix @@ -1,6 +1,19 @@ { pkgs, lib, ... }: let theme = pkgs.myThemes.current; + + fastcopy = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "fastcopy"; + version = "unstable-2022-04-18"; + src = pkgs.fetchFromGitHub + { + owner = "abhinav"; + repo = "tmux-fastcopy"; + sha256 = "0d2xdch5w35mw3kpw1y6jy8wk4zj43pjx73jlx83ciqddl3975x6"; + rev = "4b9bc8e9e71c5b6eeb44a02f608baec07e12ea3d"; + }; + }; in { home-manager.users.adrielus.programs = { @@ -17,6 +30,9 @@ in plugins = with pkgs.tmuxPlugins; [ cpu # Show CPU load with easy icons vim-tmux-navigator # Switch between tmux and vim panes with ease + sessionist # Nicer workflow for switching around between session + # fastcopy # Easy copying of stuff + resurrect # Save / restore tmux sessions ]; extraConfig = '' diff --git a/modules/applications/vieb.nix b/modules/applications/vieb.nix index 0b23612..3e6b43d 100644 --- a/modules/applications/vieb.nix +++ b/modules/applications/vieb.nix @@ -2,7 +2,7 @@ let vieb = "/home/adrielus/.config/Vieb"; in { home-manager.users.adrielus = { - home.packages = [ pkgs.vieb ]; + home.packages = [ pkgs.nixos-unstable.vieb ]; systemd.user.tmpfiles.rules = [ "L+ /home/adrielus/.viebrc - - - - ${paths.dotfiles}/vieb/.viebrc" ]; diff --git a/modules/dev/default.nix b/modules/dev/default.nix index 1655665..61c8af9 100644 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -13,7 +13,7 @@ # Proof assistants ./agda.nix - ./idris.nix + # ./idris.nix ./lean.nix ]; } diff --git a/modules/dev/idris.nix b/modules/dev/idris.nix index 81e7e61..c9a122c 100644 --- a/modules/dev/idris.nix +++ b/modules/dev/idris.nix @@ -1,6 +1,15 @@ { pkgs, ... }: { - home-manager.users.adrielus.home.packages = with pkgs; [ - idris2 - idris2-pkgs.lsp # idris2 - ]; + home-manager.users.adrielus = { + + home.packages = with pkgs; [ + idris2 + idris2-pkgs.lsp # idris2 + ]; + + programs.neovim.plugins = with pkgs.vimPlugins; + with pkgs.vimExtraPlugins; with pkgs.myVimPlugins; [ + nui-nvim # ui lib required by idris plugin + idris2-nvim # idris2 support + ]; + }; } diff --git a/modules/helpers.nix b/modules/helpers.nix index 5f84b6c..76a3e8f 100644 --- a/modules/helpers.nix +++ b/modules/helpers.nix @@ -1,8 +1,9 @@ { lib, ... }: { - mergeLines = (lines: lib.lists.foldr + mergeLines = lib.lists.foldr (a: b: '' ${a} ${b} - '') "" - lines); + '') ""; + + unwords = lib.lists.foldr (a: b: ''${a} ${b}'') ""; } diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index c9a4342..d1947c6 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -22,6 +22,12 @@ in config.allowBroken = true; }; + nixos-unstable = import nixos-unstable { + inherit system; + config.allowUnfree = true; + config.allowBroken = true; + }; + easy-purescript-nix = self.callPackage foreign.easy-purescript-nix { }; easy-dhall-nix = self.callPackage foreign.easy-dhall-nix { }; diff --git a/modules/themes/catppuccin/default.nix b/modules/themes/catppuccin/default.nix index cfac64e..3ba5613 100644 --- a/modules/themes/catppuccin/default.nix +++ b/modules/themes/catppuccin/default.nix @@ -1,14 +1,16 @@ -{ transparency ? 1, wallpaper, variant }: { pkgs, ... }: +{ transparency ? 1, wallpaper, variant }: { pkgs, lib, ... }: let githubTheme = pkgs.myVimPlugins.githubNvimTheme; # github theme for neovim foreign = pkgs.callPackage (import ./foreign.nix) { }; v = (a: b: if variant == "light" then a else b); in { + name = "catppuccin"; wallpaper = wallpaper.foreign or "${foreign.wallpapers}/${wallpaper}"; - name = "catppuccin"; neovim = { + theme = builtins.readFile ./nvim.lua; + lualineTheme = "catppuccin"; plugins = [ ( pkgs.vimUtils.buildVimPluginFrom2Nix { @@ -17,28 +19,44 @@ in } ) ]; - theme = builtins.readFile ./nvim.lua; - - lualineTheme = "catppuccin"; }; + + # grub.path = "${foreign.grub}/catppuccin-grub-theme/theme.txt"; tmux.path = "${foreign.tmux}/catppuccin.conf"; sddm.path = "${foreign.sddm}"; grub.path = pkgs.nixos-grub2-theme; - # grub.path = "${foreign.grub}/catppuccin-grub-theme/theme.txt"; - gtk.path = null; + xresources = builtins.readFile "${foreign.xresources}/Xresources"; + rofi = { - theme = "${foreign.rofi}/.local/share/rofi/themes/catppuccin.rasi"; + theme = builtins.readFile "${foreign.rofi}/.local/share/rofi/themes/catppuccin.rasi"; config = '' @import "${foreign.rofi}/.config/rofi/config.rasi" @import "${./rofi.rasi}"''; }; + chromium.extensions = [ # https://github.com/catppuccin/chrome (v "cmpdlhmnmjhihmcfnigoememnffkimlk" "bkkmolkhemgaeaeggcmfbghljjjoofoh") ]; + + fish.dangerousColors = lib.strings.concatStringsSep " " + [ + "F2CDCD" + "DDB6F2" + "F5C2E7" + "E8A2AF" + "F28FAD" + "F8BD96" + "FAE3B0" + "ABE9B3" + "B5E8E0" + "96CDFB" + "89DCEB" + ]; + alacritty.settings = { import = [ "${foreign.alacritty}/catppuccin.yml" ]; window = { @@ -53,4 +71,3 @@ in background_opacity = transparency; }; } - diff --git a/modules/themes/githubVariant.nix b/modules/themes/githubVariant.nix index f223d51..60d2f5d 100644 --- a/modules/themes/githubVariant.nix +++ b/modules/themes/githubVariant.nix @@ -18,12 +18,7 @@ in tmux.path = "${githubTheme}/terminal/tmux/github_${variant}.conf"; sddm.path = "${pkgs.sddm-theme-chili}"; # TODO: don't expose this globally grub.path = pkgs.nixos-grub2-theme; - gtk.path = null; - xresources = ""; - rofi = { - theme = "purple"; - config = { }; - }; + rofi.config = ''@theme "purple"''; alacritty.settings = { import = [ "${githubTheme}/terminal/alacritty/github_${variant}.yml" ]; window = { diff --git a/modules/themes/gtk.nix b/modules/themes/gtk.nix index 3febd18..9559cd9 100644 --- a/modules/themes/gtk.nix +++ b/modules/themes/gtk.nix @@ -5,6 +5,6 @@ in { home-manager.users.adrielus.gtk = { enable = true; - theme = theme.gtk.path; + theme = theme.gtk.path or null; }; } diff --git a/modules/themes/xresources.nix b/modules/themes/xresources.nix index 73b2d67..5200394 100644 --- a/modules/themes/xresources.nix +++ b/modules/themes/xresources.nix @@ -4,6 +4,6 @@ let in { home-manager.users.adrielus.xresources = { - extraConfig = theme.xresources; + extraConfig = theme.xresources or ""; }; } diff --git a/paths.nix b/paths.nix index 2b390b1..5e4b85d 100644 --- a/paths.nix +++ b/paths.nix @@ -1,4 +1,4 @@ rec { - root = "~/Projects/nixos-config/"; + root = "/home/adrielus/Projects/nixos-config"; dotfiles = "${root}/dotfiles"; }