aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2024-09-25 19:41:02 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2024-09-25 19:41:02 +0530
commit478081af928e1557b325f4a4cbd5b67f079660d2 (patch)
treec7975b403c29acfd4de91664320e7ebbd0ac1685
parent165cde749fc899d4c86eb6de97d3b7c4373eb7b3 (diff)
downloadhome-manager-config-478081af928e1557b325f4a4cbd5b67f079660d2.tar.gz
home-manager-config-478081af928e1557b325f4a4cbd5b67f079660d2.zip
Adding nnn file manager.
Adding bspwm bindings to sxhkd only if the module is enabled.
-rw-r--r--home.nix3
-rw-r--r--modules/desktop/display-server/x11/xinit/default.nix14
-rw-r--r--modules/desktop/display-server/x11/xinit/xinitrc4
-rw-r--r--modules/desktop/popup-manager/default.nix9
-rw-r--r--modules/desktop/popup-manager/rofi/default.nix7
-rw-r--r--modules/desktop/popup-manager/rofi/theme.rasi.mustache (renamed from modules/desktop/popup-manager/rofi/theme/theme.rasi)6
-rw-r--r--modules/desktop/popup-manager/rofi/theme/default.nix21
-rw-r--r--modules/desktop/status-bar/polybar/bars/main.nix2
-rw-r--r--modules/desktop/status-bar/polybar/default.nix18
-rw-r--r--modules/desktop/status-bar/polybar/modules/battery.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/bspwm.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/cpu.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/date.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/kernel-version.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/memory.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/time.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/xwindow.nix2
-rw-r--r--modules/desktop/terminal/default.nix6
-rw-r--r--modules/desktop/window-manager/bspwm/default.nix3
-rw-r--r--modules/desktop/window-manager/default.nix9
-rw-r--r--modules/desktop/window-manager/sxhkd/default.nix93
-rw-r--r--modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix45
-rw-r--r--modules/desktop/window-manager/sxhkd/scripts/keybindings.sh (renamed from modules/desktop/window-manager/sxhkd/scripts/show-keybindings.sh)4
-rw-r--r--modules/shell/default.nix2
-rw-r--r--modules/shell/zsh/default.nix3
-rw-r--r--modules/tools/editor/neovim/config/default.nix4
-rw-r--r--modules/tools/editor/neovim/config/keybindings.lua (renamed from modules/tools/editor/neovim/keybindings.lua)0
-rw-r--r--modules/tools/editor/neovim/config/options.lua (renamed from modules/tools/editor/neovim/options.lua)0
-rw-r--r--modules/tools/editor/neovim/default.nix11
-rw-r--r--modules/tools/editor/neovim/plugins/default.nix9
-rw-r--r--modules/tools/editor/neovim/plugins/treesitter.nix2
-rw-r--r--modules/tools/file-manager/default.nix10
-rw-r--r--modules/tools/file-manager/lf/default.nix10
-rw-r--r--modules/tools/file-manager/lf/scripts/previewer.sh3
-rw-r--r--modules/tools/file-manager/lsd/default.nix6
-rw-r--r--modules/tools/file-manager/nnn/default.nix15
-rw-r--r--modules/tools/git/default.nix5
-rw-r--r--modules/tools/viewer/bat/default.nix12
-rw-r--r--modules/tools/viewer/bat/theme.tmTheme.mustache (renamed from modules/tools/viewer/bat/theme.nix)36
39 files changed, 218 insertions, 170 deletions
diff --git a/home.nix b/home.nix
index dd0ef30..a37f846 100644
--- a/home.nix
+++ b/home.nix
@@ -19,7 +19,8 @@
# Tools
tools.editor.neovim.enable = true;
- tools.file-manager.lf.enable = true;
+ # tools.file-manager.lf.enable = true;
+ tools.file-manager.nnn.enable = true;
tools.file-manager.lsd.enable = true;
tools.git.enable = true;
tools.system-monitor.htop.enable = true;
diff --git a/modules/desktop/display-server/x11/xinit/default.nix b/modules/desktop/display-server/x11/xinit/default.nix
index a064f36..e3f10f1 100644
--- a/modules/desktop/display-server/x11/xinit/default.nix
+++ b/modules/desktop/display-server/x11/xinit/default.nix
@@ -1,14 +1,20 @@
-{ lib, config, ... }:
+{ lib, config, pkgs, ... }:
{
- options = {
- desktop.display-server.x11.xinit.enable = lib.mkEnableOption "Enables xinit.";
+ options.desktop.display-server.x11.xinit = {
+ enable = lib.mkEnableOption "Enables xinit.";
};
config = lib.mkIf config.desktop.display-server.x11.xinit.enable {
home.file.".xinitrc" = {
- source = ./xinitrc;
executable = true;
+ source = pkgs.writeText ".xinitrc"
+''
+#!/bin/sh
+${if config.desktop.status-bar.polybar.enable then "polybar main &" else ""}
+${if config.desktop.window-manager.sxhkd.enable then "sxhkd &" else ""}
+exec ${config.desktop.window-manager.default}
+'';
};
};
}
diff --git a/modules/desktop/display-server/x11/xinit/xinitrc b/modules/desktop/display-server/x11/xinit/xinitrc
deleted file mode 100644
index 2ac4486..0000000
--- a/modules/desktop/display-server/x11/xinit/xinitrc
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-polybar main &
-sxhkd &
-exec bspwm
diff --git a/modules/desktop/popup-manager/default.nix b/modules/desktop/popup-manager/default.nix
index 3eacbf6..edf3dfa 100644
--- a/modules/desktop/popup-manager/default.nix
+++ b/modules/desktop/popup-manager/default.nix
@@ -1,7 +1,14 @@
-{ ... }:
+{ lib, ... }:
{
imports = [
./rofi
];
+
+ options.desktop.popup-manager = {
+ application-launcher.default = lib.mkOption {
+ type = lib.types.str;
+ description = "Path to the default application launcher program.";
+ };
+ };
}
diff --git a/modules/desktop/popup-manager/rofi/default.nix b/modules/desktop/popup-manager/rofi/default.nix
index 5c839e1..009db89 100644
--- a/modules/desktop/popup-manager/rofi/default.nix
+++ b/modules/desktop/popup-manager/rofi/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
{
options.desktop.popup-manager.rofi = {
@@ -6,8 +6,11 @@
};
config = lib.mkIf config.desktop.popup-manager.rofi.enable {
+ desktop.popup-manager.application-launcher.default = "${pkgs.rofi}/bin/rofi -show run";
programs.rofi.enable = true;
programs.rofi.font = "FiraCode Nerd Font 16";
- programs.rofi.theme = import ./theme config;
+ programs.rofi.theme = config.scheme {
+ template = builtins.readFile ./theme.rasi.mustache;
+ };
};
}
diff --git a/modules/desktop/popup-manager/rofi/theme/theme.rasi b/modules/desktop/popup-manager/rofi/theme.rasi.mustache
index 9d808b9..02cdaf3 100644
--- a/modules/desktop/popup-manager/rofi/theme/theme.rasi
+++ b/modules/desktop/popup-manager/rofi/theme.rasi.mustache
@@ -27,12 +27,18 @@ configuration {
padding: 0;
spacing: 0;
+ bg: #{{base00-hex}};
+ bg-alt: #{{base01-hex}};
+ fg: #{{base07-hex}};
+ fg-alt: #{{base03-hex}};
+
background-color: @bg;
text-color: @fg;
}
window {
transparency: "real";
+ border-color: #{{base03-hex}};
}
mainbox {
diff --git a/modules/desktop/popup-manager/rofi/theme/default.nix b/modules/desktop/popup-manager/rofi/theme/default.nix
deleted file mode 100644
index b0b8173..0000000
--- a/modules/desktop/popup-manager/rofi/theme/default.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-config:
-
-with config.scheme.withHashtag;
-builtins.toFile "theme.rasi"
-''
-${builtins.readFile ./theme.rasi}
-configuration {
- font: "${config.programs.rofi.font}";
-}
-
-* {
- bg: ${base00};
- bg-alt: ${base01};
- fg: ${base07};
- fg-alt: ${base03};
-}
-
-window {
- border-color: ${base03};
-}
-''
diff --git a/modules/desktop/status-bar/polybar/bars/main.nix b/modules/desktop/status-bar/polybar/bars/main.nix
index 630664d..a36f97a 100644
--- a/modules/desktop/status-bar/polybar/bars/main.nix
+++ b/modules/desktop/status-bar/polybar/bars/main.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/default.nix b/modules/desktop/status-bar/polybar/default.nix
index 7608c38..4f7ace3 100644
--- a/modules/desktop/status-bar/polybar/default.nix
+++ b/modules/desktop/status-bar/polybar/default.nix
@@ -10,18 +10,18 @@
services.polybar.script = "polybar main &";
services.polybar.config = {
- "bar/main" = import ./bars/main.nix config;
- "module/xwindow" = import ./modules/xwindow.nix config;
+ "bar/main" = import ./bars/main.nix { inherit config; };
+ "module/xwindow" = import ./modules/xwindow.nix { inherit config; };
"module/bspwm" =
if config.desktop.window-manager.bspwm.enable then
- import ./modules/bspwm.nix config
+ import ./modules/bspwm.nix { inherit config; }
else null;
- "module/cpu" = import ./modules/cpu.nix config;
- "module/memory" = import ./modules/memory.nix config;
- "module/date" = import ./modules/date.nix config;
- "module/time" = import ./modules/time.nix config;
- "module/battery" = import ./modules/battery.nix config;
- "module/kernel-version" = import ./modules/kernel-version.nix config;
+ "module/cpu" = import ./modules/cpu.nix { inherit config; };
+ "module/memory" = import ./modules/memory.nix { inherit config; };
+ "module/date" = import ./modules/date.nix { inherit config; };
+ "module/time" = import ./modules/time.nix { inherit config; };
+ "module/battery" = import ./modules/battery.nix { inherit config; };
+ "module/kernel-version" = import ./modules/kernel-version.nix { inherit config; };
};
};
}
diff --git a/modules/desktop/status-bar/polybar/modules/battery.nix b/modules/desktop/status-bar/polybar/modules/battery.nix
index 9860c3c..6d4aef9 100644
--- a/modules/desktop/status-bar/polybar/modules/battery.nix
+++ b/modules/desktop/status-bar/polybar/modules/battery.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/bspwm.nix b/modules/desktop/status-bar/polybar/modules/bspwm.nix
index 7ec5c6d..0eaac30 100644
--- a/modules/desktop/status-bar/polybar/modules/bspwm.nix
+++ b/modules/desktop/status-bar/polybar/modules/bspwm.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/cpu.nix b/modules/desktop/status-bar/polybar/modules/cpu.nix
index f118990..403add3 100644
--- a/modules/desktop/status-bar/polybar/modules/cpu.nix
+++ b/modules/desktop/status-bar/polybar/modules/cpu.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/date.nix b/modules/desktop/status-bar/polybar/modules/date.nix
index 11a5934..9ebfd77 100644
--- a/modules/desktop/status-bar/polybar/modules/date.nix
+++ b/modules/desktop/status-bar/polybar/modules/date.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/kernel-version.nix b/modules/desktop/status-bar/polybar/modules/kernel-version.nix
index a900264..e6822fa 100644
--- a/modules/desktop/status-bar/polybar/modules/kernel-version.nix
+++ b/modules/desktop/status-bar/polybar/modules/kernel-version.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/memory.nix b/modules/desktop/status-bar/polybar/modules/memory.nix
index 1aff8a3..a09d4a8 100644
--- a/modules/desktop/status-bar/polybar/modules/memory.nix
+++ b/modules/desktop/status-bar/polybar/modules/memory.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/time.nix b/modules/desktop/status-bar/polybar/modules/time.nix
index e4c7cbe..f3e0054 100644
--- a/modules/desktop/status-bar/polybar/modules/time.nix
+++ b/modules/desktop/status-bar/polybar/modules/time.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/xwindow.nix b/modules/desktop/status-bar/polybar/modules/xwindow.nix
index 23245ba..833899e 100644
--- a/modules/desktop/status-bar/polybar/modules/xwindow.nix
+++ b/modules/desktop/status-bar/polybar/modules/xwindow.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/terminal/default.nix b/modules/desktop/terminal/default.nix
index 534b742..60b1e59 100644
--- a/modules/desktop/terminal/default.nix
+++ b/modules/desktop/terminal/default.nix
@@ -5,9 +5,9 @@
./alacritty
];
- options = {
- desktop.terminal.default = lib.mkOption {
- type = lib.types.string;
+ options.desktop.terminal = {
+ default = lib.mkOption {
+ type = lib.types.str;
description = "Path to the default terminal program.";
};
};
diff --git a/modules/desktop/window-manager/bspwm/default.nix b/modules/desktop/window-manager/bspwm/default.nix
index da9aa12..96df979 100644
--- a/modules/desktop/window-manager/bspwm/default.nix
+++ b/modules/desktop/window-manager/bspwm/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
{
options.desktop.window-manager.bspwm = {
@@ -6,6 +6,7 @@
};
config = lib.mkIf config.desktop.window-manager.bspwm.enable {
+ desktop.window-manager.default = "${pkgs.bspwm}/bin/bspwm";
xsession.windowManager.bspwm.enable = true;
xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; {
diff --git a/modules/desktop/window-manager/default.nix b/modules/desktop/window-manager/default.nix
index c1de8c5..23c5d6e 100644
--- a/modules/desktop/window-manager/default.nix
+++ b/modules/desktop/window-manager/default.nix
@@ -1,8 +1,15 @@
-{ ... }:
+{ lib, ... }:
{
imports = [
./bspwm
./sxhkd
];
+
+ options.desktop.window-manager = {
+ default = lib.mkOption {
+ type = lib.types.str;
+ description = "Path to the default window manager program.";
+ };
+ };
}
diff --git a/modules/desktop/window-manager/sxhkd/default.nix b/modules/desktop/window-manager/sxhkd/default.nix
index 3673b48..decad25 100644
--- a/modules/desktop/window-manager/sxhkd/default.nix
+++ b/modules/desktop/window-manager/sxhkd/default.nix
@@ -12,68 +12,35 @@
let
modKey = "alt";
createKeybinding = keybinding: description: "# ${description}\n${modKey} + ${keybinding}";
- in {
- ${(createKeybinding
- "s"
- "Show keybindings.")}
- = pkgs.writeShellScript
- "show-keybindings.sh"
- (builtins.readFile ./scripts/show-keybindings.sh);
-
- ${(createKeybinding
- "r"
- "Launch rofi.")}
- = "rofi -show run";
-
- ${(createKeybinding
- "t"
- "Launch terminal.")}
- = config.desktop.terminal.default;
-
- ${(createKeybinding
- "f"
- "Launch File Explorer.")}
- = "${config.desktop.terminal.default} -t 'File Explorer' --class 'popup' -e lf";
-
- ${(createKeybinding
- "q"
- "Kill current window.")}
- = "bspc node -c";
-
- ${(createKeybinding
- "{1-9,0}"
- "Switch workspace.")}
- = "bspc desktop -f {1-9,10}";
-
- ${(createKeybinding
- "shift + {1-9,0}"
- "Move window to workspace.")}
- = "bspc node -d {1-9,10} --follow";
-
- ${(createKeybinding
- "{n,d,m}"
- "Set current window mode (tiled, floating, fullscreen).")}
- = "bspc node focused -t {tiled,floating,fullscreen}";
-
- ${(createKeybinding
- "{_,shift + }{h,j,k,l}"
- "Navigate between windows.")}
- = "bspc node --{focus,swap} {west,south,north,east}";
-
- # the indentation for each line is required to work with the help prompt
- ${(createKeybinding
- "ctrl + {h,j,k,l}"
- "Resize current window.")}
- = ''
- {bspc node @parent/second -z left -20 0; \
- bspc node @parent/first -z right -20 0, \
- bspc node @parent/second -z top 0 +20; \
- bspc node @parent/first -z bottom 0 +20, \
- bspc node @parent/first -z bottom 0 -20; \
- bspc node @parent/second -z top 0 -20, \
- bspc node @parent/first -z right +20 0; \
- bspc node @parent/second -z left +20 0}
- '';
- };
+ in lib.mkMerge [
+ (
+ if config.desktop.window-manager.bspwm.enable then
+ (import ./keybindings/bspwm.nix { inherit pkgs createKeybinding; })
+ else {}
+ )
+ {
+ ${(createKeybinding
+ "s"
+ "Show keybindings.")}
+ = pkgs.writeShellScript
+ "keybindings.sh"
+ (builtins.readFile ./scripts/keybindings.sh);
+
+ ${(createKeybinding
+ "r"
+ "Application launcher.")}
+ = config.desktop.popup-manager.application-launcher.default;
+
+ ${(createKeybinding
+ "t"
+ "Launch terminal.")}
+ = config.desktop.terminal.default;
+
+ ${(createKeybinding
+ "f"
+ "Launch File Manager.")}
+ = "${config.desktop.terminal.default} -t 'File Manager' --class popup -e ${config.tools.file-manager.default}";
+ }
+ ];
};
}
diff --git a/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix b/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
new file mode 100644
index 0000000..1d66d16
--- /dev/null
+++ b/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
@@ -0,0 +1,45 @@
+{ createKeybinding, pkgs }:
+
+let
+ bspc = "${pkgs.bspwm}/bin/bspc";
+in {
+ ${(createKeybinding
+ "q"
+ "Kill current window.")}
+ = "${bspc} node -c";
+
+ ${(createKeybinding
+ "{1-9,0}"
+ "Switch workspace.")}
+ = "${bspc} desktop -f {1-9,10}";
+
+ ${(createKeybinding
+ "shift + {1-9,0}"
+ "Move window to workspace.")}
+ = "${bspc} node -d {1-9,10} --follow";
+
+ ${(createKeybinding
+ "{n,d,m}"
+ "Set current window mode (tiled, floating, fullscreen).")}
+ = "${bspc} node focused -t {tiled,floating,fullscreen}";
+
+ ${(createKeybinding
+ "{_,shift + }{h,j,k,l}"
+ "Navigate between windows.")}
+ = "${bspc} node --{focus,swap} {west,south,north,east}";
+
+ # the indentation for each line is required to work with the help prompt
+ ${(createKeybinding
+ "ctrl + {h,j,k,l}"
+ "Resize current window.")}
+ = ''
+ ${bspc} node {@parent/second -z left -20 0; \
+ @parent/first -z right -20 0, \
+ @parent/second -z top 0 +20; \
+ @parent/first -z bottom 0 +20, \
+ @parent/first -z bottom 0 -20; \
+ @parent/second -z top 0 -20, \
+ @parent/first -z right +20 0; \
+ @parent/second -z left +20 0}
+'';
+}
diff --git a/modules/desktop/window-manager/sxhkd/scripts/show-keybindings.sh b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
index db7863d..5e6b356 100644
--- a/modules/desktop/window-manager/sxhkd/scripts/show-keybindings.sh
+++ b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
@@ -1,6 +1,4 @@
#!/bin/sh
-SXHKD_CONFIG="$HOME/.config/sxhkd/sxhkdrc"
-
awk '
/^#/ {
desc = substr($0, 3)
@@ -10,4 +8,4 @@ awk '
getline
print cmd " : " desc
}
-' "$SXHKD_CONFIG" | rofi -dmenu -i -p "Keybindings"
+' "$HOME/.config/sxhkd/sxhkdrc" | rofi -dmenu -i -p "Keybindings"
diff --git a/modules/shell/default.nix b/modules/shell/default.nix
index 2dbd054..27a919a 100644
--- a/modules/shell/default.nix
+++ b/modules/shell/default.nix
@@ -8,7 +8,7 @@
options.shell = {
default = lib.mkOption {
- type = lib.types.string;
+ type = lib.types.str;
description = "Path to the default shell program.";
};
alias = lib.mkOption {
diff --git a/modules/shell/zsh/default.nix b/modules/shell/zsh/default.nix
index c553ec4..7d7a261 100644
--- a/modules/shell/zsh/default.nix
+++ b/modules/shell/zsh/default.nix
@@ -6,11 +6,12 @@
};
config = lib.mkIf config.shell.zsh.enable {
+ shell.default = "${pkgs.zsh}/bin/zsh";
+
programs.zsh.enable = true;
programs.zsh.dotDir = ".config/zsh";
programs.zsh.history.path = "${config.xdg.cacheHome}/zsh/history";
programs.zsh.initExtra = builtins.readFile ./zshrc;
programs.zsh.shellAliases = config.shell.alias;
- shell.default = "${pkgs.zsh}/bin/zsh";
};
}
diff --git a/modules/tools/editor/neovim/config/default.nix b/modules/tools/editor/neovim/config/default.nix
new file mode 100644
index 0000000..4514d2f
--- /dev/null
+++ b/modules/tools/editor/neovim/config/default.nix
@@ -0,0 +1,4 @@
+''
+${builtins.readFile ./options.lua}
+${builtins.readFile ./keybindings.lua}
+''
diff --git a/modules/tools/editor/neovim/keybindings.lua b/modules/tools/editor/neovim/config/keybindings.lua
index 3e8e0fa..3e8e0fa 100644
--- a/modules/tools/editor/neovim/keybindings.lua
+++ b/modules/tools/editor/neovim/config/keybindings.lua
diff --git a/modules/tools/editor/neovim/options.lua b/modules/tools/editor/neovim/config/options.lua
index b1fe9cb..b1fe9cb 100644
--- a/modules/tools/editor/neovim/options.lua
+++ b/modules/tools/editor/neovim/config/options.lua
diff --git a/modules/tools/editor/neovim/default.nix b/modules/tools/editor/neovim/default.nix
index 6cf3b50..87fad55 100644
--- a/modules/tools/editor/neovim/default.nix
+++ b/modules/tools/editor/neovim/default.nix
@@ -18,15 +18,8 @@
programs.neovim.extraLuaConfig =
''
- ${builtins.readFile ./options.lua}
- ${builtins.readFile ./keybindings.lua}
-
- -- Plugins configuration
- ${builtins.readFile ./plugins/comment.lua}
- ${builtins.readFile ./plugins/lualine.lua}
- ${import ./plugins/treesitter.nix config}
- ${builtins.readFile ./plugins/base16.lua}
- ${builtins.readFile ./plugins/nvim-tree.lua}
+${import ./config}
+${import ./plugins { inherit config; }}
'';
programs.neovim.plugins = with pkgs.vimPlugins; [
diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix
new file mode 100644
index 0000000..2df4e4a
--- /dev/null
+++ b/modules/tools/editor/neovim/plugins/default.nix
@@ -0,0 +1,9 @@
+{ config }:
+
+''
+${builtins.readFile ./comment.lua}
+${builtins.readFile ./lualine.lua}
+${import ./treesitter.nix { inherit config; }}
+${builtins.readFile ./base16.lua}
+${builtins.readFile ./nvim-tree.lua}
+''
diff --git a/modules/tools/editor/neovim/plugins/treesitter.nix b/modules/tools/editor/neovim/plugins/treesitter.nix
index 05f1f2a..be0bdb6 100644
--- a/modules/tools/editor/neovim/plugins/treesitter.nix
+++ b/modules/tools/editor/neovim/plugins/treesitter.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
''
require("nvim-treesitter.configs").setup {
diff --git a/modules/tools/file-manager/default.nix b/modules/tools/file-manager/default.nix
index fc5eb46..760584a 100644
--- a/modules/tools/file-manager/default.nix
+++ b/modules/tools/file-manager/default.nix
@@ -1,8 +1,16 @@
-{ ... }:
+{ lib, ... }:
{
imports = [
./lf
./lsd
+ ./nnn
];
+
+ options.tools.file-manager = {
+ default = lib.mkOption {
+ type = lib.types.str;
+ description = "Path to the default file manager program.";
+ };
+ };
}
diff --git a/modules/tools/file-manager/lf/default.nix b/modules/tools/file-manager/lf/default.nix
index 30ed421..4cfbba2 100644
--- a/modules/tools/file-manager/lf/default.nix
+++ b/modules/tools/file-manager/lf/default.nix
@@ -6,14 +6,20 @@
};
config = lib.mkIf config.tools.file-manager.lf.enable {
+ tools.file-manager.default = "${pkgs.nnn}/bin/lf";
programs.lf.enable = true;
programs.lf.settings = {
hidden = true;
};
programs.lf.previewer.source = pkgs.writeShellScript
"previewer.sh"
- (builtins.readFile ./scripts/previewer.sh);
-
+ ''
+#!/bin/sh
+unset COLORTERM
+${if config.tools.viewer.bat.enable then
+ "bat -pp --line-range=:500 --color=always '$1'"
+else "cat"}
+ '';
programs.lf.extraConfig = "set icons";
xdg.configFile."lf/icons".source = ./icons;
diff --git a/modules/tools/file-manager/lf/scripts/previewer.sh b/modules/tools/file-manager/lf/scripts/previewer.sh
deleted file mode 100644
index 407e0a0..0000000
--- a/modules/tools/file-manager/lf/scripts/previewer.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-unset COLORTERM
-bat -pp --line-range=:500 --color=always "$1"
diff --git a/modules/tools/file-manager/lsd/default.nix b/modules/tools/file-manager/lsd/default.nix
index 5b940ab..d99413d 100644
--- a/modules/tools/file-manager/lsd/default.nix
+++ b/modules/tools/file-manager/lsd/default.nix
@@ -8,10 +8,6 @@
config = lib.mkIf config.tools.file-manager.lsd.enable {
programs.lsd.enable = true;
programs.lsd.enableAliases = true;
- shell.alias."tree" = "${pkgs.lsd}/bin/lsd -a --tree";
-
- programs.lsd.settings = {
- icons.separator = " ";
- };
+ programs.lsd.settings.icons.separator = " ";
};
}
diff --git a/modules/tools/file-manager/nnn/default.nix b/modules/tools/file-manager/nnn/default.nix
new file mode 100644
index 0000000..6244d04
--- /dev/null
+++ b/modules/tools/file-manager/nnn/default.nix
@@ -0,0 +1,15 @@
+{ config, pkgs, lib, ... }:
+
+{
+ options.tools.file-manager.nnn = {
+ enable = lib.mkEnableOption "Enables nnn.";
+ };
+
+ config = lib.mkIf config.tools.file-manager.nnn.enable {
+ tools.file-manager.default = "${pkgs.nnn}/bin/nnn -H -d";
+ programs.nnn.enable = true;
+ programs.nnn.package = pkgs.nnn.override ({ withNerdIcons = true; });
+ programs.nnn.plugins.src = "${pkgs.nnn}/share/plugins";
+ shell.alias."nnn" = "nnn -H -d";
+ };
+}
diff --git a/modules/tools/git/default.nix b/modules/tools/git/default.nix
index 1dadacf..135cbc6 100644
--- a/modules/tools/git/default.nix
+++ b/modules/tools/git/default.nix
@@ -15,6 +15,9 @@
};
# The base directory of the credential file must exist
- home.activation.createGitCacheDirectory = lib.hm.dag.entryAfter [ "writeBoundary" ] "mkdir -p ${config.xdg.cacheHome}/git";
+ home.activation.createGitCacheDirectory
+ = lib.hm.dag.entryAfter
+ [ "writeBoundary" ]
+ "mkdir -p ${config.xdg.cacheHome}/git";
};
}
diff --git a/modules/tools/viewer/bat/default.nix b/modules/tools/viewer/bat/default.nix
index 915b4b2..73bdefd 100644
--- a/modules/tools/viewer/bat/default.nix
+++ b/modules/tools/viewer/bat/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
{
options.tools.viewer.bat = {
@@ -7,8 +7,12 @@
config = lib.mkIf config.tools.viewer.bat.enable {
programs.bat.enable = true;
- programs.bat.config.theme = "customTheme";
- xdg.configFile."bat/themes/customTheme.tmTheme".text
- = import ./theme.nix config;
+ programs.bat.config.theme = "custom-theme";
+ shell.alias."cbat" = "${pkgs.bat}/bin/bat -pp";
+ home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always";
+ xdg.configFile."bat/themes/custom-theme.tmTheme".source
+ = config.scheme {
+ template = builtins.readFile ./theme.tmTheme.mustache;
+ };
};
}
diff --git a/modules/tools/viewer/bat/theme.nix b/modules/tools/viewer/bat/theme.tmTheme.mustache
index dc22ceb..844b80d 100644
--- a/modules/tools/viewer/bat/theme.nix
+++ b/modules/tools/viewer/bat/theme.tmTheme.mustache
@@ -1,7 +1,3 @@
-config:
-
-with config.scheme.withHashtag;
-''
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
@@ -14,17 +10,17 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>background</key>
- <string>${base00}</string>
+ <string>#{{base00-hex}}</string>
<key>foreground</key>
- <string>${base05}</string>
+ <string>#{{base05-hex}}</string>
<key>caret</key>
- <string>${base07}</string>
+ <string>#{{base07-hex}}</string>
<key>invisibles</key>
- <string>${base03}</string>
+ <string>#{{base03-hex}}</string>
<key>lineHighlight</key>
- <string>${base02}</string>
+ <string>#{{base02-hex}}</string>
<key>selection</key>
- <string>${base03}</string>
+ <string>#{{base03-hex}}</string>
</dict>
</dict>
@@ -35,7 +31,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base04}</string>
+ <string>#{{base04-hex}}</string>
</dict>
</dict>
@@ -45,7 +41,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0A}</string>
+ <string>#{{base0A-hex}}</string>
</dict>
</dict>
@@ -55,7 +51,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base09}</string>
+ <string>#{{base09-hex}}</string>
</dict>
</dict>
@@ -65,7 +61,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base08}</string>
+ <string>#{{base08-hex}}</string>
</dict>
</dict>
@@ -75,7 +71,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0D}</string>
+ <string>#{{base0D-hex}}</string>
</dict>
</dict>
@@ -85,7 +81,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0E}</string>
+ <string>#{{base0E-hex}}</string>
</dict>
</dict>
@@ -95,7 +91,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0B}</string>
+ <string>#{{base0B-hex}}</string>
</dict>
</dict>
@@ -105,7 +101,7 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0C}</string>
+ <string>#{{base0C-hex}}</string>
</dict>
</dict>
@@ -115,10 +111,10 @@ with config.scheme.withHashtag;
<key>settings</key>
<dict>
<key>foreground</key>
- <string>${base0F}</string>
+ <string>#{{base0F-hex}}</string>
</dict>
</dict>
</array>
</dict>
</plist>
-''
+