From ebac38eb13690b2d8dd9be2244be4d3d89c7d59f Mon Sep 17 00:00:00 2001 From: Yves Dubromelle Date: Sat, 23 Apr 2016 12:43:24 +0200 Subject: [PATCH] initial commit --- .gitignore | 11 +++++++++++ base.nix | 8 ++++++++ bash-interactive-init.sh | 18 ++++++++++++++++++ bash-prompt.sh | 27 ++++++++++++++++++++++++++ gitconfig | 16 ++++++++++++++++ localisation.nix | 13 +++++++++++++ tools.nix | 41 ++++++++++++++++++++++++++++++++++++++++ vim.nix | 19 +++++++++++++++++++ vimrc | 33 ++++++++++++++++++++++++++++++++ 9 files changed, 186 insertions(+) create mode 100644 .gitignore create mode 100644 base.nix create mode 100644 bash-interactive-init.sh create mode 100644 bash-prompt.sh create mode 100644 gitconfig create mode 100644 localisation.nix create mode 100644 tools.nix create mode 100644 vim.nix create mode 100644 vimrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95a6d7d --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# Vim : +## swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +## session +Session.vim +## temporary +.netrwhist +*~ +## auto-generated tag files +tags diff --git a/base.nix b/base.nix new file mode 100644 index 0000000..2a380fe --- /dev/null +++ b/base.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./tools.nix + ./localisation.nix + ]; +} diff --git a/bash-interactive-init.sh b/bash-interactive-init.sh new file mode 100644 index 0000000..3b9f2e6 --- /dev/null +++ b/bash-interactive-init.sh @@ -0,0 +1,18 @@ +# don't put duplicate lines in the history. See bash(1) for more options +# don't overwrite GNU Midnight Commander's setting of `ignorespace'. +export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups +# ... or force ignoredups and ignorespace +export HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm) TERM=xterm-256color;; + screen) TERM=screen-256color;; +esac diff --git a/bash-prompt.sh b/bash-prompt.sh new file mode 100644 index 0000000..90affa8 --- /dev/null +++ b/bash-prompt.sh @@ -0,0 +1,27 @@ +# Définition des couleurs du prompt +if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + PS1_USER='\[$(tput setaf 27)\]' + PS1_HOST='\[$(tput setaf 37)\]' + PS1_ROOT='\[$(tput setaf 160)\]' + PS1_PATH='\[$(tput setaf 64)\]' + PS1_GIT='\[$(tput setaf 136)\]' + PS1_MISC='\[$(tput setaf 230)\]' + +else + PS1_USER='\[$(tput setaf 4)\]' + PS1_HOST='\[$(tput setaf 6)\]' + PS1_ROOT='\[$(tput setaf 1)\]' + PS1_PATH='\[$(tput setaf 2)\]' + PS1_GIT='\[$(tput setaf 3)\]' + PS1_MISC='\[$(tput setaf 7)\]' +fi +BOLD='\[$(tput bold)\]' +RESET='\[$(tput sgr0)\]' + +# Définition du prompt +if [ $UID = 0 ]; then + PS1_ID=$PS1_ROOT +else + PS1_ID=$PS1_USER'\u'$PS1_MISC@$PS1_HOST +fi +PS1=$RESET$BOLD$PS1_ID'\h '$PS1_PATH'\w'$PS1_GIT'$(__git_ps1)'"\n"$PS1_MISC'\$ '$RESET diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..5c7c74a --- /dev/null +++ b/gitconfig @@ -0,0 +1,16 @@ +[color] + diff = auto + branch = auto + interactive = auto + pager = true + showbranch = auto + status = auto +[alias] + a = add -p + st = status + ci = commit + co = checkout +[push] + default = simple +[core] + editor = /usr/bin/env vim diff --git a/localisation.nix b/localisation.nix new file mode 100644 index 0000000..37bafcf --- /dev/null +++ b/localisation.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + # Select internationalisation properties. + i18n = { + consoleFont = "Lat2-Terminus16"; + consoleKeyMap = "fr"; + defaultLocale = "fr_FR.UTF-8"; + }; + + # Set your time zone. + time.timeZone = "Europe/Paris"; +} diff --git a/tools.nix b/tools.nix new file mode 100644 index 0000000..8075298 --- /dev/null +++ b/tools.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: + +{ + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment = { + systemPackages = with pkgs; [ + bind # utilisé pour les utilitaires comme dig + byobu + git gitAndTools.tig + gnupg + htop + ncdu + nmap + mtr + p7zip + parted + python34Packages.glances + pwgen + tmux + tree + (import ./vim.nix) + wget + ]; + shellAliases = { + byobu = "byobu-tmux"; + tree = "tree -C"; + tree1 = "tree -d -L 1"; + tree2 = "tree -d -L 2"; + tree3 = "tree -d -L 3"; + grep = "grep --color=auto"; + vi = "vim"; + }; + etc.gitconfig.text = builtins.readFile ./gitconfig; + }; + programs.bash = { + enableCompletion = true; + promptInit = builtins.readFile ./bash-prompt.sh; + interactiveShellInit = builtins.readFile ./bash-interactive-init.sh; + }; +} diff --git a/vim.nix b/vim.nix new file mode 100644 index 0000000..d48ae33 --- /dev/null +++ b/vim.nix @@ -0,0 +1,19 @@ +with import {}; + +vim_configurable.customize { + # Specifies the vim binary name. + # E.g. set this to "my-vim" and you need to type "my-vim" to open this vim + # This allows to have multiple vim packages installed (e.g. with a different set of plugins) + name = "vim"; + vimrcConfig.customRC = builtins.readFile ./vimrc; + vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; + vimrcConfig.vam.pluginDictionaries = [ + { names = [ + # Here you can place all your vim plugins + # They are installed managed by `vam` (a vim plugin manager) + #"vim-addon-nix" + "vim-nix" + "wombat256-vim" + ]; } + ]; +} diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..8123371 --- /dev/null +++ b/vimrc @@ -0,0 +1,33 @@ +" Use Vim settings, rather than Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +set nocompatible + +" allow backspacing over everything in insert mode +set backspace=indent,eol,start + +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file +endif +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set incsearch " do incremental searching + +" Tab specific option +set tabstop=4 "A tab is 8 spaces +set expandtab "Always uses spaces instead of tabs +set softtabstop=4 "Insert 4 spaces when tab is pressed +set shiftwidth=4 "An indent is 4 spaces +set shiftround "Round indent to nearest shiftwidth multiple + +"""""" Réglages cosmétiques +set background=dark +set cc=80 +set number +highlight ColorColumn ctermbg=8 +"Détection de la profondeur des couleurs (8bits) +if &t_Co > 8 + colorscheme wombat256mod +endif