Add go devshell
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -102,6 +102,7 @@
|
|||||||
{
|
{
|
||||||
devShells = {
|
devShells = {
|
||||||
bun = import ./hosts/common/shells/bun { inherit pkgs; };
|
bun = import ./hosts/common/shells/bun { inherit pkgs; };
|
||||||
|
go = import ./hosts/common/shells/go { inherit pkgs; };
|
||||||
nix = import ./hosts/common/shells/nix { inherit pkgs; };
|
nix = import ./hosts/common/shells/nix { inherit pkgs; };
|
||||||
nodejs = import ./hosts/common/shells/nodejs { inherit pkgs; };
|
nodejs = import ./hosts/common/shells/nodejs { inherit pkgs; };
|
||||||
python = import ./hosts/common/shells/python { inherit pkgs; };
|
python = import ./hosts/common/shells/python { inherit pkgs; };
|
||||||
|
@@ -10,11 +10,6 @@
|
|||||||
kubectl
|
kubectl
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.zsh.initExtra = ''
|
programs.zsh.p10k.extraRightPromptElements = [ "kubecontext" ];
|
||||||
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
|
|
||||||
kubecontext
|
|
||||||
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -4,17 +4,21 @@
|
|||||||
}:
|
}:
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
home-manager.users.${user}.programs.neovim = {
|
home-manager.users.${user}.programs = {
|
||||||
enable = true;
|
neovim = {
|
||||||
defaultEditor = true;
|
enable = true;
|
||||||
viAlias = true;
|
defaultEditor = true;
|
||||||
vimAlias = true;
|
viAlias = true;
|
||||||
vimdiffAlias = true;
|
vimAlias = true;
|
||||||
extraConfig = ''
|
vimdiffAlias = true;
|
||||||
set tabstop=2
|
extraConfig = ''
|
||||||
set shiftwidth=2
|
set tabstop=2
|
||||||
set expandtab
|
set shiftwidth=2
|
||||||
set smartindent
|
set expandtab
|
||||||
'';
|
set smartindent
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
zsh.p10k.extraRightPromptElements = [ "vim_shell" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -19,14 +19,24 @@
|
|||||||
initExtra = ''
|
initExtra = ''
|
||||||
nix-direnv() {
|
nix-direnv() {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: nix-direnv <shell>"
|
echo "use flake" > .envrc
|
||||||
return 1
|
else
|
||||||
|
echo "use flake self#$1" > .envrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git rev-parse --is-inside-work-tree &> /dev/null && ! grep -q "^\.envrc$" .gitignore .git/info/exclude; then
|
||||||
|
echo "Do you want to hide the .envrc file from git? (y/N)"
|
||||||
|
read -r answer
|
||||||
|
if [[ "$answer" =~ ^[Yy]$ ]]; then
|
||||||
|
echo ".envrc" >> .git/info/exclude
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "use $1" > .envrc
|
|
||||||
direnv allow
|
direnv allow
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
p10k.extraRightPromptElements = [ "direnv" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -6,12 +6,16 @@
|
|||||||
{
|
{
|
||||||
environment.persistence."/cache"."${home}/.cache/ranger" = { };
|
environment.persistence."/cache"."${home}/.cache/ranger" = { };
|
||||||
|
|
||||||
home-manager.users.${user}.programs.ranger = {
|
home-manager.users.${user}.programs = {
|
||||||
enable = true;
|
ranger = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
preview_images = true;
|
preview_images = true;
|
||||||
preview_images_method = "kitty";
|
preview_images_method = "kitty";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zsh.p10k.extraRightPromptElements = [ "ranger" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -22,9 +22,6 @@
|
|||||||
status
|
status
|
||||||
command_execution_time
|
command_execution_time
|
||||||
background_jobs
|
background_jobs
|
||||||
direnv
|
|
||||||
ranger
|
|
||||||
vim_shell
|
|
||||||
nix_shell
|
nix_shell
|
||||||
per_directory_history
|
per_directory_history
|
||||||
"${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
|
"${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
|
||||||
@@ -228,6 +225,12 @@
|
|||||||
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134
|
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134
|
||||||
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
|
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
|
||||||
|
|
||||||
|
################[ goenv: go environment (https://github.com/syndbg/goenv) ]################
|
||||||
|
typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37
|
||||||
|
typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global)
|
||||||
|
typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=true
|
||||||
|
typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true
|
||||||
|
|
||||||
##################################[ context: user@hostname ]##################################
|
##################################[ context: user@hostname ]##################################
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
|
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180
|
typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
|
imports = [ ./options.nix ];
|
||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dotDir = ".config/zsh";
|
dotDir = ".config/zsh";
|
||||||
|
25
hosts/common/configs/user/console/zsh/options.nix
Normal file
25
hosts/common/configs/user/console/zsh/options.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.programs.zsh;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.zsh =
|
||||||
|
with lib;
|
||||||
|
with types;
|
||||||
|
{
|
||||||
|
p10k.extraRightPromptElements = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [ ];
|
||||||
|
description = "Extra elements to display on the right side of the prompt.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.programs.zsh =
|
||||||
|
with lib;
|
||||||
|
with cfg;
|
||||||
|
{
|
||||||
|
initExtra = ''
|
||||||
|
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(${strings.concatStringsSep " " cfg.p10k.extraRightPromptElements})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
@@ -116,6 +116,7 @@ in
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./langs/c
|
./langs/c
|
||||||
|
./langs/go
|
||||||
./langs/lua
|
./langs/lua
|
||||||
./langs/nix
|
./langs/nix
|
||||||
./langs/python
|
./langs/python
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
programs.vscode.extensions =
|
||||||
|
with pkgs;
|
||||||
|
with vscode-extensions;
|
||||||
|
[
|
||||||
|
golang.go
|
||||||
|
];
|
||||||
|
}
|
22
hosts/common/shells/go/default.nix
Normal file
22
hosts/common/shells/go/default.nix
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
go-tools
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
|
||||||
|
goenv
|
||||||
|
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if git rev-parse --is-inside-work-tree &> /dev/null && ! grep -q "^\.go$" .gitignore .git/info/exclude; then
|
||||||
|
echo ".go" >> .git/info/exclude
|
||||||
|
export GOPATH="$(git rev-parse --show-toplevel)/.go"
|
||||||
|
else
|
||||||
|
export GOPATH="$(pwd)/.go"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
@@ -125,7 +125,7 @@ in
|
|||||||
hostname = "github.com";
|
hostname = "github.com";
|
||||||
user = "git";
|
user = "git";
|
||||||
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
||||||
extraOptions.StrictHostKeyChecking = "accept-new";
|
extraOptions.StrictHostKeyChecking = "no";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -144,7 +144,7 @@ in
|
|||||||
hostname = "github.com";
|
hostname = "github.com";
|
||||||
user = "git";
|
user = "git";
|
||||||
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
||||||
extraOptions.StrictHostKeyChecking = "accept-new";
|
extraOptions.StrictHostKeyChecking = "no";
|
||||||
};
|
};
|
||||||
|
|
||||||
# SAS
|
# SAS
|
||||||
@@ -152,13 +152,14 @@ in
|
|||||||
hostname = "github.com";
|
hostname = "github.com";
|
||||||
user = "git";
|
user = "git";
|
||||||
identityFile = "${home}/.ssh/ssh_git_sas_ed25519_key";
|
identityFile = "${home}/.ssh/ssh_git_sas_ed25519_key";
|
||||||
extraOptions.StrictHostKeyChecking = "accept-new";
|
extraOptions.StrictHostKeyChecking = "no";
|
||||||
};
|
};
|
||||||
|
|
||||||
"gitlab.sas.com" = {
|
"gitlab.sas.com" = {
|
||||||
hostname = "gitlab.sas.com";
|
hostname = "gitlab.sas.com";
|
||||||
user = "git";
|
user = "git";
|
||||||
identityFile = "${home}/.ssh/ssh_git_sas_ed25519_key";
|
identityFile = "${home}/.ssh/ssh_git_sas_ed25519_key";
|
||||||
extraOptions.StrictHostKeyChecking = "accept-new";
|
extraOptions.StrictHostKeyChecking = "no";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ in
|
|||||||
hostname = "github.com";
|
hostname = "github.com";
|
||||||
user = "git";
|
user = "git";
|
||||||
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
identityFile = "${home}/.ssh/ssh_git_personal_ed25519_key";
|
||||||
extraOptions.StrictHostKeyChecking = "accept-new";
|
extraOptions.StrictHostKeyChecking = "no";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user