From 478ce7035ab7af733a0390b242affb656539f16d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 20 Apr 2018 13:31:10 +0200 Subject: Start tracking system configuration --- conf/fish.nix | 62 +++++++++++++++++ configuration.nix | 79 ++++++++++++++++++++++ hardware-configuration.nix | 26 ++++++++ pkgs/vim/conf/rc.vim | 104 +++++++++++++++++++++++++++++ pkgs/vim/conf/vim-color-akr/colors/akr.vim | 103 ++++++++++++++++++++++++++++ pkgs/vim/custom.nix | 26 ++++++++ pkgs/vim/nvim.nix | 12 ++++ pkgs/vim/plugins.nix | 18 +++++ pkgs/vim/vim.nix | 14 ++++ 9 files changed, 444 insertions(+) create mode 100644 conf/fish.nix create mode 100644 configuration.nix create mode 100644 hardware-configuration.nix create mode 100644 pkgs/vim/conf/rc.vim create mode 100644 pkgs/vim/conf/vim-color-akr/colors/akr.vim create mode 100644 pkgs/vim/custom.nix create mode 100644 pkgs/vim/nvim.nix create mode 100644 pkgs/vim/plugins.nix create mode 100644 pkgs/vim/vim.nix diff --git a/conf/fish.nix b/conf/fish.nix new file mode 100644 index 0000000..8684595 --- /dev/null +++ b/conf/fish.nix @@ -0,0 +1,62 @@ +{ + programs.fish = { + enable = true; + shellInit = '' + set fish_greeting "" + ''; + interactiveShellInit = '' + eval (dircolors -c ~/.dir_colors) + + set fish_color_normal white + set fish_color_command magenta --bold + set fish_color_param green + set fish_color_error brred + set fish_color_operator cyan + set fish_color_comment white + set fish_color_cwd green + set fish_color_quote brown + set fish_color_autosuggestion 555 + ''; + promptInit = '' + function fish_prompt + set last_status $status + + if not set -q __fish_prompt_normal + set -g __fish_prompt_normal (set_color normal) + end + + switch $USER + case root + if not set -q __fish_prompt_cwd + if set -q fish_color_cwd_root + set -g __fish_prompt_cwd (set_color $fish_color_cwd_root) + else + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end + end + + case '*' + if not set -q __fish_prompt_cwd + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end + end + + echo -n -s 'λ ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" + + if test $last_status -gt 0 + set_color $fish_color_cwd_root + echo -n -s ' ● ' + set_color normal + else + echo -n -s ' ● ' + end + end + + function fish_right_prompt + set_color $fish_color_autosuggestion + date '+%H:%M:%S' + set_color normal + end + ''; + }; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..1677d38 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,79 @@ +{ config, pkgs, ... }: + +{ + system.stateVersion = "18.03"; + + imports = [ + ./hardware-configuration.nix + ./conf/fish.nix + ]; + + boot.loader.grub = { + enable = true; + version = 2; + device = "/dev/sda"; + }; + + networking = { + hostName = "obelix"; + firewall.enable = false; + }; + + sound.enable = true; + hardware = { + pulseaudio.enable = true; + opengl.driSupport32Bit = true; + }; + + i18n = { + consoleKeyMap = "de"; + defaultLocale = "en_US.UTF-8"; + }; + + time.timeZone = "Europe/Berlin"; + + nixpkgs.config.allowUnfree = true; + + programs = { + bash.enableCompletion = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + openssh = { + enable = true; + }; + + xserver = { + enable = true; + layout = "de"; + xkbOptions = "caps:escape"; + + videoDrivers = [ "nvidia" ]; + + displayManager.slim = { + enable = true; + autoLogin = true; + defaultUser = "common"; + }; + + desktopManager.default = "none"; + }; + }; + + users.extraUsers.common = { + isNormalUser = true; + uid = 1000; + extraGroups = [ "wheel" ]; + shell = pkgs.fish; + }; + + environment.systemPackages = let + custom_vim = import ./pkgs/vim/vim.nix pkgs; + in with pkgs; [ + ntfs3g htop fish custom_vim + ]; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..3ddc0eb --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,26 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/cd4fe873-d75a-4810-bbc8-2dc00144619a"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/4ac4ae45-de8e-4c3f-b026-0d1b70aea2e2"; } + ]; + + nix.maxJobs = lib.mkDefault 8; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/pkgs/vim/conf/rc.vim b/pkgs/vim/conf/rc.vim new file mode 100644 index 0000000..bc41351 --- /dev/null +++ b/pkgs/vim/conf/rc.vim @@ -0,0 +1,104 @@ +syntax enable +filetype plugin indent on + +colorscheme akr + +set encoding=utf-8 +set showcmd +set nocompatible +set nocursorline +set number +set lazyredraw +set ttyfast +set mouse=a +set t_Co=256 +set shell=/bin/sh +set sessionoptions-=options + +set directory=~/.vim/swap//,. + +set wrap +set tabstop=4 shiftwidth=4 +set backspace=indent,eol,start +set listchars=tab:\ \ +set list +set linebreak + +set hlsearch +set incsearch +set ignorecase +set smartcase + +let mapleader="," + +map s :let @/="" +map c zz +map d + +nmap :e# +nmap f za +nmap F zA + +autocmd InsertEnter * :setlocal nohlsearch +autocmd InsertLeave * :setlocal hlsearch + +autocmd FileType scheme setlocal shiftwidth=2 tabstop=2 expandtab +autocmd FileType lisp setlocal shiftwidth=2 tabstop=2 expandtab +autocmd FileType racket setlocal shiftwidth=2 tabstop=2 expandtab +autocmd FileType pandoc setlocal nonumber autoread +autocmd FileType tex set conceallevel=2 + +vnoremap cc "+y +nnoremap cc "+p + +nnoremap gT +nnoremap gt +nnoremap @q +nnoremap J } +nnoremap K { + +nmap << +nmap >> +vmap >gv + +nmap [e +nmap ]e +vmap [egv +vmap ]egv + +nnoremap h +nnoremap l +nnoremap k +nnoremap j + +let g:gitgutter_enabled = 0 +let g:gitgutter_highlight_lines = 1 +let g:goyo_width = 90 +let g:goyo_margin_top = 1 +let g:goyo_margin_bottom = 0 + +nnoremap :UndotreeToggle +nnoremap :GitGutterToggle +nnoremap :set cursorline! +nnoremap :TagbarToggle +nnoremap :Goyo + +nnoremap :CtrlPBuffer +nnoremap :CtrlPTag +nnoremap :CtrlPBufTag + +let g:ctrlp_custom_ignore = { +\ 'dir': '\.git$', +\ 'file': '\.o$\|\.d$' +\ } + +let g:undotree_SetFocusWhenToggle = 1 + +let g:tagbar_autoclose = 1 +let g:tagbar_autopreview = 1 +let g:tagbar_compact = 1 +let g:tagbar_width = 70 + +let g:localvimrc_sandbox = 0 +let g:localvimrc_persistent = 2 diff --git a/pkgs/vim/conf/vim-color-akr/colors/akr.vim b/pkgs/vim/conf/vim-color-akr/colors/akr.vim new file mode 100644 index 0000000..127f022 --- /dev/null +++ b/pkgs/vim/conf/vim-color-akr/colors/akr.vim @@ -0,0 +1,103 @@ +hi clear +syntax reset +let background = "dark" +let g:colors_name = "akr" + +hi Normal gui=NONE guifg=#F2F2F2 guibg=#161616 +hi NonText gui=NONE guifg=#161616 guibg=#161616 +hi LineNr gui=NONE guifg=#605c5a guibg=NONE +hi Cursor gui=NONE guifg=#F2F2F2 guibg=#D80F33 +hi CursorColumn gui=NONE guifg=NONE guibg=#000000 +hi CursorLine gui=NONE guifg=NONE guibg=#212121 +hi CursorLineNr gui=NONE guifg=#aadb0f guibg=#212121 +hi ColorColumn gui=NONE guifg=NONE guibg=#aadb0f +hi SignColumn gui=NONE guifg=NONE guibg=#aadb0f + +hi TabLine gui=NONE guifg=#909636 guibg=#161616 +hi TabLineFill gui=NONE guifg=NONE guibg=#262626 +hi TabLineSel gui=NONE guifg=#161616 guibg=#909636 +hi StatusLine gui=NONE guifg=#909636 guibg=#212121 +hi StatusLineNC gui=NONE guifg=#909637 guibg=#212121 +hi VertSplit gui=NONE guifg=#262626 guibg=#262626 +hi Visual gui=NONE guifg=#E4E093 guibg=#8C3346 +hi VisualNOS gui=NONE guifg=NONE guibg=NONE + +hi Pmenu gui=NONE guifg=NONE guibg=#000000 +hi PmenuSbar gui=NONE guifg=NONE guibg=#262626 +hi PmenuSel gui=NONE guifg=NONE guibg=#333333 +hi PmenuThumb gui=NONE guifg=NONE guibg=#424242 +hi DiffAdd gui=NONE guifg=NONE guibg=#082608 +hi DiffChange gui=NONE guifg=NONE guibg=#000000 +hi DiffDelete gui=NONE guifg=NONE guibg=#260808 +hi DiffText gui=NONE guifg=NONE guibg=#333333 +hi Search gui=NONE guifg=#161616 guibg=#909636 +hi IncSearch gui=NONE guifg=#161616 guibg=#aadb0f + +hi Comment gui=italic guifg=#F2F2F2 guibg=NONE +hi Type gui=NONE guifg=#aadb0f guibg=NONE +hi Boolean gui=NONE guifg=#aadb0f guibg=NONE +hi String gui=NONE guifg=#aadb0f guibg=NONE +hi Number gui=NONE guifg=#aadb0f guibg=NONE +hi Title gui=bold guifg=#aadb0f guibg=NONE +hi Todo gui=standout guifg=NONE guibg=NONE +hi Constant gui=italic guifg=#F2F2F2 guibg=NONE +hi Identifier gui=bold guifg=#F2F2F2 guibg=#161616 +hi Statement gui=bold guifg=#aadb0f guibg=NONE +hi StorageClass gui=bold guifg=#aadb0f guibg=NONE +hi Conditional gui=bold guifg=#aadb0f guibg=NONE +hi MatchParen gui=bold guifg=NONE guibg=NONE + +hi Special gui=NONE guifg=#808080 guibg=NONE +hi SpecialKeyTab gui=NONE guifg=NONE guibg=#212121 + +hi ColorColumn gui=NONE guifg=NONE guibg=#000000 +hi Conceal gui=NONE guifg=#808080 guibg=NONE +hi Directory gui=NONE guifg=#F2F2F2 guibg=NONE +hi Error gui=NONE guifg=NONE guibg=#8C3346 +hi ErrorMsg gui=NONE guifg=NONE guibg=#8C3346 +hi FoldColumn gui=NONE guifg=#616161 guibg=NONE +hi Folded gui=NONE guifg=#707070 guibg=NONE +hi Ignore gui=NONE guifg=NONE guibg=NONE +hi ModeMsg gui=NONE guifg=NONE guibg=NONE +hi MoreMsg gui=NONE guifg=NONE guibg=NONE +hi Question gui=NONE guifg=NONE guibg=NONE +hi SignColumn gui=NONE guifg=#616161 guibg=NONE +hi Underlined gui=NONE guifg=NONE guibg=NONE +hi WarningMsg gui=NONE guifg=NONE guibg=#260808 +hi WildMenu gui=NONE guifg=NONE guibg=#525252 +hi lCursor gui=NONE guifg=NONE guibg=NONE +hi PreProc gui=NONE guifg=NONE guibg=NONE + +hi SpellBad gui=undercurl guifg=NONE guibg=#260808 +hi SpellCap gui=undercurl guifg=NONE guibg=NONE +hi SpellLocal gui=undercurl guifg=NONE guibg=#082608 +hi SpellRare gui=undercurl guifg=NONE guibg=#262626 + +hi xmlTagName gui=NONE guifg=#F2F2F2 guibg=NONE +hi xmlEndTag gui=NONE guifg=#F2F2F2 guibg=NONE +hi xmlNamespace gui=bold guifg=#F2F2F2 guibg=NONE +hi xmlAttrib gui=NONE guifg=#F2F2F2 guibg=NONE + +hi vimwikiLink gui=underline guifg=#aadb0f guibg=NONE + +hi texSection gui=bold guifg=#aadb0f guibg=NONE +hi texMathZoneX gui=NONE guifg=NONE guibg=#000000 +hi texMathText gui=NONE guifg=NONE guibg=#000000 +hi texMathSymbol gui=bold guifg=NONE guibg=#000000 +hi texMathOper gui=bold guifg=#aadb0f guibg=#000000 +hi texMathMatcher gui=NONE guifg=NONE guibg=#000000 +hi texTypeStyle gui=bold guifg=NONE guibg=#000000 +hi texStatement gui=bold guifg=NONE guibg=NONE +hi texGreek gui=NONE guifg=NONE guibg=#000000 +hi texBeginEnd gui=NONE guifg=#aadb0f guibg=NONE +hi texSubscript gui=NONE guifg=NONE guibg=#000000 +hi texSuperscript gui=NONE guifg=NONE guibg=#000000 +hi texBeginEndName gui=NONE guifg=NONE guibg=NONE +hi Conceal gui=NONE guifg=NONE guibg=#000000 + +hi prologClauseHead gui=NONE guifg=#aadb0f guibg=NONE + +hi IndentGuidesEven gui=NONE guifg=#424242 guibg=#2D2D2D +hi IndentGuidesOdd gui=NONE guifg=#424242 guibg=#2D2D2D + +match SpecialKey '^\s\+' diff --git a/pkgs/vim/custom.nix b/pkgs/vim/custom.nix new file mode 100644 index 0000000..32700f6 --- /dev/null +++ b/pkgs/vim/custom.nix @@ -0,0 +1,26 @@ +{ pkgs }: + +let + vimrc = builtins.readFile ./conf/rc.vim; + plugins = pkgs.callPackage ./plugins.nix {}; +in +{ + vam = { + knownPlugins = pkgs.vimPlugins // plugins; + pluginDictionaries = [ + { names = [ + "ctrlp" + "undotree" + "vim-gitgutter" + "goyo" + "vim-localvimrc" + "tagbar" + "vim-addon-nix" + "vim-autoformat" + "vim-csexact" + "vim-color-akr" + ];} + ]; + }; + customRC = vimrc; +} diff --git a/pkgs/vim/nvim.nix b/pkgs/vim/nvim.nix new file mode 100644 index 0000000..f9647ce --- /dev/null +++ b/pkgs/vim/nvim.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: + +let + nvim = pkgs.neovim.override { + vimAlias = false; + configure = (import ./custom.nix { pkgs = pkgs; }); + }; +in [ + nvim + pkgs.ctags + pkgs.git +] diff --git a/pkgs/vim/plugins.nix b/pkgs/vim/plugins.nix new file mode 100644 index 0000000..755ccf3 --- /dev/null +++ b/pkgs/vim/plugins.nix @@ -0,0 +1,18 @@ +{ pkgs, fetchgit }: + +let + buildVimPlugin = pkgs.vimUtils.buildVimPluginFrom2Nix; +in { + "vim-csexact" = buildVimPlugin { + name = "vim-csexact"; + src = fetchgit { + url = "https://github.com/KevinGoodsell/vim-csexact"; + rev = "d694a55e8daee475bdf4748a1ef7c1562b581476"; + sha256 = "1kwpxk68prdpzw4b7mpfwh2vq99gfymr544wzwcm072h2x89s1dv"; + }; + }; + "vim-color-akr" = buildVimPlugin { + name = "vim-csexact"; + src = ./conf/vim-color-akr; + }; +} diff --git a/pkgs/vim/vim.nix b/pkgs/vim/vim.nix new file mode 100644 index 0000000..0af940e --- /dev/null +++ b/pkgs/vim/vim.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +let + custom_vim = pkgs.vim_configurable.customize { + name = "vim"; + vimrcConfig = (import ./custom.nix { pkgs = pkgs; }); + }; +in pkgs.lib.overrideDerivation custom_vim ( o: { + gui = true; + ftNixSupport = true; + cscopeSupport = true; + fontsetSupport = true; + multibyteSupport = true; +} ) -- cgit v1.2.3