Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions images/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ curl -fsSLo /usr/local/bin/sops \
https://github.com/getsops/sops/releases/download/v3.11.0/sops-v3.11.0.linux.amd64
chmod +x /usr/local/bin/sops

# Install starship prompt
curl -fsSL https://starship.rs/install.sh | sh -s -- --yes

# Cleanup
rm -rf /var/lib/apt/lists/*
EOF
Expand All @@ -70,3 +73,7 @@ RUN userdel -r ubuntu && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

USER coder

# Starship prompt configuration
COPY --chown=coder:coder starship.toml /home/coder/.config/starship.toml
RUN echo 'eval "$(starship init bash)"' >> /home/coder/.bashrc
33 changes: 33 additions & 0 deletions images/base/starship.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
format = """
$directory\
$git_branch\
$git_status\
$nodejs\
$nix_shell\
$cmd_duration\
$line_break\
$character"""

[directory]
truncation_length = 3
truncate_to_repo = true

[git_branch]
format = "[$branch]($style) "

[git_status]
format = '([$all_status$ahead_behind]($style) )'

[nodejs]
format = "[$symbol($version)]($style) "

[nix_shell]
format = "[$symbol$state]($style) "

[cmd_duration]
min_time = 2_000
format = "[$duration]($style) "

[character]
success_symbol = "[>](bold green)"
error_symbol = "[>](bold red)"
42 changes: 42 additions & 0 deletions images/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,43 @@ coder ALL=(ALL) NOPASSWD:ALL
source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc
'';

# Starship prompt configuration
starshipConfig = pkgs.writeTextDir "home/coder/.config/starship.toml" ''
format = """
$directory\
$git_branch\
$git_status\
$nodejs\
$nix_shell\
$cmd_duration\
$line_break\
$character"""

[directory]
truncation_length = 3
truncate_to_repo = true

[git_branch]
format = "[$branch]($style) "

[git_status]
format = '([$all_status$ahead_behind]($style) )'

[nodejs]
format = "[$symbol($version)]($style) "

[nix_shell]
format = "[$symbol$state]($style) "

[cmd_duration]
min_time = 2_000
format = "[$duration]($style) "

[character]
success_symbol = "[>](bold green)"
error_symbol = "[>](bold red)"
'';

# nix-ld: library environment for running unpatched dynamic binaries.
# This bundles common shared libraries so that pre-compiled binaries
# (e.g. from npm, pip wheels, GitHub releases, VS Code Remote, rustup)
Expand Down Expand Up @@ -122,6 +159,9 @@ fi

# Direnv hook
eval "$(direnv hook bash)"

# Starship prompt
eval "$(starship init bash)"
'';

in
Expand Down Expand Up @@ -173,6 +213,7 @@ eval "$(direnv hook bash)"
ripgrep
fd
tmux
starship

# Secrets management
sops
Expand All @@ -195,6 +236,7 @@ eval "$(direnv hook bash)"
nixConf
sudoersConf
direnvrc
starshipConfig
bashrc
nix-ld-libraries
];
Expand Down
Loading