[darwin-work] Fix compost compatibility

This commit is contained in:
2025-11-14 11:22:52 -08:00
parent 7f318edc4d
commit c27518e0dc
2 changed files with 69 additions and 17 deletions

View File

@@ -49,25 +49,76 @@ in
# Override Darwin-incompatible settings from base role # Override Darwin-incompatible settings from base role
programs.rbw.settings.pinentry = lib.mkForce pkgs.pinentry_mac; programs.rbw.settings.pinentry = lib.mkForce pkgs.pinentry_mac;
programs.bash.initExtra = '' # Disable Home Manager from managing shell RC files
export NODE_EXTRA_CA_CERTS=/opt/homebrew/etc/ca-certificates/cert.pem # topsoil/compost will manage these files instead
export COREPACK_NPM_REGISTRY=https://global.block-artifacts.com/artifactory/api/npm/square-npm/ programs.bash.enable = lib.mkForce false;
export COREPACK_INTEGRITY_KEYS=0 programs.zsh.enable = lib.mkForce false;
export NVM_DIR="$HOME/.nvm" # Create a local nix integration file that topsoil-managed configs can source
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm home.file.".nix-integration.sh" = {
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion text = ''
''; # Source Home Manager session variables (nix paths, environment, etc.)
if [ -e /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh ]; then
. /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh
fi
programs.zsh.enable = true; # Setup bash completions from nix profiles
programs.zsh.initContent = '' if [[ ! -v BASH_COMPLETION_VERSINFO ]] && [ -n "$NIX_PROFILES" ]; then
export NODE_EXTRA_CA_CERTS=/opt/homebrew/etc/ca-certificates/cert.pem for profile in $NIX_PROFILES; do
export COREPACK_NPM_REGISTRY=https://global.block-artifacts.com/artifactory/api/npm/square-npm/ if [ -f "$profile/etc/profile.d/bash_completion.sh" ]; then
export COREPACK_INTEGRITY_KEYS=0 . "$profile/etc/profile.d/bash_completion.sh"
export NVM_DIR="$HOME/.nvm" break
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm fi
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion done
fi
# command-not-found handler
command_not_found_handle() {
local p=/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
if [ -n "$NIX_PROFILES" ]; then
for profile in $NIX_PROFILES; do
if [ -x "$profile/bin/command-not-found" ] && [ -f "$p" ]; then
"$profile/bin/command-not-found" "$@"
return $?
fi
done
fi
echo "$1: command not found" >&2
return 127
}
''; '';
};
home.file.".nix-integration.zsh" = {
text = ''
# Source Home Manager session variables (nix paths, environment, etc.)
if [ -e /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh ]; then
. /etc/profiles/per-user/johno/etc/profile.d/hm-session-vars.sh
fi
# Setup zsh completions from nix profiles
typeset -U path cdpath fpath manpath
for profile in ''${(z)NIX_PROFILES}; do
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done
autoload -U compinit && compinit
# command-not-found handler
command_not_found_handler() {
local p=/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
if [ -n "$NIX_PROFILES" ]; then
for profile in ''${(z)NIX_PROFILES}; do
if [ -x "$profile/bin/command-not-found" ] && [ -f "$p" ]; then
"$profile/bin/command-not-found" "$@"
return $?
fi
done
fi
echo "$1: command not found" >&2
return 127
}
'';
};
# Keep SSH and Git disabled to avoid conflicts with work environment # Keep SSH and Git disabled to avoid conflicts with work environment
programs.ssh.enable = lib.mkForce false; programs.ssh.enable = lib.mkForce false;

View File

@@ -15,6 +15,7 @@ in
environment.etc."bashrc".enable = false; environment.etc."bashrc".enable = false;
environment.etc."zshrc".enable = false; environment.etc."zshrc".enable = false;
environment.etc."zshenv".enable = false; environment.etc."zshenv".enable = false;
environment.etc."zprofile".enable = false;
# Create .local files with nix environment setup # Create .local files with nix environment setup
environment.etc."bash.local".text = '' environment.etc."bash.local".text = ''