refactor basic tools a bit

This commit is contained in:
Grigory Shipunov 2023-02-14 22:00:22 +01:00
parent f3ef2e058c
commit fc21e3a1b2
Signed by: 0xa
GPG key ID: 91FA5E5BF9AA901C
4 changed files with 85 additions and 49 deletions

View file

@ -3,6 +3,8 @@
{ {
imports = [ imports = [
./fzf.nix ./fzf.nix
./multiplexers.nix
./nix.nix
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -27,35 +29,11 @@
nnn nnn
ranger ranger
man-pages man-pages
screen
unzip unzip
usbutils usbutils
pciutils pciutils
]; ];
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# override default nix shell nixpkgs# behaviour to use current flake lock
nix.registry =
let flakes = lib.filterAttrs (_name: value: value ? outputs) inputs.self.inputs;
in builtins.mapAttrs (_name: v: { flake = v; }) flakes;
nix.nixPath = lib.mapAttrsToList (name: value: "${name}=${value.outPath}") inputs.self.inputs;
programs.tmux = {
enable = true;
keyMode = "vi";
escapeTime = 0;
historyLimit = 50000;
aggressiveResize = true;
terminal = "tmux-256color";
};
# set appropriate environ variables # set appropriate environ variables
environment.variables = { environment.variables = {
EDITOR = "nvim"; EDITOR = "nvim";
@ -70,10 +48,7 @@
ll = "ls -lah"; ll = "ls -lah";
lt = "ls --tree"; lt = "ls --tree";
vim = "nvim"; vim = "nvim";
mutt = "neomutt";
grep = "grep --color=auto"; grep = "grep --color=auto";
nix-build="${pkgs.nix-output-monitor}/bin/nom-build";
nix-shell="${pkgs.nix-output-monitor}/bin/nom-shell";
}; };
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
@ -89,19 +64,6 @@
setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_ALL_DUPS
# allow comments # allow comments
setopt interactivecomments setopt interactivecomments
# hacky wrapper for nix, so we can use nom automagically
export _nom_cmd=${pkgs.nix-output-monitor}/bin/nom
function nix {
case $1 in
build|shell|develop)
echo \[SUBSTITUTION\] ''$_nom_cmd ''${@:1} 1>&2
''$_nom_cmd ''${@:1}
;;
*)
${pkgs.nix}/bin/nix $@
esac
}
''; '';
promptInit = '' promptInit = ''
source ${pkgs.liquidprompt}/share/zsh/plugins/liquidprompt/liquidprompt source ${pkgs.liquidprompt}/share/zsh/plugins/liquidprompt/liquidprompt
@ -123,13 +85,4 @@
programs.iftop.enable = true; programs.iftop.enable = true;
programs.mosh.enable = true; programs.mosh.enable = true;
programs.screen.screenrc = ''
defscrollback 10000
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%w"
'';
} }

View file

@ -0,0 +1,43 @@
{ pkgs, ... }: {
programs.tmux = {
enable = true;
keyMode = "vi";
escapeTime = 0;
historyLimit = 500000;
aggressiveResize = true;
terminal = "tmux-256color";
};
programs.zsh.interactiveShellInit = ''
# create new tmux session with $1 as a name
# if no arguments supplied, use name of current dir
function tn {
if [ $# -eq 0 ]
then
tmux new-session -s $(basename $(pwd))
else
tmux new-session -s $1
fi
}
'';
environment.shellAliases = {
tl = "tmux list-sessions";
ta = "tmux attach -t";
};
environment.systemPackages = [
pkgs.screen
];
programs.screen.screenrc = ''
defscrollback 10000
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%w"
'';
}

View file

@ -0,0 +1,36 @@
{ lib, pkgs, inputs, ... }: {
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# override default nix shell nixpkgs# behaviour to use current flake lock
nix.registry =
let flakes = lib.filterAttrs (_name: value: value ? outputs) inputs.self.inputs;
in builtins.mapAttrs (_name: v: { flake = v; }) flakes;
nix.nixPath = lib.mapAttrsToList (name: value: "${name}=${value.outPath}") inputs.self.inputs;
environment.shellAliases = {
nix-build="${pkgs.nix-output-monitor}/bin/nom-build";
nix-shell="${pkgs.nix-output-monitor}/bin/nom-shell";
};
programs.zsh.interactiveShellInit = ''
# hacky wrapper for nix, so we can use nom automagically
export _nom_cmd=${pkgs.nix-output-monitor}/bin/nom
function nix {
case $1 in
build|shell|develop)
echo \[SUBSTITUTION\] ''$_nom_cmd ''${@:1} 1>&2
''$_nom_cmd ''${@:1}
;;
*)
${pkgs.nix}/bin/nix $@
esac
}
compdef nix=_nix
'';
}

View file

@ -12,6 +12,10 @@ in
links2 links2
]; ];
environment.shellAliases = {
mutt = "neomutt";
};
sops.secrets = { sops.secrets = {
"mail/oxapentane.com" = { "mail/oxapentane.com" = {
owner = config.users.users.grue.name; owner = config.users.users.grue.name;