infrastructure/modules/dgn-console.nix

54 lines
1.3 KiB
Nix
Raw Normal View History

2023-07-18 17:00:31 +02:00
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
mkIf;
cfg = config.dgn-console;
in
{
options.dgn-console = {
enable = mkEnableOption "DGNum console setup." // { default = true; };
};
config = mkIf cfg.enable {
time.timeZone = "Europe/Paris";
console = {
keyMap = "fr";
};
environment.systemPackages = with pkgs; [
2023-07-18 17:07:14 +02:00
neovim
2023-07-18 17:00:31 +02:00
wget
kitty.terminfo
];
environment.variables.EDITOR = "nvim";
programs.neovim.vimAlias = true;
services.nscd.enableNsncd = false;
programs.bash.promptInit = ''
# Provide a nice prompt if the terminal supports it.
if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
PROMPT_COLOR="1;31m"
((UID)) && PROMPT_COLOR="1;32m"
if [ -n "$INSIDE_EMACS" ] || [ "$TERM" = "eterm" ] || [ "$TERM" = "eterm-color" ]; then
# Emacs term mode doesn't support xterm title escape sequence (\e]0;)
PS1="\n\[\033[$PROMPT_COLOR\][\u@$(hostname -f):\w]\\$\[\033[0m\] "
else
PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\H: \w\a\]\u@$(hostname -f):\w]\\$\[\033[0m\] "
fi
if test "$TERM" = "xterm"; then
PS1="\[\033]2;$(hostname -f):\u:\w\007\]$PS1"
fi
fi
'';
hardware.enableRedistributableFirmware = true;
};
}