diff --git a/flake.lock b/flake.lock index 9768096..f8ca6e5 100644 --- a/flake.lock +++ b/flake.lock @@ -231,21 +231,6 @@ "type": "github" } }, - "myneovim": { - "locked": { - "lastModified": 1726512068, - "narHash": "sha256-M9usJfu7CAZdnPPUOJ/OjbIznQ706LjnF1O/fTdZgsc=", - "ref": "refs/heads/main", - "rev": "4e9ec3b6fa70ab5d904aa294b61c1d808c70ce11", - "revCount": 32, - "type": "git", - "url": "https://git.thewizard.link/wizardlink/neovim" - }, - "original": { - "type": "git", - "url": "https://git.thewizard.link/wizardlink/neovim" - } - }, "nixpkgs": { "locked": { "lastModified": 1725983898, @@ -282,7 +267,6 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", - "myneovim": "myneovim", "nixpkgs": "nixpkgs_2", "spicetify-nix": "spicetify-nix" } diff --git a/flake.nix b/flake.nix index 3616205..2ed1fe2 100644 --- a/flake.nix +++ b/flake.nix @@ -15,8 +15,6 @@ }; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - - myneovim.url = "git+https://git.thewizard.link/wizardlink/neovim"; }; outputs = @@ -26,20 +24,45 @@ pkgs = nixpkgs.legacyPackages.${system}; in { - nixosConfigurations.wizdesk = - let - specialArgs = inputs; - modules = [ ./nixos.nix ]; - in - nixpkgs.lib.nixosSystem { inherit system specialArgs modules; }; + nixosConfigurations = { + wizdesk = + let + specialArgs = inputs; + modules = [ + ./modules/nixos + ./specific/wizdesk/nixos.nix + ]; + in + nixpkgs.lib.nixosSystem { inherit system specialArgs modules; }; + + wizlap = + let + specialArgs = inputs; + modules = [ + ./modules/nixos + ./specific/wizlap/nixos.nix + ]; + in + nixpkgs.lib.nixosSystem { inherit system specialArgs modules; }; + }; homeConfigurations.wizardlink = home-manager.lib.homeManagerConfiguration { inherit pkgs; extraSpecialArgs = inputs; - modules = [ ./home-manager.nix ]; + modules = [ ./specific/home-manager.nix ]; }; formatter."${system}" = pkgs.nixfmt-rfc-style; + + homeManagerModules = { + emacs = import ./modules/home-manager/programs/emacs; + hyprlandConfig = import ./modules/home-manager/programs/hyprland; + neovim = import ./modules/home-manager/programs/neovim; + }; + + nixosModules = { + default = import ./modules/nixos; + }; }; } diff --git a/home-manager.nix b/home-manager.nix deleted file mode 100644 index 2b45b9e..0000000 --- a/home-manager.nix +++ /dev/null @@ -1,324 +0,0 @@ -{ pkgs, myneovim, ... }: - -{ - # - ## HOME CONFIGURATION # - # - - # Import configurations for better modularity. - imports = [ - ./programs/alacritty.nix - ./programs/direnv - ./programs/emacs - ./programs/fish - ./programs/git.nix - ./programs/hyprland - ./programs/mangohud.nix - ./programs/obs-studio.nix - ./programs/rofi - ./programs/spotify - ./programs/tmux - ./programs/waybar.nix - ./services/openttd.nix - myneovim.homeManagerModules.default - ]; - - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "wizardlink"; - home.homeDirectory = "/home/wizardlink"; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "23.05"; # Please read the comment before changing. - - # You can also manage environment variables but you will have to manually - # source - # - # ~/.nix-profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # /etc/profiles/per-user/wizardlink/etc/profile.d/hm-session-vars.sh - # if you don't want to manage your shell through Home Manager. - home.sessionVariables = { - EDITOR = "nvim"; - - NIXOS_OZONE_WL = "1"; - QT_QPA_PLATFORM = "wayland"; - }; - - ## - ## PACKAGES # - ## - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # The home.packages option allows you to install Nix packages into your - # environment. - home.packages = with pkgs; [ - # # 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}!" - # '') - - ## Tools - # Utilities - brightnessctl - fastfetch - firefox - pavucontrol - protonvpn-gui - qbittorrent - qdirstat - speedcrunch - vlc - yt-dlp - zathura - - # Personal utilities - anki - ledger - vesktop - - # Editing - libreoffice - - # Creative work - blender - krita - lmms - orca-slicer - shotcut - vcv-rack - - ## Entertainment - jellyfin-media-player - - # Gaming - protontricks - wineWowPackages.unstableFull - winetricks - - # Games - openttd - prismlauncher - shattered-pixel-dungeon - xonotic - - ## Libraries - libsForQt5.kdegraphics-thumbnailers - libsForQt5.kio-extras - rnnoise-plugin - xwaylandvideobridge - - ## Development - beekeeper-studio - lazygit - - ## Desktop environment - cliphist - grim - libsForQt5.ark - mako - slurp - swww - - # Mail client - thunderbird - - ## Theming - (nerdfonts.override { - fonts = [ - "FantasqueSansMono" - "NerdFontsSymbolsOnly" - ]; - }) - libsForQt5.qtstyleplugin-kvantum - libsForQt5.qtwayland - qt6Packages.qtstyleplugin-kvantum - qt6Packages.qtwayland - - # Create an FHS environment using the command `fhs`, enabling the execution of non-NixOS packages in NixOS! - ( - let - base = appimageTools.defaultFhsEnvArgs; - in - buildFHSUserEnv ( - base - // { - name = "fhs"; - targetPkgs = - pkgs: - ( - # pkgs.buildFHSUserEnv provides only a minimal FHS environment, - # lacking many basic packages needed by most software. - # Therefore, we need to add them manually. - # - # pkgs.appimageTools provides basic packages required by most software. - (base.targetPkgs pkgs) ++ (with pkgs; [ nodejs ]) - ); - profile = "export FHS=1"; - runScript = "bash"; - extraOutputsToInstall = [ "dev" ]; - } - ) - ) - ]; - - # - ## DOTFILES # - # - - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # Cattpuccin theme for fish shell. - ".config/fish/themes/Catppuccin-Frappe.theme".source = ./programs/fish/Catppuccin-Frappe.theme; - - # Configuration for gamemode, for running games with optimizations. - ".config/gamemode.ini".source = ./programs/gamemode.ini; - - # Configuration for mako, a notification daemon. - ".config/mako".source = ./programs/mako; - - ## Kvantum's theme configuration. - ".config/Kvantum/Catppuccin-Frappe-Lavender" = { - source = "${ - pkgs.catppuccin-kvantum.override { - accent = "Lavender"; - variant = "Frappe"; - } - }/share/Kvantum/Catppuccin-Frappe-Lavender"; - }; - - ".config/Kvantum/kvantum.kvconfig".text = '' - [General] - theme=Catppuccin-Frappe-Lavender - ''; - ## - - ## Themeing configuration for qt5 and qt6 - ".config/qt5ct/colors".source = ./theming/qt5ct; - - ".config/qt6ct/colors".source = ./theming/qt5ct; # We use the qt5ct because it's the SAME spec - ## - - # Configure pipewire for microphone noise supression. - ".config/pipewire/pipewire.conf.d/99-input-denoising.conf".text = '' - context.modules = [ - { name = libpipewire-module-filter-chain - args = { - node.description = "Noise Canceling source" - media.name = "Noise Canceling source" - filter.graph = { - nodes = [ - { - type = ladspa - name = rnnoise - plugin = ${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so - label = noise_suppressor_mono - control = { - "VAD Threshold (%)" = 60.0 - "VAD Grace Period (ms)" = 175 - "Retroactive VAD Grace (ms)" = 50 - } - } - ] - } - capture.props = { - node.name = "capture.rnnoise_source" - node.passive = true - audio.rate = 48000 - } - playback.props = { - node.name = "rnnoise_source" - media.class = Audio/Source - audio.rate = 48000 - } - } - } - ] - ''; - - # Configure DXVK - ".config/dxvk.conf".text = '' - dxgi.tearFree = True - dxvk.enableGraphicsPipelineLibrary = True - - dxvk.enableAsync = True - ''; - - ".local/share/SpeedCrunch/color-schemes/catppuccin-frappe.json" = { - recursive = true; - source = builtins.fetchurl { - url = "https://raw.githubusercontent.com/catppuccin/speedcrunch/34f2b382de0188d2fd85f59a8a366f313fc30a71/themes/catppuccin-frappe.json"; - sha256 = "sha256:0imx5a53p3ls5kddplgr7mbpbidrmzl9qiwpv7r8jjmsf8yxs0i4"; - }; - }; - - # My utility scripts - ".local/share/scripts" = { - source = ./scripts; - recursive = true; - }; - }; - - # - ## THEMING # - # - home.pointerCursor = { - package = pkgs.catppuccin-cursors.frappeLavender; - name = "catppuccin-frappe-lavender-cursors"; - - gtk.enable = true; - x11.enable = true; - }; - - # Configure GTK. - gtk = { - enable = true; - - gtk3.extraConfig = { - gtk-application-prefer-dark-theme = true; - }; - - gtk4.extraConfig = { - gtk-application-prefer-dark-theme = true; - }; - - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme.override { color = "violet"; }; - }; - }; - - # Configure QT - qt = { - enable = true; - platformTheme.name = "qtct"; - }; - - # Configure XDG - xdg.mimeApps.defaultApplications = { - "inode/directory" = [ "thunar.desktop" ]; - "text/html" = [ "firefox.desktop" ]; - "video/mp4" = [ "vlc.desktop" ]; - "video/x-matroska" = [ "vlc.desktop" ]; - "x-scheme-handler/about" = [ "firefox.desktop" ]; - "x-scheme-handler/http" = [ "firefox.desktop" ]; - "x-scheme-handler/https" = [ "firefox.desktop" ]; - "x-scheme-handler/unknown" = [ "firefox.desktop" ]; - }; -} diff --git a/modules/home-manager/common.nix b/modules/home-manager/common.nix new file mode 100644 index 0000000..10049bd --- /dev/null +++ b/modules/home-manager/common.nix @@ -0,0 +1,79 @@ +{ pkgs, ... }: + +{ + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland"; + }; + + home.file = { + # Configuration for gamemode, for running games with optimizations. + ".config/gamemode.ini".source = ./programs/gamemode.ini; + + # Configuration for mako, a notification daemon. + ".config/mako".source = ./programs/mako; + + # Configure pipewire for microphone noise supression. + ".config/pipewire/pipewire.conf.d/99-input-denoising.conf".text = '' + context.modules = [ + { name = libpipewire-module-filter-chain + args = { + node.description = "Noise Canceling source" + media.name = "Noise Canceling source" + filter.graph = { + nodes = [ + { + type = ladspa + name = rnnoise + plugin = ${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so + label = noise_suppressor_mono + control = { + "VAD Threshold (%)" = 60.0 + "VAD Grace Period (ms)" = 175 + "Retroactive VAD Grace (ms)" = 50 + } + } + ] + } + capture.props = { + node.name = "capture.rnnoise_source" + node.passive = true + audio.rate = 48000 + } + playback.props = { + node.name = "rnnoise_source" + media.class = Audio/Source + audio.rate = 48000 + } + } + } + ] + ''; + + # Configure DXVK + ".config/dxvk.conf".text = '' + dxgi.tearFree = True + dxvk.enableGraphicsPipelineLibrary = True + + dxvk.enableAsync = True + ''; + + # My utility scripts + ".local/share/scripts" = { + source = ./scripts; + recursive = true; + }; + }; + + # Configure XDG + xdg.mimeApps.defaultApplications = { + "inode/directory" = [ "thunar.desktop" ]; + "text/html" = [ "firefox.desktop" ]; + "video/mp4" = [ "vlc.desktop" ]; + "video/x-matroska" = [ "vlc.desktop" ]; + "x-scheme-handler/about" = [ "firefox.desktop" ]; + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; + "x-scheme-handler/unknown" = [ "firefox.desktop" ]; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..50b9785 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./common.nix + ./packages.nix + ./theming.nix + ]; +} diff --git a/modules/home-manager/packages.nix b/modules/home-manager/packages.nix new file mode 100644 index 0000000..7b704b1 --- /dev/null +++ b/modules/home-manager/packages.nix @@ -0,0 +1,127 @@ +{ pkgs, ... }: + +{ + imports = [ + ./programs + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + # # 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}!" + # '') + + ## Tools + # Utilities + brightnessctl + fastfetch + firefox + pavucontrol + protonvpn-gui + qbittorrent + qdirstat + speedcrunch + vlc + yt-dlp + zathura + + # Personal utilities + anki + ledger + vesktop + + # Editing + libreoffice + + # Creative work + blender + krita + lmms + orca-slicer + shotcut + vcv-rack + + ## Entertainment + jellyfin-media-player + + # Gaming + protontricks + wineWowPackages.unstableFull + winetricks + + # Games + openttd + prismlauncher + shattered-pixel-dungeon + xonotic + + ## Libraries + libsForQt5.kdegraphics-thumbnailers + libsForQt5.kio-extras + rnnoise-plugin + xwaylandvideobridge + + ## Development + beekeeper-studio + lazygit + + ## Desktop environment + cliphist + grim + libsForQt5.ark + mako + slurp + swww + + # Mail client + thunderbird + + ## Theming + (nerdfonts.override { + fonts = [ + "FantasqueSansMono" + "NerdFontsSymbolsOnly" + ]; + }) + libsForQt5.qtstyleplugin-kvantum + libsForQt5.qtwayland + qt6Packages.qtstyleplugin-kvantum + qt6Packages.qtwayland + + # Create an FHS environment using the command `fhs`, enabling the execution of non-NixOS packages in NixOS! + ( + let + base = appimageTools.defaultFhsEnvArgs; + in + buildFHSUserEnv ( + base + // { + name = "fhs"; + targetPkgs = + pkgs: + ( + # pkgs.buildFHSUserEnv provides only a minimal FHS environment, + # lacking many basic packages needed by most software. + # Therefore, we need to add them manually. + # + # pkgs.appimageTools provides basic packages required by most software. + (base.targetPkgs pkgs) ++ (with pkgs; [ nodejs ]) + ); + profile = "export FHS=1"; + runScript = "bash"; + extraOutputsToInstall = [ "dev" ]; + } + ) + ) + ]; +} diff --git a/programs/alacritty.nix b/modules/home-manager/programs/alacritty.nix similarity index 100% rename from programs/alacritty.nix rename to modules/home-manager/programs/alacritty.nix diff --git a/modules/home-manager/programs/default.nix b/modules/home-manager/programs/default.nix new file mode 100644 index 0000000..977e328 --- /dev/null +++ b/modules/home-manager/programs/default.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + imports = [ + ./alacritty.nix + ./direnv + ./emacs + ./fish + ./git.nix + ./hyprland + ./mangohud.nix + ./obs-studio.nix + ./rofi + ./spotify + ./tmux + ./waybar.nix + ./neovim + ]; +} diff --git a/programs/direnv/default.nix b/modules/home-manager/programs/direnv/default.nix similarity index 100% rename from programs/direnv/default.nix rename to modules/home-manager/programs/direnv/default.nix diff --git a/programs/emacs/default.nix b/modules/home-manager/programs/emacs/default.nix similarity index 100% rename from programs/emacs/default.nix rename to modules/home-manager/programs/emacs/default.nix diff --git a/programs/emacs/doom/config.el b/modules/home-manager/programs/emacs/doom/config.el similarity index 100% rename from programs/emacs/doom/config.el rename to modules/home-manager/programs/emacs/doom/config.el diff --git a/programs/emacs/doom/init.el b/modules/home-manager/programs/emacs/doom/init.el similarity index 100% rename from programs/emacs/doom/init.el rename to modules/home-manager/programs/emacs/doom/init.el diff --git a/programs/emacs/doom/packages.el b/modules/home-manager/programs/emacs/doom/packages.el similarity index 100% rename from programs/emacs/doom/packages.el rename to modules/home-manager/programs/emacs/doom/packages.el diff --git a/programs/emacs/doom/snippets/org-mode/daily.org b/modules/home-manager/programs/emacs/doom/snippets/org-mode/daily.org similarity index 100% rename from programs/emacs/doom/snippets/org-mode/daily.org rename to modules/home-manager/programs/emacs/doom/snippets/org-mode/daily.org diff --git a/programs/emacs/doom/templates/roam/daily.org b/modules/home-manager/programs/emacs/doom/templates/roam/daily.org similarity index 100% rename from programs/emacs/doom/templates/roam/daily.org rename to modules/home-manager/programs/emacs/doom/templates/roam/daily.org diff --git a/programs/fish/Catppuccin-Frappe.theme b/modules/home-manager/programs/fish/Catppuccin-Frappe.theme similarity index 100% rename from programs/fish/Catppuccin-Frappe.theme rename to modules/home-manager/programs/fish/Catppuccin-Frappe.theme diff --git a/programs/fish/default.nix b/modules/home-manager/programs/fish/default.nix similarity index 100% rename from programs/fish/default.nix rename to modules/home-manager/programs/fish/default.nix diff --git a/programs/gamemode.ini b/modules/home-manager/programs/gamemode.ini similarity index 100% rename from programs/gamemode.ini rename to modules/home-manager/programs/gamemode.ini diff --git a/programs/git.nix b/modules/home-manager/programs/git.nix similarity index 100% rename from programs/git.nix rename to modules/home-manager/programs/git.nix diff --git a/programs/hyprland/default.nix b/modules/home-manager/programs/hyprland/default.nix similarity index 100% rename from programs/hyprland/default.nix rename to modules/home-manager/programs/hyprland/default.nix diff --git a/programs/mako/config b/modules/home-manager/programs/mako/config similarity index 100% rename from programs/mako/config rename to modules/home-manager/programs/mako/config diff --git a/programs/mangohud.nix b/modules/home-manager/programs/mangohud.nix similarity index 100% rename from programs/mangohud.nix rename to modules/home-manager/programs/mangohud.nix diff --git a/modules/home-manager/programs/neovim/README.md b/modules/home-manager/programs/neovim/README.md new file mode 100644 index 0000000..739ce42 --- /dev/null +++ b/modules/home-manager/programs/neovim/README.md @@ -0,0 +1,73 @@ +# My [Home Manager] module for neovim configuration + +This is my personal configuration for _[neovim]_ using [Nix](https://nixos.org/), so this will not work outside of it - though it can be made to be. + +In this case, I am outputting a [Home Manager] module to be used directly in your configuration, it currently barely has +any +options and is opinionated due to it being my personal configuration for daily use... But I plan to slowly add options +to make it usable by other people. + +## Installing + +First you add this repository as a flake input: + +```nix +{ + inputs = { + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + wizardlink-neovim.url = "git+https://git.thewizard.link/wizardlink/neovim"; + }; + + outputs = { home-manager, ... }@inputs: { + homeConfigurations.YOURHOSTNAME = home-manager.lib.homeManagerConfiguration { + # ... + extraSPecialArgs = inputs; + }; + }; +} +``` + +Then in your [Home Manager] configuration you can just import it: + +```nix +{ wizardlink-neovim }: + +{ + imports = [ + wizardlink-neovim.homeManagerModules.default + ]; +} +``` + +## Configuring + +### [nixd](https://github.com/nix-community/nixd/) + +```nix +programs.neovim.flake = { + hostname = "nixos"; # Your hostname used to build your system. + location = "git+file:///home/wizardlink/.system"; # Where you store your flake. +}; +``` + +## My neovim failed because of package X not existing + +My configuration is based off of `nixos-unstable` so sometimes your package may not exist or have a different name, I +apologise for that but I don't plan on maintaining backwards compatibility. :( + +## How it looks + +Here's some screenshots of how it currently looks like: + +![image](./docs/example_1.png) +![image](./docs/example_2.png) +![image](./docs/example_3.png) + +The theme I'm using is [catppuccin](https://github.com/catppuccin) in case you're curious. + +[neovim]: https://neovim.io/ +[Home Manager]: https://github.com/nix-community/home-manager diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix new file mode 100644 index 0000000..d5cb314 --- /dev/null +++ b/modules/home-manager/programs/neovim/default.nix @@ -0,0 +1,284 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) types mkOption; + ollamaPackage = + if config.programs.neovim.ollama.type == "amd" then pkgs.ollama-rocm else pkgs.ollama-cuda; +in +{ + options.programs.neovim = { + flake = { + hostname = mkOption { + default = "wizdesk"; + description = "Your NixOS hostname, needed for nixd lsp."; + example = "nixos"; + type = types.str; + }; + + location = mkOption { + default = "git+file:///home/wizardlink/.system"; + description = "Path to your flake location, prepend 'file:///' to it and 'git+' before that if using git."; + example = "git+file:///home/wizardlink/.system"; + type = types.str; + }; + }; + + ollama.type = mkOption { + default = "amd"; + description = "The type of ollama package to install, AMD GPU accelerated or NVIDIA GPU accelerated."; + example = "amd"; + type = types.enum [ + "amd" + "nvidia" + ]; + }; + }; + + config = { + programs.neovim = { + enable = true; + withNodeJs = true; + withPython3 = true; + + extraLuaConfig = builtins.readFile ./init.lua; + + extraPackages = with pkgs; [ + # Needed by ollama.nvim + curl + ollamaPackage + + # CMAKE + neocmakelsp + + # C/C++ + clang-tools + gcc # Needed for treesitter + + # HTML/CSS/JSON + emmet-ls + vscode-langservers-extracted + + # LUA + lua-language-server + stylua + + # Markdown + markdownlint-cli + marksman + prettierd + + # Nix + nixd + nixfmt-rfc-style + + # TypeScript + typescript-language-server + + # Rust + rust-analyzer + taplo + vscode-extensions.vadimcn.vscode-lldb.adapter + + # Vue + vue-language-server + + # Svelte + nodePackages.svelte-language-server + + # YAML + yaml-language-server + ]; + }; + + xdg.configFile."nvim/lua" = { + recursive = true; + source = ./lua; + }; + + xdg.configFile."nvim/lua/plugins/astrolsp.lua".text = + let + hostname = config.programs.neovim.flake.hostname; + location = config.programs.neovim.flake.location; + in + #lua + '' + -- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine + -- Configuration documentation can be found with `:h astrolsp` + -- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) + -- as this provides autocomplete and documentation while editing + + ---@type LazySpec + return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + autoformat = true, -- enable or disable auto formatting on start + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + "c", + "cpp", + "h", + "javascript", + "jsx", + "lua", + "nix", + "rust", + "svelte", + "tsx", + "typescript", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + "clangd", + "cmake", + "cssls", + "eslint", + "html", + "jsonls", + "lua_ls", + "marksman", + "nixd", + "rust_analyzer", + "svelte", + "taplo", + "tsserver", + "volar", + "yamlls", + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + nixd = { + settings = { + nixd = { + options = { + nixos = { + expr = '(builtins.getFlake ("${location}")).nixosConfigurations.${hostname}.options', + }, + home_manager = { + expr = + '(builtins.getFlake ("${location}")).homeConfigurations.${hostname}.options', + }, + }, + }, + }, + }, + tsserver = { + init_options = { + plugins = { + { + name = "@vue/typescript-plugin", + location = "${pkgs.vue-language-server}/bin/vue-language-server", + languages = { "javascript", "typescript", "vue" }, + }, + }, + }, + filetypes = { + "javascript", + "typescript", + "vue", + }, + }, + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_document_highlight = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/documentHighlight", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "CursorHold", "CursorHoldI" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Document Highlighting", + callback = function() + vim.lsp.buf.document_highlight() + end, + }, + { + event = { "CursorMoved", "CursorMovedI", "BufLeave" }, + desc = "Document Highlighting Clear", + callback = function() + vim.lsp.buf.clear_references() + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + gl = { + function() + vim.diagnostic.open_float() + end, + desc = "Hover diagnostics", + }, + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + -- gD = { + -- function() vim.lsp.buf.declaration() end, + -- desc = "Declaration of current symbol", + -- cond = "textDocument/declaration", + -- }, + -- ["uY"] = { + -- function() require("astrolsp.toggles").buffer_semantic_tokens() end, + -- desc = "Toggle LSP semantic highlight (buffer)", + -- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, + -- }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + end, + }, + } + ''; + }; +} diff --git a/modules/home-manager/programs/neovim/docs/example_1.png b/modules/home-manager/programs/neovim/docs/example_1.png new file mode 100644 index 0000000..b3f74a2 Binary files /dev/null and b/modules/home-manager/programs/neovim/docs/example_1.png differ diff --git a/modules/home-manager/programs/neovim/docs/example_2.png b/modules/home-manager/programs/neovim/docs/example_2.png new file mode 100644 index 0000000..c8efe4c Binary files /dev/null and b/modules/home-manager/programs/neovim/docs/example_2.png differ diff --git a/modules/home-manager/programs/neovim/docs/example_3.png b/modules/home-manager/programs/neovim/docs/example_3.png new file mode 100644 index 0000000..df20232 Binary files /dev/null and b/modules/home-manager/programs/neovim/docs/example_3.png differ diff --git a/modules/home-manager/programs/neovim/init.lua b/modules/home-manager/programs/neovim/init.lua new file mode 100644 index 0000000..2ce1cdd --- /dev/null +++ b/modules/home-manager/programs/neovim/init.lua @@ -0,0 +1,19 @@ +-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution +-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. +local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- validate that lazy is available +if not pcall(require, "lazy") then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end + +require "lazy_setup" +require "polish" diff --git a/modules/home-manager/programs/neovim/lua/community.lua b/modules/home-manager/programs/neovim/lua/community.lua new file mode 100644 index 0000000..4a34756 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/community.lua @@ -0,0 +1,40 @@ +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.colorscheme.catppuccin" }, + { + "catppuccin/nvim", + name = "catppuccin", + opts = function(_, config) + config.flavour = "frappe" + config.transparent_background = true + end, + }, + + { import = "astrocommunity.editing-support.todo-comments-nvim" }, + { import = "astrocommunity.editing-support.zen-mode-nvim" }, + + { import = "astrocommunity.motion.flash-nvim" }, + { import = "astrocommunity.motion.flit-nvim" }, + { import = "astrocommunity.motion.leap-nvim" }, + { import = "astrocommunity.motion.mini-ai" }, + { import = "astrocommunity.motion.mini-surround" }, + + { import = "astrocommunity.pack.cmake" }, + { import = "astrocommunity.pack.cpp" }, + { import = "astrocommunity.pack.godot" }, + { import = "astrocommunity.pack.html-css" }, + { import = "astrocommunity.pack.json" }, + { import = "astrocommunity.pack.lua" }, + { import = "astrocommunity.pack.markdown" }, + { import = "astrocommunity.pack.nix" }, + { import = "astrocommunity.pack.rust" }, + { import = "astrocommunity.pack.toml" }, + { import = "astrocommunity.pack.typescript" }, + { import = "astrocommunity.pack.vue" }, + { import = "astrocommunity.pack.yaml" }, +} diff --git a/modules/home-manager/programs/neovim/lua/lazy_setup.lua b/modules/home-manager/programs/neovim/lua/lazy_setup.lua new file mode 100644 index 0000000..3fb71f7 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/lazy_setup.lua @@ -0,0 +1,31 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + --version = "^4", -- Remove version tracking to elect for nighly AstroNvim + import = "astronvim.plugins", + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrodark", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua b/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..ed325ae --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/astrocore.lua @@ -0,0 +1,84 @@ +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + autoindent = true, -- indents automatically based on context + expandtab = true, -- use spaces instead of tabs + grepprg = "rg --vimgrep", -- use ripgrep on grep actions + number = true, -- sets vim.opt.number + relativenumber = true, -- sets vim.opt.relativenumber + shiftwidth = 2, -- how many spaces after indentation + signcolumn = "auto", -- sets vim.opt.signcolumn to auto + smartindent = true, -- smartly indent + spell = false, -- sets vim.opt.spell + tabstop = 2, -- how many spaces to indent when pressing tab + wrap = false, -- sets vim.opt.wrap + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- Mappings can be configured through AstroCore as well. + -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized + mappings = { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + + -- navigate buffer tabs with `H` and `L` + -- L = { + -- function() require("astrocore.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, + -- desc = "Next buffer", + -- }, + -- H = { + -- function() require("astrocore.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end, + -- desc = "Previous buffer", + -- }, + + -- mappings seen under group name "Buffer" + ["bD"] = { + function() + require("astroui.status.heirline").buffer_picker(function(bufnr) + require("astrocore.buffer").close(bufnr) + end) + end, + desc = "Pick to close", + }, + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + ["b"] = { desc = "Buffers" }, + -- quick save + -- [""] = { ":w!", desc = "Save File" }, -- change description but the same command + }, + t = { + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + }, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/astroui.lua b/modules/home-manager/programs/neovim/lua/plugins/astroui.lua new file mode 100644 index 0000000..b061470 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/astroui.lua @@ -0,0 +1,37 @@ +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "catppuccin", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrotheme = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "⠋", + LSPLoading2 = "⠙", + LSPLoading3 = "⠹", + LSPLoading4 = "⠸", + LSPLoading5 = "⠼", + LSPLoading6 = "⠴", + LSPLoading7 = "⠦", + LSPLoading8 = "⠧", + LSPLoading9 = "⠇", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/mason.lua b/modules/home-manager/programs/neovim/lua/plugins/mason.lua new file mode 100644 index 0000000..5a91b71 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/mason.lua @@ -0,0 +1,31 @@ +-- Customize Mason plugins + +---@type LazySpec +return { + -- use mason-lspconfig to configure LSP installations + { + "williamboman/mason-lspconfig.nvim", + -- overrides `require("mason-lspconfig").setup(...)` + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + }, + -- use mason-null-ls to configure Formatters/Linter installation for null-ls sources + { + "jay-babu/mason-null-ls.nvim", + -- overrides `require("mason-null-ls").setup(...)` + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + -- overrides `require("mason-nvim-dap").setup(...)` + opts = function(_, opts) + opts.ensure_installed = nil + opts.automatic_installation = false + end, + }, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..5601ff7 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/none-ls.lua @@ -0,0 +1,22 @@ +-- Customize None-ls sources + +---@type LazySpec +return { + "nvimtools/none-ls.nvim", + opts = function(_, config) + -- config variable is the default configuration table for the setup function call + local null_ls = require("null-ls") + + -- Check supported formatters and linters + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + config.sources = { + -- Set a formatter + null_ls.builtins.formatting.clang_format, + null_ls.builtins.formatting.nixfmt, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.stylua, + } + return config -- return final config table + end, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..0244de8 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/treesitter.lua @@ -0,0 +1,49 @@ +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add more things to the ensure_installed table protecting against community packs modifying it + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { + -- Programming + "c", + "cmake", + "cpp", + "css", + "gdscript", + "godot_resource", + "html", + "hyprlang", + "javascript", + "jsdoc", + "lua", + "nim", + "nim_format_string", + "objc", + "proto", + "python", + "svelte", + "tsx", + "typescript", + "vue", + -- Scripting + "bash", + "glsl", + -- Configuring + "dockerfile", + "json", + "jsonc", + "nix", + "yaml", + -- Misc + "cuda", + "markdown", + "markdown_inline", + "query", + -- VIM + "vim", + "vimdoc", + }) + end, +} diff --git a/modules/home-manager/programs/neovim/lua/plugins/user.lua b/modules/home-manager/programs/neovim/lua/plugins/user.lua new file mode 100644 index 0000000..8002d04 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/plugins/user.lua @@ -0,0 +1,93 @@ +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- Here are some examples: + +---@type LazySpec +return { + + -- Discord presence + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() + require("lsp_signature").setup() + end, + }, + + -- Customize alpha options + { + "goolord/alpha-nvim", + opts = function(_, opts) + -- customize the dashboard header + opts.section.header.val = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣶⣶⣾⣿⣿⣿⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣾⣿⣿⣿⣿⣷⣶⣶⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢀⣠⡴⠾⠟⠋⠉⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠉⠉⠙⠛⠷⢦⣄⡀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠘⠋⠁⠀⠀⢀⣀⣤⣶⣖⣒⣒⡲⠶⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠶⢖⣒⣒⣲⣶⣤⣀⡀⠀⠀⠈⠙⠂⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⣠⢖⣫⣷⣿⣿⣿⣿⣿⣿⣶⣤⡙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢋⣤⣾⣿⣿⣿⣿⣿⣿⣾⣝⡲⣄⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⣄⣀⣠⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠻⢿⣿⣿⣦⣳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣟⣴⣿⣿⡿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⡻⣄⣀⣤⠀⠀⠀", + "⠀⠀⠀⠈⠟⣿⣿⣿⡿⢻⣿⣿⣿⠃⠀⠀⠀⠀⠙⣿⣿⣿⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⣿⣿⣿⠋⠀⠀⠀⠀⠘⣿⣿⣿⡟⢿⣿⣿⣟⠻⠁⠀⠀⠀", + "⠤⣤⣶⣶⣿⣿⣿⡟⠀⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡏⠀⠀⠀⠀⠀⠀⣹⣿⣿⣷⠈⢻⣿⣿⣿⣶⣦⣤⠤", + "⠀⠀⠀⠀⠀⢻⣟⠀⠀⣿⣿⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⣿⣿⠀⠀⣿⡟⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠻⣆⠀⢹⣿⠟⢿⣿⣦⣤⣤⣴⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡿⢷⣤⣤⣤⣴⣿⣿⣿⣿⡇⠀⣰⠟⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠙⠂⠀⠙⢀⣀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠁⠀⣻⣿⣿⣿⣿⣿⣿⠏⠀⠘⠃⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡈⠻⠿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠻⢿⣿⣿⣿⠿⠛⢁⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⣶⣦⣤⣤⣤⡤⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⢤⣤⣤⣤⣶⣾⠛⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + } + return opts + end, + }, + + -- Adds highlighting and lsp features for embedded code in documents. + { + "jmbuhr/otter.nvim", + dependencies = { + "hrsh7th/nvim-cmp", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + }, + + -- Adds highlighting and custom commands for ledger files + { + "ledger/vim-ledger", + }, + + -- Better UI hooks + { + "stevearc/dressing.nvim", + }, + + -- Add Ollama support in-editor + { + "nomnivore/ollama.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + + -- All the user commands added by the plugin + cmd = { "Ollama", "OllamaModel", "OllamaServe", "OllamaServeStop" }, + + keys = { + -- Sample keybind for prompt menu. Note that the is important for selections to work properly. + { + "oo", + ":lua require('ollama').prompt()", + desc = "ollama prompt", + mode = { "n", "v" }, + }, + + -- Sample keybind for direct prompting. Note that the is important for selections to work properly. + { + "oG", + ":lua require('ollama').prompt('Generate_Code')", + desc = "ollama Generate Code", + mode = { "n", "v" }, + }, + }, + + ---@type Ollama.Config + opts = { + -- your configuration overrides + }, + }, +} diff --git a/modules/home-manager/programs/neovim/lua/polish.lua b/modules/home-manager/programs/neovim/lua/polish.lua new file mode 100644 index 0000000..b19c743 --- /dev/null +++ b/modules/home-manager/programs/neovim/lua/polish.lua @@ -0,0 +1,39 @@ +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This just pure lua so anything that doesn't +-- fit in the normal config locations above can go here + +-- Set up custom filetypes +vim.filetype.add { + extension = { + foo = "fooscript", + }, + filename = { + ["Foofile"] = "fooscript", + }, + pattern = { + ["~/%.config/foo/.*"] = "fooscript", + }, +} + + +local dap = require "dap" + +dap.adapters.codelldb = { + port = "${port}", + type = "server", + executable = { + command = "codelldb", + args = { "--port", "${port}" }, + }, +} + +dap.configurations.rust = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + }, +} diff --git a/programs/obs-studio.nix b/modules/home-manager/programs/obs-studio.nix similarity index 100% rename from programs/obs-studio.nix rename to modules/home-manager/programs/obs-studio.nix diff --git a/programs/rofi/catppuccin-frappe.rasi b/modules/home-manager/programs/rofi/catppuccin-frappe.rasi similarity index 100% rename from programs/rofi/catppuccin-frappe.rasi rename to modules/home-manager/programs/rofi/catppuccin-frappe.rasi diff --git a/programs/rofi/default.nix b/modules/home-manager/programs/rofi/default.nix similarity index 100% rename from programs/rofi/default.nix rename to modules/home-manager/programs/rofi/default.nix diff --git a/programs/spotify/default.nix b/modules/home-manager/programs/spotify/default.nix similarity index 100% rename from programs/spotify/default.nix rename to modules/home-manager/programs/spotify/default.nix diff --git a/programs/tmux/default.nix b/modules/home-manager/programs/tmux/default.nix similarity index 100% rename from programs/tmux/default.nix rename to modules/home-manager/programs/tmux/default.nix diff --git a/programs/waybar.nix b/modules/home-manager/programs/waybar.nix similarity index 100% rename from programs/waybar.nix rename to modules/home-manager/programs/waybar.nix diff --git a/scripts/create_feedback_sink.sh b/modules/home-manager/scripts/create_feedback_sink.sh similarity index 100% rename from scripts/create_feedback_sink.sh rename to modules/home-manager/scripts/create_feedback_sink.sh diff --git a/scripts/delete_feedback_sink.sh b/modules/home-manager/scripts/delete_feedback_sink.sh similarity index 100% rename from scripts/delete_feedback_sink.sh rename to modules/home-manager/scripts/delete_feedback_sink.sh diff --git a/scripts/games/launch.sh b/modules/home-manager/scripts/games/launch.sh similarity index 100% rename from scripts/games/launch.sh rename to modules/home-manager/scripts/games/launch.sh diff --git a/scripts/hyprland/screenshot.sh b/modules/home-manager/scripts/hyprland/screenshot.sh similarity index 100% rename from scripts/hyprland/screenshot.sh rename to modules/home-manager/scripts/hyprland/screenshot.sh diff --git a/scripts/hyprland/screenshot_area.sh b/modules/home-manager/scripts/hyprland/screenshot_area.sh similarity index 100% rename from scripts/hyprland/screenshot_area.sh rename to modules/home-manager/scripts/hyprland/screenshot_area.sh diff --git a/scripts/hyprland/start_apps.sh b/modules/home-manager/scripts/hyprland/start_apps.sh similarity index 100% rename from scripts/hyprland/start_apps.sh rename to modules/home-manager/scripts/hyprland/start_apps.sh diff --git a/scripts/hyprland/start_services.sh b/modules/home-manager/scripts/hyprland/start_services.sh similarity index 100% rename from scripts/hyprland/start_services.sh rename to modules/home-manager/scripts/hyprland/start_services.sh diff --git a/services/openttd.nix b/modules/home-manager/services.nix similarity index 100% rename from services/openttd.nix rename to modules/home-manager/services.nix diff --git a/modules/home-manager/theming.nix b/modules/home-manager/theming.nix new file mode 100644 index 0000000..51901de --- /dev/null +++ b/modules/home-manager/theming.nix @@ -0,0 +1,70 @@ +{ pkgs, ... }: + +{ + home.file = { + # Cattpuccin theme for fish shell. + ".config/fish/themes/Catppuccin-Frappe.theme".source = ./theming/Catppuccin-Frappe.theme; + + ## Kvantum's theme configuration. + ".config/Kvantum/Catppuccin-Frappe-Lavender" = { + source = "${ + pkgs.catppuccin-kvantum.override { + accent = "Lavender"; + variant = "Frappe"; + } + }/share/Kvantum/Catppuccin-Frappe-Lavender"; + }; + + ".config/Kvantum/kvantum.kvconfig".text = '' + [General] + theme=Catppuccin-Frappe-Lavender + ''; + ## + + ## Themeing configuration for qt5 and qt6 + ".config/qt5ct/colors".source = ./theming/qt5ct; + + ".config/qt6ct/colors".source = ./theming/qt5ct; # We use the qt5ct because it's the SAME spec + ## + + ".local/share/SpeedCrunch/color-schemes/catppuccin-frappe.json" = { + recursive = true; + source = builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/speedcrunch/34f2b382de0188d2fd85f59a8a366f313fc30a71/themes/catppuccin-frappe.json"; + sha256 = "sha256:0imx5a53p3ls5kddplgr7mbpbidrmzl9qiwpv7r8jjmsf8yxs0i4"; + }; + }; + }; + + home.pointerCursor = { + package = pkgs.catppuccin-cursors.frappeLavender; + name = "catppuccin-frappe-lavender-cursors"; + + gtk.enable = true; + x11.enable = true; + }; + + # Configure GTK. + gtk = { + enable = true; + + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = true; + }; + + gtk4.extraConfig = { + gtk-application-prefer-dark-theme = true; + }; + + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme.override { color = "violet"; }; + }; + }; + + # Configure QT + qt = { + enable = true; + platformTheme.name = "qtct"; + }; +} diff --git a/modules/home-manager/theming/Catppuccin-Frappe.theme b/modules/home-manager/theming/Catppuccin-Frappe.theme new file mode 100644 index 0000000..e69de29 diff --git a/theming/qt5ct/Catppuccin-Frappe.conf b/modules/home-manager/theming/qt5ct/Catppuccin-Frappe.conf similarity index 100% rename from theming/qt5ct/Catppuccin-Frappe.conf rename to modules/home-manager/theming/qt5ct/Catppuccin-Frappe.conf diff --git a/theming/qt5ct/Catppuccin-Latte.conf b/modules/home-manager/theming/qt5ct/Catppuccin-Latte.conf similarity index 100% rename from theming/qt5ct/Catppuccin-Latte.conf rename to modules/home-manager/theming/qt5ct/Catppuccin-Latte.conf diff --git a/theming/qt5ct/Catppuccin-Macchiato.conf b/modules/home-manager/theming/qt5ct/Catppuccin-Macchiato.conf similarity index 100% rename from theming/qt5ct/Catppuccin-Macchiato.conf rename to modules/home-manager/theming/qt5ct/Catppuccin-Macchiato.conf diff --git a/theming/qt5ct/Catppuccin-Mocha.conf b/modules/home-manager/theming/qt5ct/Catppuccin-Mocha.conf similarity index 100% rename from theming/qt5ct/Catppuccin-Mocha.conf rename to modules/home-manager/theming/qt5ct/Catppuccin-Mocha.conf diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix new file mode 100644 index 0000000..2b03ec1 --- /dev/null +++ b/modules/nixos/common.nix @@ -0,0 +1,30 @@ +{ ... }: + +{ + # Enable experimental features + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + # Enable nh, a bundle of CLI utilities for NixOS + programs.nh = { + enable = true; + + # Enable automatic garbage collection. + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + + flake = "/home/wizardlink/.system"; + }; + + # Optimize storage + nix.optimise.automatic = true; + nix.settings.auto-optimise-store = true; + + # Enable Hyprland's cachix + nix.settings.substituters = [ "https://hyprland.cachix.org" ]; + nix.settings.trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..2c7933a --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + imports = [ + ./common.nix + ./desktop.nix + ./hardware.nix + ./packages.nix + ./services.nix + ./sound.nix + ./system.nix + ]; +} diff --git a/modules/nixos/desktop.nix b/modules/nixos/desktop.nix new file mode 100644 index 0000000..d66e563 --- /dev/null +++ b/modules/nixos/desktop.nix @@ -0,0 +1,83 @@ +{ pkgs, hyprland, ... }: + +let + hyprland-pkgs = hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}; +in +{ + environment.sessionVariables = { + # Set env for Fcitx5 + QMODIFIERS = "@im=fcitx5"; + }; + + # Enable SDDM. + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + theme = "catppuccin-frappe"; + package = pkgs.kdePackages.sddm; + }; + + # Enable Hyprland + programs.hyprland = { + enable = true; + + package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + portalPackage = pkgs.xdg-desktop-portal-wlr; + }; + + # Enable XDG Desktop Portals. + xdg.portal = { + enable = true; + + config = { + common = { + default = [ "wlr" ]; + }; + }; + }; + + # Needed for home-manager + environment.pathsToLink = [ + "/share/xdg-desktop-portal" + "/share/applications" + ]; + + # Enable OpenGL. + hardware.graphics = { + enable = true; + enable32Bit = true; + + package = hyprland-pkgs.mesa.drivers; + package32 = hyprland-pkgs.pkgsi686Linux.mesa.drivers; + + extraPackages = with pkgs; [ + rocm-opencl-icd # OpenGL hwa + rocm-opencl-runtime + ]; + }; + + # Enable Thunar and it's dependencies + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [ thunar-archive-plugin ]; + }; + programs.xfconf.enable = true; # For configuring + services.gvfs.enable = true; # For mounting drives, trash, etc. + services.tumbler.enable = true; # Thumbnail support + + # Enable the Fcitx5 IME + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + + fcitx5 = { + addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + fcitx5-catppuccin + ]; + + waylandFrontend = true; + }; + }; +} diff --git a/modules/nixos/hardware.nix b/modules/nixos/hardware.nix new file mode 100644 index 0000000..9df7970 --- /dev/null +++ b/modules/nixos/hardware.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + # Enable Bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + services.blueman.enable = true; + + # Enable fstrim for better ssd lifespan + services.fstrim.enable = true; +} diff --git a/modules/nixos/packages.nix b/modules/nixos/packages.nix new file mode 100644 index 0000000..90ff3c1 --- /dev/null +++ b/modules/nixos/packages.nix @@ -0,0 +1,108 @@ +{ pkgs, ... }: + +{ + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Enable GPG. + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # Enable fish system-wide to integrate with nixpkgs. + programs.fish.enable = true; + + # Enable Steam. + programs.steam = { + enable = true; + + remotePlay.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + # ^ Enables so we can transfer games to other computers in the network. + + # Add Proton-GE to 'compatibilitytools.d'. + extraCompatPackages = with pkgs; [ proton-ge-bin ]; + }; + + # Enable and configure gamemode. + programs.gamemode = { + enable = true; + enableRenice = true; + }; + + # Enable KDEConnect + programs.kdeconnect.enable = true; + + # Enable Docker. + virtualisation.docker.enable = true; + + # Enable virt-manager + programs.virt-manager.enable = true; + + # Enable virtd and spice USB redirection + virtualisation.spiceUSBRedirection.enable = true; + virtualisation.libvirtd.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + ## Tools + # Utilities + bat + btrfs-progs + duf + fuseiso + lm_sensors + p7zip + tree + unrar + unzip + wget + zip + + # File managing + sshfs + yazi + + # Virtualization + docker-compose + quickemu + + # Desktop + wl-clipboard + xclip + zoxide + (catppuccin-sddm.override # So SDDM finds the theme files. + { + flavor = "frappe"; + font = "FantasqueSansM Nerd Font"; + fontSize = "12"; + background = "${./theming/sddm/Background.jpg}"; + loginBackground = true; + } + ) + + # Networking + gping + nmap + + # Processes + btop + killall + + # Filter + fzf + ripgrep + + ## Libraries + libsForQt5.qt5.qtgraphicaleffects + libsForQt5.qt5.qtquickcontrols2 + pkgsi686Linux.gperftools # Needed for TF2 rn :( + + ## Hardware specific + openrazer-daemon # Razor products back-end + polychromatic # and it's front-end + vial + ]; +} diff --git a/modules/nixos/services.nix b/modules/nixos/services.nix new file mode 100644 index 0000000..bf45751 --- /dev/null +++ b/modules/nixos/services.nix @@ -0,0 +1,38 @@ +{ + pkgs, + lib, + config, + ... +}: + +{ + # Enable polkit, + security.polkit.enable = true; + + # install an agent to interface with it, + environment.systemPackages = with pkgs; [ polkit_gnome ]; + + # And enable GNOME keyring for registering keys. + services.gnome.gnome-keyring.enable = true; + + services.postgresql = { + identMap = lib.mkIf config.services.postgresql.enable '' + # MAP_NAME SYSTEM_USER DB_USER + superuser_map root postgres + superuser_map postgres postgres + superuser_map /^(.*)$ \1 + ''; + + authentication = lib.mkIf config.services.postgresql.enable ( + lib.mkOverride 10 '' + # TYPE DATABASE USER ADDRESS METHOD MAP + local all all peer map=superuser_map + host all all 127.0.0.1/32 md5 + host all all ::1/128 md5 + local replication all peer map=superuser_map + host replication all 127.0.0.1/32 ident map=superuser_map + host replication all ::1/128 ident map=superuser_map + '' + ); + }; +} diff --git a/modules/nixos/sound.nix b/modules/nixos/sound.nix new file mode 100644 index 0000000..023ed41 --- /dev/null +++ b/modules/nixos/sound.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + audio.enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + + pulse.enable = true; + }; +} diff --git a/modules/nixos/system.nix b/modules/nixos/system.nix new file mode 100644 index 0000000..2abe44a --- /dev/null +++ b/modules/nixos/system.nix @@ -0,0 +1,54 @@ +{ pkgs, config, ... }: + +{ + # Kernel + boot.kernelPackages = pkgs.linuxPackages_zen; + + # Add AMD drivers. + boot.initrd.kernelModules = [ "amdgpu" ]; + + boot.extraModulePackages = [ + config.boot.kernelPackages.v4l2loopback + ]; + + # Bootloader. + boot.loader = { + systemd-boot = { + enable = true; + configurationLimit = 10; + }; + + efi.canTouchEfiVariables = true; + }; + + # Enables zram. + zramSwap.enable = true; + + # Enable networking + networking.networkmanager.enable = true; + + # Enable WOL on my ethernet interface. + networking.interfaces.enp5s0.wakeOnLan.enable = true; + + # Define variables that will be initialized in PAM. + environment.sessionVariables = { + # Set env for Fcitx5 + QMODIFIERS = "@im=fcitx5"; + }; + + # Set fish as the default shell for all users. + users.defaultUserShell = pkgs.fish; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; + }; +} diff --git a/theming/sddm/Background.jpg b/modules/nixos/theming/sddm/Background.jpg similarity index 100% rename from theming/sddm/Background.jpg rename to modules/nixos/theming/sddm/Background.jpg diff --git a/nixos.nix b/nixos.nix deleted file mode 100644 index 04f32da..0000000 --- a/nixos.nix +++ /dev/null @@ -1,514 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ - config, - pkgs, - hyprland, - ... -}: - -let - hyprland-pkgs = hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}; -in -{ - ## - ## NIXOS ## - ## - - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - # Include service configuration - ./services/archi.nix - ./services/authentication.nix - ./services/caddy.nix - ./services/forgejo.nix - ./services/jellyfin.nix - ]; - - # Enable experimental features - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - # Enable nh, a bundle of CLI utilities for NixOS - programs.nh = { - enable = true; - - # Enable automatic garbage collection. - clean.enable = true; - clean.extraArgs = "--keep-since 4d --keep 3"; - - flake = "/home/wizardlink/.system"; - }; - - # Optimize storage - nix.optimise.automatic = true; - nix.settings.auto-optimise-store = true; - - # Enable Hyprland's cachix - nix.settings.substituters = [ "https://hyprland.cachix.org" ]; - nix.settings.trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - ]; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - - ## - ## SYSTEM ## - ## - - # Kernel - boot.kernelPackages = pkgs.linuxPackages_zen; - - # Add AMD drivers. - boot.initrd.kernelModules = [ "amdgpu" ]; - - # TODO: FIX IT BEING BEING OVERWRITTEN - boot.extraModulePackages = [ - config.boot.kernelPackages.v4l2loopback - (pkgs.callPackage ./kernel/zenergy.nix { kernel = pkgs.linux_zen; }) - ]; - - # Bootloader. - boot.loader = { - systemd-boot = { - enable = true; - configurationLimit = 10; - }; - - efi.canTouchEfiVariables = true; - }; - - # Configure options for mounted volumes. - fileSystems = { - "/".options = [ "compress=zstd" ]; - "/home".options = [ "compress=zstd" ]; - "/nix".options = [ - "compress=zstd" - "noatime" - ]; - "/mnt/extra".options = [ "nofail" ]; - "/mnt/internal".options = [ "nofail" ]; - "/mnt/media".options = [ "nofail" ]; - "/mnt/ssd".options = [ "nofail" ]; - }; - - # Enable btrf's auto scrubbing of volumes. - services.btrfs.autoScrub = { - enable = true; - interval = "weekly"; - fileSystems = [ "/" ]; - }; - - # Enables zram. - zramSwap.enable = true; - - networking.hostName = "wizdesk"; # Define your hostname. - - # Enable networking - networking.networkmanager.enable = true; - - # Enable WOL on my ethernet interface. - networking.interfaces.enp5s0.wakeOnLan.enable = true; - - # Open ports in the firewall. - networking.firewall = { - allowedTCPPorts = [ - 443 # SSL - 6567 # Mindustry - 80 # HTTP - 3979 # OpenTTD - ]; - - allowedUDPPorts = [ - 2626 # Dolphin emulator - 27015 # Source games - 28910 # Heretic II - 6567 # Mindustry - 8211 # Palworld - 3979 # OpenTTD - ]; - - allowedTCPPortRanges = [ - { - from = 1714; - to = 1764; - } # KDEConnect - ]; - allowedUDPPortRanges = [ - { - from = 1714; - to = 1764; - } # KDEConnect - ]; - }; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Define system-wide variables. - environment.variables = { }; - - # Define variables that will be initialized in PAM. - environment.sessionVariables = { - # Set env for Fcitx5 - QMODIFIERS = "@im=fcitx5"; - }; - - # Set fish as the default shell for all users. - users.defaultUserShell = pkgs.fish; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.wizardlink = { - createHome = true; - description = "Alexandre Cavalheiro"; - extraGroups = [ - "docker" - "gamemode" - "libvirtd" - "networkmanager" - "openrazer" - "postgresql" - "wheel" - ]; - - initialPassword = "wizardlink"; - isNormalUser = true; - - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva " - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa - ]; - }; - - # Set your time zone. - time.timeZone = "America/Sao_Paulo"; - - # Select internationalisation properties. - i18n = { - defaultLocale = "en_US.UTF-8"; - supportedLocales = [ - "C.UTF-8/UTF-8" - "en_GB.UTF-8/UTF-8" - "en_US.UTF-8/UTF-8" - "ja_JP.UTF-8/UTF-8" - "pt_BR.UTF-8/UTF-8" - ]; - - extraLocaleSettings = { - LANGUAGE = "en_US.UTF-8"; - LC_ADDRESS = "en_US.UTF-8"; - LC_ALL = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "pt_BR.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "pt_BR.UTF-8"; - LC_PAPER = "pt_BR.UTF-8"; - LC_TELEPHONE = "pt_BR.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - - settings = { - PasswordAuthentication = false; - PermitRootLogin = "no"; - }; - }; - - ## - ## HARDWARE ## - ## - - # Enable Bluetooth - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - services.blueman.enable = true; - - # Enable openrazer for managing Razer products' configuration - hardware.openrazer = { - enable = true; - users = [ "wizardlink" ]; - }; - - services.udev = { - # Vial udev rule for Monsgeek M1 - extraRules = '' - # Monsgeek M1 - KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0005", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl" - ''; - - # WB32 DFU rules - needed for flashing - packages = [ (pkgs.callPackage ./services/udev/wb32dfu.nix { }) ]; - }; - - # enable a better driver for wireless xbox controllers. - hardware.xpadneo.enable = true; - - # Enable fstrim for better ssd lifespan - services.fstrim.enable = true; - - ## - ## DESKTOP ## - ## - - # Enable SDDM. - services.displayManager.sddm = { - enable = true; - wayland.enable = true; - theme = "catppuccin-frappe"; - package = pkgs.kdePackages.sddm; - }; - - # Enable Hyprland - programs.hyprland = { - enable = true; - - package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - portalPackage = pkgs.xdg-desktop-portal-wlr; - }; - - # Enable XDG Desktop Portals. - xdg.portal = { - enable = true; - - config = { - common = { - default = [ "wlr" ]; - }; - }; - }; - - # Needed for home-manager - environment.pathsToLink = [ - "/share/xdg-desktop-portal" - "/share/applications" - ]; - - # Enable OpenGL. - hardware.graphics = { - enable = true; - enable32Bit = true; - - package = hyprland-pkgs.mesa.drivers; - package32 = hyprland-pkgs.pkgsi686Linux.mesa.drivers; - - extraPackages = with pkgs; [ - rocm-opencl-icd # OpenGL hwa - rocm-opencl-runtime - ]; - }; - - # Enable Thunar and it's dependencies - programs.thunar = { - enable = true; - plugins = with pkgs.xfce; [ thunar-archive-plugin ]; - }; - programs.xfconf.enable = true; # For configuring - services.gvfs.enable = true; # For mounting drives, trash, etc. - services.tumbler.enable = true; # Thumbnail support - - # Enable the Fcitx5 IME - i18n.inputMethod = { - enable = true; - type = "fcitx5"; - - fcitx5 = { - addons = with pkgs; [ - fcitx5-mozc - fcitx5-gtk - fcitx5-catppuccin - ]; - - waylandFrontend = true; - }; - }; - - ## - ## SOUND # - ## - - # Enable sound with pipewire. - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - audio.enable = true; - - alsa.enable = true; - alsa.support32Bit = true; - - pulse.enable = true; - - #jack.enable = true; - }; - - ## - ## PACKAGES ## - ## - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # Enable GPG. - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # Enable fish system-wide to integrate with nixpkgs. - programs.fish.enable = true; - - # Enable Steam. - programs.steam = { - enable = true; - - remotePlay.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; - # ^ Enables so we can transfer games to other computers in the network. - - # Add Proton-GE to 'compatibilitytools.d'. - extraCompatPackages = with pkgs; [ proton-ge-bin ]; - }; - - # Enable and configure gamemode. - programs.gamemode = { - enable = true; - enableRenice = true; - }; - - # Enable KDEConnect - programs.kdeconnect.enable = true; - - # Enable Docker. - virtualisation.docker.enable = true; - - # Enable virt-manager - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - virtualisation.spiceUSBRedirection.enable = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - ## Tools - # Utilities - bat - btrfs-progs - duf - fuseiso - lm_sensors - p7zip - tree - unrar - unzip - wget - zip - - # File managing - sshfs - yazi - - # Virtualization - docker-compose - quickemu - - # Desktop - wl-clipboard - xclip - zoxide - (catppuccin-sddm.override # So SDDM finds the theme files. - { - flavor = "frappe"; - font = "FantasqueSansM Nerd Font"; - fontSize = "12"; - background = "${./theming/sddm/Background.jpg}"; - loginBackground = true; - } - ) - - # Networking - gping - nmap - - # Processes - btop - killall - - # Filter - fzf - ripgrep - - ## Libraries - libsForQt5.qt5.qtgraphicaleffects - libsForQt5.qt5.qtquickcontrols2 - pkgsi686Linux.gperftools # Needed for TF2 rn :( - - ## Hardware specific - openrazer-daemon # Razor products back-end - polychromatic # and it's front-end - vial - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - ## - ## SERVICES # - ## - - # Enable flatpak - services.flatpak.enable = true; - - # Enable and configure PostgreSQL. - services.postgresql = { - enable = true; - - identMap = '' - # MAP_NAME SYSTEM_USER DB_USER - superuser_map root postgres - superuser_map postgres postgres - superuser_map /^(.*)$ \1 - ''; - - authentication = pkgs.lib.mkOverride 10 '' - # TYPE DATABASE USER ADDRESS METHOD MAP - local all all peer map=superuser_map - host all all 127.0.0.1/32 md5 - host all all ::1/128 md5 - local replication all peer map=superuser_map - host replication all 127.0.0.1/32 ident map=superuser_map - host replication all ::1/128 ident map=superuser_map - ''; - - initialScript = pkgs.writeText "backend-initScript" '' - CREATE ROLE wizardlink WITH LOGIN SUPERUSER PASSWORD 'wizardlink' CREATEDB CREATEROLE REPLICATION; - CREATE DATABASE wizardlink; - GRANT ALL PRIVILEGES ON DATABASE wizardlink TO wizardlink; - ''; - }; -} diff --git a/specific/home-manager.nix b/specific/home-manager.nix new file mode 100644 index 0000000..7192ae2 --- /dev/null +++ b/specific/home-manager.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +{ + # + ## HOME CONFIGURATION # + # + + # Import configurations for better modularity. + imports = [ + ../../modules/home-manager + ../../modules/home-manager/services.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "wizardlink"; + home.homeDirectory = "/home/wizardlink"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.05"; # Please read the comment before changing. + + home.sessionVariables = { + EDITOR = "nvim"; + }; +} diff --git a/kernel/zenergy.nix b/specific/kernel/zenergy.nix similarity index 100% rename from kernel/zenergy.nix rename to specific/kernel/zenergy.nix diff --git a/hardware-configuration.nix b/specific/wizdesk/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to specific/wizdesk/hardware-configuration.nix diff --git a/specific/wizdesk/hardware.nix b/specific/wizdesk/hardware.nix new file mode 100644 index 0000000..62e354f --- /dev/null +++ b/specific/wizdesk/hardware.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + # Enable Zenergy + boot.extraModulePackages = [ + (pkgs.callPackage ../kernel/zenergy.nix { kernel = pkgs.linux_zen; }) + ]; + + # Enable openrazer for managing Razer products' configuration + hardware.openrazer = { + enable = true; + users = [ "wizardlink" ]; + }; + + services.udev = { + # Vial udev rule for Monsgeek M1 + extraRules = '' + # Monsgeek M1 + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0005", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl" + ''; + + # WB32 DFU rules - needed for flashing + packages = [ (pkgs.callPackage ./services/udev/wb32dfu.nix { }) ]; + }; + + # enable a better driver for wireless xbox controllers. + hardware.xpadneo.enable = true; +} diff --git a/specific/wizdesk/nixos.nix b/specific/wizdesk/nixos.nix new file mode 100644 index 0000000..1a8d1ed --- /dev/null +++ b/specific/wizdesk/nixos.nix @@ -0,0 +1,125 @@ +{ ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./hardware.nix + ./services.nix + ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; + + # Configure options for mounted volumes. + fileSystems = { + "/".options = [ "compress=zstd" ]; + "/home".options = [ "compress=zstd" ]; + "/nix".options = [ + "compress=zstd" + "noatime" + ]; + "/mnt/extra".options = [ "nofail" ]; + "/mnt/internal".options = [ "nofail" ]; + "/mnt/media".options = [ "nofail" ]; + "/mnt/ssd".options = [ "nofail" ]; + }; + + # Enable btrf's auto scrubbing of volumes. + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = [ "/" ]; + }; + + networking.hostName = "wizdesk"; # Define your hostname. + + # Open ports in the firewall. + networking.firewall = { + allowedTCPPorts = [ + 443 # SSL + 6567 # Mindustry + 80 # HTTP + 3979 # OpenTTD + ]; + + allowedUDPPorts = [ + 2626 # Dolphin emulator + 27015 # Source games + 28910 # Heretic II + 6567 # Mindustry + 8211 # Palworld + 3979 # OpenTTD + ]; + + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect + ]; + allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect + ]; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.wizardlink = { + createHome = true; + description = "Alexandre Cavalheiro"; + extraGroups = [ + "docker" + "gamemode" + "libvirtd" + "networkmanager" + "openrazer" + "postgresql" + "wheel" + ]; + + initialPassword = "wizardlink"; + isNormalUser = true; + + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva " + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa + ]; + }; + + # Set your time zone. + time.timeZone = "America/Sao_Paulo"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ + "C.UTF-8/UTF-8" + "en_GB.UTF-8/UTF-8" + "en_US.UTF-8/UTF-8" + "ja_JP.UTF-8/UTF-8" + "pt_BR.UTF-8/UTF-8" + ]; + + extraLocaleSettings = { + LANGUAGE = "en_US.UTF-8"; + LC_ADDRESS = "en_US.UTF-8"; + LC_ALL = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "pt_BR.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "pt_BR.UTF-8"; + LC_PAPER = "pt_BR.UTF-8"; + LC_TELEPHONE = "pt_BR.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + }; +} diff --git a/specific/wizdesk/services.nix b/specific/wizdesk/services.nix new file mode 100644 index 0000000..b696832 --- /dev/null +++ b/specific/wizdesk/services.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + imports = [ + ./services/archi.nix + ./services/caddy.nix + ./services/forgejo.nix + ./services/jellyfin.nix + ]; + + services.postgresql = { + enable = true; + + initialScript = pkgs.writeText "backend-initScript" '' + CREATE ROLE wizardlink WITH LOGIN SUPERUSER PASSWORD 'wizardlink' CREATEDB CREATEROLE REPLICATION; + CREATE DATABASE wizardlink; + GRANT ALL PRIVILEGES ON DATABASE wizardlink TO wizardlink; + ''; + }; +} diff --git a/services/archi.nix b/specific/wizdesk/services/archi.nix similarity index 100% rename from services/archi.nix rename to specific/wizdesk/services/archi.nix diff --git a/services/authentication.nix b/specific/wizdesk/services/authentication.nix similarity index 100% rename from services/authentication.nix rename to specific/wizdesk/services/authentication.nix diff --git a/services/caddy.nix b/specific/wizdesk/services/caddy.nix similarity index 100% rename from services/caddy.nix rename to specific/wizdesk/services/caddy.nix diff --git a/services/forgejo.nix b/specific/wizdesk/services/forgejo.nix similarity index 100% rename from services/forgejo.nix rename to specific/wizdesk/services/forgejo.nix diff --git a/services/jellyfin.nix b/specific/wizdesk/services/jellyfin.nix similarity index 100% rename from services/jellyfin.nix rename to specific/wizdesk/services/jellyfin.nix diff --git a/services/udev/wb32dfu.nix b/specific/wizdesk/services/udev/wb32dfu.nix similarity index 100% rename from services/udev/wb32dfu.nix rename to specific/wizdesk/services/udev/wb32dfu.nix diff --git a/services/udev/wb32dfu.rules b/specific/wizdesk/services/udev/wb32dfu.rules similarity index 100% rename from services/udev/wb32dfu.rules rename to specific/wizdesk/services/udev/wb32dfu.rules diff --git a/specific/wizlap/hardware.nix b/specific/wizlap/hardware.nix new file mode 100644 index 0000000..7206211 --- /dev/null +++ b/specific/wizlap/hardware.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: + +{ + # Enable Zenergy + boot.extraModulePackages = [ + (pkgs.callPackage ../kernel/zenergy.nix { kernel = pkgs.linux_zen; }) + ]; + + # enable a better driver for wireless xbox controllers. + hardware.xpadneo.enable = true; +} diff --git a/specific/wizlap/nixos.nix b/specific/wizlap/nixos.nix new file mode 100644 index 0000000..e59db1a --- /dev/null +++ b/specific/wizlap/nixos.nix @@ -0,0 +1,78 @@ +{ ... }: + +{ + imports = [ + ./hardware.nix + ]; + + networking.hostName = "wizlap"; # Define your hostname. + + # Open ports in the firewall. + networking.firewall = { + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect + ]; + allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect + ]; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.wizardlink = { + createHome = true; + description = "Alexandre Cavalheiro"; + extraGroups = [ + "docker" + "gamemode" + "libvirtd" + "networkmanager" + "openrazer" + "postgresql" + "wheel" + ]; + + initialPassword = "wizardlink"; + isNormalUser = true; + + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva " + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa + ]; + }; + + # Set your time zone. + time.timeZone = "America/Sao_Paulo"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ + "C.UTF-8/UTF-8" + "en_GB.UTF-8/UTF-8" + "en_US.UTF-8/UTF-8" + "ja_JP.UTF-8/UTF-8" + "pt_BR.UTF-8/UTF-8" + ]; + + extraLocaleSettings = { + LANGUAGE = "en_US.UTF-8"; + LC_ADDRESS = "en_US.UTF-8"; + LC_ALL = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "pt_BR.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "pt_BR.UTF-8"; + LC_PAPER = "pt_BR.UTF-8"; + LC_TELEPHONE = "pt_BR.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + }; +}