mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2025-01-18 17:11:39 +01:00
global zsh config
This commit is contained in:
parent
82b62d2cae
commit
1737739b73
10 changed files with 73 additions and 107 deletions
19
flake.lock
19
flake.lock
|
@ -117,11 +117,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681971090,
|
||||
"narHash": "sha256-3j0M63GkG6GGny9e+C//GyuDCx1IwrurD27S0YI+GQY=",
|
||||
"lastModified": 1682072616,
|
||||
"narHash": "sha256-sR5RL3LACGuq5oePcAoJ/e1S3vitKQQSNACMYmqIE1E=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "5160039edca28a7e66bad0cfc72a07c91d6768ad",
|
||||
"rev": "47d6c3f65234230d37f1cf7d3d6b5575ec80fe0c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -140,16 +140,17 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682031571,
|
||||
"narHash": "sha256-zYApIP2EeBa5Pef2MDzHaoTtTPRaxZ97cHqBYZ+6wBE=",
|
||||
"lastModified": 1682080615,
|
||||
"narHash": "sha256-g3YTp28uN+YDMHhrrx1bef68/2qIfpWW4zf0XSi9+tg=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "510db64860fa307e33db5fdb843c6cc5a428b5a4",
|
||||
"rev": "2df0d034bc4a18fafb3524401eeeceaa6b23e753",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "2df0d034bc4a18fafb3524401eeeceaa6b23e753",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -221,11 +222,11 @@
|
|||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1680875144,
|
||||
"narHash": "sha256-Ub/Y+/zoAoji+E7WCLbTykcTmfRiyzLJ5QEyR3NbHgY=",
|
||||
"lastModified": 1682090414,
|
||||
"narHash": "sha256-ZU0NVk068KndcG2o+JvgJPOfnjrCb36LP5wW/r1piXc=",
|
||||
"owner": "Misterio77",
|
||||
"repo": "nix-colors",
|
||||
"rev": "41cc6c1086a4d26509f9fc80a538131d03a11234",
|
||||
"rev": "4ccd57b4d4f900567455542f114e062a4fab6a98",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
};
|
||||
|
||||
hyprland = {
|
||||
url = github:hyprwm/Hyprland;
|
||||
# temp pin hyprland until wayland is updated in nixpkgs
|
||||
url = github:hyprwm/Hyprland/2df0d034bc4a18fafb3524401eeeceaa6b23e753;
|
||||
inputs = {
|
||||
xdph.follows = "xdph";
|
||||
};
|
||||
|
@ -89,6 +90,7 @@
|
|||
nixos-hardware.nixosModules.common-pc-laptop-ssd
|
||||
home-manager.nixosModules.home-manager
|
||||
sops-nix.nixosModules.sops
|
||||
nix-index-database.nixosModules.nix-index
|
||||
{
|
||||
home-manager.extraSpecialArgs = attrs;
|
||||
home-manager.users.rouven = {
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
keyMap = "dvorak";
|
||||
};
|
||||
|
||||
programs.command-not-found.enable = false;
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
wget
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
keyMap = "dvorak";
|
||||
};
|
||||
|
||||
programs.command-not-found.enable = false;
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
wget
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.bash.shellInit = ''
|
||||
download_nixpkgs_cache_index () {
|
||||
filename="index-$(uname -m)-$(uname | tr A-Z a-z)"
|
||||
mkdir -p ~/.cache/nix-index && cd ~/.cache/nix-index
|
||||
# -N will only download a new version if there is an update.
|
||||
wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename
|
||||
ln -f $filename files
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./bash.nix
|
||||
./caches.nix
|
||||
./gpg.nix
|
||||
./sops.nix
|
||||
./vim.nix
|
||||
./zsh.nix
|
||||
];
|
||||
}
|
||||
|
|
59
shared/zsh.nix
Normal file
59
shared/zsh.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.command-not-found.enable = false;
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
rm = "trash";
|
||||
ls = "exa --icons";
|
||||
l = "ls -l";
|
||||
ll = "ls -la";
|
||||
la = "ls -a";
|
||||
switch = "sudo nixos-rebuild switch && cat ${../images/another-cat-2.sixel}";
|
||||
update = "cd /etc/nixos && nix flake update && cat ${../images/another-cat.sixel}";
|
||||
garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}";
|
||||
q = "exit";
|
||||
};
|
||||
histSize = 100000;
|
||||
histFile = "~/.local/share/zsh/history";
|
||||
autosuggestions = {
|
||||
enable = true;
|
||||
highlightStyle = "fg=#00bbbb,bold";
|
||||
};
|
||||
|
||||
ohMyZsh = {
|
||||
enable = true;
|
||||
plugins = [ "gh" ];
|
||||
theme = "agnoster";
|
||||
};
|
||||
|
||||
shellInit =
|
||||
''
|
||||
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
|
||||
|
||||
function c() {
|
||||
if [ $# -eq 0 ]; then
|
||||
cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
else
|
||||
$1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
fi
|
||||
}
|
||||
|
||||
function svpn() {
|
||||
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
|
||||
if [ $(systemctl is-active $unit) = "inactive" ]; then
|
||||
systemctl start $unit
|
||||
else
|
||||
systemctl stop $unit
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_dir() {
|
||||
prompt_segment blue $CURRENT_FG '%c'
|
||||
}
|
||||
cat ${../images/cat.sixel}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# generate system completions
|
||||
programs.zsh.enable = true;
|
||||
|
||||
# fixes pam entries for swaylock
|
||||
security.pam.services.swaylock.text = ''
|
||||
# Account management.
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
./tmux
|
||||
./vifm
|
||||
./theme
|
||||
./zsh
|
||||
./packages.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
rm = "trash";
|
||||
ls = "exa --icons";
|
||||
l = "ls -l";
|
||||
ll = "ls -la";
|
||||
la = "ls -a";
|
||||
switch = "sudo nixos-rebuild switch && cat ${../../../../images/another-cat-2.sixel}";
|
||||
update = "cd /etc/nixos && nix flake update && cat ${../../../../images/another-cat.sixel}";
|
||||
garbage = "sudo nix-collect-garbage -d && cat ${../../../../images/cat-garbage.sixel}";
|
||||
q = "exit";
|
||||
};
|
||||
history = {
|
||||
size = 10000;
|
||||
path = "${config.xdg.dataHome}/zsh/history";
|
||||
};
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [ "gh" "pass" ];
|
||||
theme = "agnoster";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "v0.7.0";
|
||||
sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "14f66e4d3d0b366552c0412eb08ca9e0f7c797bd";
|
||||
sha256 = "YkfHPSuSKParz7JidR924CJSuXO6Rk0RZTlxPOBwLJk=";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
localVariables = {
|
||||
COMPLETION_WAITING_DOTS = "true";
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#00bbbb,bold";
|
||||
};
|
||||
|
||||
initExtra =
|
||||
''
|
||||
function c() {
|
||||
if [ $# -eq 0 ]; then
|
||||
cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
else
|
||||
$1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview '${pkgs.tree}/bin/tree -C {}')
|
||||
fi
|
||||
}
|
||||
|
||||
function svpn() {
|
||||
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
|
||||
if [ $(systemctl is-active $unit) = "inactive" ]; then
|
||||
systemctl start $unit
|
||||
else
|
||||
systemctl stop $unit
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_dir() {
|
||||
prompt_segment blue $CURRENT_FG '%c'
|
||||
}
|
||||
cat ${../../../../images/cat.sixel}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue