From 155faafcbcaf99f8a19010f5f9a4cd3666b0e9e7 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Jul 2015 06:56:42 +0200 Subject: nomic: use same environment as wu --- modules/nomic/default.nix | 1 + modules/tv/environment.nix | 83 ++++++++++++++++++++++++++++++++++++++++++++++ modules/wu/default.nix | 79 +------------------------------------------ 3 files changed, 85 insertions(+), 78 deletions(-) create mode 100644 modules/tv/environment.nix (limited to 'modules') diff --git a/modules/nomic/default.nix b/modules/nomic/default.nix index e9d1bfc..9d3fc0d 100644 --- a/modules/nomic/default.nix +++ b/modules/nomic/default.nix @@ -9,6 +9,7 @@ in ./hardware-configuration.nix ./users.nix ../tv/base.nix + ../tv/environment.nix ../tv/exim-retiolum.nix ../tv/git/public.nix ../tv/sanitize.nix diff --git a/modules/tv/environment.nix b/modules/tv/environment.nix new file mode 100644 index 0000000..f901ef6 --- /dev/null +++ b/modules/tv/environment.nix @@ -0,0 +1,83 @@ +{ pkgs, ... }: + +let + lib = import ../../lib { lib = pkgs.lib; inherit pkgs; }; + + inherit (lib) majmin; +in + +{ + environment.systemPackages = with pkgs; [ + vim + ]; + + environment.etc."vim/vimrc".text = '' + set nocp + ''; + + environment.etc."vim/vim${majmin pkgs.vim.version}".source = + "${pkgs.vim}/share/vim/vim${majmin pkgs.vim.version}"; + + # multiple-definition-problem when defining environment.variables.EDITOR + environment.extraInit = '' + EDITOR=vim + ''; + + environment.shellAliases = { + # alias cal='cal -m3' + gp = "${pkgs.pari}/bin/gp -q"; + df = "df -h"; + du = "du -h"; + # alias grep='grep --color=auto' + + # TODO alias cannot contain #\' + # "ps?" = "ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep"; + + # alias la='ls -lA' + lAtr = "ls -lAtr"; + # alias ll='ls -l' + ls = "ls -h --color=auto --group-directories-first"; + # alias vim='vim -p' + # alias vi='vim' + # alias view='vim -R' + dmesg = "dmesg -L --reltime"; + }; + + environment.variables.VIM = "/etc/vim"; + + programs.bash = { + interactiveShellInit = '' + HISTCONTROL='erasedups:ignorespace' + HISTSIZE=65536 + HISTFILESIZE=$HISTSIZE + + shopt -s checkhash + shopt -s histappend histreedit histverify + shopt -s no_empty_cmd_completion + complete -d cd + + # TODO source bridge + ''; + promptInit = '' + case $UID in + 0) + PS1='\[\e[1;31m\]\w\[\e[0m\] ' + ;; + 1337) + PS1='\[\e[1;32m\]\w\[\e[0m\] ' + ;; + *) + PS1='\[\e[1;35m\]\u \[\e[1;32m\]\w\[\e[0m\] ' + ;; + esac + if test -n "$SSH_CLIENT"; then + PS1='\[\e[35m\]\h'" $PS1" + fi + if test -n "$SSH_AGENT_PID"; then + PS1="ssh-agent[$SSH_AGENT_PID] $PS1" + fi + ''; + }; + + programs.ssh.startAgent = false; +} diff --git a/modules/wu/default.nix b/modules/wu/default.nix index 2271798..3cfbad6 100644 --- a/modules/wu/default.nix +++ b/modules/wu/default.nix @@ -1,10 +1,6 @@ { config, pkgs, ... }: let - lib = import ../../lib { lib = pkgs.lib; inherit pkgs; }; - - inherit (lib) majmin; - location = pkgs.lib.nameValuePair; # TODO this is also in modules/tv/git/cgit.nix in @@ -13,6 +9,7 @@ in ./hosts.nix ../tv/base.nix ../tv/exim-retiolum.nix + ../tv/environment.nix ../tv/sanitize.nix ../tv/smartd.nix ../tv/synaptics.nix @@ -244,83 +241,9 @@ in #chromiumDevWrapper tinc iptables - vim #jack2 ]; - - environment.etc."vim/vimrc".text = '' - set nocp - ''; - environment.etc."vim/vim${majmin pkgs.vim.version}".source = - "${pkgs.vim}/share/vim/vim${majmin pkgs.vim.version}"; - - # multiple-definition-problem when defining environment.variables.EDITOR - environment.extraInit = '' - EDITOR=vim - ''; - environment.variables.VIM = "/etc/vim"; - - environment.shellAliases = { - # alias cal='cal -m3' - bc = "bc -q"; - gp = "gp -q"; - df = "df -h"; - du = "du -h"; - # alias grep='grep --color=auto' - - # TODO alias cannot contain #\' - # "ps?" = "ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep"; - - # alias la='ls -lA' - lAtr = "ls -lAtr"; - # alias ll='ls -l' - ls = "ls -h --color=auto --group-directories-first"; - # alias vim='vim -p' - # alias vi='vim' - # alias view='vim -R' - dmesg = "dmesg -L --reltime"; - }; - - - programs.bash = { - interactiveShellInit = '' - HISTCONTROL='erasedups:ignorespace' - HISTSIZE=65536 - HISTFILESIZE=$HISTSIZE - - shopt -s checkhash - shopt -s histappend histreedit histverify - shopt -s no_empty_cmd_completion - complete -d cd - - # TODO source bridge - ''; - promptInit = '' - case $UID in - 0) - PS1='\[\e[1;31m\]\w\[\e[0m\] ' - ;; - 1337) - PS1='\[\e[1;32m\]\w\[\e[0m\] ' - ;; - *) - PS1='\[\e[1;35m\]\u \[\e[1;32m\]\w\[\e[0m\] ' - ;; - esac - if test -n "$SSH_CLIENT"; then - PS1='\[\e[35m\]\h'" $PS1" - fi - if test -n "$SSH_AGENT_PID"; then - PS1="ssh-agent[$SSH_AGENT_PID] $PS1" - fi - ''; - }; - - - programs.ssh.startAgent = false; - - security.setuidPrograms = [ "sendmail" # for cron "slock" -- cgit v1.2.3