From e6e98a16de850f1b8ac4d2d050ae614e8eb61352 Mon Sep 17 00:00:00 2001 From: stitchy Date: Sun, 6 Aug 2023 16:25:52 +0000 Subject: [PATCH] It still does not work, I wonder why --- config/neovim/init.vim | 149 +++++++++++++++++++++++++++++++++++++ configuration.nix | 2 +- flake.lock | 127 ++++++++++++++++++++++++++++++- flake.nix | 35 ++++++--- packages/default.nix | 1 - users/stitchynyan/home.nix | 3 + 6 files changed, 303 insertions(+), 14 deletions(-) create mode 100755 config/neovim/init.vim create mode 100644 users/stitchynyan/home.nix diff --git a/config/neovim/init.vim b/config/neovim/init.vim new file mode 100755 index 0000000..57f352d --- /dev/null +++ b/config/neovim/init.vim @@ -0,0 +1,149 @@ +" (Neo)vim Configuration +" By Flying_Stitchman +" 4 Jan 2022 + + " Basic Configuration + +syntax on +set spell +set hlsearch +set ignorecase +set number relativenumber +set noswapfile +inoremap jk +let mapleader = "`" + + " Make Lines Wrap Properly +set linebreak +set wrap + " True Color Support +if has('nvim') + set t_8f=[38;2;%lu;%lu;%lum + set t_8b=[48;2;%lu;%lu;%lum + set termguicolors +endif +"colorscheme cwcolors + + + " Highlight Trailing Spaces +let c_space_errors=1 + +set noincsearch + + " Plugs +"call plug#begin() +"Plug 'neovim/nvim-lspconfig' +"Plug 'jackguo380/vim-lsp-cxx-highlight' +"Plug 'folke/tokyonight.nvim', { 'branch': 'main' } +"Plug 'tribela/vim-transparent' +"Plug 'hrsh7th/nvim-cmp' +"Plug 'hrsh7th/cmp-nvim-lsp' +"Plug 'saadparwaiz1/cmp_luasnip' +"Plug 'L3MON4D3/LuaSnip' +"call plug#end() + +let g:airline#extensions#wordcount#filetypes = '\vasciidoc|help|mail|markdown|markdown.pandoc|org|rst|tex|text' +set laststatus=2 " enables vim-airline. + + + + " C Syntax highlighting +lua << EOF +require'lspconfig'.rust_analyzer.setup{} +require'lspconfig'.texlab.setup{} +require'lspconfig'.svls.setup{} +require'lspconfig'.pylsp.setup{ + settings = { + pylsp = { + plugins = { + pycodestyle = { + ignore = {'W391'}, + maxLineLength = 100 + }, + pylint = { + enabled = false + }, + pyflakes = { + enabled = true + } + } + } + } +} +require'lspconfig'.ccls.setup{ + init_options = { + highlight = { + lsRanges = true; + } + } + } + + +-- Add additional capabilities supported by nvim-cmp +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local lspconfig = require('lspconfig') + +-- Enable some language servers with the additional completion capabilities offered by nvim-cmp +local servers = { 'clangd', 'rust_analyzer', 'tsserver' } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + -- on_attach = my_custom_on_attach, + capabilities = capabilities, + } +end + +-- luasnip setup +local luasnip = require 'luasnip' + +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), -- Up + [''] = cmp.mapping.scroll_docs(4), -- Down + -- C-b (back) C-f (forward) for snippet placeholder navigation. + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + +EOF + + + + + " Color Themes +colorscheme tokyonight +hi Comment guifg=#e69dc5 +hi Linenr guifg=#a672f3 diff --git a/configuration.nix b/configuration.nix index f986fab..c15abe5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -62,7 +62,7 @@ vimAlias = true; defaultEditor = true; configure = { - customRC = builtins.readFile /home/stitchynyan/.config/nvim/init.vim; + customRC = builtins.readFile ./config/neovim/init.vim; packages.myVimPackage = with pkgs.vimPlugins; { start = [ nvim-lspconfig diff --git a/flake.lock b/flake.lock index 137fbba..cbcde07 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,85 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691225770, + "narHash": "sha256-O5slH8nW8msTAqVAS5rkvdHSkjmrO+JauuSDzZCmv2M=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0a014a729cdd54d9919ff36b714d047909d7a4c8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1691270973, + "narHash": "sha256-mm4JEJ8zTfSZPurYFOczJFuUUVlI+iBZKxbpcgKWN+M=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "a077b7a92e87a3edd1cebb9bdd4c4fa3ec3d7bb7", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684265364, + "narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1690179384, + "narHash": "sha256-+arbgqFTAtoeKtepW9wCnA0njCOyoiDFyl0Q0SBSOtE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b12803b6d90e2e583429bb79b859ca53c348b39a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1691186842, "narHash": "sha256-wxBVCvZUwq+XS4N4t9NqsHV4E64cPVqQ2fdDISpjcw0=", @@ -18,7 +97,53 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "home-manager": "home-manager", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1691073628, + "narHash": "sha256-LlxE3o3UzRY7APYVLGNKM30DBMcDifCRIQiMVSbYLIc=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "c74f89d4f84bfed0284d3908aee5d207698c70c5", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "c74f89d4f84bfed0284d3908aee5d207698c70c5", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685385764, + "narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 247b0fd..080a26c 100644 --- a/flake.nix +++ b/flake.nix @@ -6,31 +6,44 @@ url = "github:NixOS/nixpkgs/nixos-unstable"; }; - home-manager-unstable = { + home-manager = { url = "github:nix-community/home-manager/master"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs"; }; hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { - self, nixpkgs, - home-manager-unstable, - hyprland + home-manager, + hyprland, + ... }: { + nixpkgs.hostPlatform = "x86_64-linux"; + + + pkgs = import nixpkgs { + #config.allowUnfree = true; + }; + + nixosConfigurations = { - stitchynyan = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ + + hostname = nixpkgs.lib.nixosSystem { + modules = [ ./configuration.nix - home-manager-unstable.nixosModules.home-manager + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = false; + home-manager.users.stitchynyan = import ./users/stitchynyan/home.nix ; + } hyprland.homeManagerModules.default - {wayland.windowManager.hyprland.enable = true;} + {wayland.windowManager.hyprland.enable = true;} ]; }; - }; + }; }; } diff --git a/packages/default.nix b/packages/default.nix index 6aff7c8..c8360ef 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -11,7 +11,6 @@ librewolf kitty exa - hyprland git zoxide nheko diff --git a/users/stitchynyan/home.nix b/users/stitchynyan/home.nix new file mode 100644 index 0000000..7e057f7 --- /dev/null +++ b/users/stitchynyan/home.nix @@ -0,0 +1,3 @@ + + +{ config, pkgs, ... }