style: format (alejandra)

This commit is contained in:
zerosummed
2025-02-14 21:06:51 +03:00
parent 70021da132
commit e1c484b1c0
14 changed files with 363 additions and 341 deletions

View File

@@ -1,12 +1,11 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "unpack" ''
#!/usr/bin/env sh
set -e
# Determine the Git repository root or default to current directory
GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
SILENT=false
AUTO_YES=false
ZIPFILE=
@@ -16,7 +15,7 @@ pkgs.writeShellScriptBin "unpack" ''
# Check if the user is inside the 'web' directory or any of its subdirectories
RELATIVE_PATH="$(realpath --relative-to="$GIT_ROOT" "$ORIGINAL_DIR")"
IN_WEB=false
if [ "$RELATIVE_PATH" = "web" ] || echo "$RELATIVE_PATH" | grep -qE '^web(/|$)'; then
IN_WEB=true

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "colorize" ''
awk '
BEGIN {

View File

@@ -1,5 +1,5 @@
# FIXME: very unstable (on every request opens pager) but works somehow
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "gh-tl" ''
set -euo pipefail
@@ -54,7 +54,7 @@ pkgs.writeShellScriptBin "gh-tl" ''
# Fetch all labels from the source repository with pagination
echo "Fetching labels from $SOURCE_REPO..."
LABELS_JSON=$(gh api -H "Accept: application/vnd.github.v3+json" \
/repos/"$SOURCE_REPO"/labels --paginate | jq -s 'add')

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "migration-name" ''
curl --silent https://raw.githubusercontent.com/dwyl/english-words/master/words.txt | shuf -n2 | tr '\n' '_' | sed 's/_$//'
curl --silent https://raw.githubusercontent.com/dwyl/english-words/master/words.txt | shuf -n2 | tr '\n' '_' | sed 's/_$//'
''

View File

@@ -1,28 +1,28 @@
# necessary to load every time .nvimrc
# makes some magic to shading nvim but still uses nvim that shaded
{ pkgs, ... }:
# makes some magic to shading nvim but still uses nvim that shaded
{pkgs, ...}:
pkgs.writeShellScriptBin "nvim" ''
# Source .env file
if [ -f .env ]; then
set -a
. .env
set +a
fi
# Source .env file
if [ -f .env ]; then
set -a
. .env
set +a
fi
# Get the directory of this script
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
# Remove the script's directory from PATH to avoid recursion
PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "$SCRIPT_DIR" | paste -sd ':' -)
# Find the system's nvim
SYSTEM_NVIM=$(command -v nvim)
if [ -z "$SYSTEM_NVIM" ]; then
echo "Error: nvim not found in PATH" >&2
exit 1
fi
# Get the directory of this script
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
# Execute the system's nvim with your custom arguments
exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@"
# Remove the script's directory from PATH to avoid recursion
PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "$SCRIPT_DIR" | paste -sd ':' -)
# Find the system's nvim
SYSTEM_NVIM=$(command -v nvim)
if [ -z "$SYSTEM_NVIM" ]; then
echo "Error: nvim not found in PATH" >&2
exit 1
fi
# Execute the system's nvim with your custom arguments
exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@"
''

View File

@@ -1,14 +1,14 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "pager" ''
nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -c 'set nowrap' \
-c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \
-c 'runtime! plugin/*.vim' -c 'AnsiEsc' -
# ^^^^^^^^^^^^^^^^^^^^
# Prevents Neovim from treating the buffer as a file
# ^^^^^^^^^^^^^^^^^^^^
# Makes 'q' quit Neovim immediately
# ^^^^^^^^^^^
# Disables text wrapping
# ^^^^^^^^
# Enables ANSI color interpretation
nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -c 'set nowrap' \
-c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \
-c 'runtime! plugin/*.vim' -c 'AnsiEsc' -
# ^^^^^^^^^^^^^^^^^^^^
# Prevents Neovim from treating the buffer as a file
# ^^^^^^^^^^^^^^^^^^^^
# Makes 'q' quit Neovim immediately
# ^^^^^^^^^^^
# Disables text wrapping
# ^^^^^^^^
# Enables ANSI color interpretation
''

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }:
let
{
cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.;
cargo = cargoToml src;
in
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
inherit nativeBuildInputs src;
inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }:
let
{
cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.;
cargo = cargoToml src;
in
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
inherit nativeBuildInputs src;
inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }:
let
{
cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.;
cargo = cargoToml src;
in
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name;
version = cargo.package.version;
inherit nativeBuildInputs src;
inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
}

View File

@@ -1,7 +1,6 @@
{ pkgs, ... }:
let
{pkgs, ...}: let
name = "printobstacle";
in
pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
''
in
pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
''

View File

@@ -1,7 +1,6 @@
{ pkgs, ... }:
let
{pkgs, ...}: let
name = "printprogress";
in
pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}"
''
pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}"
''

View File

@@ -1,14 +1,14 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "supabase" ''
# Get the root of the repository
GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
# Get the root of the repository
GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
# Source .env from root of the repo if it exists
if [ -f "$GIT_ROOT/.env" ]; then
set -a
. "$GIT_ROOT/.env"
set +a
fi
# Source .env from root of the repo if it exists
if [ -f "$GIT_ROOT/.env" ]; then
set -a
. "$GIT_ROOT/.env"
set +a
fi
${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@
${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@
''