Compare commits

...

4 Commits

Author SHA1 Message Date
Ahmed Hosam 0a11f2d273
Merge d8fbc75bab into 7ff836131a 2026-03-11 11:48:46 +01:00
Kevin Ji 7ff836131a
fix(gcloud): prevent gcloud CLI from hanging (#2935)
If the `gcloud` command is interactive (e.g. asks to install a component, or needs an update), the current code will hang forever, and is uninterruptible as `INT` is being swallowed.

Fix this with `</dev/null` and `--quiet`.
2026-03-11 09:09:44 +08:00
Ahmed Hosam d8fbc75bab
Update README.md
Specify the version of NixOS, and add the update of `initExtra` in 25.05v of NixOS.
2025-05-15 16:42:43 +03:00
Ahmed Hosam 8de553fbc9
add nixos installation for home-manager and system-wide 2025-05-03 22:40:53 +03:00
2 changed files with 40 additions and 1 deletions

View File

@ -431,6 +431,7 @@ Powerlevel10k.
- [Arch Linux](#arch-linux) - [Arch Linux](#arch-linux)
- [Alpine Linux](#alpine-linux) - [Alpine Linux](#alpine-linux)
- [Fig](#fig) - [Fig](#fig)
- [NixOS](#nixos)
### Manual ### Manual
@ -549,6 +550,42 @@ ln -s /usr/share/zsh/plugins/powerlevel10k ~/.local/share/zsh/plugins/
Follow the instructions on Follow the instructions on
[this page](https://fig.io/plugins/other/powerlevel10k). [this page](https://fig.io/plugins/other/powerlevel10k).
### NixOS
**Home Manager**
```nix
programs.zsh = {
...
plugins = [
{
name = "zsh-powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/";
file = "powerlevel10k.zsh-theme";
}
];
# NixOS 24.11 or earlier:
initExtra = ''
source ~/.p10k.zsh
'';
# NixOS 25.05 or later:
# initContent = let initExtra = lib.mkOrder 1000 '' [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh ''; in lib.mkMerge [initExtra];
};
```
**System wide**
```nix
programs.zsh = {
...
promptInit = ''
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
source ~/.p10k.zsh
'';
};
```
## Configuration ## Configuration
- [For new users](#for-new-users) - [For new users](#for-new-users)

View File

@ -4716,7 +4716,9 @@ _p9k_gcloud_prefetch() {
if ! _p9k_cache_stat_get $0 ${CLOUDSDK_CONFIG:-~/.config/gcloud}/configurations/config_$P9K_GCLOUD_CONFIGURATION; then if ! _p9k_cache_stat_get $0 ${CLOUDSDK_CONFIG:-~/.config/gcloud}/configurations/config_$P9K_GCLOUD_CONFIGURATION; then
local pair account project_id local pair account project_id
pair="$(gcloud config configurations describe $P9K_GCLOUD_CONFIGURATION \ pair="$(gcloud config configurations describe $P9K_GCLOUD_CONFIGURATION \
--format=$'value[separator="\1"](properties.core.account,properties.core.project)')" --quiet \
--format=$'value[separator="\1"](properties.core.account,properties.core.project)' \
</dev/null)"
(( ! $? )) && IFS=$'\1' read account project_id <<<$pair (( ! $? )) && IFS=$'\1' read account project_id <<<$pair
_p9k_cache_stat_set "$account" "$project_id" _p9k_cache_stat_set "$account" "$project_id"
fi fi