From b0d2058ed55095c688a0ceb5d69f998ad93438d9 Mon Sep 17 00:00:00 2001 From: Tao Tien <29749622+taotien@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:18:55 -0800 Subject: [PATCH] starship --- systems/NOlaptop.nix | 2 ++ systems/disk-config.nix | 4 +-- users/tao.nix | 1 + users/tao/starship.toml | 59 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/systems/NOlaptop.nix b/systems/NOlaptop.nix index c5e4da9..08dbd72 100644 --- a/systems/NOlaptop.nix +++ b/systems/NOlaptop.nix @@ -57,6 +57,8 @@ services.udev.extraRules = '' # ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness" # ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/%k/brightness" + + ACTION=="add|change", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0012", ATTR{power/wakeup}="disabled" ''; services.fprintd.enable = true; diff --git a/systems/disk-config.nix b/systems/disk-config.nix index 2ab9000..7d0d35e 100644 --- a/systems/disk-config.nix +++ b/systems/disk-config.nix @@ -35,8 +35,8 @@ "compression=zstd" "background_compression=zstd" "discard" - "fsck" - "fix_errors" + # "fsck" + # "fix_errors" ]; mountpoint = "/"; }; diff --git a/users/tao.nix b/users/tao.nix index 95b8d30..73f3de9 100644 --- a/users/tao.nix +++ b/users/tao.nix @@ -6,6 +6,7 @@ ... }: { users.users.tao.packages = with pkgs; [ + usbutils freecad-wayland piper mousai diff --git a/users/tao/starship.toml b/users/tao/starship.toml index 5aa7b25..857c1d0 100644 --- a/users/tao/starship.toml +++ b/users/tao/starship.toml @@ -6,13 +6,12 @@ $username\ [](bg:color_yellow fg:color_orange)\ $directory\ [](fg:color_yellow bg:color_aqua)\ +$jj\ +$git_branch\ +$git_status\ [](fg:color_aqua bg:color_blue)\ $c\ $rust\ -$golang\ -$nodejs\ -$java\ -$kotlin\ $python\ [](fg:color_blue bg:color_bg3)\ $docker_context\ @@ -117,4 +116,54 @@ vimcmd_replace_symbol = '[](bold fg:color_purple)' vimcmd_visual_symbol = '[](bold fg:color_yellow)' [[battery.display]] -thershold = 42 +threshold = 42 + +# custom module for jj status +[custom.jj] +ignore_timeout = true +description = "current jj status" +symbol = "" +when = true +command = ''' +jj root > /dev/null && jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' + separate(" ", + "🥋", + change_id.shortest(4), + bookmarks, + "|", + concat( + if(conflict, "💥"), + if(divergent, "🚧"), + if(hidden, "👻"), + if(immutable, "🔒"), + ), + raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), + raw_escape_sequence("\x1b[1;32m") ++ if(description.first_line().len() == 0, + "(no description set)", + if(description.first_line().substr(0, 29) == description.first_line(), + description.first_line(), + description.first_line().substr(0, 29) ++ "…", + ) + ) ++ raw_escape_sequence("\x1b[0m"), + ) +' +''' + +# disable git modules +[git_state] +disabled = true + +[git_commit] +disabled = true + +[git_metrics] +disabled = true + +[git_branch] +disabled = true + +# re-enable git_branch as long as we're not in a jj repo +[custom.git_branch] +when = true +command = "jj root >/dev/null 2>&1 || starship module git_branch" +description = "Only show git_branch if we're not in a jj repo"