about summary refs log tree commit diff stats
path: root/modules/by-name/le/less/module.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 17:58:37 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 17:58:37 +0100
commit66ffa2470f7fae22b88c03c27aa7f0baf6906915 (patch)
tree1857951eec2503828fbf824ced33676a0f5ce104 /modules/by-name/le/less/module.nix
parentfix(modules/legacy/alacitty): Update config to include new subsection (diff)
downloadnixos-config-66ffa2470f7fae22b88c03c27aa7f0baf6906915.tar.gz
nixos-config-66ffa2470f7fae22b88c03c27aa7f0baf6906915.zip
refactor(modules/legacy/less): Migrate to `by-name`
Diffstat (limited to 'modules/by-name/le/less/module.nix')
-rw-r--r--modules/by-name/le/less/module.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/by-name/le/less/module.nix b/modules/by-name/le/less/module.nix
new file mode 100644
index 00000000..f2475b73
--- /dev/null
+++ b/modules/by-name/le/less/module.nix
@@ -0,0 +1,32 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.soispha.programs.less;
+in {
+  options.soispha.programs.less = {
+    enable = lib.mkEnableOption "less";
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.soispha = {
+      home.sessionVariables = {
+        PAGER = "less";
+        MANPAGER = "less --color=d+r --color=u+b";
+
+        # These are added here because adding them in the lesskey file somehow doesn't work.
+        LESSHISTSIZE = 10000;
+        LESSHISTFILE = "${config.home-manager.users.soispha.xdg.dataHome}/less/history";
+      };
+
+      programs.less = {
+        enable = true;
+        keys =
+          builtins.readFile ./command.less
+          + builtins.readFile ./line-edit.less
+          + builtins.readFile ./env.less;
+      };
+    };
+  };
+}