diff options
Diffstat (limited to '')
-rw-r--r-- | modules/by-name/zs/zsh/module.nix | 5 | ||||
-rw-r--r-- | modules/home.legacy/pkgs/default.nix | 2 | ||||
-rwxr-xr-x | pkgs/by-name/au/aumo/aumo.sh | 19 | ||||
-rw-r--r-- | pkgs/by-name/au/aumo/package.nix | 6 | ||||
-rwxr-xr-x | pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh | 8 | ||||
-rw-r--r-- | pkgs/by-name/fu/fupdate-flake/package.nix | 9 | ||||
-rwxr-xr-x | pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh | 19 | ||||
-rw-r--r-- | pkgs/by-name/ll/ll/package.nix | 2 | ||||
-rw-r--r-- | pkgs/by-name/lm/lm/package.nix | 1 |
9 files changed, 43 insertions, 28 deletions
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix index b50e72ac..fd99031b 100644 --- a/modules/by-name/zs/zsh/module.nix +++ b/modules/by-name/zs/zsh/module.nix @@ -3,6 +3,7 @@ lib, shell_library, system, + pkgs, ... }: let cfg = config.soispha.programs.zsh; @@ -133,8 +134,8 @@ in { }; shellAliases = { - ll = ". ll"; - lm = ". lm"; + ll = ". ${lib.getExe pkgs.ll}"; + lm = ". ${lib.getExe pkgs.lm}"; }; }; }; diff --git a/modules/home.legacy/pkgs/default.nix b/modules/home.legacy/pkgs/default.nix index 9cb360f4..fd8b811a 100644 --- a/modules/home.legacy/pkgs/default.nix +++ b/modules/home.legacy/pkgs/default.nix @@ -94,8 +94,6 @@ with pkgs; let fd # Simple, fast and user-friendly alternative to find ripgrep # A search tool that combines the usability of ag with the raw speed of grep file # Show information about a file - ll # Wrapper around `lf` to automatically change the path - lm # Wrapper around `ll` to automatically cd to the last accessed path ]; Programming = { diff --git a/pkgs/by-name/au/aumo/aumo.sh b/pkgs/by-name/au/aumo/aumo.sh index d86165b2..991f257c 100755 --- a/pkgs/by-name/au/aumo/aumo.sh +++ b/pkgs/by-name/au/aumo/aumo.sh @@ -8,11 +8,11 @@ error() { die() { error "$1" - if [ -n "$2" ]; then - exit "$2" - else - exit 1 - fi + exit "${2-1}" +} + +usage() { + echo "Usage: $NAME mount|unmount" } get_mounted_labels() { @@ -45,14 +45,19 @@ mounting() { udisksctl mount --block-device "/dev/disk/by-label/$disk_name" } -case "$1" in +case "${1-unset}" in "mount") mounting ;; "unmount" | "umount") unmounting ;; +"unset") + usage + die "You need to provide one argument." + ;; *) - die "Usage: $NAME mount|unmount" + usage + die "Unknown command: '$1'" ;; esac diff --git a/pkgs/by-name/au/aumo/package.nix b/pkgs/by-name/au/aumo/package.nix index 58618e63..5ced60dc 100644 --- a/pkgs/by-name/au/aumo/package.nix +++ b/pkgs/by-name/au/aumo/package.nix @@ -4,6 +4,9 @@ udisks, findutils, rofi, + jq, + gnugrep, + util-linux, }: writeShellApplication { name = "aumo"; @@ -13,5 +16,8 @@ writeShellApplication { udisks findutils rofi + jq + gnugrep + util-linux # for findmnt ]; } diff --git a/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh b/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh index 6d343995..dd475cf3 100755 --- a/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh +++ b/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh @@ -6,7 +6,7 @@ info() { echo "Info: $1" } dbg() { - [ -n "$DEBUG_ENABLE" ] && echo "Debug: $1" + [ "${DEBUG_ENABLE-unset}" != "unset" ] && echo "Debug: $1" >&2 } die() { echo "Error: $1" @@ -37,7 +37,7 @@ upfind() { while search_result=$(fd "$search_string" "$current_directory/" --max-depth 1) - dbg "Debugging upfind - search in $current_directory gives: $search_result" + dbg "upfind - search in $current_directory gives: $search_result" [ -z "$search_result" ] && [ "$current_directory" != "/" ] do current_directory=$(dirname "$current_directory"); done @@ -58,7 +58,7 @@ upfind() { get_storage_path() { update_script="$(realpath "$1")" - storage_path="$XDG_DATE_HOME/fupdate-flake/$update_script" + storage_path="$XDG_DATA_HOME/fupdate-flake/$update_script" echo "$storage_path" } @@ -177,4 +177,6 @@ main() { fi } +main + # vim: ft=sh diff --git a/pkgs/by-name/fu/fupdate-flake/package.nix b/pkgs/by-name/fu/fupdate-flake/package.nix index d2784169..5b2d7d29 100644 --- a/pkgs/by-name/fu/fupdate-flake/package.nix +++ b/pkgs/by-name/fu/fupdate-flake/package.nix @@ -7,19 +7,22 @@ bat-extras, # For `batgrep` bat, # used by batgrep gnused, # required by batgrep + git, }: writeShellApplication { name = "fupdate-flake"; - tetx = builtins.readFile ./fupdate-flake.sh; + text = builtins.readFile ./fupdate-flake.sh; - inheritPath = false; + # The `update.sh` script might actually want to keep the path. + inheritPath = true; runtimeInputs = [ coreutils fd gnugrep - bat-extras # For `batgrep` + bat-extras.batgrep bat # Used by `batgrep` gnused # Required by `batgrep` + git ]; } diff --git a/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh index 38debf44..28e09f3d 100755 --- a/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh +++ b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh @@ -13,10 +13,12 @@ die() { fi } print() { - printf "%s" "$*" + # shellcheck disable=SC2059 + printf "$*" } println() { - printf "%s\n" "$*" + # shellcheck disable=SC2059 + printf "$*\n" } eprint() { >&2 print "$@" @@ -24,7 +26,7 @@ eprint() { eprintln() { >&2 println "$@" } -if [ -n "$NO_COLOR" ]; then +if [ "${NO_COLOR-unset}" != "unset" ]; then error() { eprintln "==> ERROR:" "$*" } @@ -71,7 +73,6 @@ else fi # }}} - NAME="update-sys" help() { cat <<EOF @@ -106,7 +107,7 @@ while [ "$#" -gt 0 ]; do help 0 ;; "--branch" | "-b") - if [ -n "$2" ]; then + if [ "${2-unset}" != "unset" ]; then BRANCH="$2" else error "$1 requires an argument" @@ -115,7 +116,7 @@ while [ "$#" -gt 0 ]; do shift 2 ;; "--mode" | "-m") - if [ -n "$2" ]; then + if [ "${2-unset}" != "unset" ]; then MODE="$2" else error "$1 requires an argument" @@ -149,11 +150,7 @@ trap cleanup EXIT git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' >"$default_branch" & msg2 "Updating system..." -if [ -n "$MODE" ]; then - nixos-rebuild "$MODE" -else - nixos-rebuild switch -fi +nixos-rebuild "${MODE-switch}" git switch "$(cat "$default_branch")" >/dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'" msg "Finished Update!" diff --git a/pkgs/by-name/ll/ll/package.nix b/pkgs/by-name/ll/ll/package.nix index 1516c51c..caca5b4e 100644 --- a/pkgs/by-name/ll/ll/package.nix +++ b/pkgs/by-name/ll/ll/package.nix @@ -3,5 +3,7 @@ writeShellApplication { name = "ll"; text = builtins.readFile ./ll.sh; + # This is sourced in the shell inheritPath = true; + bashOptions = []; } diff --git a/pkgs/by-name/lm/lm/package.nix b/pkgs/by-name/lm/lm/package.nix index e3ebe962..a80c473e 100644 --- a/pkgs/by-name/lm/lm/package.nix +++ b/pkgs/by-name/lm/lm/package.nix @@ -5,4 +5,5 @@ writeShellApplication { # This is sourced in the shell inheritPath = true; + bashOptions = []; } |