mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
refactor: prepare new modules structure
This commit is contained in:
parent
d25e24c15b
commit
bf82970b9e
65 changed files with 94 additions and 94 deletions
1
modules/programs/comma.nix
Normal file
1
modules/programs/comma.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
_: {programs.nix-index-database.comma.enable = true;}
|
||||
45
modules/programs/core.nix
Normal file
45
modules/programs/core.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{pkgs, ...}: {
|
||||
config = {
|
||||
environment.enableAllTerminfo = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Man pages
|
||||
man-pages
|
||||
man-pages-posix
|
||||
|
||||
# Networking
|
||||
curl
|
||||
wget
|
||||
whois
|
||||
rsync
|
||||
|
||||
# Shell
|
||||
tmux
|
||||
fzf
|
||||
|
||||
# Files
|
||||
file
|
||||
findutils
|
||||
which
|
||||
tree
|
||||
|
||||
# Text processing
|
||||
ripgrep
|
||||
jq
|
||||
gnugrep
|
||||
gawk
|
||||
gnused
|
||||
|
||||
# Monitoring
|
||||
htop
|
||||
btop
|
||||
lshw
|
||||
|
||||
# Archive
|
||||
zip
|
||||
unzip
|
||||
gzip
|
||||
xz
|
||||
];
|
||||
};
|
||||
}
|
||||
11
modules/programs/default.nix
Normal file
11
modules/programs/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
_: {
|
||||
imports = [
|
||||
./fish/default.nix
|
||||
./core.nix
|
||||
./git.nix
|
||||
./just.nix
|
||||
./neovim.nix
|
||||
./zellij.nix
|
||||
./zoxide.nix
|
||||
];
|
||||
}
|
||||
4
modules/programs/fish/autocomplete.fish
Normal file
4
modules/programs/fish/autocomplete.fish
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# ds autocomplete (if its installed)
|
||||
if type -q ds
|
||||
_DS_COMPLETE=fish_source ds | source
|
||||
end
|
||||
44
modules/programs/fish/default.nix
Normal file
44
modules/programs/fish/default.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
username,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
config = {
|
||||
programs.fish.enable = true;
|
||||
users.users.${username}.shell = pkgs.fish;
|
||||
|
||||
# Fish enables generateCaches by default, which causes slow builds
|
||||
documentation.man.generateCaches = false;
|
||||
|
||||
fireproof.home-manager.programs.fish = {
|
||||
enable = true;
|
||||
shellInit = ''
|
||||
|
||||
${builtins.readFile ./theme.fish}
|
||||
${builtins.readFile ./k8s.fish}
|
||||
${builtins.readFile ./autocomplete.fish}
|
||||
|
||||
'';
|
||||
plugins = [
|
||||
{
|
||||
name = "to-fish";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "joehillen";
|
||||
repo = "to-fish";
|
||||
rev = "52b151cfe67c00cb64d80ccc6dae398f20364938";
|
||||
sha256 = "sha256-DfDsU/qY2XdYlkLISIOv02ggHfKEpb+YompNWWjs5/A=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "theme-bobthefish";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "theme-bobthefish";
|
||||
rev = "e3b4d4eafc23516e35f162686f08a42edf844e40";
|
||||
hash = "sha256-cXOYvdn74H4rkMWSC7G6bT4wa9d3/3vRnKed2ixRnuA=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
63
modules/programs/fish/k8s.fish
Normal file
63
modules/programs/fish/k8s.fish
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
set __kube_verbs get describe delete edit
|
||||
set __kube_verbs_short g d rm e
|
||||
set __kube_resource pods deployments services ingresses configmaps daemonsets statefulsets namespace namespace
|
||||
set __kube_resource_short p d s i c ds ss n ns
|
||||
|
||||
function __echo_kubeexec
|
||||
set _flag_namespace (kubectl config view --minify --output 'jsonpath={..namespace}')
|
||||
if test -z "$_flag_namespace"
|
||||
set _flag_namespace default
|
||||
end
|
||||
|
||||
set _flag_pod shop
|
||||
set POD (kubectl get pods --namespace $_flag_namespace 2>/dev/null | grep "^$_flag_pod" | grep Running | head -n1 | awk '{ print $1 }')
|
||||
if test -z "$POD"
|
||||
echo "kubectl exec --namespace $_flag_namespace -it"
|
||||
return
|
||||
end
|
||||
echo "kubectl exec --namespace $_flag_namespace -it $POD --"
|
||||
end
|
||||
|
||||
function __echo_kubemanage
|
||||
set _flag_namespace (kubectl config view --minify --output 'jsonpath={..namespace}')
|
||||
if test -z "$_flag_namespace"
|
||||
set _flag_namespace default
|
||||
end
|
||||
|
||||
set _flag_pod shop
|
||||
set POD (kubectl get pods --namespace $_flag_namespace 2>/dev/null | grep "^$_flag_pod" | grep Running | head -n1 | awk '{ print $1 }')
|
||||
if test -z "$POD"
|
||||
echo "kubectl exec --namespace $_flag_namespace -it"
|
||||
return
|
||||
end
|
||||
echo "kubectl exec --namespace $_flag_namespace -it $POD -- python3 /src/lib/manage.py"
|
||||
end
|
||||
|
||||
if type -q kubectl
|
||||
for verb_index in (seq (count $__kube_verbs))
|
||||
abbr "k$__kube_verbs_short[$verb_index]" "kubectl $__kube_verbs[$verb_index]"
|
||||
for res_index in (seq (count $__kube_resource))
|
||||
abbr "k$__kube_verbs_short[$verb_index]$__kube_resource_short[$res_index]" "kubectl $__kube_verbs[$verb_index] $__kube_resource[$res_index]"
|
||||
end
|
||||
end
|
||||
|
||||
abbr k kubectl
|
||||
abbr kl kubectl logs -f
|
||||
abbr kgl kubectl logs -f
|
||||
abbr kaf kubectl apply -f
|
||||
abbr kr kubectl rollout
|
||||
abbr krs kubectl rollout status
|
||||
abbr krr kubectl rollout restart
|
||||
abbr kt kubectl top
|
||||
abbr ktp kubectl top pods
|
||||
abbr ktn kubectl top nodes
|
||||
abbr kpf kubectl port-forward
|
||||
abbr kfp kubectl port-forward
|
||||
|
||||
alias kns "kubectl config view --minify --output 'jsonpath={..namespace}'"
|
||||
abbr ksns "kubectl config set-context --current --namespace"
|
||||
abbr ksc "kubectl config set-context"
|
||||
|
||||
abbr kexec --function __echo_kubeexec
|
||||
abbr kmanage --function __echo_kubemanage
|
||||
end
|
||||
45
modules/programs/fish/theme.fish
Normal file
45
modules/programs/fish/theme.fish
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Colorscheme: use terminal colors
|
||||
set -U fish_color_normal normal
|
||||
set -U fish_color_command blue
|
||||
set -U fish_color_quote yellow
|
||||
set -U fish_color_redirection cyan --bold
|
||||
set -U fish_color_end green
|
||||
set -U fish_color_error brred
|
||||
set -U fish_color_param cyan
|
||||
set -U fish_color_comment red
|
||||
set -U fish_color_match --background=brblue
|
||||
set -U fish_color_selection white --bold --background=brblack
|
||||
set -U fish_color_search_match bryellow --background=brblack
|
||||
set -U fish_color_history_current --bold
|
||||
set -U fish_color_operator brcyan
|
||||
set -U fish_color_escape brcyan
|
||||
set -U fish_color_cwd green
|
||||
set -U fish_color_cwd_root red
|
||||
set -U fish_color_valid_path --underline
|
||||
set -U fish_color_autosuggestion brblack
|
||||
set -U fish_color_user brgreen
|
||||
set -U fish_color_host normal
|
||||
set -U fish_color_cancel --reverse
|
||||
set -U fish_pager_color_prefix normal --bold --underline
|
||||
set -U fish_pager_color_progress brwhite --background=cyan
|
||||
set -U fish_pager_color_completion normal
|
||||
set -U fish_pager_color_description yellow --italics
|
||||
set -U fish_pager_color_selected_background --reverse
|
||||
set -U fish_pager_color_selected_description
|
||||
set -U fish_pager_color_selected_completion
|
||||
set -U fish_pager_color_secondary_completion
|
||||
set -U fish_pager_color_secondary_background
|
||||
set -U fish_color_keyword
|
||||
set -U fish_pager_color_selected_prefix
|
||||
set -U fish_pager_color_background
|
||||
set -U fish_pager_color_secondary_prefix
|
||||
set -U fish_pager_color_secondary_description
|
||||
set -U fish_color_host_remote
|
||||
set -U fish_color_option
|
||||
|
||||
# Bobthefish config
|
||||
set -g theme_date_timezone Europe/Copenhagen
|
||||
set -g theme_date_format "+%a %H:%M"
|
||||
set -g theme_nerd_fonts yes
|
||||
set -g theme_color_scheme terminal
|
||||
set -g theme_display_user ssh
|
||||
44
modules/programs/git.nix
Normal file
44
modules/programs/git.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
gh
|
||||
pre-commit
|
||||
];
|
||||
|
||||
fireproof.home-manager.programs.git = {
|
||||
enable = true;
|
||||
|
||||
userEmail = "nickolaj@fireproof.website";
|
||||
userName = "Nickolaj Jepsen";
|
||||
|
||||
extraConfig = {
|
||||
gpg.format = "ssh";
|
||||
gpg.ssh.program = "op-ssh-sign";
|
||||
push.autosetupremote = "true";
|
||||
pull.rebase = "true";
|
||||
rebase.autosquash = "true";
|
||||
rebase.autoStash = "true";
|
||||
rerere.enabled = true;
|
||||
init.defaultBranch = "main";
|
||||
};
|
||||
|
||||
delta.enable = true;
|
||||
|
||||
aliases = {
|
||||
"fixup" = "!git log -n 50 --pretty=format:'%h %s' --no-merges | ${lib.getExe pkgs.fzf} | cut -c -7 | xargs -o git commit --fixup";
|
||||
};
|
||||
|
||||
includes = [
|
||||
{
|
||||
condition = "hasconfig:remote.*.url:git@github.com:Digital-Udvikling/**";
|
||||
contents = {
|
||||
user.email = "nij@ao.dk";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
5
modules/programs/just.nix
Normal file
5
modules/programs/just.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{pkgsUnstable, ...}: {
|
||||
environment.systemPackages = [
|
||||
pkgsUnstable.just
|
||||
];
|
||||
}
|
||||
9
modules/programs/neovim.nix
Normal file
9
modules/programs/neovim.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
_: {
|
||||
config = {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
11
modules/programs/zellij.nix
Normal file
11
modules/programs/zellij.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
zellij
|
||||
];
|
||||
|
||||
fireproof.home-manager = {
|
||||
programs.zellij = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
5
modules/programs/zoxide.nix
Normal file
5
modules/programs/zoxide.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
fireproof.home-manager.programs.zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue