aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-23 18:01:02 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-23 18:02:33 +0200
commit610db1afbe513669f7950adfd63496d9a0a32c81 (patch)
tree6dfcdc70b59ac5ad543858c897a00aba4892d18d /modules
parent{modules/common,hosts/apzu}: Only enable power management for apzu (diff)
downloadnixos-config-610db1afbe513669f7950adfd63496d9a0a32c81.zip
modules/starship: Migrate to `by-name`
Diffstat (limited to 'modules')
-rw-r--r--modules/by-name/st/starship/module.nix156
-rw-r--r--modules/home.legacy/conf/default.nix1
-rw-r--r--modules/home.legacy/conf/starship/default.nix143
3 files changed, 156 insertions, 144 deletions
diff --git a/modules/by-name/st/starship/module.nix b/modules/by-name/st/starship/module.nix
new file mode 100644
index 00000000..c649381f
--- /dev/null
+++ b/modules/by-name/st/starship/module.nix
@@ -0,0 +1,156 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{
+ lib,
+ pkgs,
+ config,
+ libraries,
+ ...
+}: let
+ cfg = config.soispha.programs.starship;
+in {
+ options.soispha.programs.starship = {
+ enable = libraries.base.options.mkEnable "starship";
+
+ showBattery = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = "Whether to show the current battery percentage in the prompt";
+ };
+ };
+
+ config.home-manager.users.soispha = lib.mkIf cfg.enable {
+ programs.starship = {
+ enable = true;
+ enableZshIntegration = true;
+
+ settings = {
+ add_newline = false;
+ format = lib.concatStrings [
+ "$directory"
+ "$username"
+ "\${custom.in_nixos_shell}"
+ "$cmd_duration"
+ "$status"
+ "$character"
+ ];
+
+ right_format = lib.concatStrings (
+ [
+ "$git_metrics"
+ "$git_branch"
+ "$git_status"
+ "$git_commit"
+ "$git_state"
+ "$time"
+ ]
+ ++ lib.optionals cfg.showBattery ["$battery"]
+ );
+
+ scan_timeout = 20;
+
+ character = {
+ # success_symbol = "[❯](bold blue)";
+ # a = "⬢";
+ success_symbol = "[](bold blue)";
+ error_symbol = "[](bold red)";
+ };
+
+ status = {
+ disabled = false;
+ format = "([($common_meaning )($status)( $signal_name)]($style) )";
+ };
+
+ time = {
+ disabled = false;
+ format = "[\\[$time\\]]($style)";
+ };
+
+ username = {
+ format = "as [$user]($style) ";
+ };
+
+ git_branch = {
+ format = "[($symbol$branch(:$remote_branch) )]($style)";
+ };
+ git_status = {
+ disabled = true;
+ format = "([\\[$ahead_behind\\]]($style) )";
+ ahead = "⇡$count";
+ diverged = "⇕⇡$ahead_count⇣$behind_count";
+ behind = "⇣$count";
+ };
+ git_metrics = {
+ disabled = true;
+ ignore_submodules = true;
+ };
+ git_state = {
+ format = "[($state( $progress_current of $progress_total))]($style) ";
+ rebase = "[rebasing](bold magenta)";
+ merge = "[merging](bold yellow)";
+ revert = "[reverting](bold blue)";
+ cherry_pick = "[picking](bold red)";
+ bisect = "[bisecting](bold red)";
+ am = "[applying](bold green)";
+ am_or_rebase = "[applying/rebasing](bold yellow)";
+ };
+ git_commit = {
+ disabled = true;
+ tag_disabled = false;
+ tag_symbol = "v";
+ format = "[(\\[$tag\\] )]($style)";
+ };
+
+ directory = {
+ truncate_to_repo = true;
+ read_only = " 󰌾";
+ before_repo_root_style = "black bold dimmed";
+ };
+
+ cmd_duration = {
+ min_time = 2000; # Milliseconds
+ style = "bold white";
+ };
+
+ custom = {
+ in_nixos_shell = {
+ symbol = "VM ";
+ style = "bold white";
+ when = ''test "$IN_NIXOS_SHELL" = true '';
+ shell = ["${lib.getExe pkgs.dash}"];
+ description = "Show if a shell is run in a vm";
+ };
+ };
+
+ battery = {
+ # '󰁹 '
+ # '󰂄 '
+ # '󰂃 '
+ # '󰁽 '
+ # '󰂎 '
+ display = [
+ {
+ threshold = 10;
+ style = "bold red";
+ }
+ {
+ threshold = 30;
+ style = "bold blue";
+ }
+ {
+ threshold = 50;
+ style = "bold green";
+ }
+ ];
+ };
+ };
+ };
+ };
+}
diff --git a/modules/home.legacy/conf/default.nix b/modules/home.legacy/conf/default.nix
index 9af67102..cedcf71a 100644
--- a/modules/home.legacy/conf/default.nix
+++ b/modules/home.legacy/conf/default.nix
@@ -22,6 +22,5 @@
./npm
./prusa_slicer
./python
- ./starship
];
}
diff --git a/modules/home.legacy/conf/starship/default.nix b/modules/home.legacy/conf/starship/default.nix
deleted file mode 100644
index c34beb05..00000000
--- a/modules/home.legacy/conf/starship/default.nix
+++ /dev/null
@@ -1,143 +0,0 @@
-# nixos-config - My current NixOS configuration
-#
-# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-# SPDX-License-Identifier: GPL-3.0-or-later
-#
-# This file is part of my nixos-config.
-#
-# You should have received a copy of the License along with this program.
-# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-{
- lib,
- nixosConfig,
- pkgs,
- ...
-}: {
- programs.starship = {
- enable = true;
- enableZshIntegration = true;
-
- settings = {
- add_newline = false;
- format = lib.concatStrings [
- "$directory"
- "$username"
- "\${custom.in_nixos_shell}"
- "$cmd_duration"
- "$status"
- "$character"
- ];
-
- right_format = lib.concatStrings (
- [
- "$git_metrics"
- "$git_branch"
- "$git_status"
- "$git_commit"
- "$git_state"
- "$time"
- ]
- ++ lib.optional
- nixosConfig.soispha.laptop.enable
- "$battery"
- );
-
- scan_timeout = 20;
-
- character = {
- # success_symbol = "[❯](bold blue)";
- # a = "⬢";
- success_symbol = "[](bold blue)";
- error_symbol = "[](bold red)";
- };
-
- status = {
- disabled = false;
- format = "([($common_meaning )($status)( $signal_name)]($style) )";
- };
-
- time = {
- disabled = false;
- format = "[\\[$time\\]]($style)";
- };
-
- username = {
- format = "as [$user]($style) ";
- };
-
- git_branch = {
- format = "[($symbol$branch(:$remote_branch) )]($style)";
- };
- git_status = {
- disabled = true;
- format = "([\\[$ahead_behind\\]]($style) )";
- ahead = "⇡$count";
- diverged = "⇕⇡$ahead_count⇣$behind_count";
- behind = "⇣$count";
- };
- git_metrics = {
- disabled = true;
- ignore_submodules = true;
- };
- git_state = {
- format = "[($state( $progress_current of $progress_total))]($style) ";
- rebase = "[rebasing](bold magenta)";
- merge = "[merging](bold yellow)";
- revert = "[reverting](bold blue)";
- cherry_pick = "[picking](bold red)";
- bisect = "[bisecting](bold red)";
- am = "[applying](bold green)";
- am_or_rebase = "[applying/rebasing](bold yellow)";
- };
- git_commit = {
- disabled = true;
- tag_disabled = false;
- tag_symbol = "v";
- format = "[(\\[$tag\\] )]($style)";
- };
-
- directory = {
- truncate_to_repo = true;
- read_only = " 󰌾";
- before_repo_root_style = "black bold dimmed";
- };
-
- cmd_duration = {
- min_time = 2000; # Milliseconds
- style = "bold white";
- };
-
- custom = {
- in_nixos_shell = {
- symbol = "VM ";
- style = "bold white";
- when = ''test "$IN_NIXOS_SHELL" = true '';
- shell = ["${lib.getExe pkgs.dash}"];
- description = "Show if a shell is run in a vm";
- };
- };
-
- battery = {
- # '󰁹 '
- # '󰂄 '
- # '󰂃 '
- # '󰁽 '
- # '󰂎 '
- display = [
- {
- threshold = 10;
- style = "bold red";
- }
- {
- threshold = 30;
- style = "bold blue";
- }
- {
- threshold = 50;
- style = "bold green";
- }
- ];
- };
- };
- };
-}