From 33920289425affe3d7de5777280c09925f451627 Mon Sep 17 00:00:00 2001 From: FreeCorn Date: Fri, 18 Oct 2024 20:30:36 -0600 Subject: [PATCH] last commit till merge with desktop --- configuration.nix | 11 ++++- freecorn.nix | 4 ++ neovim.nix | 106 ++++++++++++++++++++++++++++++++++++++++++++++ wireguard.nix | 21 +++++++++ zsh.nix | 36 ++++++++++++++++ 5 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 neovim.nix create mode 100644 wireguard.nix create mode 100644 zsh.nix diff --git a/configuration.nix b/configuration.nix index ea97411..d9573b2 100644 --- a/configuration.nix +++ b/configuration.nix @@ -14,7 +14,9 @@ in ./freecorn.nix ./jimbo.nix ./vaultwarden.nix - "${homeManager}/nixos" + "${homeManager}/nixos" +# ./wireguard.nix +# ./neovim.nix ]; # Bootloader @@ -272,6 +274,7 @@ in steam-run # openwebrx qbittorrent + vim ]; # Enable the OpenSSH daemon. @@ -327,6 +330,11 @@ in }; }; + + +# :3 + + # NFS server # services.nfs.server = { # enable = true; @@ -341,4 +349,3 @@ in # Don't change this system.stateVersion = "24.05"; } - diff --git a/freecorn.nix b/freecorn.nix index 0af0b0f..001ec28 100644 --- a/freecorn.nix +++ b/freecorn.nix @@ -25,6 +25,10 @@ in { useGlobalPkgs = true; useUserPackages = true; users.freecorn = { config, pkgs, ... }: { + # imports = [ + # ./zsh.nix + # ./neovim.nix +# ]; # Install user programs home.packages = (with pkgs; [ rustdesk-flutter anydesk vlc diff --git a/neovim.nix b/neovim.nix new file mode 100644 index 0000000..9734be0 --- /dev/null +++ b/neovim.nix @@ -0,0 +1,106 @@ +{pkgs, outputs, ...}: { + # Install Neovim and plugins + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + plugins = with pkgs.vimPlugins; [ + # Vim theme + vim-airline + vim-airline-themes + + # Internal clipboard + vim-vsnip + cmp-vsnip + + # Autocomplete manager + lspkind-nvim + + # Autocomplete plugins + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp-cmdline + nvim-cmp + + # Hex color visualizer and color theme + nvim-colorizer-lua + vim-monokai-pro + + # Discord + vimsence + + ]; + extraConfig = '' + lua <'] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' } + }, { + { name = 'buffer' }, + }) + }) + + -- Use buffer source for '/' and '?' + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- Use cmdline & path source for ':' + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) + EOF + + colorscheme monokai_pro + let g:airline_theme='onedark' + let g:airline#extensions#tabline#enabled = 1 + hi Normal guibg=none ctermbg=235 + hi EndOfBuffer guibg=none ctermbg=235 + hi LineNr guibg=none ctermbg=none + lua require'colorizer'.setup() + + set nu rnu + set termguicolors + set mouse=a + + set undofile + set undodir=$HOME/.local/share/nvim/undo + set undolevels=100 + set undoreload=10000 + + nmap :bnext + nmap :bprev + nmap :bd + + let g:vimsence_small_text = 'NeoVim' + let g:vimsence_small_image = 'neovim' + ''; + }; +} diff --git a/wireguard.nix b/wireguard.nix new file mode 100644 index 0000000..d218004 --- /dev/null +++ b/wireguard.nix @@ -0,0 +1,21 @@ +{outputs, ...}: { + networking.firewall = { + allowedUDPPorts = [ 51820 ]; + }; + + networking.wireguard.interfaces = { + "${outputs.ips.wgInt}" = { + # Define IP of client in per device config + listenPort = 51820; + privateKey = outputs.secrets.wgClientPriv; + peers = [ + { # 0.0.0.0 makes wg act like a traditional VPN + publicKey = outputs.secrets.wgServerPub; + allowedIPs = [ "0.0.0.0/0" ]; + endpoint = "other.${outputs.secrets.cornDomain}:51820"; + persistentKeepalive = 25; + } + ]; + }; + }; +} diff --git a/zsh.nix b/zsh.nix new file mode 100644 index 0000000..d9b60e6 --- /dev/null +++ b/zsh.nix @@ -0,0 +1,36 @@ +{pkgs, config, outputs, ...}: { + programs.zsh = { + enable = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + oh-my-zsh = { + enable = true; + theme = "alanpeabody"; + plugins = ["git"]; + }; + shellAliases = { + + # NixOS aliases + nixclean = "sudo nix-store --gc; nix-collect-garbage -d"; + nixpurge = "sudo nix-collect-garbage --delete-old"; + nixoptimize = "sudo nix store optimise"; + nixcleanall = "nixclean; nixpurge; nixoptimize"; + + # Flake commands + flakedate = "sudo nix flake update /etc/nixos"; + sysswitch = "sudo nixos-rebuild switch --flake /etc/nixos"; + homeswitch = "home-manager switch --flake /etc/nixos"; + nixswitch = "sysswitch; homeswitch;"; + nixdate = "flakedate && sysswitch; homeswitch"; + + # Unzip to 7za + unzip = "7za x"; + + }; + initExtra = '' + ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin; + setopt HIST_IGNORE_SPACE + setopt RM_STAR_WAIT + ''; + }; +}