From ca20fce5265e3ad2580fe30a3984fab090a7fdfe Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Sun, 19 Jan 2025 16:19:55 -0600 Subject: [PATCH] treewide: migrate to new standalone nixvim design --- flake/checks.nix | 18 ------------ flake/default.nix | 5 +--- flake/nixvim.nix | 49 +++++++++++++++++++++++++++++++++ modules/nixvim/default.nix | 8 +++++- packages/khanelivim/package.nix | 20 -------------- 5 files changed, 57 insertions(+), 43 deletions(-) delete mode 100644 flake/checks.nix create mode 100644 flake/nixvim.nix delete mode 100644 packages/khanelivim/package.nix diff --git a/flake/checks.nix b/flake/checks.nix deleted file mode 100644 index 7fb1887..0000000 --- a/flake/checks.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ inputs, self, ... }: -{ - perSystem = - { pkgs, system, ... }: - { - checks.nixvim = inputs.nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule { - inherit pkgs; - - extraSpecialArgs = { - inherit self system inputs; - }; - - module = { - imports = [ ../modules/nixvim ]; - }; - }; - }; -} diff --git a/flake/default.nix b/flake/default.nix index 91f0895..91f4193 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -6,9 +6,9 @@ }: { imports = [ - ./checks.nix ./devshell.nix ./git-hooks.nix + ./nixvim.nix ./overlays.nix ./pkgs-by-name.nix ./treefmt.nix @@ -16,7 +16,6 @@ perSystem = { - self', system, ... }: @@ -26,7 +25,5 @@ overlays = lib.attrValues self.overlays; config.allowUnfree = true; }; - - packages.default = self'.packages.khanelivim; }; } diff --git a/flake/nixvim.nix b/flake/nixvim.nix new file mode 100644 index 0000000..7deb130 --- /dev/null +++ b/flake/nixvim.nix @@ -0,0 +1,49 @@ +{ inputs, self, ... }: +{ + imports = [ + inputs.nixvim.flakeModules.default + ]; + + nixvim = + let + nameFunction = name: name; + in + { + packages = { + enable = true; + inherit nameFunction; + }; + checks = { + enable = true; + inherit nameFunction; + }; + }; + + flake.nixvimModules = { + default = ../modules/nixvim; + }; + + perSystem = + { config, system, ... }: + { + nixvimConfigurations = { + khanelivim = inputs.nixvim.lib.evalNixvim { + inherit system; + + extraSpecialArgs = { + inherit inputs system; + inherit (inputs) self; + }; + + modules = [ + self.nixvimModules.default + ]; + }; + }; + + packages = { + # Lets you start nixvim using `nix run` + default = config.packages.khanelivim; + }; + }; +} diff --git a/modules/nixvim/default.nix b/modules/nixvim/default.nix index a2bb1be..433b410 100644 --- a/modules/nixvim/default.nix +++ b/modules/nixvim/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, self, ... }: let inherit (builtins) readDir; inherit (lib.attrsets) foldlAttrs; @@ -22,4 +22,10 @@ in ./performance.nix ./usercommands.nix ]; + + nixpkgs = { + overlays = lib.attrValues self.overlays; + config.allowUnfree = true; + }; + } diff --git a/packages/khanelivim/package.nix b/packages/khanelivim/package.nix deleted file mode 100644 index fa1e71a..0000000 --- a/packages/khanelivim/package.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - inputs, - pkgs, - system, - ... -}: -inputs.nixvim.legacyPackages.${system}.makeNixvimWithModule { - inherit pkgs; - - extraSpecialArgs = { - inherit inputs system; - inherit (inputs) self; - }; - - module = { - imports = [ ../../modules/nixvim ]; - - nixpkgs.pkgs = pkgs; - }; -}