diff --git a/lib/default.nix b/lib/default.nix index 3f4bc45..9b6eef9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -48,7 +48,10 @@ in { forSystems = systems: nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs commonSystems; - shellModules.logs = builtins.readFile ./shell/logs.sh; + shellModules = { + logs = builtins.readFile ./shell/logs.sh; + check-tool = builtins.readFile ./shell/check-tool.sh; + }; sharedShellAliases = { jc = ''journalctl''; diff --git a/lib/shell/check-tool.sh b/lib/shell/check-tool.sh new file mode 100644 index 0000000..c2f120d --- /dev/null +++ b/lib/shell/check-tool.sh @@ -0,0 +1,6 @@ +check_tool() { + if ! command -v "$1" >/dev/null; then + echo "Required tool \`$2\` are not installed or binary \`$1\` not found." >&2 + exit 1 + fi +}