Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions home-manager/programs/bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"

# ICU for CGo builds (e.g. go-icu-regex used by beads)
export PKG_CONFIG_PATH="${pkgs.icu.dev}/lib/pkgconfig''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export CGO_CFLAGS="-I${pkgs.icu.dev}/include''${CGO_CFLAGS:+ $CGO_CFLAGS}"
export CGO_LDFLAGS="-L${pkgs.icu.out}/lib''${CGO_LDFLAGS:+ $CGO_LDFLAGS}"

# Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)
export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
Expand Down Expand Up @@ -96,6 +101,11 @@
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"

# ICU for CGo builds (e.g. go-icu-regex used by beads)
export PKG_CONFIG_PATH="${pkgs.icu.dev}/lib/pkgconfig''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export CGO_CFLAGS="-I${pkgs.icu.dev}/include''${CGO_CFLAGS:+ $CGO_CFLAGS}"
export CGO_LDFLAGS="-L${pkgs.icu.out}/lib''${CGO_LDFLAGS:+ $CGO_LDFLAGS}"

# Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)
export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
Expand Down
5 changes: 5 additions & 0 deletions home-manager/programs/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
set -gx OPENSSL_LIB_DIR "${pkgs.openssl.out}/lib"
set -gx OPENSSL_INCLUDE_DIR "${pkgs.openssl.dev}/include"

# ICU for CGo builds (e.g. go-icu-regex used by beads)
set -gx PKG_CONFIG_PATH "${pkgs.icu.dev}/lib/pkgconfig" $PKG_CONFIG_PATH
set -gx CGO_CFLAGS "-I${pkgs.icu.dev}/include $CGO_CFLAGS"
set -gx CGO_LDFLAGS "-L${pkgs.icu.out}/lib $CGO_LDFLAGS"

# Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)
set -gx LD_LIBRARY_PATH ${lib.optionalString pkgs.stdenv.isLinux ''"${pkgs.alsa-lib}/lib"''} "${pkgs.glib.out}/lib" "${pkgs.libsecret}/lib" "${pkgs.stdenv.cc.cc.lib}/lib" "${pkgs.zlib}/lib" $LD_LIBRARY_PATH
end
Expand Down
5 changes: 5 additions & 0 deletions home-manager/programs/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"

# ICU for CGo builds (e.g. go-icu-regex used by beads)
export PKG_CONFIG_PATH="${pkgs.icu.dev}/lib/pkgconfig''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export CGO_CFLAGS="-I${pkgs.icu.dev}/include''${CGO_CFLAGS:+ $CGO_CFLAGS}"
export CGO_LDFLAGS="-L${pkgs.icu.out}/lib''${CGO_LDFLAGS:+ $CGO_LDFLAGS}"

# Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)
export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
Expand Down
3 changes: 3 additions & 0 deletions home-manager/services/make-updater/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ in
"AUTOMATED_UPDATE=true"
"RUSTUP_HOME=%h/.rustup"
"CARGO_HOME=%h/.cargo"
"PKG_CONFIG_PATH=${pkgs.openssl.dev}/lib/pkgconfig:${pkgs.icu.dev}/lib/pkgconfig"
"CGO_CFLAGS=-I${pkgs.icu.dev}/include"
"CGO_LDFLAGS=-L${pkgs.icu.out}/lib"
];
Nice = 19;
IOSchedulingPriority = 7;
Expand Down
23 changes: 19 additions & 4 deletions scripts/update-local-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ build_repo() {
# Install tools via mise if mise.toml is present
if [ -f "$build_dir/mise.toml" ] && command -v mise >/dev/null 2>&1; then
log_step " Installing tools via mise..."
(cd "$build_dir" && mise trust 2>&1) || true

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mise trust persists a trust decision for the directory (and potentially its tool config) into the user’s mise trust store. Running it automatically inside an update/build script can unintentionally trust configs from repos the user didn’t explicitly approve. Prefer avoiding persistent trust changes from automation (e.g., require an explicit opt-in flag/env var before running mise trust, or use a scoped/non-persistent mechanism if mise supports it), so the script can build without mutating global trust state.

Suggested change
(cd "$build_dir" && mise trust 2>&1) || true
if [ "${MISE_AUTO_TRUST:-}" = "1" ]; then
(cd "$build_dir" && mise trust 2>&1) || true
else
log_warn " Skipping 'mise trust' because MISE_AUTO_TRUST is not set to 1; run 'mise trust' manually if needed."
fi

Copilot uses AI. Check for mistakes.
(cd "$build_dir" && mise install 2>&1) || true
fi

# Initialize git submodules if .gitmodules exists
if [ -f "$repo_dir/.gitmodules" ]; then
log_step " Initializing submodules..."
(cd "$repo_dir" && git submodule update --init --recursive 2>&1) || true
Comment on lines +146 to +149

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submodule initialization is performed in repo_dir, but builds are executed from build_dir throughout this function. If build_dir is a separate checkout/copy (as the surrounding code implies), submodules in the build tree won’t be initialized and builds can fail. Initialize submodules in the same directory you build from (and check .gitmodules in that directory) to keep the operation consistent and effective.

Suggested change
# Initialize git submodules if .gitmodules exists
if [ -f "$repo_dir/.gitmodules" ]; then
log_step " Initializing submodules..."
(cd "$repo_dir" && git submodule update --init --recursive 2>&1) || true
# Initialize git submodules if .gitmodules exists in the build directory
if [ -f "$build_dir/.gitmodules" ]; then
log_step " Initializing submodules..."
(cd "$build_dir" && git submodule update --init --recursive 2>&1) || true

Copilot uses AI. Check for mistakes.
fi

if [ -f "$build_dir/Makefile" ]; then
# Use mise exec if mise.toml present to ensure correct tool versions
local make_cmd="make"
Expand All @@ -152,19 +159,27 @@ build_repo() {
if (cd "$build_dir" && $make_cmd -n deps >/dev/null 2>&1); then
(cd "$build_dir" && $make_cmd deps 2>&1) || true
fi
if (cd "$build_dir" && $make_cmd build 2>&1); then
return 0
# If Makefile has no build target, fall through to other build systems
if (cd "$build_dir" && $make_cmd -n build >/dev/null 2>&1); then
if (cd "$build_dir" && $make_cmd build 2>&1); then
return 0
else
return 1
fi
else
return 1
log_warn " Makefile has no build target, trying other build systems..."
fi
Comment on lines +162 to 171

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using make -n build as a proxy for 'target exists' can misclassify real Makefile errors (e.g., missing included files, syntax errors, required env) as 'no build target', causing the script to silently fall through to other build systems and hide the actual failure. A more reliable approach is to only fall through when the failure is specifically 'No rule to make target …', and otherwise treat it as a genuine Makefile error (return non-zero and surface the output).

Copilot uses AI. Check for mistakes.
elif [ -f "$build_dir/Cargo.toml" ]; then
fi

if [ -f "$build_dir/Cargo.toml" ]; then
if (cd "$build_dir" && cargo +nightly build --release 2>&1); then
return 0
else
return 1
fi
elif [ -f "$build_dir/go.mod" ]; then
# Go project: build ./cmd/{repo_name} if it exists, otherwise build root
# ICU/CGo env vars are provided by shell init (fish/bash/zsh via nix)
if [ -d "$build_dir/cmd/$repo_name" ]; then
if (cd "$build_dir" && go build "./cmd/$repo_name" 2>&1); then
return 0
Expand Down
Loading