diff options
author | Soispha <soispha@vhack.eu> | 2023-05-28 18:35:07 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-05-28 22:02:51 +0200 |
commit | 1e4fb0086ef0b2094e1e14579fce87b81b16773a (patch) | |
tree | fe08500bad6be7d03839bb91f8d78588d0370af6 | |
parent | Fix(flake): Add 'flake_version_update' for following (diff) | |
download | nixos-config-1e4fb0086ef0b2094e1e14579fce87b81b16773a.tar.gz nixos-config-1e4fb0086ef0b2094e1e14579fce87b81b16773a.zip |
Fix(hm/conf/lf/cmds/mk_scr): Use the official shell library template
-rw-r--r-- | home-manager/config/lf/commands/default.nix | 21 | ||||
-rwxr-xr-x | home-manager/config/lf/commands/scripts/mk_scr | 10 | ||||
-rw-r--r-- | home-manager/config/lf/default.nix | 4 |
3 files changed, 21 insertions, 14 deletions
diff --git a/home-manager/config/lf/commands/default.nix b/home-manager/config/lf/commands/default.nix index a44db5ac..27bf01db 100644 --- a/home-manager/config/lf/commands/default.nix +++ b/home-manager/config/lf/commands/default.nix @@ -1,53 +1,61 @@ { pkgs, sysLib, + shell_library, + system, ... }: let functionCall = { file, dependencies, + replacementStrings, ... }: sysLib.writeShellScriptWithLibraryAndKeepPath { name = "${builtins.baseNameOf file}"; src = file; dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); + inherit replacementStrings; } + "/bin/${builtins.baseNameOf file}"; shell = { file, dependencies, + replacementStrings ? null, ... }: '' ''${{ - ${functionCall {inherit file dependencies;}} + ${functionCall {inherit file dependencies replacementStrings;}} }} ''; # closes the lf tui pipe = { file, dependencies, + replacementStrings ? null, ... }: '' %{{ - ${functionCall {inherit file dependencies;}} + ${functionCall {inherit file dependencies replacementStrings;}} }} ''; # runs the command in the ui/term bar async = { file, dependencies, + replacementStrings ? null, ... }: '' &{{ - ${functionCall {inherit file dependencies;}} + ${functionCall {inherit file dependencies replacementStrings;}} }} ''; # runs the command in the background wait = { file, dependencies, + replacementStrings ? null, ... }: '' !{{ - ${functionCall {inherit file dependencies;}} + ${functionCall {inherit file dependencies replacementStrings;}} }} ''; # adds a prompt after the command has run in { @@ -142,6 +150,9 @@ in { mk_scr = shell { file = ./scripts/mk_scr; dependencies = builtins.attrValues {inherit (pkgs) neovim;}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + }; }; open = shell { file = ./scripts/open; @@ -201,3 +212,5 @@ in { }; }; } +# vim: ts=2 + diff --git a/home-manager/config/lf/commands/scripts/mk_scr b/home-manager/config/lf/commands/scripts/mk_scr index 9d404c87..99f9f1d6 100755 --- a/home-manager/config/lf/commands/scripts/mk_scr +++ b/home-manager/config/lf/commands/scripts/mk_scr @@ -4,15 +4,7 @@ SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH script=$(mktmp) -cat << EOF > $script -#!/usr/bin/env dash -# shellcheck disable=SC2086 -# shellcheck source=/dev/null -. %SHELL_LIBRARY_PATH - - - -EOF +cat "%SHELL_LIBRARY_TEMPLATE" > "$script" readp "Script Name: " script_name scr="$(pwd)"/"$script_name" diff --git a/home-manager/config/lf/default.nix b/home-manager/config/lf/default.nix index fbd17497..73c2cd3d 100644 --- a/home-manager/config/lf/default.nix +++ b/home-manager/config/lf/default.nix @@ -2,9 +2,11 @@ pkgs, sysLib, nixosConfig, + shell_library, + system, ... }: let - commands = import ./commands {inherit pkgs sysLib;}; + commands = import ./commands {inherit pkgs sysLib shell_library system;}; keybindings = import ./keybindings {inherit nixosConfig;}; in { xdg.configFile."lf/icons".source = ./icons; |