root version of jsl-zsh
This commit is contained in:
+31
-18
@@ -1,25 +1,38 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.lxc = { pkgs, lib, ...}: {
|
||||
imports = with inputs.self.modules.nixos; [
|
||||
({ modulesPath, ... }: { imports = [ "${modulesPath}/virtualisation/proxmox-lxc.nix" ]; })
|
||||
];
|
||||
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
|
||||
system.stateVersion = "25.11";
|
||||
time.timeZone = "US/Central";
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
environment.systemPackages = with pkgs; [ git zsh ];
|
||||
flake.modules.nixos.lxc = { pkgs, lib, ...}:
|
||||
let
|
||||
selfPackages = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
rootShellPath = lib.getExe' selfPackages.jsl-zsh-tty "jsl-zsh-tty";
|
||||
in
|
||||
{
|
||||
imports = with inputs.self.modules.nixos; [
|
||||
({ modulesPath, ... }: { imports = [ "${modulesPath}/virtualisation/proxmox-lxc.nix" ]; })
|
||||
];
|
||||
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
|
||||
system.stateVersion = "25.11";
|
||||
time.timeZone = "US/Central";
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
zsh
|
||||
selfPackages.jsl-zsh-tty
|
||||
];
|
||||
environment.shells = lib.mkAfter [
|
||||
rootShellPath
|
||||
];
|
||||
users.users.root.shell = lib.mkForce rootShellPath;
|
||||
|
||||
# security.sudo-rs.enable = true;
|
||||
programs.nix-ld.enable = true;
|
||||
nix.optimise.automatic = true;
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
# security.sudo-rs.enable = true;
|
||||
programs.nix-ld.enable = true;
|
||||
nix.optimise.automatic = true;
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
programs.bash.enable = true;
|
||||
};
|
||||
programs.bash.enable = true;
|
||||
};
|
||||
|
||||
# Generic bootstrapping lxc, use a specific host file for more
|
||||
flake.nixosConfigurations.lxc = inputs.nixpkgs.lib.nixosSystem {
|
||||
|
||||
@@ -50,5 +50,65 @@
|
||||
'';
|
||||
};
|
||||
}).wrapper;
|
||||
|
||||
packages.starship-ascii = (inputs.wrappers.wrapperModules.starship.apply {
|
||||
inherit pkgs;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
|
||||
format = "$username$hostname$directory$git_branch$git_status$cmd_duration$line_break$character";
|
||||
|
||||
username = {
|
||||
show_always = true;
|
||||
format = "[$user]($style)";
|
||||
style_user = "bold blue";
|
||||
style_root = "bold red";
|
||||
};
|
||||
|
||||
hostname = {
|
||||
disabled = false;
|
||||
ssh_only = false;
|
||||
format = "[@$hostname]($style) ";
|
||||
style = "bold blue";
|
||||
};
|
||||
|
||||
directory = {
|
||||
truncation_length = 3;
|
||||
truncate_to_repo = true;
|
||||
format = "[ in $path]($style) ";
|
||||
style = "bold cyan";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
symbol = "on ";
|
||||
format = "[$symbol$branch]($style) ";
|
||||
style = "bold yellow";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
format = "([$all_status$ahead_behind]($style) )";
|
||||
style = "bold red";
|
||||
ahead = "ahead:$count ";
|
||||
behind = "behind:$count ";
|
||||
diverged = "diverged:$ahead_count/$behind_count ";
|
||||
up_to_date = "";
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
min_time = 2000;
|
||||
show_notifications = false;
|
||||
format = "took [$duration]($style) ";
|
||||
style = "bold green";
|
||||
};
|
||||
|
||||
line_break.disabled = false;
|
||||
|
||||
character = {
|
||||
success_symbol = "[\\$](bold green) ";
|
||||
error_symbol = "[\\$](bold red) ";
|
||||
vicmd_symbol = "[\\$](bold yellow) ";
|
||||
};
|
||||
};
|
||||
}).wrapper;
|
||||
};
|
||||
}
|
||||
+109
-90
@@ -23,97 +23,116 @@ let
|
||||
in
|
||||
{
|
||||
flake.modules = {
|
||||
nixos.zsh = { pkgs, ... }: {
|
||||
users.users."${username}".shell = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh;
|
||||
programs.zsh.enable = true;
|
||||
};
|
||||
nixos.zsh = { pkgs, ... }:
|
||||
let
|
||||
selfPackages = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
users.users."${username}".shell = selfPackages.jsl-zsh;
|
||||
programs.zsh.enable = true;
|
||||
};
|
||||
|
||||
homeManager.zsh = { pkgs, config, ... }: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh;
|
||||
dotDir = "${config.xdg.configHome}/zsh";
|
||||
homeManager.zsh = { pkgs, config, ... }:
|
||||
let
|
||||
selfPackages = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
package = selfPackages.jsl-zsh;
|
||||
dotDir = "${config.xdg.configHome}/zsh";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = { config, self', pkgs, lib, ... }:
|
||||
let
|
||||
ignorePatterns = [
|
||||
"ls" "eza" "history" "clear"
|
||||
];
|
||||
integrationPackages = with pkgs; [
|
||||
fzf
|
||||
zoxide
|
||||
];
|
||||
extraToolPackages = with pkgs; [
|
||||
lazygit
|
||||
lazydocker
|
||||
devenv
|
||||
self'.packages.shell-tools
|
||||
self'.packages.neovim-min
|
||||
];
|
||||
aliasStr = lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") {
|
||||
ls = "eza";
|
||||
ll = "eza -l";
|
||||
la = "eza -a";
|
||||
lt = "eza --tree";
|
||||
lla = "eza -la";
|
||||
ds = "gdu -i /snap /";
|
||||
ld = "lazydocker";
|
||||
});
|
||||
|
||||
mkJslZsh = { binName, starshipPackage }:
|
||||
let
|
||||
loginBootstrapPath = lib.makeBinPath (integrationPackages ++ [ starshipPackage ] ++ extraToolPackages);
|
||||
in
|
||||
(inputs.wrappers.wrapperModules.zsh.apply {
|
||||
inherit pkgs binName;
|
||||
env = {
|
||||
LANG = "en_US.UTF-8";
|
||||
COLORTERM = "truecolor";
|
||||
DEVENV_SHELL_TYPE = "zsh";
|
||||
};
|
||||
settings = {
|
||||
completion = {
|
||||
enable = true;
|
||||
extraCompletions = true;
|
||||
caseInsensitive = true;
|
||||
fuzzySearch = true;
|
||||
};
|
||||
autoSuggestions = {
|
||||
enable = true;
|
||||
strategy = [ "history" "completion" ];
|
||||
};
|
||||
history = {
|
||||
append = true;
|
||||
expanded = true;
|
||||
share = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreSpace = true;
|
||||
};
|
||||
};
|
||||
extraRC = ''
|
||||
${homeEndKeyBindings}
|
||||
|
||||
# Login shells may reset PATH before integrations run.
|
||||
export PATH=${lib.escapeShellArg loginBootstrapPath}:$PATH
|
||||
|
||||
source <(fzf --zsh)
|
||||
eval "$(zoxide init zsh)"
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
HISTFILE=$HOME/.config/zsh/.zsh_history
|
||||
SAVEHIST=${toString historySize}
|
||||
HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" ignorePatterns})"}
|
||||
|
||||
HOSTNAME=$(hostname -s)
|
||||
${aliasStr}
|
||||
|
||||
eval "$(devenv hook zsh)"
|
||||
'';
|
||||
extraPackages = extraToolPackages;
|
||||
}).wrapper;
|
||||
in
|
||||
{
|
||||
packages.jsl-zsh = mkJslZsh {
|
||||
binName = "jsl-zsh";
|
||||
starshipPackage = self'.packages.starship;
|
||||
};
|
||||
|
||||
packages.jsl-zsh-tty = mkJslZsh {
|
||||
binName = "jsl-zsh-tty";
|
||||
starshipPackage = self'.packages.starship-ascii;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = { config, self', pkgs, lib, ... }: {
|
||||
packages.jsl-zsh =
|
||||
let
|
||||
ignorePatterns = [
|
||||
"ls" "eza" "history" "clear"
|
||||
];
|
||||
integrationPackages = with pkgs; [
|
||||
fzf
|
||||
zoxide
|
||||
self'.packages.starship
|
||||
];
|
||||
extraToolPackages = with pkgs; [
|
||||
lazygit
|
||||
lazydocker
|
||||
devenv
|
||||
self'.packages.shell-tools
|
||||
self'.packages.neovim-min
|
||||
];
|
||||
loginBootstrapPath = lib.makeBinPath (integrationPackages ++ extraToolPackages);
|
||||
aliasStr = lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") {
|
||||
ls = "eza";
|
||||
ll = "eza -l";
|
||||
la = "eza -a";
|
||||
lt = "eza --tree";
|
||||
lla = "eza -la";
|
||||
ds = "gdu -i /snap /";
|
||||
ld = "lazydocker";
|
||||
});
|
||||
in
|
||||
(inputs.wrappers.wrapperModules.zsh.apply {
|
||||
inherit pkgs;
|
||||
binName = "jsl-zsh";
|
||||
env = {
|
||||
LANG = "en_US.UTF-8";
|
||||
COLORTERM = "truecolor";
|
||||
DEVENV_SHELL_TYPE = "zsh";
|
||||
};
|
||||
settings = {
|
||||
completion = {
|
||||
enable = true;
|
||||
extraCompletions = true;
|
||||
caseInsensitive = true;
|
||||
fuzzySearch = true;
|
||||
};
|
||||
autoSuggestions = {
|
||||
enable = true;
|
||||
strategy = [ "history" "completion" ];
|
||||
};
|
||||
history = {
|
||||
append = true;
|
||||
expanded = true;
|
||||
share = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreSpace = true;
|
||||
};
|
||||
};
|
||||
extraRC = ''
|
||||
${homeEndKeyBindings}
|
||||
|
||||
# Login shells may reset PATH before integrations run.
|
||||
export PATH=${lib.escapeShellArg loginBootstrapPath}:$PATH
|
||||
|
||||
source <(fzf --zsh)
|
||||
eval "$(zoxide init zsh)"
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
HISTFILE=$HOME/.config/zsh/.zsh_history
|
||||
SAVEHIST=${toString historySize}
|
||||
HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" ignorePatterns})"}
|
||||
|
||||
HOSTNAME=$(hostname -s)
|
||||
${aliasStr}
|
||||
|
||||
eval "$(devenv hook zsh)"
|
||||
'';
|
||||
extraPackages = extraToolPackages;
|
||||
}).wrapper;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user