From b683acbbffb456ed75e3320b08e17d1e3f22946e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Reyrol?= Date: Sun, 20 Aug 2023 20:17:49 +0200 Subject: [PATCH] wip --- flake.lock | 9 ++++---- flake.nix | 17 ++++++++++---- lib/os/default.nix | 5 ++--- users/gael/configuration.nix | 43 +++++++++--------------------------- users/gael/neovim.nix | 39 ++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 45 deletions(-) create mode 100644 users/gael/neovim.nix diff --git a/flake.lock b/flake.lock index f4a59f2..1138ae7 100644 --- a/flake.lock +++ b/flake.lock @@ -246,23 +246,22 @@ "beautysh": "beautysh", "flake-utils": "flake-utils", "nixpkgs": [ - "nixpkgs" + "unstable" ], "pre-commit-hooks": [ "pre-commit-hooks" ] }, "locked": { - "lastModified": 1692191366, - "narHash": "sha256-WmEMwDFENSrGpmdYaUQ5/OTatcw3uBthY+Uq2nom8FE=", + "lastModified": 1692476227, + "narHash": "sha256-PDHK8tNTveeWcWgKGq+tGiovl/PUB51lsnAemQj6Zss=", "owner": "nix-community", "repo": "nixvim", - "rev": "ac21d4d85ea28fd877aa5c9676a53fe95979621d", + "rev": "4ef53c788b99768f3ab948d53078d9bd1594f03c", "type": "github" }, "original": { "owner": "nix-community", - "ref": "nixos-23.05", "repo": "nixvim", "type": "github" } diff --git a/flake.nix b/flake.nix index 9fbc860..0319114 100644 --- a/flake.nix +++ b/flake.nix @@ -25,8 +25,8 @@ sbomnix.url = "github:tiiuae/sbomnix"; sbomnix.inputs.nixpkgs.follows = "unstable"; - nixvim.url = "github:nix-community/nixvim/nixos-23.05"; - nixvim.inputs.nixpkgs.follows = "nixpkgs"; + nixvim.url = "github:nix-community/nixvim"; + nixvim.inputs.nixpkgs.follows = "unstable"; nixvim.inputs.pre-commit-hooks.follows = "pre-commit-hooks"; udev-nix.url = "github:gaelreyrol/udev-nix"; @@ -37,7 +37,7 @@ mention.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nixpkgs, unstable, treefmt-nix, pre-commit-hooks, sbomnix, udev-nix, ... }: + outputs = inputs@{ self, nixpkgs, unstable, treefmt-nix, pre-commit-hooks, sbomnix, udev-nix, nixvim, ... }: let myLib = import ./lib { inherit inputs; }; config = { @@ -86,6 +86,10 @@ actionlint.enable = true; }; }; + nvim = nixvim.lib.${system}.check.mkTestDerivationFromNvim { + inherit (self.packages.${system}) nvim; + name = "A nixvim configuration"; + }; }); devShells = forSystems ({ pkgs, system }: { @@ -134,7 +138,12 @@ } ]; - packages = forSystems ({ pkgs, system }: pkgs.myPkgs); + packages = forSystems ({ pkgs, system }: pkgs.myPkgs // { + nvim = nixvim.legacyPackages."${system}".makeNixvimWithModule { + pkgs = pkgs.unstable; + module = import ./users/gael/neovim.nix; + }; + }); templates = { trivial = { diff --git a/lib/os/default.nix b/lib/os/default.nix index 39edeb7..00b9146 100644 --- a/lib/os/default.nix +++ b/lib/os/default.nix @@ -1,14 +1,14 @@ { inputs, ... }: let - inherit (inputs) self nixpkgs sops-nix nur home-manager nixvim udev-nix mention; + inherit (inputs) self nixpkgs sops-nix nur home-manager udev-nix mention; in rec { mkNixosSystem = { system, host, user, ... }: nixpkgs.lib.nixosSystem { inherit system; specialArgs = { - inherit self inputs; + inherit self system inputs; }; modules = [ @@ -55,7 +55,6 @@ rec { sops-nix.nixosModules.sops home-manager.nixosModules.home-manager - nixvim.nixosModules.nixvim nur.nixosModules.nur mention.nixosModules.default { diff --git a/users/gael/configuration.nix b/users/gael/configuration.nix index b11bd1a..8139ff4 100644 --- a/users/gael/configuration.nix +++ b/users/gael/configuration.nix @@ -1,5 +1,8 @@ -{ config, pkgs, ... }: +{ system, pkgs, inputs, ... }: +let + inherit (inputs) nixvim; +in { users.users.gael = { isNormalUser = true; @@ -42,36 +45,10 @@ # ACTION=="remove", SUBSYSTEM=="input", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0010|0110|0111|0114|0116|0401|0403|0405|0407|0410", ENV{ID_SECURITY_TOKEN}="1", RUN+="${pkgs.systemd}/bin/systemctl start xlock.service" # ''; - - programs.nixvim = { - enable = true; - - colorscheme = "solarized"; - - plugins = { - cmp-treesitter.enable = true; - # dap.enable = true; - # diffview.enable = true; - gitsigns.enable = true; - indent-blankline.enable = true; - lsp.enable = true; - neo-tree.enable = true; - nix.enable = true; - telescope.enable = true; - treesitter.enable = true; - # trouble.enable = true; in error - which-key.enable = true; - }; - - extraPlugins = with pkgs.vimPlugins; [ - heirline-nvim - nvim-autopairs - solarized-nvim - vim-hardtime - - # not available in nixvim/nixos-23.05 - nvim-dap - diffview-nvim - ]; - }; + environment.systemPackages = [ + (nixvim.legacyPackages."${system}".makeNixvimWithModule { + pkgs = pkgs.unstable; + module = import ./neovim.nix; + }) + ]; } diff --git a/users/gael/neovim.nix b/users/gael/neovim.nix new file mode 100644 index 0000000..cd9cabd --- /dev/null +++ b/users/gael/neovim.nix @@ -0,0 +1,39 @@ +{ pkgs, ... }: + +{ + config = { + colorscheme = "NeoSolarized"; + + options = { + number = true; + }; + + extraConfigVim = '' + set background=light + ''; + + plugins = { + cmp-treesitter.enable = true; + dap.enable = true; + diffview.enable = true; + gitsigns.enable = true; + indent-blankline.enable = true; + lsp.enable = true; + neo-tree.enable = true; + nix.enable = true; + nvim-cmp.enable = true; + telescope.enable = true; + treesitter.enable = true; + trouble.enable = true; + which-key.enable = true; + }; + + extraPlugins = with pkgs.vimPlugins; [ + heirline-nvim + NeoSolarized + nvim-autopairs + solarized-nvim + vim-hardtime + ]; + }; +}