finally getting rid of old terminal structure

This commit is contained in:
Ingolf Wagner 2023-06-30 22:10:42 +02:00
parent 7eb8da31e0
commit 4136136d85
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
10 changed files with 131 additions and 103 deletions

View file

@ -225,7 +225,15 @@
];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.root = {
home.stateVersion = "22.11";
imports = [
home-manager-utils.hmModule
#stylix.homeManagerModules.stylix
];
};
home-manager.users.mainUser = {
home.stateVersion = "22.11";
imports = [
doom-emacs-nix.hmModule
home-manager-utils.hmModule

View file

@ -9,6 +9,8 @@ with lib;
./i3.nix
];
# todo slice this configuration file properly
# todo a home-manager folder make no sense
config = mkIf config.components.gui.enable {
# don't run autoload -U compinit && compinit before ~/.zshrc
@ -16,8 +18,6 @@ with lib;
home-manager.users.mainUser = {
home.stateVersion = "22.11";
# a better cat
programs.bat = {
enable = true;

View file

@ -2,15 +2,20 @@
with lib;
{
options.components.terminal = {
enable = lib.mkEnableOption "Terminal configurations";
enable = mkOption {
type = types.bool;
default = true;
};
};
imports = [
./direnv.nix
./git.nix
./hoard.nix
./oh-my-posh.nix
./remote-install.nix
./wtf.nix
./git.nix
./zsh.nix
];
config = mkIf config.components.terminal.enable {

View file

@ -0,0 +1,25 @@
{ pkgs, config, lib, ... }:
with lib;
{
options.components.terminal.oh-my-posh.enable = mkOption {
type = lib.types.bool;
default = config.components.terminal.enable;
};
config = mkIf (config.components.terminal.oh-my-posh.enable) {
home-manager.users =
let
poshConfig = {
programs.oh-my-posh = {
enable = true;
useTheme = "gruvbox";
};
};
in
{
mainUser = poshConfig;
root = poshConfig;
};
};
}

View file

@ -0,0 +1,49 @@
{ pkgs, config, lib, ... }:
with lib;
{
options.components.terminal.zsh.enable = mkOption {
type = lib.types.bool;
default = config.components.terminal.enable;
};
config = mkIf (config.components.terminal.zsh.enable) {
home-manager.users =
let
zshConfig = {
programs.zsh = {
enable = true;
defaultKeymap = "viins";
};
};
in
{
mainUser = zshConfig;
root = zshConfig;
};
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
shellAliases = {
ls = "ls --color=tty";
l = "ls -CFh";
la = "ls -Ah";
ll = "ls -lh";
lt = "ls -lct --reverse";
less = "less -S";
top = "htop";
version = "date '+%Y%m%d%H%M%S'";
vclip = "xclip -selection clipboard";
df = "df -h";
timestamp = "date +%Y%m%d%H%M%S";
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
};
};
};
}

View file

@ -72,7 +72,6 @@
networking.hostName = "chungus";
programs.custom. zsh.enable = true;
users.users.root.shell = pkgs.zsh;
# todo : rename to component.init.ssh

View file

@ -22,8 +22,8 @@
#./programs/ffmpeg.nix
#./programs/git.nix
./programs/shell-bash.nix
./programs/shell-tools.nix
./programs/shell-zsh.nix
#./programs/shell-tools.nix
#./programs/shell-zsh.nix
#./programs/slack.nix
./programs/steam.nix
#./programs/taskwarrior.nix

View file

@ -22,13 +22,13 @@ in
enable = true;
enableCompletion = true;
#autosuggestions.enable = true;
syntaxHighlighting.enable = true;
ohMyZsh = {
custom = "/etc/zshcustom/";
enable = true;
enable = false;
# powerline themes
# ----------------
@ -46,9 +46,10 @@ in
];
};
loginShellInit = ''
export TERM="xterm-256color"
'';
#loginShellInit = ''
# export TERM="xterm-256color"
#'';
shellAliases = {
ls = "ls --color=tty";
l = "ls -CFh";
@ -63,11 +64,11 @@ in
timestamp = "date +%Y%m%d%H%M%S";
nix-search = "nix-env -qaP";
nix-list = ''nix-env -qaP "*" --description'';
nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
nix-list-node = ''nix-env -f "<nixpkgs>" -qaP -A nodePackages'';
nix-list-beam = ''nix-env -f "<nixpkgs>" -qaP -A beamPackages'';
#nix-search = "nix-env -qaP";
#nix-list = ''nix-env -qaP "*" --description'';
#nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
#nix-list-node = ''nix-env -f "<nixpkgs>" -qaP -A nodePackages'';
#nix-list-beam = ''nix-env -f "<nixpkgs>" -qaP -A beamPackages'';
#nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w";
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
@ -75,94 +76,36 @@ in
};
};
#environment.systemPackages = [
# pkgs.nix-index # make nix-index also available to users
#];
# only used to make quick config changes
# --------------------------------------
environment.etc."zshcustom/mainuser.zsh".source =
pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then ''
source ${config.users.users.mainUser.home}/.zshrc
'' else
"# programs.custom.zsh.mainUser not set ");
#environment.etc."zshcustom/mainuser.zsh".source =
# pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then ''
# source ${config.users.users.mainUser.home}/.zshrc
# '' else
# "# programs.custom.zsh.mainUser not set ");
# Theme
# -----
# make sure powerline-fonts is set in `fonts.fonts`
environment.etc."zshcustom/themes/powerlevel9k".source =
pkgs.fetchFromGitHub {
owner = "bhilburn";
repo = "powerlevel9k";
rev = "v0.6.4";
sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5";
};
environment.etc."zshcustom/powerlevel9kpatch.zsh".source =
pkgs.writeText "powerlevel9kpatch.zsh" ''
# this shows all the colors which are available
# ---------------------------------------------
# for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f"
# prompt elements
# ---------------
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
# vi mode
# -------
#POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND="black"
#POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND="blue"
#POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND="black"
#POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND="yellow"
# context
# -------
#POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="green"
#POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="008"
#POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="008"
#POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red"
#POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND="008"
#POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND="red"
# dir
# ---
#POWERLEVEL9K_DIR_HOME_FOREGROUND="black"
#POWERLEVEL9K_DIR_HOME_BACKGROUND="yellow"
#POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="black"
#POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="yellow"
#POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="black"
#POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="green"
# root_indicator
# --------------
#environment.etc."zshcustom/themes/powerlevel9k".source =
# pkgs.fetchFromGitHub {
# owner = "bhilburn";
# repo = "powerlevel9k";
# rev = "v0.6.4";
# sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5";
# };
#environment.etc."zshcustom/powerlevel9kpatch.zsh".source =
# pkgs.writeText "powerlevel9kpatch.zsh" ''
# # prompt elements
# # ---------------
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status)
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
#
# # root_indicator
# # --------------
# POWERLEVEL9K_ROOT_ICON="#"
# POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black"
# POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red"
# background_jobs
# ---------------
POWERLEVEL9K_BACKGROUND_JOBS_ICON=""
# status
# ------
#POWERLEVEL9K_STATUS_OK_BACKGROUND="008"
#POWERLEVEL9K_STATUS_ERROR_BACKGROUND="008"
# time
# ----
#POWERLEVEL9K_TIME_FOREGROUND="008"
#POWERLEVEL9K_TIME_BACKGROUND="006"
# jail indicator
# --------------
POWERLEVEL9K_CUSTOM_JAIL="[ -z $JAIL ] || echo $JAIL"
POWERLEVEL9K_CUSTOM_JAIL_BACKGROUND="red"
POWERLEVEL9K_CUSTOM_JAIL_FOREGROUND="black"
'';
# '';
};
}

View file

@ -33,7 +33,7 @@
# -------------------
programs.custom = {
bash.enable = true;
zsh.enable = true;
#zsh.enable = true;
};
# This value determines the NixOS release with which your system is to be

View file

@ -33,7 +33,6 @@
colorTheme = "light";
};
shellTools.enable = true;
curlScripts.enable = true;
citate.enable = true;
vim.enable = true;