nixos-config/modules/programs/shell-tools.nix

43 lines
890 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, pkgs, lib, ... }:
with lib;
let
xterm-colors = pkgs.writeShellScriptBin "256-xterm-colors"
2019-12-20 05:54:26 +01:00
# sh
''
for i in {0..255} ; do
printf "\x1b[38;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
printf "\n";
fi
done
'';
xterm-background-colors = pkgs.writeShellScriptBin
"256-xterm-colors-background"
# sh
''
for i in {0..255} ; do
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
printf "\n";
fi
done
'';
2019-10-24 02:20:38 +02:00
cfg = config.programs.custom.shellTools;
in {
2019-12-20 05:54:26 +01:00
options.programs.custom.shellTools.enable =
mkEnableOption "enable shell tools";
2019-10-24 02:20:38 +02:00
config = mkIf cfg.enable {
2019-12-20 05:54:26 +01:00
environment.systemPackages = [ xterm-colors xterm-background-colors ];
2019-10-24 02:20:38 +02:00
};
}