From 3fbe1f6b2d0567eb5cac0efd906d4696333d71c8 Mon Sep 17 00:00:00 2001 From: Petar Kirov Date: Mon, 29 Jan 2024 09:45:22 +0200 Subject: [PATCH] feat(fish/functions): Add `build` function --- .config/fish/functions/build.fish | 21 +++++++++++++++++++++ .gitignore | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 .config/fish/functions/build.fish diff --git a/.config/fish/functions/build.fish b/.config/fish/functions/build.fish new file mode 100644 index 0000000..979f0cf --- /dev/null +++ b/.config/fish/functions/build.fish @@ -0,0 +1,21 @@ +function build -a cache -d "Build with Nix and push to Cachix" + argparse --min-args=1 h/help c/cache= -- $argv + or return + set -l cache "$_flag_cache" + if test -z "$cache" + set cache "$CACHIX_CACHE" + end + if set -ql _flag_help; or test -z "$cache" + echo "build [-h|--help] [-c|--cache] [FLAKE_REFs ...]" + return 0 + end + echo "Building" + for attr in $argv + echo " * $attr" + end + echo "And pushing to cache: '$cache'" + nom build -L --json --no-link --keep-going \ + $argv \ + | jq -r '.[] | .outputs.out' \ + | cachix push $cache +end diff --git a/.gitignore b/.gitignore index 0221db1..906c295 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ result # Direnv .direnv + +# dotenv +.env