infrastructure/modules/dgn-console.nix

63 lines
1.8 KiB
Nix
Raw Normal View History

2023-07-18 17:00:31 +02:00
{ config, lib, pkgs, ... }:
let
2023-10-26 14:17:01 +02:00
inherit (lib) mkEnableOption mkIf;
2023-07-18 17:00:31 +02:00
cfg = config.dgn-console;
2023-10-26 14:17:01 +02:00
in {
2023-07-18 17:00:31 +02:00
options.dgn-console = {
enable = mkEnableOption "DGNum console setup." // { default = true; };
};
config = mkIf cfg.enable {
time.timeZone = "Europe/Paris";
2023-10-26 14:17:01 +02:00
console = { keyMap = "fr"; };
2023-07-18 17:00:31 +02:00
2023-10-26 14:17:01 +02:00
environment.systemPackages = with pkgs; [ neovim wget kitty.terminfo ];
2023-07-18 17:00:31 +02:00
environment.variables.EDITOR = "nvim";
programs.neovim.vimAlias = true;
2023-10-26 14:17:01 +02:00
# services.nscd.enableNsncd = false;
nixpkgs.overlays = [
(final: prev: {
nsncd = pkgs.rustPlatform.buildRustPackage {
pname = "nsncd";
version = "unstable-2023-10-26";
src = pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "nsncd";
rev = "47755a26ab3a45a47e55785eb112c817ba1e6bed";
hash = "sha256-CSIFbCwXj33t7QW7PTqOXRcOYP/ivTWmK+s/xBZd0VQ=";
};
cargoSha256 = "sha256-cUM7rYXWpJ0aMiurXBp15IlxAmf/x5uiodxEqBPCQT0=";
};
})
];
2023-07-18 17:00:31 +02:00
programs.bash.promptInit = ''
FQDN="$(hostname).$(domainname)"
2023-07-18 17:00:31 +02:00
# 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@$FQDN:\w]\\$\[\033[0m\] "
2023-07-18 17:00:31 +02:00
else
PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\H: \w\a\]\u@$FQDN:\w]\\$\[\033[0m\] "
2023-07-18 17:00:31 +02:00
fi
if test "$TERM" = "xterm"; then
PS1="\[\033]2;$FQDN:\u:\w\007\]$PS1"
2023-07-18 17:00:31 +02:00
fi
fi
'';
hardware.enableRedistributableFirmware = true;
};
}