aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-27 18:21:40 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-27 18:21:40 +0200
commitc9b4cefd8653f73db385d6e3eb5438c4ad9dc788 (patch)
tree14300c2955e2b11f5dd1d1a1989bfd9717a90881
parentmodules/direnv/landlock-fish: Allow sudo (diff)
downloadnixos-config-c9b4cefd8653f73db385d6e3eb5438c4ad9dc788.zip
modules/lf: Init system commands and direnv sandbox enable/disable
-rw-r--r--modules/by-name/lf/lf/commands/default.nix9
-rw-r--r--modules/by-name/lf/lf/keybindings/default.nix11
-rw-r--r--modules/by-name/lf/lf/module.nix2
-rw-r--r--modules/by-name/lf/lf/wrappers/ll.fish13
4 files changed, 33 insertions, 2 deletions
diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix
index 98b3119f..0c0acecf 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -28,6 +28,12 @@
}
+ "/bin/${name}";
+ syscmd = command: ''
+ ''${{
+ printf "%s\n" "SYSCMD::${command}"
+ }}
+ '';
+
# closes the lf tui
shell = args: ''
''${{
@@ -145,6 +151,9 @@ in {
];
};
+ syscmd_direnv_sandbox_enable = syscmd "DIRENV::SANDBOX::ENABLE";
+ syscmd_direnv_sandbox_disable = syscmd "DIRENV::SANDBOX::DISABLE";
+
stripspace = pipe {
name = "stripspace";
dependencies = [pkgs.gnused];
diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix
index bd4b2a2c..c980fde3 100644
--- a/modules/by-name/lf/lf/keybindings/default.nix
+++ b/modules/by-name/lf/lf/keybindings/default.nix
@@ -104,6 +104,17 @@
s = "dragon_stay";
};
+ # that is just here for documentation
+ # i = "ctpv preview"
+
+ # [o]perate on system commands
+ o = {
+ d = {
+ e = "syscmd_direnv_sandbox_enable";
+ d = "syscmd_direnv_sandbox_disable";
+ };
+ };
+
j = {
c = "trash_clear";
r = "trash_restore";
diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix
index 11708152..435df119 100644
--- a/modules/by-name/lf/lf/module.nix
+++ b/modules/by-name/lf/lf/module.nix
@@ -20,7 +20,7 @@
real_commands = import ./commands {inherit pkgs sysLib shell_library system;};
keybindings_raw = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;};
- # NOTE: There is no (easy) way for me to make sure, that the `clearmaps` command is
+ # HACK: There is no (easy) way for me to make sure, that the `clearmaps` command is
# generated in the lf config before the keymapping commands.
# This command injection works around that. <2026-07-21>
commands = libraries.extra.warnMerge real_commands {
diff --git a/modules/by-name/lf/lf/wrappers/ll.fish b/modules/by-name/lf/lf/wrappers/ll.fish
index 7a146993..4d1e3561 100644
--- a/modules/by-name/lf/lf/wrappers/ll.fish
+++ b/modules/by-name/lf/lf/wrappers/ll.fish
@@ -14,7 +14,18 @@ begin
test -d "$XDG_RUNTIME_DIR/ll"; or mkdir "$XDG_RUNTIME_DIR/ll"
set last_directory "$XDG_RUNTIME_DIR/ll/last_directory"
- command lf -last-dir-path="$last_directory" "$argv"
+ command lf -last-dir-path="$last_directory" "$argv" 2>&1 | while read -l cmd
+ switch "$cmd"
+ case "SYSCMD::DIRENV::SANDBOX::ENABLE"
+ set --global SHOULD_SANDBOX_DIRENV
+ case "SYSCMD::DIRENV::SANDBOX::DISABLE"
+ set --erase SHOULD_SANDBOX_DIRENV
+ case '*'
+ # Just pass things along, that we don't know about
+ printf "SYSCMD not recognized: %s\n" "$cmd"
+ end
+ end
+
set dir "$(cat "$last_directory")"
if not cd "$dir"