From 20f48dfb270bf114de90c8f3b12f6bccfb6f953c Mon Sep 17 00:00:00 2001 From: Truxnell <9149206+truxnell@users.noreply.github.com> Date: Sun, 31 Mar 2024 15:02:26 +1100 Subject: [PATCH] feat: add wezterm, fish and starship --- .taskfiles/nix/Taskfile.yaml | 1 + nixos/home/modules/default.nix | 12 ++ nixos/home/modules/shell/default.nix | 4 +- nixos/home/modules/shell/fish/default.nix | 18 +-- nixos/home/modules/shell/starship/default.nix | 115 ++++++++++++++++++ nixos/home/modules/shell/wezterm/default.nix | 24 ++++ nixos/home/truxnell/default.nix | 41 ++++--- nixos/home/truxnell/workstation.nix | 1 + 8 files changed, 189 insertions(+), 27 deletions(-) create mode 100644 nixos/home/modules/shell/starship/default.nix create mode 100644 nixos/home/modules/shell/wezterm/default.nix diff --git a/.taskfiles/nix/Taskfile.yaml b/.taskfiles/nix/Taskfile.yaml index 7f382c82..96271fbe 100644 --- a/.taskfiles/nix/Taskfile.yaml +++ b/.taskfiles/nix/Taskfile.yaml @@ -15,6 +15,7 @@ tasks: cmds: - echo "This will switch your config." - task: .prompt_to_continue + - git add . - sudo nixos-rebuild switch --flake "{{.ROOT_DIR}}/#{{.host}}" --impure preconditions: - sh: which nix diff --git a/nixos/home/modules/default.nix b/nixos/home/modules/default.nix index e31bb52a..020dc701 100644 --- a/nixos/home/modules/default.nix +++ b/nixos/home/modules/default.nix @@ -1,11 +1,23 @@ { inputs , config +, lib , ... }: { imports = [ ./shell ]; + options.myHome.username = lib.mkOption { + type = lib.types.str; + description = "users username"; + default = "truxnell"; + }; + options.myHome.homeDirectory = lib.mkOption { + type = lib.types.str; + description = "homedir"; + default = "truxnell"; + }; + # Home-manager defaults config = { home.stateVersion = "23.11"; diff --git a/nixos/home/modules/shell/default.nix b/nixos/home/modules/shell/default.nix index 32441d87..4c1112fa 100644 --- a/nixos/home/modules/shell/default.nix +++ b/nixos/home/modules/shell/default.nix @@ -1,5 +1,7 @@ { ... }: { imports = [ - # ./fish + ./fish + ./starship + ./wezterm ]; } diff --git a/nixos/home/modules/shell/fish/default.nix b/nixos/home/modules/shell/fish/default.nix index 827325b0..cbb6d241 100644 --- a/nixos/home/modules/shell/fish/default.nix +++ b/nixos/home/modules/shell/fish/default.nix @@ -4,7 +4,7 @@ , ... }: with lib; let - inherit (config.home) username homeDirectory; + inherit (config.myHome) username homeDirectory; cfg = config.myHome.shell.fish; in { @@ -110,14 +110,14 @@ in programs.nix-index.enable = true; - programs.fish = { - functions = { - agent = { - description = "Start SSH agent"; - body = builtins.readFile ./functions/agent.fish; - }; - }; - }; + # programs.fish = { + # functions = { + # agent = { + # description = "Start SSH agent"; + # body = builtins.readFile ./functions/agent.fish; + # }; + # }; + # }; }) ]; } diff --git a/nixos/home/modules/shell/starship/default.nix b/nixos/home/modules/shell/starship/default.nix new file mode 100644 index 00000000..ad077180 --- /dev/null +++ b/nixos/home/modules/shell/starship/default.nix @@ -0,0 +1,115 @@ +{ lib +, config +, ... +}: +with lib; let + cfg = config.myHome.shell.starship; +in +{ + options.myHome.shell.starship = { enable = mkEnableOption "starship"; }; + + config = mkIf cfg.enable { + programs.starship = { + enable = true; + settings = { + add_newline = false; + command_timeout = 1000; + format = lib.concatStrings [ + "$username" + "$hostname" + "$directory" + "$git_branch" + "$git_status" + "$\{custom.direnv\}" + "$fill" + "$python" + "$status" + "$cmd_duration" + "$line_break" + "$character" + ]; + + username = { + style_user = "yellow"; + style_root = "red"; + format = "[$user]($style)"; + show_always = false; + }; + + hostname = { + ssh_only = true; + format = "[@$hostname]($style) in "; + style = "green"; + }; + + directory = { + truncation_length = 3; + format = "[$path]($style)[$read_only]($read_only_style) "; + style = "blue"; + read_only = " "; + truncation_symbol = "../"; + truncate_to_repo = true; + fish_style_pwd_dir_length = 1; + }; + + git_branch = { + format = "on [$symbol$branch]($style) "; + style = "purple"; + symbol = " "; + }; + + git_status = { + format = "([$all_status$ahead_behind]($style) )"; + style = "purple"; + conflicted = " "; + ahead = " "; + behind = " "; + diverged = "󰆗 "; + up_to_date = " "; + untracked = " "; + stashed = " "; + modified = " "; + staged = " "; + renamed = " "; + deleted = " "; + }; + + fill = { + symbol = " "; + }; + + python = { + format = "[\${symbol}\${pyenv_prefix}(\${version} )(\($virtualenv\) )]($style)"; + symbol = "🐍 "; + }; + + status = { + disabled = false; + format = "[$symbol]($style) "; + symbol = " "; + success_symbol = " "; + style = "red"; + }; + + cmd_duration = { + min_time = 2000; + format = "took [$duration]($style) "; + style = "yellow"; + }; + + character = { + success_symbol = "[](green)"; + error_symbol = "[](green)"; + vicmd_symbol = "[](purple)"; + }; + + custom.direnv = { + format = "[$symbol]($style)"; + symbol = " "; + style = "blue"; + when = "env | grep -E '^DIRENV_FILE='"; + }; + }; + }; + }; +} diff --git a/nixos/home/modules/shell/wezterm/default.nix b/nixos/home/modules/shell/wezterm/default.nix new file mode 100644 index 00000000..8d2e64a3 --- /dev/null +++ b/nixos/home/modules/shell/wezterm/default.nix @@ -0,0 +1,24 @@ +{ config +, pkgs +, lib +, ... +}: +with lib; let + cfg = config.myHome.shell.wezterm; +in +{ + options.myHome.shell.wezterm = { + enable = mkEnableOption "wezterm"; + configPath = mkOption { + type = types.str; + }; + }; + + # Temporary make .config/wezterm/wezterm.lua link to the local copy + config = mkIf cfg.enable { + # xdg.configFile."wezterm/wezterm.lua".source = config.lib.file.mkOutOfStoreSymlink cfg.configPath; + programs.wezterm = { + enable = true; + }; + }; +} diff --git a/nixos/home/truxnell/default.nix b/nixos/home/truxnell/default.nix index 4c5fa089..5f530c86 100644 --- a/nixos/home/truxnell/default.nix +++ b/nixos/home/truxnell/default.nix @@ -6,30 +6,37 @@ with config; ../modules ]; - # services.gpg-agent.pinentryPackage = pkgs.pinentry-qt; - systemd.user.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - ZDOTDIR = "/home/pinpox/.config/zsh"; - }; - - home = { - # Install these packages for my user - packages = with pkgs; [ - eza - htop - unzip - ]; + config = { + myHome.username = "truxnell"; + myHome.homeDirectory = "/home/truxnell/"; + myHome.shell.starship.enable = true; + myHome.shell.fish.enable = true; + myHome.shell.wezterm.enable = true; - sessionVariables = { - # Workaround for alacritty (breaks wezterm and other apps!) - # LIBGL_ALWAYS_SOFTWARE = "1"; + # services.gpg-agent.pinentryPackage = pkgs.pinentry-qt; + systemd.user.sessionVariables = { EDITOR = "nvim"; VISUAL = "nvim"; ZDOTDIR = "/home/pinpox/.config/zsh"; }; + home = { + # Install these packages for my user + packages = with pkgs; [ + eza + htop + unzip + ]; + sessionVariables = { + # Workaround for alacritty (breaks wezterm and other apps!) + # LIBGL_ALWAYS_SOFTWARE = "1"; + EDITOR = "nvim"; + VISUAL = "nvim"; + ZDOTDIR = "/home/pinpox/.config/zsh"; + }; + + }; }; } diff --git a/nixos/home/truxnell/workstation.nix b/nixos/home/truxnell/workstation.nix index f3e526aa..a915b511 100644 --- a/nixos/home/truxnell/workstation.nix +++ b/nixos/home/truxnell/workstation.nix @@ -9,6 +9,7 @@ with config; steam spotify brightnessctl + prusaslicer bat dbus