Skip to content

Commit 97d8056

Browse files
committed
updates
1 parent b5da53f commit 97d8056

File tree

3 files changed

+60
-25
lines changed

3 files changed

+60
-25
lines changed

vagrant/github.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# GitHub CLI configuration
2+
{ config, lib, pkgs, username, ... }:
3+
4+
{
5+
# Enable GitHub CLI
6+
programs.gh = {
7+
enable = true;
8+
settings = {
9+
# Default browser for GitHub CLI
10+
# This will use the browser-forward provider that routes to the host
11+
browser = "browser-forward";
12+
13+
# Default protocol when cloning repositories
14+
git_protocol = "ssh";
15+
16+
# Default editor
17+
editor = "nvim";
18+
19+
# Prompt for every command
20+
prompt = "enabled";
21+
};
22+
};
23+
}

vagrant/home.nix

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ config, pkgs, username, lib, ... }:
22

33
{
4-
imports = [ ./zsh.nix ./git.nix ./aws.nix ./ramdisk.nix ];
4+
imports = [ ./zsh.nix ./git.nix ./aws.nix ./ramdisk.nix ./github.nix ];
55

66
# Explicitly tell home-manager not to manage nix.conf
77
xdg.configFile."nix/nix.conf".enable = false;
@@ -10,6 +10,32 @@
1010
home.activation.setupBinDir = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
1111
mkdir -p $HOME/.bin
1212
chmod 755 $HOME/.bin
13+
14+
# Generate aliases file for all executable scripts in .bin
15+
if [ -d "$HOME/.bin" ]; then
16+
# Create a file that will be sourced by zsh
17+
ALIAS_FILE="$HOME/.bin_aliases"
18+
echo "# Auto-generated aliases for scripts in ~/.bin" > "$ALIAS_FILE"
19+
20+
if [ "$(ls -A $HOME/.bin 2>/dev/null)" ]; then
21+
echo "# Generated on $(date)" >> "$ALIAS_FILE"
22+
# Make all scripts executable
23+
chmod +x "$HOME/.bin"/* 2>/dev/null || true
24+
25+
for script in "$HOME/.bin"/*; do
26+
if [ -f "$script" ] && [ -x "$script" ]; then
27+
script_name=$(basename "$script" .sh)
28+
echo "alias $script_name=\"$script\"" >> "$ALIAS_FILE"
29+
fi
30+
done
31+
echo "Auto-generated $(grep -c "^alias" "$ALIAS_FILE") aliases for ~/.bin scripts"
32+
else
33+
echo "# No scripts found in ~/.bin" >> "$ALIAS_FILE"
34+
echo "No scripts found in ~/.bin directory to create aliases for"
35+
fi
36+
37+
chmod 644 "$ALIAS_FILE"
38+
fi
1339
'';
1440

1541
nixpkgs.config.allowUnfree = true;
@@ -30,7 +56,8 @@
3056
# Tools needed by zsh configuration
3157
zoxide
3258
oh-my-posh
33-
eza # Modern ls replacement
59+
eza
60+
gh
3461

3562
# Vagrant-specific development tools
3663
git
@@ -47,10 +74,10 @@
4774
# Terraform tools
4875
terraform-docs
4976
terraform-ls
50-
77+
5178
# Node.js tools
5279
nodePackages.pnpm
53-
80+
5481
tmux
5582
htop
5683
jq

vagrant/zsh.nix

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ in {
1515
enableCompletion = true;
1616
autosuggestion.enable = true;
1717

18+
# Apply shared aliases explicitly
19+
shellAliases = sharedZsh.aliases;
20+
1821
oh-my-zsh = {
1922
enable = true;
2023
plugins = [ "git" ];
@@ -69,27 +72,9 @@ in {
6972
# Custom user binaries directory
7073
export PATH="$HOME/.bin:$PATH"
7174
72-
# Create .bin directory if it doesn't exist
73-
mkdir -p "$HOME/.bin"
74-
75-
# Set execute permissions for all scripts in .bin (only if files exist)
76-
if [ "$(ls -A $HOME/.bin 2>/dev/null)" ]; then
77-
chmod +x "$HOME/.bin"/* 2>/dev/null || true
78-
fi
79-
80-
# Auto-generate aliases for all scripts in .bin
81-
if [ -d "$HOME/.bin" ]; then
82-
# First check if there are any files
83-
if [ "$(ls -A $HOME/.bin 2>/dev/null)" ]; then
84-
for script in "$HOME/.bin"/*; do
85-
if [ -f "$script" ] && [ -x "$script" ]; then
86-
script_name=$(basename "$script" .sh)
87-
alias "$script_name"="$script"
88-
fi
89-
done
90-
else
91-
echo "No files found in ~/.bin directory"
92-
fi
75+
# Source auto-generated aliases if the file exists
76+
if [ -f "$HOME/.bin_aliases" ]; then
77+
source "$HOME/.bin_aliases"
9378
fi
9479
'';
9580
};

0 commit comments

Comments
 (0)