Skip to content
Draft
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
5 changes: 4 additions & 1 deletion docker-arm/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ in
};

programs = util.programs // {
bash.enable = true; # Necessary for aliases and Starship to work.
bash = {
enable = true; # Necessary for aliases and Starship to work.
initExtra = util.shellInit;
};
};

assertions = util.assertions;
Expand Down
5 changes: 4 additions & 1 deletion docker-x86/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ in
};

programs = util.programs // {
bash.enable = true; # Necessary for aliases and Starship to work.
bash = {
enable = true; # Necessary for aliases and Starship to work.
initExtra = util.shellInit;
};
};

assertions = util.assertions;
Expand Down
5 changes: 4 additions & 1 deletion macos/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ in
};

programs = util.programs // {
zsh.enable = true; # Necessary for aliases and Starship to work.
zsh = {
enable = true; # Necessary for aliases and Starship to work.
initContent = util.shellInit;
};
};

assertions = util.assertions;
Expand Down
5 changes: 4 additions & 1 deletion nixos/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ in
};

programs = util.programs // {
bash.enable = true; # Necessary for aliases and Starship to work.
bash = {
enable = true; # Necessary for aliases and Starship to work.
initExtra = util.shellInit;
};

firefox = {
enable = true;
Expand Down
5 changes: 4 additions & 1 deletion tart/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ in
};

programs = util.programs // {
zsh.enable = true; # Necessary for aliases and Starship to work.
zsh = {
enable = true; # Necessary for aliases and Starship to work.
initContent = util.shellInit;
};
};

assertions = util.assertions;
Expand Down
17 changes: 17 additions & 0 deletions util.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ rec {
".gitconfig" = symlink ".gitconfig";
};

shellInit = ''
ghcd() {
local regex='^((https://)?github\.com/)?([A-Za-z0-9._-]+/[A-Za-z0-9._-]+)'
local repo
repo=$(printf '%s' "''${1-}" | sed -nE "s|''${regex}.*|\3|p")
if [ -z "$repo" ]; then
printf 'must match this regex: %s\n' "$regex" >&2
return 1
fi
local dir="$HOME/github/$repo"
if [ ! -e "$dir" ]; then
git clone --recurse-submodules "https://github.com/$repo.git" "$dir" || return $?
fi
cd "$dir"
}
'';

programs = {
eza.enable = true;

Expand Down