[darwin-work] Fix compost compatibility
This commit is contained in:
@@ -49,25 +49,76 @@ in
|
||||
# Override Darwin-incompatible settings from base role
|
||||
programs.rbw.settings.pinentry = lib.mkForce pkgs.pinentry_mac;
|
||||
|
||||
programs.bash.initExtra = ''
|
||||
export NODE_EXTRA_CA_CERTS=/opt/homebrew/etc/ca-certificates/cert.pem
|
||||
export COREPACK_NPM_REGISTRY=https://global.block-artifacts.com/artifactory/api/npm/square-npm/
|
||||
export COREPACK_INTEGRITY_KEYS=0
|
||||
# Disable Home Manager from managing shell RC files
|
||||
# topsoil/compost will manage these files instead
|
||||
programs.bash.enable = lib.mkForce false;
|
||||
programs.zsh.enable = lib.mkForce false;
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
'';
|
||||
# Create a local nix integration file that topsoil-managed configs can source
|
||||
home.file.".nix-integration.sh" = {
|
||||
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;
|
||||
programs.zsh.initContent = ''
|
||||
export NODE_EXTRA_CA_CERTS=/opt/homebrew/etc/ca-certificates/cert.pem
|
||||
export COREPACK_NPM_REGISTRY=https://global.block-artifacts.com/artifactory/api/npm/square-npm/
|
||||
export COREPACK_INTEGRITY_KEYS=0
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
'';
|
||||
# Setup bash completions from nix profiles
|
||||
if [[ ! -v BASH_COMPLETION_VERSINFO ]] && [ -n "$NIX_PROFILES" ]; then
|
||||
for profile in $NIX_PROFILES; do
|
||||
if [ -f "$profile/etc/profile.d/bash_completion.sh" ]; then
|
||||
. "$profile/etc/profile.d/bash_completion.sh"
|
||||
break
|
||||
fi
|
||||
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
|
||||
programs.ssh.enable = lib.mkForce false;
|
||||
|
||||
@@ -15,6 +15,7 @@ in
|
||||
environment.etc."bashrc".enable = false;
|
||||
environment.etc."zshrc".enable = false;
|
||||
environment.etc."zshenv".enable = false;
|
||||
environment.etc."zprofile".enable = false;
|
||||
|
||||
# Create .local files with nix environment setup
|
||||
environment.etc."bash.local".text = ''
|
||||
|
||||
Reference in New Issue
Block a user