Major config overhaul: use custom modules, setup for multi-host config, and less boilerplate
This commit is contained in:
63
modules/user/shell/default.nix
Normal file
63
modules/user/shell/default.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.userSettings.shell;
|
||||
in {
|
||||
options = {
|
||||
userSettings.shell = {
|
||||
enable = lib.mkEnableOption "Enable fancy zsh with some necessary CLI utilities";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
enableCompletion = true;
|
||||
shellAliases = {
|
||||
ls = "eza --icons -l -T -L=1";
|
||||
cat = "bat";
|
||||
htop = "btm";
|
||||
fd = "fd -Lu";
|
||||
w3m = "w3m -no-cookie -v";
|
||||
neofetch = "disfetch";
|
||||
fetch = "disfetch";
|
||||
gitfetch = "onefetch";
|
||||
"," = "comma";
|
||||
",," = "comma-shell";
|
||||
};
|
||||
initExtra = ''
|
||||
PROMPT=" ◉ %U%F{magenta}%n%f%u@%U%F{blue}%m%f%u:%F{yellow}%~%f
|
||||
%F{green}→%f "
|
||||
RPROMPT="%F{red}▂%f%F{yellow}▄%f%F{green}▆%f%F{cyan}█%f%F{blue}▆%f%F{magenta}▄%f%F{white}▂%f"
|
||||
[ $TERM = "dumb" ] && unsetopt zle && PS1='$ '
|
||||
bindkey '^P' history-beginning-search-backward
|
||||
bindkey '^N' history-beginning-search-forward
|
||||
'';
|
||||
};
|
||||
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
shellAliases = config.programs.zsh.shellAliases;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
gnugrep gnused w3m
|
||||
bat eza bottom fd bc
|
||||
direnv nix-direnv
|
||||
];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.enableZshIntegration = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
programs.direnv.nix-direnv.package = pkgs.nix-direnv-flakes;
|
||||
};
|
||||
}
|
46
modules/user/shell/term-apps-extra.nix
Normal file
46
modules/user/shell/term-apps-extra.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.userSettings.shell.extraApps;
|
||||
in {
|
||||
options = {
|
||||
userSettings.shell.extraApps = {
|
||||
enable = lib.mkEnableOption "Add some fun but mostly useless CLI apps";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Fun CLI apps that aren't necessary
|
||||
home.packages = with pkgs; [
|
||||
# Command Line
|
||||
disfetch lolcat cowsay
|
||||
starfetch
|
||||
(stdenv.mkDerivation {
|
||||
name = "pokemon-colorscripts";
|
||||
version = "unstable";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "phoneybadger";
|
||||
repo = "pokemon-colorscripts";
|
||||
rev = "0483c85b93362637bdd0632056ff986c07f30868";
|
||||
sha256 = "sha256-rj0qKYHCu9SyNsj1PZn1g7arjcHuIDGHwubZg/yJt7A=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/bin $out/opt
|
||||
cp -rf $src/colorscripts $out/opt
|
||||
cp $src/pokemon-colorscripts.py $out/opt
|
||||
cp $src/pokemon.json $out/opt
|
||||
ln -s $out/opt/pokemon-colorscripts.py $out/bin/pokemon-colorscripts
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/Admiral-Fish/PokeFinder";
|
||||
description = "CLI utility to print out images of pokemon to terminal";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [];
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
66
modules/user/shell/term-apps.nix
Normal file
66
modules/user/shell/term-apps.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.userSettings.shell.apps;
|
||||
in {
|
||||
options = {
|
||||
userSettings.shell.apps = {
|
||||
enable = lib.mkEnableOption "Enable a collection of additional useful CLI apps";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Collection of useful CLI apps
|
||||
home.packages = with pkgs; [
|
||||
# Command Line
|
||||
killall
|
||||
libnotify
|
||||
timer
|
||||
brightnessctl
|
||||
gnugrep
|
||||
bat eza fd bottom ripgrep
|
||||
rsync
|
||||
zip unzip
|
||||
w3m
|
||||
pandoc
|
||||
hwinfo
|
||||
pciutils
|
||||
numbat
|
||||
(pkgs.writeShellScriptBin "airplane-mode" ''
|
||||
#!/bin/sh
|
||||
connectivity="$(nmcli n connectivity)"
|
||||
if [ "$connectivity" == "full" ]
|
||||
then
|
||||
nmcli n off
|
||||
else
|
||||
nmcli n on
|
||||
fi
|
||||
'')
|
||||
(pkgs.writeScriptBin "comma" ''
|
||||
if [ "$#" = 0 ]; then
|
||||
echo "usage: comma PKGNAME... [EXECUTABLE]";
|
||||
elif [ "$#" = 1 ]; then
|
||||
nix-shell -p $1 --run $1;
|
||||
elif [ "$#" = 2 ]; then
|
||||
nix-shell -p $1 --run $2;
|
||||
else
|
||||
echo "error: too many arguments";
|
||||
echo "usage: comma PKGNAME... [EXECUTABLE]";
|
||||
fi
|
||||
'')
|
||||
(pkgs.writeScriptBin "comma-shell" ''
|
||||
if [ "$#" = 0 ]; then
|
||||
echo "usage: comma-shell PKGNAME1 [PKGNAME2 PKGNAME3...]";
|
||||
else
|
||||
nix-shell -p $@
|
||||
fi
|
||||
'')
|
||||
];
|
||||
|
||||
programs.zsh.shellAliases = {
|
||||
w3m = "w3m -no-cookie -v";
|
||||
"," = "comma";
|
||||
",," = "comma-shell";
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user