about summary refs log tree commit diff stats
path: root/flake/packages
diff options
context:
space:
mode:
Diffstat (limited to 'flake/packages')
-rw-r--r--flake/packages/default.nix68
-rw-r--r--flake/packages/merge.nix86
2 files changed, 23 insertions, 131 deletions
diff --git a/flake/packages/default.nix b/flake/packages/default.nix
index 125bf888..5b07b6f3 100644
--- a/flake/packages/default.nix
+++ b/flake/packages/default.nix
@@ -11,53 +11,31 @@
   ...
 }: let
   inherit (pkgs) lib;
-  inherit (import ./merge.nix {inherit lib;}) merge;
   output = import ../../bootstrap {inherit pkgs sysLib;};
 
-  # FIXME: Do what the trace says. <2024-11-09>
-  nvim = builtins.trace "nvim build currently broken, using default" {
-    tiamat = pkgs.neovim;
-    apzu =
-      pkgs.neovim;
-  };
-  # builtins.mapAttrs (
-  #   name: value: let
-  #     nvim_config =
-  #       import ../../modules/home.legacy/conf/nvim/default.nix
-  #       build_args;
-  #     build_args = let
-  #       inherit (value._module.args) pkgs;
-  #       inherit (pkgs) lib;
-  #     in {
-  #       inherit pkgs pkgsStable lib;
-  #       nixosConfig = value.config;
-  #       config = value.config.home-manager.users.soispha;
-  #     };
-  #
-  #     resolve_imports = attrs:
-  #       merge (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 [
-  #           (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;
+  nvim =
+    builtins.mapAttrs (
+      name: value: let
+        config = value.config.home-manager.users.soispha.programs.nixvim;
+
+        # NOTE: This is copied from `nixvim`, and could be achieved by setting
+        # `config.wrapRc` to `true`. But I have yet to find a way to set this in this
+        # context, but not in the general context.  <2024-11-09>
+        wrapped = config.build.package.override (prev: {
+          wrapperArgs =
+            (
+              if lib.isString prev.wrapperArgs
+              then prev.wrapperArgs
+              else lib.escapeShellArgs prev.wrapperArgs
+            )
+            + " "
+            + ''--add-flags -u --add-flags "${config.build.initFile}"'';
+          wrapRc = false;
+        });
+      in
+        wrapped
+    )
+    self.nixosConfigurations;
 
   output_neovim = lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair "nvim_${name}" value) nvim;
 
diff --git a/flake/packages/merge.nix b/flake/packages/merge.nix
deleted file mode 100644
index 43161ba0..00000000
--- a/flake/packages/merge.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{lib, ...}: let
-  merge = merge_list: let
-    head_of_merge = builtins.head merge_list;
-  in
-    if builtins.isAttrs head_of_merge
-    then
-      builtins.zipAttrsWith (
-        name: values: let
-          head_value = builtins.head values;
-        in
-          if builtins.isString head_value
-          then builtins.concatStringsSep "" values
-          else if builtins.isList head_value
-          then builtins.concatLists values
-          else if builtins.isAttrs head_value
-          then merge values
-          else builtins.head values
-      )
-      merge_list
-    else if builtins.isString head_of_merge
-    then builtins.concatStringsSep "" merge_list
-    else if builtins.isList head_of_merge
-    then builtins.concatLists merge_list
-    else builtins.head merge_list;
-
-  # Tests
-  ## Strings
-  a = {
-    a = ''
-      This is some
-    '';
-  };
-  b = {
-    a = ''
-      example text
-    '';
-  };
-  c = {
-    a = "(which is nice)";
-  };
-  ## Lists
-  d = {
-    a = ["element1" "element2"];
-  };
-  e = {
-    a = [["elment3" "elemnt4"]];
-  };
-  f = {
-    a = ["elemnt5"];
-  };
-  ## Pure strings
-  g = "This";
-  h = "is";
-  i = "some example text";
-  j = ''
-    (with a newline)
-  '';
-  ## Pure lists
-  k = ["element1"];
-  l = ["element2" "element3"];
-  m = ["element4"];
-
-  ## Prepared tests
-  tests = {
-    tests = []; # Comment to actually run the tests
-    test_strings = {
-      expr = merge [a b c];
-      expected = {a = "This is some\nexample text\n(which is nice)";};
-    };
-    test_lists = {
-      expr = merge [d e f];
-      expected = {a = ["element1" "element2" ["elment3" "elemnt4"] "elemnt5"];};
-    };
-    test_pure_strings = {
-      expr = merge [g h i j];
-      expected = "Thisissome example text(with a newline)\n";
-    };
-    test_pure_lists = {
-      expr = merge [k l m];
-      expected = ["element1" "element2" "element3" "element4"];
-    };
-  };
-in {
-  inherit merge;
-  result = lib.debug.runTests tests;
-}