about summary refs log tree commit diff stats
path: root/flake/packages/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flake/packages/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/flake/packages/default.nix b/flake/packages/default.nix
index 4ab68775..708852a0 100644
--- a/flake/packages/default.nix
+++ b/flake/packages/default.nix
@@ -1,12 +1,54 @@
 {
+  self,
   nixos-generators,
   defaultSpecialArgs,
   defaultModules,
   pkgs,
   sysLib,
+  nixVim,
+  system,
   ...
 }: let
+  inherit (pkgs) lib;
+  inherit (import ./merge.nix {inherit lib;}) merge;
   output = import ../../bootstrap {inherit pkgs sysLib;};
+  args = {
+    inherit pkgs;
+    inherit (pkgs) lib;
+  };
+  nvim =
+    builtins.mapAttrs (
+      name: value: let
+        nvim_config =
+          import ../../home-manager/soispha/config/neovim/nixvim/default.nix
+          args;
+        build_args = args // {nixosConfig = value.config;};
+
+        merge_attrs = list_of_attrs: builtins.foldl' (x: y: merge [x y]) {} list_of_attrs;
+        resolve_imports = attrs:
+          merge_attrs (builtins.map (v: import v build_args)
+            attrs.imports);
+
+        resolve_imports' = attrs:
+          if builtins.any (n: n == "imports") (builtins.attrNames attrs)
+          then
+            resolve_imports' (merge_attrs [
+              (resolve_imports attrs)
+              (builtins.removeAttrs
+                attrs
+                ["imports"])
+            ])
+          else attrs;
+
+        complete_config = resolve_imports' nvim_config;
+      in
+        nixVim.legacyPackages."${system}".makeNixvim
+        (
+          builtins.removeAttrs
+          complete_config.programs.nixvim ["enable"]
+        )
+    )
+    self.nixosConfigurations;
 in
   {
     install-iso = nixos-generators.nixosGenerate {
@@ -27,5 +69,7 @@ in
         ++ defaultModules;
       format = "iso";
     };
+    vim = nvim.tiamat;
+    inherit nvim;
   }
   // output