From 50da7ffff8b2f74c220df32de760edf079ab353a Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Sat, 24 May 2025 15:38:19 +0200 Subject: [PATCH] initial commit --- flake.lock | 272 +++++++++++++++++ flake.nix | 39 +++ hosts/thegeneralist-mbp/configuration.nix | 37 +++ hosts/thegeneralist-mbp/default.nix | 26 ++ .../hardware-configuration.nix | 11 + hosts/thegeneralist-mbp/hostkey.age | Bin 0 -> 631 bytes hosts/thegeneralist/configuration.nix | 57 ++++ hosts/thegeneralist/default.nix | 21 ++ .../thegeneralist/hardware-configuration.nix | 43 +++ hosts/thegeneralist/hostkey.age | Bin 0 -> 631 bytes keys.nix | 3 + modules/common/default.nix | 1 + modules/darwin/default.nix | 1 + modules/home/default.nix | 54 ++++ modules/home/dotfiles/i3/config | 231 ++++++++++++++ modules/home/dotfiles/i3/detect-tray.sh | 5 + modules/home/dotfiles/i3status/config | 32 ++ .../dotfiles/nvim/after/ftplugin/rust.lua | 18 ++ modules/home/dotfiles/nvim/init.lua | 1 + modules/home/dotfiles/nvim/lazy-lock.json | 55 ++++ modules/home/dotfiles/nvim/lua/.luarc.json | 3 + .../dotfiles/nvim/lua/thegeneralist/init.lua | 77 +++++ .../nvim/lua/thegeneralist/lazy/avante.lua | 80 +++++ .../nvim/lua/thegeneralist/lazy/blink.lua | 84 +++++ .../nvim/lua/thegeneralist/lazy/colors.lua | 134 ++++++++ .../lua/thegeneralist/lazy/command_bar.lua | 6 + .../nvim/lua/thegeneralist/lazy/commenter.lua | 6 + .../nvim/lua/thegeneralist/lazy/dap.lua | 215 +++++++++++++ .../nvim/lua/thegeneralist/lazy/fugitive.lua | 6 + .../nvim/lua/thegeneralist/lazy/gh.lua | 52 ++++ .../nvim/lua/thegeneralist/lazy/harpoon.lua | 54 ++++ .../nvim/lua/thegeneralist/lazy/init.lua | 101 ++++++ .../nvim/lua/thegeneralist/lazy/jupyter.lua | 41 +++ .../nvim/lua/thegeneralist/lazy/lazydev.lua | 25 ++ .../nvim/lua/thegeneralist/lazy/lsp.lua | 287 ++++++++++++++++++ .../nvim/lua/thegeneralist/lazy/luasnip.lua | 22 ++ .../nvim/lua/thegeneralist/lazy/markdown.lua | 9 + .../nvim/lua/thegeneralist/lazy/neogen.lua | 25 ++ .../nvim/lua/thegeneralist/lazy/nullls.lua | 51 ++++ .../lua/thegeneralist/lazy/statusline.lua | 128 ++++++++ .../nvim/lua/thegeneralist/lazy/telescope.lua | 63 ++++ .../lua/thegeneralist/lazy/treesitter.lua | 45 +++ .../nvim/lua/thegeneralist/lazy/trouble.lua | 23 ++ .../nvim/lua/thegeneralist/lazy/undotree.lua | 7 + .../nvim/lua/thegeneralist/lazy/whichkey.lua | 73 +++++ .../nvim/lua/thegeneralist/lazy_init.lua | 17 ++ .../dotfiles/nvim/lua/thegeneralist/remap.lua | 101 ++++++ .../dotfiles/nvim/lua/thegeneralist/set.lua | 38 +++ modules/linux/agenix.nix | 9 + modules/linux/boot.nix | 6 + modules/linux/ghostty.nix | 29 ++ modules/linux/git.nix | 27 ++ modules/linux/neovim.nix | 41 +++ modules/linux/networking.nix | 5 + modules/linux/nix.nix | 8 + modules/linux/nushell/config.nu | 33 ++ modules/linux/nushell/default.nix | 49 +++ modules/linux/nushell/env.nu | 31 ++ modules/linux/nvidia.nix | 10 + modules/linux/packages.nix | 21 ++ modules/linux/printers.nix | 18 ++ modules/linux/ssh.nix | 13 + modules/linux/steam.nix | 17 ++ modules/linux/tailscale-marshall.age | 5 + modules/linux/tailscale.nix | 17 ++ modules/linux/xserver.nix | 50 +++ modules/linux/zsh.nix | 11 + secrets.nix | 6 + 68 files changed, 3086 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/thegeneralist-mbp/configuration.nix create mode 100644 hosts/thegeneralist-mbp/default.nix create mode 100644 hosts/thegeneralist-mbp/hardware-configuration.nix create mode 100644 hosts/thegeneralist-mbp/hostkey.age create mode 100644 hosts/thegeneralist/configuration.nix create mode 100644 hosts/thegeneralist/default.nix create mode 100644 hosts/thegeneralist/hardware-configuration.nix create mode 100644 hosts/thegeneralist/hostkey.age create mode 100644 keys.nix create mode 100644 modules/common/default.nix create mode 100644 modules/darwin/default.nix create mode 100644 modules/home/default.nix create mode 100644 modules/home/dotfiles/i3/config create mode 100755 modules/home/dotfiles/i3/detect-tray.sh create mode 100644 modules/home/dotfiles/i3status/config create mode 100644 modules/home/dotfiles/nvim/after/ftplugin/rust.lua create mode 100644 modules/home/dotfiles/nvim/init.lua create mode 100644 modules/home/dotfiles/nvim/lazy-lock.json create mode 100644 modules/home/dotfiles/nvim/lua/.luarc.json create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/init.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/avante.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/colors.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/command_bar.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/commenter.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/dap.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/fugitive.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/gh.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/harpoon.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/init.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/jupyter.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lazydev.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/luasnip.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/neogen.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/statusline.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/telescope.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/treesitter.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/trouble.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/undotree.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy/whichkey.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/lazy_init.lua create mode 100755 modules/home/dotfiles/nvim/lua/thegeneralist/remap.lua create mode 100644 modules/home/dotfiles/nvim/lua/thegeneralist/set.lua create mode 100644 modules/linux/agenix.nix create mode 100644 modules/linux/boot.nix create mode 100644 modules/linux/ghostty.nix create mode 100644 modules/linux/git.nix create mode 100644 modules/linux/neovim.nix create mode 100644 modules/linux/networking.nix create mode 100644 modules/linux/nix.nix create mode 100644 modules/linux/nushell/config.nu create mode 100644 modules/linux/nushell/default.nix create mode 100644 modules/linux/nushell/env.nu create mode 100644 modules/linux/nvidia.nix create mode 100644 modules/linux/packages.nix create mode 100644 modules/linux/printers.nix create mode 100644 modules/linux/ssh.nix create mode 100644 modules/linux/steam.nix create mode 100644 modules/linux/tailscale-marshall.age create mode 100644 modules/linux/tailscale.nix create mode 100644 modules/linux/xserver.nix create mode 100644 modules/linux/zsh.nix create mode 100644 secrets.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b71344d --- /dev/null +++ b/flake.lock @@ -0,0 +1,272 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": [ + "nix-darwin" + ], + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1747575206, + "narHash": "sha256-NwmAFuDUO/PFcgaGGr4j3ozG9Pe5hZ/ogitWhY+D81k=", + "owner": "ryantm", + "repo": "agenix", + "rev": "4835b1dc898959d8547a871ef484930675cb47f1", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghostty": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", + "zig": "zig", + "zon2nix": "zon2nix" + }, + "locked": { + "lastModified": 1747866154, + "narHash": "sha256-nMWY6YqdXZ9VGjgvqCREabaJ4Oy6UNRY77PX3UpIyBQ=", + "owner": "ghostty-org", + "repo": "ghostty", + "rev": "a2f52b08e5ad43420aab4e5cf5b2733cefb05845", + "type": "github" + }, + "original": { + "owner": "ghostty-org", + "repo": "ghostty", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747875884, + "narHash": "sha256-tdVx4kghhdy62LKuTnwE2RytOe8o88tah/yhpyuL0D4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f9186c64fcc6ee5f0114547acf9e814c806a640b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747820204, + "narHash": "sha256-oY/mH8K1LOd+YbO58sw9ORtOdTxy3rR9lvTzOJKVUtA=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "e2676937faf868111dcea6a4a9cf4b6549907c9d", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747744144, + "narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1741992157, + "narHash": "sha256-nlIfTsTrMSksEJc1f7YexXiPVuzD1gOfeN1ggwZyUoc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "da4b122f63095ca1199bd4d526f9e26426697689", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1741865919, + "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "ghostty": "ghostty", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "zig": { + "inputs": { + "flake-compat": [ + "ghostty" + ], + "flake-utils": [ + "ghostty", + "flake-utils" + ], + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1741825901, + "narHash": "sha256-aeopo+aXg5I2IksOPFN79usw7AeimH1+tjfuMzJHFdk=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "0b14285e283f5a747f372fb2931835dd937c4383", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zon2nix": { + "inputs": { + "flake-utils": [ + "ghostty", + "flake-utils" + ], + "nixpkgs": [ + "ghostty", + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1742104771, + "narHash": "sha256-LhidlyEA9MP8jGe1rEnyjGFCzLLgCdDpYeWggibayr0=", + "owner": "jcollie", + "repo": "zon2nix", + "rev": "56c159be489cc6c0e73c3930bd908ddc6fe89613", + "type": "github" + }, + "original": { + "owner": "jcollie", + "ref": "56c159be489cc6c0e73c3930bd908ddc6fe89613", + "repo": "zon2nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..58621df --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "thegeneralist's config flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-darwin = { + url = "github:nix-darwin/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + inputs.darwin.follows = "nix-darwin"; + }; + ghostty = { + url = "github:ghostty-org/ghostty"; + }; + }; + + outputs = inputs@{ self, nixpkgs, ... }: let + inherit (builtins) readDir; + inherit (nixpkgs.lib) attrsToList const groupBy listToAttrs mapAttrs; + + targetHost = readDir ./hosts + |> mapAttrs (name: const <| import ./hosts/${name} nixpkgs.lib inputs self) + |> attrsToList + |> groupBy (host: + if host.name == "thegeneralist" then + "nixosConfigurations" + else + "darwinConfigurations") + |> mapAttrs (const listToAttrs); + in targetHost; +} diff --git a/hosts/thegeneralist-mbp/configuration.nix b/hosts/thegeneralist-mbp/configuration.nix new file mode 100644 index 0000000..6c1f167 --- /dev/null +++ b/hosts/thegeneralist-mbp/configuration.nix @@ -0,0 +1,37 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ self, config, pkgs, lib, inputs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + inputs.agenix.darwinModules.default + # inputs.home-manager.darwinModules.default + ]; + + # age.secrets.hostkey.file = ./hostkey.age; + # services.openssh.hostKeys = [{ + # type = "ed25519"; + # path = config.age.secrets.hostkey.path; + # }]; + + users.users.thegeneralist = { + name = "thegeneralist"; + home = "/Users/thegeneralist"; + shell = pkgs.nushell; + # openssh.authorizedKeys.keys = let + # inherit (import ../../keys.nix) thegeneralist; + # in [ thegeneralist ]; + }; + + # home-manager.users.thegeneralist.home = { + # stateVersion = "24.11"; + # homeDirectory = "/Users/thegeneralist"; + # }; + + system.stateVersion = 6; +} + diff --git a/hosts/thegeneralist-mbp/default.nix b/hosts/thegeneralist-mbp/default.nix new file mode 100644 index 0000000..0c5c014 --- /dev/null +++ b/hosts/thegeneralist-mbp/default.nix @@ -0,0 +1,26 @@ +lib: inputs: self: lib.nixosSystem { + specialArgs = inputs // { inherit inputs; inherit self; }; + modules = [ + ./configuration.nix + + # Modules + ({ pkgs, ... }: let + inherit (lib) filter hasSuffix; + commonModules = lib.filesystem.listFilesRecursive ../../modules/common |> filter (hasSuffix ".nix"); + darwinModules = lib.filesystem.listFilesRecursive ../../modules/darwin |> filter (hasSuffix ".nix"); + in { + imports = commonModules ++ darwinModules; + }) + + # Overlays + ({ pkgs, lib, ... }: let + inherit (lib) attrValues hasAttrByPath getAttrFromPath filter; + packagePath = [ "overlays" "default" ]; + overlays = (attrValues inputs) + |> filter (hasAttrByPath packagePath) + |> map (getAttrFromPath packagePath); + in { + nixpkgs.overlays = overlays; + }) + ]; +} diff --git a/hosts/thegeneralist-mbp/hardware-configuration.nix b/hosts/thegeneralist-mbp/hardware-configuration.nix new file mode 100644 index 0000000..bdd1ed5 --- /dev/null +++ b/hosts/thegeneralist-mbp/hardware-configuration.nix @@ -0,0 +1,11 @@ +{ lib, ... }: + +{ + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + # networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-darwin"; +} diff --git a/hosts/thegeneralist-mbp/hostkey.age b/hosts/thegeneralist-mbp/hostkey.age new file mode 100644 index 0000000000000000000000000000000000000000..093a311c62d1296bebd37b2575e10186536541a8 GIT binary patch literal 631 zcmYdHPt{G$OD?J`D9Oyv)5|YP*Do{V(zR14F3!+RO))YxHMCSHD6lL{2~;Td^>z2j zP4Y9>cFwCP2=Yu!Pt*=@4f6Lbba4p|2?;bXDex;!2`lh(G~x2}C`hs__mA>*Eln}Z zit!44)m11mEi-Tn@-;U0Ep#q*4T?-N z^U5v@&#Edm(k}P5h)T{0$p|YC$nmT24CHd%{);g*RMpAj&hFC+Cw%|4u(`$5$M&j7 zJ$v}iFwNx)e^RM#*9B*tGTmEyOrjH)e19nO+VJLPa|6#S&1Y|_)NEY%<|p$N4ufaM zf+ruCmbBKwB4nq@wP*VlwJKcCe*D%fTs`9Xr};-m9`){izyW5UG46_0xj?^2gN6 zwI9~1te>2!E_yus4x7yDYL)8a>8}ns3%Z(_mhL=sdzMp8+^$(nr}r&YVSjwvbRXZ_ z>cw2Mf8Oxh^Z)#&PP6lmkMrL1UA(3DwT6oE{F7{g;q2!w=kF>$r0eyv=JnjAIXC*4 zc5>$kxJI%S&H2rQT!yVz%aVRQj%6;W`b!=5+aec$W0KYp2&K45k^UBF|~^X&^Fw2%Iuwczx;r3POoUGy;UUvZ290QDCjVE_OC literal 0 HcmV?d00001 diff --git a/hosts/thegeneralist/configuration.nix b/hosts/thegeneralist/configuration.nix new file mode 100644 index 0000000..94915ab --- /dev/null +++ b/hosts/thegeneralist/configuration.nix @@ -0,0 +1,57 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ self, config, pkgs, lib, inputs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + inputs.agenix.nixosModules.default + inputs.home-manager.nixosModules.default + ]; + + age.secrets.hostkey.file = ./hostkey.age; + services.openssh.hostKeys = [{ + type = "ed25519"; + path = config.age.secrets.hostkey.path; + }]; + + users.users.thegeneralist = { + isNormalUser = true; + description = "thegeneralist"; + extraGroups = [ "wheel" "audio" "video" "input" "scanner" ]; + shell = pkgs.nushell; + home = "/home/thegeneralist"; + openssh.authorizedKeys.keys = let + inherit (import ../../keys.nix) thegeneralist; + in [ thegeneralist ]; + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + thegeneralist = import (self + /modules/home); + }; + }; + + # Some programs + services.libinput.enable = true; + programs.firefox.enable = true; + programs.zsh.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + system.stateVersion = "24.11"; +} + diff --git a/hosts/thegeneralist/default.nix b/hosts/thegeneralist/default.nix new file mode 100644 index 0000000..3b54984 --- /dev/null +++ b/hosts/thegeneralist/default.nix @@ -0,0 +1,21 @@ +lib: inputs: self: lib.nixosSystem { + specialArgs = inputs // { inherit inputs; inherit self; }; + modules = [ + ./configuration.nix + ({ pkgs, ... }: let + inherit (lib) filter hasSuffix; + modules = lib.filesystem.listFilesRecursive ../../modules/linux |> filter (hasSuffix ".nix"); + in { + imports = modules; + }) + ({ pkgs, lib, ... }: let + inherit (lib) attrValues hasAttrByPath getAttrFromPath filter; + packagePath = [ "overlays" "default" ]; + overlays = (attrValues inputs) + |> filter (hasAttrByPath packagePath) + |> map (getAttrFromPath packagePath); + in { + nixpkgs.overlays = overlays; + }) + ]; +} diff --git a/hosts/thegeneralist/hardware-configuration.nix b/hosts/thegeneralist/hardware-configuration.nix new file mode 100644 index 0000000..1d85655 --- /dev/null +++ b/hosts/thegeneralist/hardware-configuration.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + + # Wi-Fi stuff + nixpkgs.config.allowUnfree = true; + hardware.enableAllFirmware = true; + boot.kernelModules = [ "kvm-intel" "rtw_8822bu" ]; + + fileSystems."/" = + { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [{ + device = "/dev/disk/by-label/swap"; + }]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f0u5.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/thegeneralist/hostkey.age b/hosts/thegeneralist/hostkey.age new file mode 100644 index 0000000000000000000000000000000000000000..093a311c62d1296bebd37b2575e10186536541a8 GIT binary patch literal 631 zcmYdHPt{G$OD?J`D9Oyv)5|YP*Do{V(zR14F3!+RO))YxHMCSHD6lL{2~;Td^>z2j zP4Y9>cFwCP2=Yu!Pt*=@4f6Lbba4p|2?;bXDex;!2`lh(G~x2}C`hs__mA>*Eln}Z zit!44)m11mEi-Tn@-;U0Ep#q*4T?-N z^U5v@&#Edm(k}P5h)T{0$p|YC$nmT24CHd%{);g*RMpAj&hFC+Cw%|4u(`$5$M&j7 zJ$v}iFwNx)e^RM#*9B*tGTmEyOrjH)e19nO+VJLPa|6#S&1Y|_)NEY%<|p$N4ufaM zf+ruCmbBKwB4nq@wP*VlwJKcCe*D%fTs`9Xr};-m9`){izyW5UG46_0xj?^2gN6 zwI9~1te>2!E_yus4x7yDYL)8a>8}ns3%Z(_mhL=sdzMp8+^$(nr}r&YVSjwvbRXZ_ z>cw2Mf8Oxh^Z)#&PP6lmkMrL1UA(3DwT6oE{F7{g;q2!w=kF>$r0eyv=JnjAIXC*4 zc5>$kxJI%S&H2rQT!yVz%aVRQj%6;W`b!=5+aec$W0KYp2&K45k^UBF|~^X&^Fw2%Iuwczx;r3POoUGy;UUvZ290QDCjVE_OC literal 0 HcmV?d00001 diff --git a/keys.nix b/keys.nix new file mode 100644 index 0000000..d624b65 --- /dev/null +++ b/keys.nix @@ -0,0 +1,3 @@ +{ + thegeneralist = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBm2mtgxLsmsn/VU1Y4oUr5euwnC6DnlJWewkFeTtGDo 180094941+thegeneralist01@users.noreply.github.com"; +} diff --git a/modules/common/default.nix b/modules/common/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/common/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/modules/darwin/default.nix @@ -0,0 +1 @@ + diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..eb742af --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,54 @@ +{ config, pkgs, inputs, lib, ... }: { + home.username = "thegeneralist"; + home.homeDirectory = "/home/thegeneralist"; + + home.packages = with pkgs; [ + android-tools + + zip + xz + unzip + + mtr + iperf3 + dnsutils + ldns + nmap + + file + which + tree + gnupg + btop + + pciutils + usbutils + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # or + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # or + # /etc/profiles/per-user/thegeneralist/etc/profile.d/hm-session-vars.sh + + home.stateVersion = "24.11"; + programs.home-manager.enable = true; +} diff --git a/modules/home/dotfiles/i3/config b/modules/home/dotfiles/i3/config new file mode 100644 index 0000000..bc80ca5 --- /dev/null +++ b/modules/home/dotfiles/i3/config @@ -0,0 +1,231 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod1 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# GET DEM BORDERS OUT OF HEREc:w +# +# Thanks Childz +for_window [class="^.*"] border pixel 2 + # class border backgr. text indicator child_border +for_window [class="^.*"] client.focused #77dd77 #285577 #ffffff #2e9ef4 #285577 + +for_window [class="pinentry-qt"] floating enable +for_window [window_role="pop-up"] floating enable +for_window [window_role="bubble"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [window_type="dialog"] floating enable +for_window [window_type="menu"] floating enable + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +#set $refresh_i3status killall -SIGUSR1 i3status + +# Use pactl to adjust volume in PulseAudio. +exec --no-startup-id sxhkd +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioStop exec --no-startup-id playerctl stop +bindsym XF86AudioNext exec --no-startup-id playerctl next +bindsym XF86AudioPrev exec --no-startup-id playerctl previous +bindsym XF86AudioRaiseVolume exec --no-startup-id wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bindsym XF86AudioLowerVolume exec --no-startup-id wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindsym XF86AudioMute exec --no-startup-id wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +# bindsym $mod+Return exec i3-sensible-terminal +bindsym $mod+Return exec ghostty + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +# bindsym $mod+d exec --no-startup-id dmenu_run +# A more modern dmenu replacement is rofi: +bindcode $mod+40 exec "rofi -modi drun,run -show drun" +# There also is i3-dmenu-desktop which only displays applications shipping a +# .desktop file. It is a wrapper around dmenu, so you need that installed. +# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop + +# change focus +bindsym $mod+Ctrl+h focus left +bindsym $mod+Ctrl+j focus down +bindsym $mod+Ctrl+k focus up +bindsym $mod+Ctrl+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Ctrl+Left focus left +bindsym $mod+Ctrl+Down focus down +bindsym $mod+Ctrl+Up focus up +bindsym $mod+Ctrl+Right focus right + +# move focused window +bindsym $mod+Ctrl+Shift+h move left +bindsym $mod+Ctrl+Shift+j move down +bindsym $mod+Ctrl+Shift+k move up +bindsym $mod+Ctrl+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Ctrl+Shift+Left move left +bindsym $mod+Ctrl+Shift+Down move down +bindsym $mod+Ctrl+Shift+Up move up +bindsym $mod+Ctrl+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" +set $ws11 "11" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 +bindsym $mod+Shift+F11 workspace number $ws11 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 +bindsym $mod+Ctrl+Shift+F11 move container to workspace number $ws11 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym semicolon resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status + # status_command i3blocks + tray_output primary +} +bindsym ISO_Next_Group exec pkill -RTMIN+1 i3blocks + +################ +# CUSTOM +# MAPPINGS +################ + +# Keyboard layouts +exec_always "setxkbmap -layout us,ru -option grp:win_space_toggle" + +# Screenshot keybind +bindsym --release Print exec flameshot gui + +exec --no-startup-id feh --bg-scale /usr/share/psycho_mask.jpg + +exec_always --no-startup-id xset r rate 200 25 +exec vmware-user-suid-wrapper --no-startup-id + +exec --no-startup-id xrdb -merge /home/thegeneralist01/.Xresources diff --git a/modules/home/dotfiles/i3/detect-tray.sh b/modules/home/dotfiles/i3/detect-tray.sh new file mode 100755 index 0000000..5453671 --- /dev/null +++ b/modules/home/dotfiles/i3/detect-tray.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# Detect primary or fallback to first connected output +OUTPUT=$(xrandr --query | awk '/ connected/{print $1; exit}') +exec i3bar --tray_output "$OUTPUT" diff --git a/modules/home/dotfiles/i3status/config b/modules/home/dotfiles/i3status/config new file mode 100644 index 0000000..aa92d3f --- /dev/null +++ b/modules/home/dotfiles/i3status/config @@ -0,0 +1,32 @@ +general { + interval = 5 + colors = true +} + +order += "cpu_usage" +order += "memory" +order += "disk /" +order += "tztime local" +#order += "keyboard_layout" + +cpu_usage { + format = "CPU: %usage" +} + +memory { + format = "RAM: %used/%total" +} + +disk "/" { + format = "Disk: %avail" +} + +tztime local { + format = "%Y-%m-%d %H:%M:%S %Z" +} + +#keyboard_layout { +# format = "LANG: %s" +# interval = 1 +# exec = "xkblayout-state print '%s'" +#} diff --git a/modules/home/dotfiles/nvim/after/ftplugin/rust.lua b/modules/home/dotfiles/nvim/after/ftplugin/rust.lua new file mode 100644 index 0000000..8d34f5e --- /dev/null +++ b/modules/home/dotfiles/nvim/after/ftplugin/rust.lua @@ -0,0 +1,18 @@ +local bufnr = vim.api.nvim_get_current_buf() +vim.keymap.set( + "n", + "a", + function() + vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. + end, + { silent = true, buffer = bufnr } +) +vim.keymap.set( + "n", + "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp({ 'hover', 'actions' }) + end, + { silent = true, buffer = bufnr } +) diff --git a/modules/home/dotfiles/nvim/init.lua b/modules/home/dotfiles/nvim/init.lua new file mode 100644 index 0000000..abe190f --- /dev/null +++ b/modules/home/dotfiles/nvim/init.lua @@ -0,0 +1 @@ +require("thegeneralist") diff --git a/modules/home/dotfiles/nvim/lazy-lock.json b/modules/home/dotfiles/nvim/lazy-lock.json new file mode 100644 index 0000000..1f6c0c9 --- /dev/null +++ b/modules/home/dotfiles/nvim/lazy-lock.json @@ -0,0 +1,55 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "avante.nvim": { "branch": "main", "commit": "a60a8d470160a5f7aa6ceec019095dbd7563e3e0" }, + "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, + "catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" }, + "copilot.vim": { "branch": "release", "commit": "5015939f131627a6a332c9e3ecad9a7cb4c2e549" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "editorconfig.nvim": { "branch": "master", "commit": "67758c3e8a2f79019322a60013e4ce0aad09dafa" }, + "fine-cmdline.nvim": { "branch": "main", "commit": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gh.nvim": { "branch": "main", "commit": "6f367b2ab8f9d4a0a23df2b703a3f91137618387" }, + "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, + "img-clip.nvim": { "branch": "main", "commit": "24c13df08e3fe66624bed5350a2a780f77f1f65b" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "litee.nvim": { "branch": "main", "commit": "4efaf373322d9e71eaff31164abb393417cc6f6a" }, + "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lualine.nvim": { "branch": "master", "commit": "9fef261b53fbe3a2ef01ee9667f6fde064b1ed10" }, + "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "neogen": { "branch": "main", "commit": "05d754004da8c89115b291f2a23ca530a8cac8fd" }, + "nerdfont.vim": { "branch": "master", "commit": "3605ba4ba4dc0295f5eb400506fd05b451df3e1f" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "6557f20e631d2e9b2a9fd27a5c045d701a3a292c" }, + "none-ls.nvim": { "branch": "main", "commit": "a117163db44c256d53c3be8717f3e1a2a28e6299" }, + "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, + "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, + "nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" }, + "nvim-dap-probe-rs": { "branch": "master", "commit": "6df52c49755d78a2d7754c0630dd58694ea39ada" }, + "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, + "nvim-treesitter": { "branch": "master", "commit": "b10436b9fb29d3c3c406c07ce813f70245f9bc7b" }, + "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "oil.nvim": { "branch": "master", "commit": "ab887d926c2665a708fbe9e6c4654042cc5f4c60" }, + "plenary": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "rose-pine": { "branch": "main", "commit": "7d1b5c7dcd274921f0f58e90a8bf935f6a95fbf3" }, + "rustaceanvim": { "branch": "master", "commit": "448c76451ecf3c0edabcde427b7f1c8c219be2dd" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "which-key.nvim": { "branch": "main", "commit": "af4ded85542d40e190014c732fa051bdbf88be3d" } +} diff --git a/modules/home/dotfiles/nvim/lua/.luarc.json b/modules/home/dotfiles/nvim/lua/.luarc.json new file mode 100644 index 0000000..23b9ee2 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/.luarc.json @@ -0,0 +1,3 @@ +{ + "workspace.checkThirdParty": false +} \ No newline at end of file diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/init.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/init.lua new file mode 100644 index 0000000..058fcd1 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/init.lua @@ -0,0 +1,77 @@ +require("thegeneralist.remap") +require("thegeneralist.set") +require("thegeneralist.lazy_init") + + +local augroup = vim.api.nvim_create_augroup +local thegeneralist_group = augroup('thegeneralist', {}) + +local autocmd = vim.api.nvim_create_autocmd +local yank_group = augroup('HighlightYank', {}) + +autocmd('TextYankPost', { + group = yank_group, + pattern = '*', + callback = function() + vim.highlight.on_yank({ + higroup = 'IncSearch', + timeout = 40, + }) + end, +}) + +autocmd({ "BufWritePre" }, { + group = thegeneralist_group, + pattern = "*", + command = [[%s/\s\+$//e]], +}) + +autocmd('LspAttach', { + group = thegeneralist_group, + callback = function(e) + -- @param desc string + local function opts(desc) + return { + buffer = e.buf, + --noremap = true, -- Not sure about this + desc = "[LSP] " .. desc + } + end + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts("Go to Definition")) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Go to Declaration")) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts("Hover info")) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts("Workspace Symbol")) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts("Open float?")) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts("View code actions")) + vim.keymap.set("i", "", function() vim.lsp.buf.code_action() end, opts("View code actions")) + vim.keymap.set("n", "va", function() + -- TODO: this + local params = vim.lsp.util.make_range_params() + params.context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() } + local result, err = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000) + if result and result[1] and result[1].result and result[1].result[1] then + local first_action = result[1].result[1] + vim.lsp.buf.execute_command(first_action.command) + else + print("No code actions available") + end + end, opts("Apply 1st code action")) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts("Show references")) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts("Rename")) + vim.keymap.set("n", "[d", function() + vim.diagnostic.jump({ + count = 1, + float = true, + }) + end, opts("Previous diagnostic")) + vim.keymap.set("n", "]d", function() + vim.diagnostic.jump({ + count = -1, + float = true, + }) + end, opts("Next diagnostic")) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts("Signature help")) + vim.keymap.set("n", "h", function() vim.lsp.buf.signature_help() end, opts("Signature help")) + end +}) diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/avante.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/avante.lua new file mode 100644 index 0000000..6bf6df4 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/avante.lua @@ -0,0 +1,80 @@ +return { + -- { + -- "MeanderingProgrammer/render-markdown.nvim", + -- opts = { + -- file_types = { "markdown", "Avante" }, + -- }, + -- ft = { "markdown", "Avante" }, + -- }, + { + "yetone/avante.nvim", + ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string + event = "VeryLazy", + lazy = false, + opts = { + provider = "copilot", + mappings = { + diff = { + ours = "co", + theirs = "ct", + all_theirs = "ca", + both = "cb", + cursor = "cc", + next = "]x", + prev = "[x", + }, + ask = "Aa", + edit = "Ae", + refresh = "Ar", + toggle = { + default = "At", + debug = "Ad", + hint = "Ah", + suggestion = "As", + }, + }, + behaviour = { + auto_suggestions = false, + }, + hints = { enabled = false }, + }, + branch = "main", + -- commit = "ff316f91101fcc328d1e7879ab1bf26a055c2745", + -- if you want to download pre-built binary, then pass source=false. Make sure to follow instruction above. + -- Also note that downloading prebuilt binary is a lot faster comparing to compiling from source. + build = ":AvanteBuild source=false", + dependencies = { + "stevearc/dressing.nvim", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + --- The below dependencies are optional, + "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons + -- "zbirenbaum/copilot.lua", -- for providers='copilot' + { + -- support for image pasting + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, + }, + { + -- Make sure to setup it properly if you have lazy=true + "MeanderingProgrammer/render-markdown.nvim", + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, + }, + }, + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua new file mode 100644 index 0000000..c6a6f85 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua @@ -0,0 +1,84 @@ +return { + { + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "default" }, + + appearance = { + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, + + -- { + -- 'neovim/nvim-lspconfig', + -- dependencies = { + -- 'saghen/blink.cmp', + -- 'williamboman/mason.nvim', + -- 'mason-org/mason-registry', + -- 'williamboman/mason-lspconfig.nvim', + -- 'L3MON4D3/LuaSnip', + -- 'saadparwaiz1/cmp_luasnip', + -- 'j-hui/fidget.nvim', + -- }, + -- + -- -- example using `opts` for defining servers + -- opts = { + -- servers = { + -- lua_ls = {} + -- } + -- }, + -- config = function(_, opts) + -- require("fidget").setup({}) + -- require("mason").setup() + -- + -- local lspconfig = require('mason-lspconfig') + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- print('configuring server:', server) + -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + -- require("lspconfig")[server].setup(config) + -- end + -- end + -- + -- example calling setup directly for each LSP + -- config = function() + -- local capabilities = require('blink.cmp').get_lsp_capabilities() + -- local lspconfig = require('lspconfig') + -- + -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) + -- end + -- }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/colors.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/colors.lua new file mode 100644 index 0000000..60770c0 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/colors.lua @@ -0,0 +1,134 @@ +function ColorMyPencils(color) + -- color = color or "rose-pine" + color = color or "tokyonight-storm" or "rose-pine" or "tokyonight-night" + vim.cmd.colorscheme(color) + + -- vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + -- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + + -- Shift+k, supposedly + -- we don't need er + -- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + -- vim.lsp.handlers.hover, { + -- border = "single", -- Use a sharp border with `FloatBorder` highlights + -- max_width = 50, + -- } + -- ) +end + +return { + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + }, + { + "folke/tokyonight.nvim", + priority = 1000, + config = function() + require("tokyonight").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + transparent = true, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = false }, + keywords = { italic = false }, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + }) + end, + }, + { + "rose-pine/neovim", + name = "rose-pine", + priority = 1000, + config = function() + --[[ require('rose-pine').setup({ + disable_background = true, + styles = { + italic = false, + }, + }) ]] + + require("rose-pine").setup({ + variant = "auto", -- auto, main, moon, or dawn + dark_variant = "main", -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + + styles = { + bold = true, + italic = false, + transparency = false, + }, + + groups = { + border = "muted", + link = "iris", + panel = "surface", + + error = "love", + hint = "iris", + info = "foam", + note = "pine", + todo = "rose", + warn = "gold", + + git_add = "foam", + git_change = "rose", + git_delete = "love", + git_dirty = "rose", + git_ignore = "muted", + git_merge = "iris", + git_rename = "pine", + git_stage = "iris", + git_text = "rose", + git_untracked = "subtle", + + h1 = "iris", + h2 = "foam", + h3 = "rose", + h4 = "gold", + h5 = "pine", + h6 = "foam", + }, + + highlight_groups = { + -- Comment = { fg = "foam" }, + -- VertSplit = { fg = "muted", bg = "muted" }, + }, + + before_highlight = function(group, highlight, palette) + -- Disable all undercurls + -- if highlight.undercurl then + -- highlight.undercurl = false + -- end + -- + -- Change palette colour + -- if highlight.fg == palette.pine then + -- highlight.fg = palette.foam + -- end + end, + }) + + -- vim.cmd("colorscheme rose-pine") + -- vim.cmd("colorscheme rose-pine-main") + -- vim.cmd("colorscheme rose-pine-moon") + -- vim.cmd("colorscheme rose-pine-dawn") + + ColorMyPencils() + end, + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/command_bar.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/command_bar.lua new file mode 100644 index 0000000..c84bbc8 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/command_bar.lua @@ -0,0 +1,6 @@ +return { + "VonHeikemen/fine-cmdline.nvim", + dependencies = { + "MunifTanjim/nui.nvim", + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/commenter.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/commenter.lua new file mode 100644 index 0000000..6712af9 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/commenter.lua @@ -0,0 +1,6 @@ +return { + 'numToStr/Comment.nvim', + config = function() + require('Comment').setup() + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/dap.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/dap.lua new file mode 100644 index 0000000..546a657 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/dap.lua @@ -0,0 +1,215 @@ +return +{ + { + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + "nvim-neotest/nvim-nio", + "mfussenegger/nvim-dap-python", + "abayomi185/nvim-dap-probe-rs", + }, + config = function() + local dap = require("dap") + local ui = require("dapui") + + require("dapui").setup() + require("nvim-dap-virtual-text").setup({}) + require('dap-probe-rs').setup() + + -- Adapters + dap.adapters.cppdbg = { + id = "cppdbg", + type = "executable", + command = "/home/thegeneralist/.cpptools/extension/debugAdapters/bin/OpenDebugAD7", + } + dap.adapters.gdb = { + type = "executable", + id = "gdb", + args = { "--interpreter=dap", "--eval-command", "set print pretty on" } + } + dap.adapters["probe-rs-debug"] = { + type = "server", + port = "${port}", + executable = { + command = vim.fn.expand "$HOME/.cargo/bin/probe-rs", + args = { "dap-server", "--port", "${port}" }, + }, + } + + -- RUST + dap.adapters["probe-rs-debug"] = { + type = "server", + port = "${port}", + executable = { + command = vim.fn.expand "$HOME/.cargo/bin/probe-rs", + args = { "dap-server", "--port", "${port}" }, + }, + } + -- Connect the probe-rs-debug with rust files. Configuration of the debugger is done via project_folder/.vscode/launch.json + require("dap.ext.vscode").type_to_filetypes["probe-rs-debug"] = { "rust" } + -- Set up of handlers for RTT and probe-rs messages. + -- In addition to nvim-dap-ui I write messages to a probe-rs.log in project folder + -- If RTT is enabled, probe-rs sends an event after init of a channel. This has to be confirmed or otherwise probe-rs wont sent the rtt data. + dap.listeners.before["event_probe-rs-rtt-channel-config"]["plugins.nvim-dap-probe-rs"] = function(session, body) + local utils = require "dap.utils" + utils.notify( + string.format('probe-rs: Opening RTT channel %d with name "%s"!', body.channelNumber, body.channelName) + ) + local file = io.open("probe-rs.log", "a") + if file then + file:write( + string.format( + '%s: Opening RTT channel %d with name "%s"!\n', + os.date "%Y-%m-%d-T%H:%M:%S", + body.channelNumber, + body.channelName + ) + ) + end + if file then file:close() end + session:request("rttWindowOpened", { body.channelNumber, true }) + end + -- After confirming RTT window is open, we will get rtt-data-events. + -- I print them to the dap-repl, which is one way and not separated. + -- If you have better ideas, let me know. + dap.listeners.before["event_probe-rs-rtt-data"]["plugins.nvim-dap-probe-rs"] = function(_, body) + local message = + string.format("%s: RTT-Channel %d - Message: %s", os.date "%Y-%m-%d-T%H:%M:%S", body.channelNumber, body + .data) + local repl = require "dap.repl" + repl.append(message) + local file = io.open("probe-rs.log", "a") + if file then file:write(message) end + if file then file:close() end + end + -- Probe-rs can send messages, which are handled with this listener. + dap.listeners.before["event_probe-rs-show-message"]["plugins.nvim-dap-probe-rs"] = function(_, body) + local message = string.format("%s: probe-rs message: %s", os.date "%Y-%m-%d-T%H:%M:%S", body.message) + local repl = require "dap.repl" + repl.append(message) + local file = io.open("probe-rs.log", "a") + if file then file:write(message) end + if file then file:close() end + end + -- RUST END + + dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + { + name = "Select and attach to process", + type = "gdb", + request = "attach", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + pid = function() + local name = vim.fn.input('Executable name (filter): ') + return require("dap.utils").pick_process({ filter = name }) + end, + cwd = '${workspaceFolder}' + }, + { + name = 'Attach to gdbserver :1234', + type = 'gdb', + request = 'attach', + target = 'localhost:1234', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}' + }, + } + + + + -- Configurations + -- dap.configurations.cpp = { + -- { + -- name = "Launch file", + -- type = "cppdbg", + -- request = "launch", + -- program = function() + -- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + -- end, + -- cwd = "${workspaceFolder}", + -- stopAtEntry = true, + -- setupCommands = { + -- { + -- text = "-enable-pretty-printing", + -- description = "enable pretty printing", + -- ignoreFailures = false, + -- }, + -- }, + -- }, + -- { + -- name = "Attach to gdbserver :1234", + -- type = "cppdbg", + -- request = "launch", + -- MIMode = "gdb", + -- miDebuggerServerAddress = "localhost:1234", + -- miDebuggerPath = "/usr/bin/gdb", + -- cwd = "${workspaceFolder}", + -- program = function() + -- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + -- end, + -- setupCommands = { + -- { + -- text = "-enable-pretty-printing", + -- description = "enable pretty printing", + -- ignoreFailures = false, + -- }, + -- }, + -- }, + -- } + + + dap.configurations.cpp = dap.configurations.c + require("dap-python").setup("python") + + vim.keymap.set("n", "b", dap.toggle_breakpoint) + vim.keymap.set("n", "gb", dap.run_to_cursor) + vim.keymap.set("n", "guo", ui.open) + vim.keymap.set("n", "guc", ui.close) + + -- Eval var under cursor + vim.keymap.set("n", "?", function() + ui.eval(nil, { enter = true }) + end) + + vim.keymap.set("n", "", dap.continue) + vim.keymap.set("n", "", dap.step_into) + vim.keymap.set("n", "", dap.step_over) + vim.keymap.set("n", "", dap.step_out) + vim.keymap.set("n", "", dap.step_back) + vim.keymap.set("n", "", dap.restart) + + dap.listeners.before.attach.dapui_config = function() + ui.open() + end + dap.listeners.before.launch.dapui_config = function() + ui.open() + end + -- dap.listeners.before.event_terminated.dapui_config = function() + -- ui.close() + -- end + -- dap.listeners.before.event_exited.dapui_config = function() + -- -- ui.close() + -- end + end, + }, + { + 'mrcjkb/rustaceanvim', + version = '^5', -- Recommended + lazy = false, -- This plugin is already lazy + } +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/fugitive.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/fugitive.lua new file mode 100644 index 0000000..7e058e3 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/fugitive.lua @@ -0,0 +1,6 @@ +return { + "tpope/vim-fugitive", + config = function() + vim.keymap.set("n", "gs", vim.cmd.Git) + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/gh.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/gh.lua new file mode 100644 index 0000000..8c96b34 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/gh.lua @@ -0,0 +1,52 @@ +return { + 'ldelossa/gh.nvim', + dependencies = { + "ldelossa/litee.nvim" + }, + config = function() + require('litee.lib').setup() + require('litee.gh').setup({ + -- deprecated, around for compatability for now. + jump_mode = "invoking", + -- remap the arrow keys to resize any litee.nvim windows. + map_resize_keys = false, + -- do not map any keys inside any gh.nvim buffers. + disable_keymaps = false, + -- the icon set to use. + icon_set = "default", + -- any custom icons to use. + icon_set_custom = nil, + -- whether to register the @username and #issue_number omnifunc completion + -- in buffers which start with .git/ + git_buffer_completion = true, + -- defines keymaps in gh.nvim buffers. + keymaps = { + -- when inside a gh.nvim panel, this key will open a node if it has + -- any futher functionality. for example, hitting on a commit node + -- will open the commit's changed files in a new gh.nvim panel. + open = "", + -- when inside a gh.nvim panel, expand a collapsed node + expand = "zo", + -- when inside a gh.nvim panel, collpased and expanded node + collapse = "zc", + -- when cursor is over a "#1234" formatted issue or PR, open its details + -- and comments in a new tab. + goto_issue = "gd", + -- show any details about a node, typically, this reveals commit messages + -- and submitted review bodys. + details = "d", + -- inside a convo buffer, submit a comment + submit_comment = "", + -- inside a convo buffer, when your cursor is ontop of a comment, open + -- up a set of actions that can be performed. + actions = "", + -- inside a thread convo buffer, resolve the thread. + resolve_thread = "", + -- inside a gh.nvim panel, if possible, open the node's web URL in your + -- browser. useful particularily for digging into external failed CI + -- checks. + goto_web = "gx" + } + }) + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/harpoon.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/harpoon.lua new file mode 100644 index 0000000..92ae3b1 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/harpoon.lua @@ -0,0 +1,54 @@ +return { + "theprimeagen/harpoon", + branch = "harpoon2", + config = function() + local harpoon = require("harpoon") + + harpoon:setup() + + -- Add and list + vim.keymap.set( + "n", + "a", + function() harpoon:list():add() end, + { desc = '[Harpoon] Add file' } + ) + vim.keymap.set( + "n", + "", + function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, + { desc = '[Harpoon] Toggle quick menu' } + ) + + -- Navigate + vim.keymap.set("n", "", function() harpoon:list():select(1) end, { desc = '[Harpoon] First file' }) + vim.keymap.set("n", "", function() harpoon:list():select(2) end, { desc = '[Harpoon] Second file' }) + vim.keymap.set("n", "", function() harpoon:list():select(3) end, { desc = '[Harpoon] Third file' }) + vim.keymap.set("n", "", function() harpoon:list():select(4) end, { desc = '[Harpoon] Fourth file' }) + vim.keymap.set("n", "", function() + local input = vim.fn.input("File number > ") + local file_number = tonumber(input, 10) + if not file_number then return print(input .. " is not a valid number") end + harpoon:list():select(file_number) + end, { desc = '[Harpoon] File by number' }) + + -- Set + vim.keymap.set("n", "", function() harpoon:list():replace_at(1) end, + { desc = '[Harpoon] Replace first file' }) + vim.keymap.set("n", "", function() harpoon:list():replace_at(2) end, + { desc = '[Harpoon] Replace second file' }) + vim.keymap.set("n", "", function() harpoon:list():replace_at(3) end, + { desc = '[Harpoon] Replace third file' }) + vim.keymap.set("n", "", function() harpoon:list():replace_at(4) end, + { desc = '[Harpoon] Replace fourth file' }) + vim.keymap.set("n", + "", + function() + local file_number = tonumber(vim.fn.input("File number > "), 10) + if not file_number then return end + harpoon:list():select(file_number) + end, + { desc = '[Harpoon] File by number' } + ) + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/init.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/init.lua new file mode 100644 index 0000000..fb7a1a6 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/init.lua @@ -0,0 +1,101 @@ +return { + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, + }, + --[[ { + 'boganworld/crackboard.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + session_key = 'redacted', + }, + }, ]] + { + "onsails/lspkind-nvim", + }, + -- { + -- "ziglang/zig.vim", + -- }, + { + "nvim-lua/plenary.nvim", + name = "plenary", + }, + { + "stevearc/oil.nvim", + config = function() + require("oil").setup() + end, + }, + -- { + -- -- https://github.com/zbirenbaum/copilot.lua + -- "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- event = "InsertEnter", + -- config = function() + -- require("copilot").setup({ + -- panel = { + -- keymap = { + -- jump_prev = "]]", + -- jump_next = "[[", + -- accept = "", + -- refresh = "gr", + -- open = "", + -- }, + -- }, + -- suggestion = { + -- auto_trigger = true, + -- keymap = { + -- accept = "", + -- }, + -- }, + -- }) + -- -- vim.keymap.set("n", "cpe", "Copilot enable") + -- -- vim.keymap.set("n", "cpd", "Copilot disable") + -- end, + -- }, + { + "github/copilot.vim", + config = function() + -- set cpd and cpe to disable/enable copilot + vim.keymap.set("n", "cpe", "Copilot enable") + vim.keymap.set("n", "cpd", "Copilot disable") + end, + }, + -- { + -- "Exafunction/codeium.nvim", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- "hrsh7th/nvim-cmp", + -- }, + -- config = function() + -- require("codeium").setup({ + -- -- https://github.com/Exafunction/codeium.vim + -- }) + -- end + -- }, + { + "ldelossa/gh.nvim", + dependencies = { + "ldelossa/litee.nvim", + }, + }, + "eandrju/cellular-automaton.nvim", + "gpanders/editorconfig.nvim", + + -- Useful for getting pretty icons, but requires a Nerd Font. + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + "lambdalisue/nerdfont.vim", + "junegunn/vim-easy-align", + "rcarriga/nvim-notify", + + -- Highlight todo, notes, etc in comments + { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/jupyter.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/jupyter.lua new file mode 100644 index 0000000..a27e82a --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/jupyter.lua @@ -0,0 +1,41 @@ +return { +-- "SUSTech-data/neopyter", +-- ---@type neopyter.Option +-- opts = { +-- mode = "proxy", -- was "direct" +-- remote_address = "127.0.0.1:9001", +-- file_pattern = { "*.ju.*" }, +-- on_attach = function(bufnr) +-- -- do some buffer keymap +-- end, +-- highlight = { +-- enable = true, +-- shortsighted = false, +-- }, +-- parser = { +-- -- trim leading/tailing whitespace of cell +-- trim_whitespace = false, +-- }, +-- }, +-- on_attach = function(buf) +-- local function map(mode, lhs, rhs, desc) +-- vim.keymap.set(mode, lhs, rhs, { desc = desc, buffer = buf }) +-- end +-- -- same, recommend the former +-- map("n", "", "Neopyter execute notebook:run-cell", "run selected") +-- -- map("n", "", "Neopyter run current", "run selected") +-- +-- -- same, recommend the former +-- map("n", "X", "Neopyter execute notebook:run-all-above", "run all above cell") +-- -- map("n", "X", "Neopyter run allAbove", "run all above cell") +-- +-- -- same, recommend the former, but the latter is silent +-- map("n", "nt", "Neopyter execute kernelmenu:restart", "restart kernel") +-- -- map("n", "nt", "Neopyter kernel restart", "restart kernel") +-- +-- map("n", "", "Neopyter execute runmenu:run", "run selected and select next") +-- map("n", "", "Neopyter execute run-cell-and-insert-below", "run selected and insert below") +-- +-- map("n", "", "Neopyter execute notebook:restart-run-all", "restart kernel and run all") +-- end, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lazydev.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lazydev.lua new file mode 100644 index 0000000..8f033aa --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lazydev.lua @@ -0,0 +1,25 @@ +return { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, + { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings + { -- optional completion source for require statements and module annotations + "hrsh7th/nvim-cmp", + opts = function(_, opts) + opts.sources = opts.sources or {} + table.insert(opts.sources, { + name = "lazydev", + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }) + end, + }, + -- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua new file mode 100644 index 0000000..f698c10 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua @@ -0,0 +1,287 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "saghen/blink.cmp", + -- "folke/neodev.nvim", + "williamboman/mason.nvim", + "mason-org/mason-registry", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + -- "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + }, + config = function() + local lspkind = require("lspkind") + -- local cmp = require("cmp") + -- local cmp_lsp = require("cmp_nvim_lsp") + -- local capabilities = vim.tbl_deep_extend( + -- "force", + -- {}, + -- vim.lsp.protocol.make_client_capabilities(), + -- cmp_lsp.default_capabilities() + -- ) + + require("fidget").setup({}) + require("mason").setup() + + local capabilities = require("blink.cmp").get_lsp_capabilities() + require("lspconfig").lua_ls.setup({ capabilites = capabilities }) + + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local c = vim.lsp.get_client_by_id(args.data.client_id) + if not c then + return + end + + if vim.bo.filetype == "lua" then + -- Format the current buffer on save + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = c.id }) + end, + }) + end + end, + }) + + -- local vue_typescript_plugin = require("mason-registry") + -- .get_package("vue-language-server") + -- :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin" + + -- require("mason-lspconfig").setup({ + -- ensure_installed = { + -- "lua_ls", + -- "rust_analyzer", + -- "ts_ls", + -- "cssls", + -- "tailwindcss", + -- "pyright", + -- }, + -- handlers = { + -- function(server_name) -- default handler (optional) + -- if server_name == "rust_analyzer" then + -- return + -- end + -- require("lspconfig")[server_name].setup({ + -- capabilities = capabilities, + -- }) + -- end, + -- + -- ["lua_ls"] = function() + -- local lspconfig = require("lspconfig") + -- lspconfig.lua_ls.setup({ + -- capabilities = capabilities, + -- settings = { + -- Lua = { + -- diagnostics = { + -- globals = { "vim", "it", "describe", "before_each", "after_each" }, + -- }, + -- }, + -- }, + -- }) + -- end, + -- + -- ["ts_ls"] = function() + -- local lspconfig = require("lspconfig") + -- lspconfig.ts_ls.setup({ + -- capabilities = capabilities, + -- -- settings = { + -- -- }, + -- init_options = { + -- plugins = { + -- { + -- name = "@vue/typescript-plugin", + -- location = vue_typescript_plugin, + -- languages = { "vue" }, + -- }, + -- }, + -- }, + -- filetypes = { + -- "javascript", + -- "javascriptreact", + -- "javascript.jsx", + -- "typescript", + -- "typescriptreact", + -- "typescript.tsx", + -- "vue", + -- }, + -- }) + -- end, + -- }, + -- }) + + -- local cmp_select = { behavior = cmp.SelectBehavior.Select } + + --- Select item next/prev, taking into account whether the cmp window is + --- top-down or bottoom-up so that the movement is always in the same direction. + -- local select_item_smart = function(dir, opts) + -- return function(fallback) + -- if cmp.visible() then + -- opts = opts or { behavior = cmp.SelectBehavior.Select } + -- if cmp.core.view.custom_entries_view:is_direction_top_down() then + -- ({ next = cmp.select_next_item, prev = cmp.select_prev_item })[dir](opts) + -- else + -- ({ prev = cmp.select_next_item, next = cmp.select_prev_item })[dir](opts) + -- end + -- else + -- fallback() + -- end + -- end + -- end + + -- cmp.setup({ + -- snippet = { + -- expand = function(args) + -- require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + -- end, + -- }, + -- completion = { + -- completeopt = "menu,menuone,noinsert", + -- }, + -- -- No idea what this is + -- matching = { + -- disallow_fuzzy_matching = false, + -- disallow_fullfuzzy_matching = false, + -- disallow_partial_fuzzy_matching = false, + -- }, + -- performance = { + -- -- debounce = 50, + -- debounce = 25, + -- -- max_view_entries = 20, + -- }, + -- That crazy window + -- window = { + -- completion = cmp.config.window.bordered({ + -- border = "single", + -- side_padding = 2, + -- col_offset = -3, + -- max_width = 80, + -- }), + -- documentation = cmp.config.window.bordered({ + -- max_width = 50, + -- }), + -- }, + -- mapping = cmp.mapping.preset.insert({ + -- [""] = select_item_smart("prev", cmp_select), + -- [""] = select_item_smart("next", cmp_select), + -- [""] = cmp.mapping.close(), + -- [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp.mapping.complete(), + -- [""] = cmp.mapping.scroll_docs(-3), + -- [""] = cmp.mapping.scroll_docs(3), + -- [""] = cmp.mapping.abort(), + -- }), + -- sorting = { + -- comparators = { + -- cmp.config.compare.locality, + -- cmp.config.compare.offset, + -- cmp.config.compare.recently_used, + -- cmp.config.compare.exact, + -- cmp.config.compare.order, + -- cmp.config.compare.length, + -- function(entry1, entry2) + -- local _, entry1_under = entry1.completion_item.label:find("^_+") + -- local _, entry2_under = entry2.completion_item.label:find("^_+") + -- entry1_under = entry1_under or 0 + -- entry2_under = entry2_under or 0 + -- if entry1_under > entry2_under then + -- return false + -- elseif entry1_under < entry2_under then + -- return true + -- end + -- end, + -- cmp.config.compare.kind, + -- cmp.config.compare.sort_text, + -- }, + -- }, + -- sources = cmp.config.sources({ + -- { name = "neopyter" }, + -- { name = "nvim_lsp" }, + -- { name = "codeium" }, + -- { name = "luasnip" }, -- For luasnip users. + -- }, { + -- { name = "buffer" }, + -- }), + -- formatting = { + -- fields = { + -- "abbr", + -- "kind", + -- "menu", + -- }, + -- expandable_indicator = true, + -- format = lspkind.cmp_format({ + -- mode = "symbol_text", + -- maxwidth = 50, + -- ellipsis_char = "...", + -- menu = { + -- neopyter = "[Neopyter]", + -- }, + -- symbol_map = { + -- -- specific complete item kind icon + -- ["Magic"] = "🪄", + -- ["Path"] = "📁", + -- ["Dict key"] = "🔑", + -- ["Instance"] = "󱃻", + -- ["Statement"] = "󱇯", + -- }, + -- }), + -- }, + -- }) + + -- -- menu item highlight + -- vim.api.nvim_set_hl(0, "CmpItemKindMagic", { bg = "NONE", fg = "#D4D434" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindPath", { link = "CmpItemKindFolder" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindDictkey", { link = "CmpItemKindKeyword" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindInstance", { link = "CmpItemKindVariable" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindStatement", { link = "CmpItemKindVariable" }) + + -- vim.diagnostic.config({ + -- -- update_in_insert = true, -- Update diagnostics in Insert mode + -- -- ^ (if false, diagnostics are updated on InsertLeave) + -- + -- underline = true, + -- + -- virtual_text = true, + -- + -- severity_sort = true, -- high -> low + -- + -- -- float = { + -- -- focusable = false, + -- -- style = "minimal", + -- -- border = "rounded", + -- -- source = true, + -- -- header = { "  Diagnostics", "String" }, + -- -- prefix = function(_, _, _) + -- -- return "  ", "String" + -- -- end, + -- -- }, + -- }) + + -- treesitter jupyter notebook stuff + -- require("nvim-treesitter.configs").setup({ + -- textobjects = { + -- move = { + -- enable = true, + -- goto_next_start = { + -- ["]j"] = "@cellseparator", + -- ["]c"] = "@cellcontent", + -- }, + -- goto_previous_start = { + -- ["[j"] = "@cellseparator", + -- ["[c"] = "@cellcontent", + -- }, + -- }, + -- }, + -- }) + end, + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/luasnip.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/luasnip.lua new file mode 100644 index 0000000..00ab5c6 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/luasnip.lua @@ -0,0 +1,22 @@ +return { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + dependencies = { "rafamadriz/friendly-snippets" }, + config = function() + local ls = require("luasnip") + require("luasnip.loaders.from_vscode").lazy_load() + + vim.keymap.set({ "i" }, "", function() ls.expand() end, { silent = true }) + vim.keymap.set({ "i", "s" }, "", function() ls.jump(1) end, { silent = true }) + vim.keymap.set({ "i", "s" }, "", function() ls.jump(-1) end, { silent = true }) + + vim.keymap.set({ "i", "s" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, { silent = true }) + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua new file mode 100644 index 0000000..e9d7525 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua @@ -0,0 +1,9 @@ +return { + -- "iamcco/markdown-preview.nvim", + -- cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + -- build = "cd app && yarn install", + -- init = function() + -- vim.g.mkdp_filetypes = { "markdown" } + -- end, + -- ft = { "markdown" }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/neogen.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/neogen.lua new file mode 100644 index 0000000..25baa2c --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/neogen.lua @@ -0,0 +1,25 @@ +return { + "danymat/neogen", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "L3MON4D3/LuaSnip", + }, + config = function() + local neogen = require("neogen") + + neogen.setup({ + snippet_engine = "luasnip" + }) + + vim.keymap.set("n", "nf", function() + neogen.generate({ type = "func" }) + end) + + vim.keymap.set("n", "nt", function() + neogen.generate({ type = "type" }) + end) + + end + -- Uncomment next line if you want to follow only stable versions + -- version = "*" +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua new file mode 100644 index 0000000..7c30498 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua @@ -0,0 +1,51 @@ +--[[ +These three tabs are necessary when dealing with this nonsense: +- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md#arguments +- https://github.com/jay-babu/mason-null-ls.nvim +- https://github.com/nvimtools/none-ls.nvim +--]] +return { + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "nvimtools/none-ls.nvim", + "nvimtools/none-ls-extras.nvim", + }, + config = function() + local null_ls = require("null-ls") + require("mason-null-ls").setup({ + ensure_installed = { + "stylua", + "jq", + "mypy", + "ruff", + "black", + }, + handlers = { + ["mypy"] = function(source_name, methods) + local options = { + extra_args = function() + local command = "which python" + local handle = io.popen(command) + local python_path = "" + if handle then + python_path = handle:read("*a") + python_path = string.gsub(python_path, "\n", "") + handle:close() + end + return { "--python-executable", python_path } + end, + } + null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) + end, + --[[ ["ruff"] = function(source_name, methods) + null_ls.register(null_ls.builtins.diagnostics.ruff) + --require('mason-null-ls').default_setup(source_name, methods) -- to maintain default behavior + end, ]] + }, + }) + + null_ls.setup() + end, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/statusline.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/statusline.lua new file mode 100644 index 0000000..64e92fc --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/statusline.lua @@ -0,0 +1,128 @@ +return { + "nvim-lualine/lualine.nvim", + -- "freddiehaddad/feline.nvim", + dependencies = { + -- "Hitesh-Aggarwal/feline_one_monokai.nvim", + "nvim-tree/nvim-web-devicons", + }, + config = function() + local tcolors = require("tokyonight.colors").setup() -- pass in any of the config options as explained above + local util = require("tokyonight.util") + local bgc = util.lighten(tcolors.bg_statusline, 0.9) + + local theme = { + normal = { + a = { fg = tcolors.fg, bg = bgc }, + b = { fg = tcolors.fg, bg = bgc }, + c = { fg = tcolors.fg, bg = bgc }, + z = { fg = tcolors.fg, bg = bgc }, + }, + insert = { a = { fg = tcolors.black, bg = tcolors.green } }, + visual = { a = { fg = tcolors.black, bg = tcolors.orange } }, + replace = { a = { fg = tcolors.black, bg = tcolors.green } }, + } + + local empty = require("lualine.component"):extend() + function empty:draw(default_highlight) + self.status = "" + self.applied_separator = "" + self:apply_highlights(default_highlight) + self:apply_section_separators() + return self.status + end + + -- Put proper separators and gaps between components in sections + local function process_sections(sections) + for name, section in pairs(sections) do + local left = name:sub(9, 10) < "x" + for pos = 1, name ~= "lualine_z" and #section or #section - 1 do + table.insert(section, pos * 2, { empty, color = { fg = tcolors.bg_dark, bg = tcolors.bg_dark } }) + end + for id, comp in ipairs(section) do + if type(comp) ~= "table" then + comp = { comp } + section[id] = comp + end + comp.separator = left and { right = "" } or { left = "" } + end + end + return sections + end + + local function search_result() + if vim.v.hlsearch == 0 then + return "" + end + local last_search = vim.fn.getreg("/") + if not last_search or last_search == "" then + return "" + end + local searchcount = vim.fn.searchcount({ maxcount = 9999 }) + return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" + end + + local function modified() + if vim.bo.modified then + return "+" + elseif vim.bo.modifiable == false or vim.bo.readonly == true then + return "-" + end + return "" + end + + require("lualine").setup({ + options = { + theme = theme, + component_separators = "", + section_separators = { left = "", right = "" }, + }, + sections = process_sections({ + lualine_a = { "mode" }, + lualine_b = { + "branch", + -- "diff", + { + "diagnostics", + source = { "nvim" }, + sections = { "error" }, + diagnostics_color = { error = { bg = tcolors.red1, fg = tcolors.bg } }, + }, + { + "diagnostics", + source = { "nvim" }, + sections = { "warn" }, + diagnostics_color = { warn = { bg = tcolors.orange, fg = tcolors.bg } }, + }, + { "filename", file_status = false, path = 3 }, + { modified, color = { bg = tcolors.red1, fg = "#ffffff" } }, + { + "%w", + cond = function() + return vim.wo.previewwindow + end, + }, + { + "%r", + cond = function() + return vim.bo.readonly + end, + }, + { + "%q", + cond = function() + return vim.bo.buftype == "quickfix" + end, + }, + }, + lualine_c = {}, + lualine_x = {}, + lualine_y = { search_result, "filetype" }, + lualine_z = { "%l:%c", "%p%%/%L" }, + }), + inactive_sections = { + lualine_c = { "%f %y %m" }, + lualine_x = {}, + }, + }) + end, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/telescope.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/telescope.lua new file mode 100644 index 0000000..8acccf9 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/telescope.lua @@ -0,0 +1,63 @@ +return { + "nvim-telescope/telescope.nvim", + + tag = "0.1.5", + + dependencies = { + "nvim-lua/plenary.nvim", + }, + + config = function() + require("telescope").setup({ + defaults = { + preview = { + treesitter = true, + }, + file_ignore_patterns = { + "node_modules", + }, + }, + }) + local builtin = require("telescope.builtin") + pcall(require("telescope").load_extension, "fzf") + + vim.keymap.set("n", "ps", function() + local search_string = vim.fn.input("Grep > ") + if search_string == "" then + return + end + builtin.grep_string({ search = search_string }) + end) + + vim.keymap.set("n", "pws", function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + + vim.keymap.set("n", "pWs", function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + + vim.keymap.set("n", "pg", builtin.live_grep, {}) + + vim.keymap.set("n", "pf", builtin.find_files, {}) + + vim.keymap.set("n", "", builtin.git_files, {}) + + vim.keymap.set("n", "pb", builtin.buffers, {}) + + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set("n", "/", function() + builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) + end, { desc = "[/] Fuzzily search in current buffer" }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set("n", "on", function() + builtin.find_files({ cwd = vim.fn.stdpath("config") }) + end, { desc = "[O]pen [N]eovim files" }) + end, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/treesitter.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/treesitter.lua new file mode 100644 index 0000000..774deeb --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/treesitter.lua @@ -0,0 +1,45 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require('nvim-treesitter.configs').setup({ + ensure_installed = { + }, + -- A list of parser names, or "all" (the five listed parsers should always be installed) + --[[ + ensure_installed = { + "svelte", + "javascript", + "typescript", + "c", + "cpp", + "html", + "css", + "scss", + "lua", + "vim", + "vimdoc", + "query" + }, + --]] + --ensure_installed = 'all', + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + }) + end +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/trouble.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/trouble.lua new file mode 100644 index 0000000..05c890e --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/trouble.lua @@ -0,0 +1,23 @@ +return { + { + "folke/trouble.nvim", + config = function() + require("trouble").setup({ + icons = false, + }) + + vim.keymap.set("n", "tt", function() + require("trouble").toggle() + end) + + vim.keymap.set("n", "[t", function() + require("trouble").next({skip_groups = true, jump = true}); + end) + + vim.keymap.set("n", "]t", function() + require("trouble").previous({skip_groups = true, jump = true}); + end) + + end + }, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/undotree.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/undotree.lua new file mode 100644 index 0000000..bbd65b0 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/undotree.lua @@ -0,0 +1,7 @@ +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end, +} diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/whichkey.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/whichkey.lua new file mode 100644 index 0000000..07eea0e --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy/whichkey.lua @@ -0,0 +1,73 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + commit = "af4ded85542d40e190014c732fa051bdbf88be3d", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = { + t = { + name = '+Trouble', + w = { 'TroubleToggle workspace_diagnostics', 'Workspace Diagnostics' }, + d = { 'TroubleToggle document_diagnostics', 'Document Diagnostics' }, + q = { 'TroubleToggle quickfix', 'Quickfix' }, + l = { 'TroubleToggle loclist', 'Location List' }, + }, + g = { + R = { 'TroubleToggle lsp_references', 'LSP References' }, + h = { + name = "+Git", + h = { + name = "+Github", + c = { + name = "+Commits", + c = { "GHCloseCommit", "Close" }, + e = { "GHExpandCommit", "Expand" }, + o = { "GHOpenToCommit", "Open To" }, + p = { "GHPopOutCommit", "Pop Out" }, + z = { "GHCollapseCommit", "Collapse" }, + }, + i = { + name = "+Issues", + p = { "GHPreviewIssue", "Preview" }, + }, + l = { + name = "+Litee", + t = { "LTPanel", "Toggle Panel" }, + }, + r = { + name = "+Review", + b = { "GHStartReview", "Begin" }, + c = { "GHCloseReview", "Close" }, + d = { "GHDeleteReview", "Delete" }, + e = { "GHExpandReview", "Expand" }, + s = { "GHSubmitReview", "Submit" }, + z = { "GHCollapseReview", "Collapse" }, + }, + p = { + name = "+Pull Request", + c = { "GHClosePR", "Close" }, + d = { "GHPRDetails", "Details" }, + e = { "GHExpandPR", "Expand" }, + o = { "GHOpenPR", "Open" }, + p = { "GHPopOutPR", "PopOut" }, + r = { "GHRefreshPR", "Refresh" }, + t = { "GHOpenToPR", "Open To" }, + z = { "GHCollapsePR", "Collapse" }, + }, + t = { + name = "+Threads", + c = { "GHCreateThread", "Create" }, + n = { "GHNextThread", "Next" }, + t = { "GHToggleThread", "Toggle" }, + }, + }, + }, + }, + --conf end + } +} +--local wk = require("which-key") +--wk.register({ +--}, { prefix = "" }) diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/lazy_init.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy_init.lua new file mode 100644 index 0000000..3af1a5e --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/lazy_init.lua @@ -0,0 +1,17 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = "thegeneralist.lazy", + change_detection = { notify = false } +}) diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/remap.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/remap.lua new file mode 100755 index 0000000..8766e4d --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/remap.lua @@ -0,0 +1,101 @@ +vim.g.mapleader = " " +--vim.keymap.set("n", "pv", vim.cmd.Ex) +--vim.keymap.set("n", "e", vim.cmd.Ex) +-- vim.keymap.set("n", "e", function() +-- vim.cmd("NvimTreeToggle") +-- end) + +vim.keymap.set("n", "e", "Oil", { desc = "Open parent directory" }) +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +vim.keymap.set("n", "vwm", function() + require("vim-with-me").StartVimWithMe() +end) +vim.keymap.set("n", "svwm", function() + require("vim-with-me").StopVimWithMe() +end) + +vim.keymap.set("n", "vs", "v") + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "", "") + +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") +vim.keymap.set("n", "f", vim.lsp.buf.format) + +vim.keymap.set("n", "m", "cnextzz") +vim.keymap.set("n", "m", "cprevzz") +vim.keymap.set("n", "mk", "lnextzz") +vim.keymap.set("n", "mj", "lprevzz") + +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +vim.keymap.set("n", "ge", "oif err != nil {}Oreturn err") + +vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua") +vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain") + +vim.keymap.set("n", "", function() + vim.cmd("so") +end) + +vim.keymap.set("n", "zh", "$viBhzf", { + desc = "Fold { block", +}) + +vim.keymap.set("n", "zj", "$vi[hzf", { + desc = "Fold [ block", +}) + +vim.keymap.set("n", "zk", "$vibhzf", { + desc = "Fold ( block", +}) + +vim.keymap.set("n", "ga", "EasyAlign") +vim.keymap.set("v", "ga", "'<,'>EasyAlign") + +-- Keep selection in visual mode after indent +vim.keymap.set("v", "<", "", ">gv") + +-- Indent with tab +vim.keymap.set("v", "", ">gv") +vim.keymap.set("v", "", "e", "jq") + +vim.keymap.set("n", "w", function() + vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) + vim.o.shiftwidth = tonumber(input) + end) +end) +-- vim.keymap.set("n", "tc", function() +-- -- local file_number = tonumber(vim.fn.input("File number > "), 10) +-- vim.fn.inputlist({ +-- "Select a theme", +-- "1. onedark", +-- }) +-- end) + +vim.keymap.set("n", "lr", "LspRestart", { desc = "Restart LSP" }) +vim.keymap.set("n", "le", "LspStart", { desc = "Start LSP" }) +vim.keymap.set("n", "ld", "LspStop", { desc = "Stop LSP" }) diff --git a/modules/home/dotfiles/nvim/lua/thegeneralist/set.lua b/modules/home/dotfiles/nvim/lua/thegeneralist/set.lua new file mode 100644 index 0000000..a20e4a9 --- /dev/null +++ b/modules/home/dotfiles/nvim/lua/thegeneralist/set.lua @@ -0,0 +1,38 @@ +vim.opt.guicursor = "n-v-c-i:block" + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +-- https://www.reddit.com/r/vim/comments/3ql651/what_do_you_set_your_updatetime_to/ +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = "80" +-- vim.opt.cmdheight = 0 +-- vim.opt.showmode = false +-- vim.opt.showcmd = false +-- vim.opt.shortmess:append("F") +-- vim.api.nvim_set_keymap('n', ':', 'FineCmdline', {noremap = true}) diff --git a/modules/linux/agenix.nix b/modules/linux/agenix.nix new file mode 100644 index 0000000..fbff72a --- /dev/null +++ b/modules/linux/agenix.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + agenix + ]; + + age.identityPaths = [ + "/home/thegeneralist/.ssh/id_ed25519" + ]; +} diff --git a/modules/linux/boot.nix b/modules/linux/boot.nix new file mode 100644 index 0000000..7ce4daf --- /dev/null +++ b/modules/linux/boot.nix @@ -0,0 +1,6 @@ +{ + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub.device = "/dev/nvme0n1"; +} diff --git a/modules/linux/ghostty.nix b/modules/linux/ghostty.nix new file mode 100644 index 0000000..f60fdb8 --- /dev/null +++ b/modules/linux/ghostty.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: { + environment.variables = { + TERMINAL = "ghostty"; + }; + + home-manager.sharedModules = [{ + programs.ghostty = { + enable = true; + package = pkgs.ghostty; + + clearDefaultKeybinds = false; + settings = { + theme = "tokyonight"; + font-family = "JetBrainsMono NL NFM Medium"; + font-size = 16; + + shell-integration-features = "no-cursor"; + + cursor-style = "block"; + background-opacity = 1; + + background-blur-radius = 0; + + gtk-titlebar = false; + mouse-hide-while-typing = true; + }; + }; + }]; +} diff --git a/modules/linux/git.nix b/modules/linux/git.nix new file mode 100644 index 0000000..e8d9686 --- /dev/null +++ b/modules/linux/git.nix @@ -0,0 +1,27 @@ +{ + home-manager.sharedModules = [{ + programs.git = { + enable = true; + + userName = "TheGeneralist"; + userEmail = "180094941+thegeneralist01@users.noreply.github.com"; + lfs = { + enable = true; + }; + + extraConfig = { + commit.gpgSign = true; + tag.gpgSign = true; + gpg.format = "ssh"; + user.signingKey = "~/.ssh/id_ed25519"; + }; + }; + + programs.gh = { + enable = true; + }; + programs.gh-dash = { + enable = true; + }; + }]; +} diff --git a/modules/linux/neovim.nix b/modules/linux/neovim.nix new file mode 100644 index 0000000..0dabc89 --- /dev/null +++ b/modules/linux/neovim.nix @@ -0,0 +1,41 @@ +{ pkgs, lib, ... }: { + environment.variables.EDITOR = "nvim"; + + home-manager.sharedModules = [{ + programs.neovim = { + enable = true; + extraLuaConfig = lib.fileContents ../home/dotfiles/nvim/init.lua; + }; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + + home.packages = with pkgs; [ + vimPlugins.markdown-preview-nvim + + # Lua + luajitPackages.luarocks_bootstrap + lua-language-server + + python311 + + nodejs + nodePackages."sass" + + gcc_multi + #llvmPackages_20.clangWithLibcAndBasicRtAndLibcxx + ]; + + home.file.".config/i3status" = { + source = ../home/dotfiles/i3status; + force = true; + recursive = true; + }; + }]; + + programs.npm.npmrc = '' + prefix=~/.npm-packages + color=true + ''; +} diff --git a/modules/linux/networking.nix b/modules/linux/networking.nix new file mode 100644 index 0000000..ef47066 --- /dev/null +++ b/modules/linux/networking.nix @@ -0,0 +1,5 @@ +{ + networking.hostName = "thegeneralist"; + networking.networkmanager.enable = true; + networking.networkmanager.wifi.powersave = false; +} diff --git a/modules/linux/nix.nix b/modules/linux/nix.nix new file mode 100644 index 0000000..3396fa5 --- /dev/null +++ b/modules/linux/nix.nix @@ -0,0 +1,8 @@ +{ + # todo: gc + nix.settings.experimental-features = [ + "flakes" + "nix-command" + "pipe-operators" + ]; +} diff --git a/modules/linux/nushell/config.nu b/modules/linux/nushell/config.nu new file mode 100644 index 0000000..2351790 --- /dev/null +++ b/modules/linux/nushell/config.nu @@ -0,0 +1,33 @@ +$env.config.buffer_editor = "/home/thegeneralist/.nix-profile/bin/nvim" +$env.config.show_banner = false + +# Basic Aliases +alias v = nvim . +alias ff = fastfetch --load-config examples/10.jsonc +alias g = glimpse --interactive -o both -f llm.md +def gg [] { + open llm.md | save -r /dev/stdout | ^xclip -sel c +} +alias rn = yazi + +# Zoxide init +#^zoxide init nushell | save --force ~/.config/nushell/zoxide.nu +#source ~/.config/nushell/zoxide.nu + +alias c = clear +alias e = exa +alias el = exa -la +alias l = ls -a +alias ll = ls -la +alias cl = c; l + +alias ap = cd ~/personal +alias ad = cd ~/Downloads +alias ab = cd ~/books +alias a = cd ~ +alias ah = cd ~/dotfiles/hosts/thegeneralist +alias ai3 = nvim /home/thegeneralist/dotfiles/hosts/thegeneralist/dotfiles/i3/config +# alias rb = sudo nixos-rebuild switch --flake ~/dotfiles#thegeneralist +alias rb = nh os switch . -v -- --show-trace --verbose + +source ~/.zoxide.nu diff --git a/modules/linux/nushell/default.nix b/modules/linux/nushell/default.nix new file mode 100644 index 0000000..ebc112d --- /dev/null +++ b/modules/linux/nushell/default.nix @@ -0,0 +1,49 @@ +{ config, pkgs, lib, ... }: let + inherit (lib) readFile; +in { + # TODO: starship + change the zoxide src + # TODO: Rust tooling + environment = { + systemPackages = with pkgs; [ + nushell + zoxide + ripgrep + jq + yq-go + eza + fzf + gh + fastfetch + ]; + + shellAliases = { + v = "nvim ."; + ff = "fastfetch --load-config examples/10.jsonc"; + g = "glimpse --interactive -o both -f llm.md"; + gg = "open llm.md | save -r /dev/stdout | ^xclip -sel c"; + rn = "yazi"; + c = "clear"; + e = "exa"; + el = "exa -la"; + l = "ls -a"; + ll = "ls -la"; + cl = "c; l"; + ap = "cd ~/personal"; + ad = "cd ~/Downloads"; + ab = "cd ~/books"; + a = "cd ~"; + ah = "cd ~/dotfiles/hosts/thegeneralist"; + ai3 = "nvim /home/thegeneralist/dotfiles/hosts/thegeneralist/dotfiles/i3/config"; + rb = "nh os switch . -v -- --show-trace --verbose"; + }; + }; + + home-manager.sharedModules = [{ + programs.nushell = { + enable = true; + configFile.text = readFile ./config.nu; + envFile.text = readFile ./env.nu; + environmentVariables = config.environment.variables; + }; + }]; +} diff --git a/modules/linux/nushell/env.nu b/modules/linux/nushell/env.nu new file mode 100644 index 0000000..f785e39 --- /dev/null +++ b/modules/linux/nushell/env.nu @@ -0,0 +1,31 @@ + +# NVM +# TODO: this +# source ("/Users/thegeneralist/.nvm/" | path join "nvm.sh") + +# GPG TTY +# $env.GPG_TTY = (tty) + +# Extra PATHs +# $env.PATH = [ +# # "/home/thegeneralist/AppImages" +# # ($env.HOME | path join "personal/zen") +# # ($env.HOME | path join ".local/scripts") +# # ($env.HOME | path join ".local/bin") +# # ($env.HOME | path join ".bun/bin") +# # ($env.HOME | path join ".nix-profile/bin") +# # "/nix/var/nix/profiles/default/bin" +# # ($env.HOME | path join ".local/share/pnpm") +# # "/usr/bin" +# # "/usr/sbin" +# # "/sbin" +# # "/Applications/Ghostty.app/Contents/MacOS" +# # ($env.HOME | path join ".local/bin") +# # ($env.HOME | path join ".cargo/env") +# # ($env.HOME | path join ".cargo/bin") +# # "/usr/local/go/bin" +# # ($env.HOME | path join "go/bin") +# # ($env.HOME | path join ".npm-packages/bin") +# # ($env.HOME | path join ".Android/Sdk/platform-tools") +# # ($env.HOME | path join ".Android/Sdk/emulator") +# ] ++ $env.PATH diff --git a/modules/linux/nvidia.nix b/modules/linux/nvidia.nix new file mode 100644 index 0000000..6f374ea --- /dev/null +++ b/modules/linux/nvidia.nix @@ -0,0 +1,10 @@ +{ + hardware.nvidia = { + open = true; + modesetting.enable = true; + }; + + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.graphics.enable = true; +} diff --git a/modules/linux/packages.nix b/modules/linux/packages.nix new file mode 100644 index 0000000..5615d58 --- /dev/null +++ b/modules/linux/packages.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, agenix, ...}: let + inherit (lib) attrValues; +in { + environment.systemPackages = attrValues { + inherit (pkgs) + wget + zsh + neovim + vim + home-manager + protonup-qt + pipewire + pwvucontrol + wireplumber + playerctl + + xsane + simple-scan + ; + }; +} diff --git a/modules/linux/printers.nix b/modules/linux/printers.nix new file mode 100644 index 0000000..a5237e7 --- /dev/null +++ b/modules/linux/printers.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Epson proprietary backend + hardware.sane.enable = true; + hardware.sane.extraBackends = [ + pkgs.epkowa + ]; +} diff --git a/modules/linux/ssh.nix b/modules/linux/ssh.nix new file mode 100644 index 0000000..d7156aa --- /dev/null +++ b/modules/linux/ssh.nix @@ -0,0 +1,13 @@ +{ + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + }; + + networking.firewall.enable = true; + networking.firewall.allowedTCPPorts = [ 22 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; +} diff --git a/modules/linux/steam.nix b/modules/linux/steam.nix new file mode 100644 index 0000000..f81c5dc --- /dev/null +++ b/modules/linux/steam.nix @@ -0,0 +1,17 @@ +{ lib, ... }: { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-unwrapped" + "steam-run" + ]; + + nixpkgs.config.allowUnfree = true; +} diff --git a/modules/linux/tailscale-marshall.age b/modules/linux/tailscale-marshall.age new file mode 100644 index 0000000..faf61b2 --- /dev/null +++ b/modules/linux/tailscale-marshall.age @@ -0,0 +1,5 @@ +age-encryption.org/v1 +-> ssh-ed25519 pp9qdQ 6l47mExiqqxdEP4ELKCvj/YnFows5CSfNqgSuI9Pumc +eqQCf0gVfLblki2WaTZBsfxwU3CZ5yAoW2K1yY7kewk +--- cuSZYUOIOdGIjEtNCfZ2/GMqF2PCn0J56GS0K3yISHw +c3&Y8{*SϘ9:sߪm|fT[h\^e7rՒlٝPDFM]p5TssD \ No newline at end of file diff --git a/modules/linux/tailscale.nix b/modules/linux/tailscale.nix new file mode 100644 index 0000000..0956059 --- /dev/null +++ b/modules/linux/tailscale.nix @@ -0,0 +1,17 @@ +{ config, ... }: { + age.secrets.tailscaleMarshall.file = ./tailscale-marshall.age; + services.tailscale = { + enable = true; + interfaceName = "tailscale0"; + useRoutingFeatures = "both"; + openFirewall = true; # or false? + extraUpFlags = [ "--ssh" ]; + extraSetFlags = [ "--advertise-exit-node" ]; + disableTaildrop = false; + authKeyFile = config.age.secrets.tailscaleMarshall.path; + }; + + networking.nameservers = [ "100.100.100.100" "8.8.8.8" "1.1.1.1" ]; + networking.search = [ "shorthair-wall.ts.net" ]; + networking.firewall.trustedInterfaces = [ "tailscale0" ]; +} diff --git a/modules/linux/xserver.nix b/modules/linux/xserver.nix new file mode 100644 index 0000000..ec1f0f1 --- /dev/null +++ b/modules/linux/xserver.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: { + # TODO: write i3 and i3status here instead of stowing + services.xserver = { + enable = true; + + displayManager = { + lightdm = { + enable = true; + greeters = { + gtk = { + enable = true; + }; + }; + }; + }; + + windowManager.i3 = { + enable = true; + package = pkgs.i3; + configFile = ../home/dotfiles/i3/config; + + extraPackages = with pkgs; [ + i3 + i3status + rofi + dmenu + feh + picom # transparency effects compositor + dunst # notification daemon + xfce.thunar + nemo + arandr # screen conf + lxappearance + ]; + }; + }; + + # Configure keymap in X11 + services.xserver.xkb.layout = "us,ru"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + + # home.file.".xprofile".text = '' + # xrandr --output HDMI-0 --primary + # ''; + # services.xserver.xrandrHeads = builtins.map (head: + # head // { + # primary = if head.output == "HDMI-0" then true else head.primary; + # } + # ) options.services.xserver.xrandrHeads; +} diff --git a/modules/linux/zsh.nix b/modules/linux/zsh.nix new file mode 100644 index 0000000..b6b758e --- /dev/null +++ b/modules/linux/zsh.nix @@ -0,0 +1,11 @@ +{ + home-manager.sharedModules = [{ + programs.zsh = { + enable = true; + enableCompletion = true; + autocd = true; + autosuggestion.enable = true; + }; + }]; + environment.pathsToLink = [ "/share/zsh" ]; +} diff --git a/secrets.nix b/secrets.nix new file mode 100644 index 0000000..91b11f9 --- /dev/null +++ b/secrets.nix @@ -0,0 +1,6 @@ +let + inherit (import ./keys.nix) thegeneralist; +in { + "hosts/thegeneralist/hostkey.age".publicKeys = [ thegeneralist ]; + "modules/linux/tailscale-marshall.age".publicKeys = [ thegeneralist ]; +}