From 69b718cc930e0a97d2d785cfec8b6c5fa2f1b367 Mon Sep 17 00:00:00 2001 From: kmein Date: Mon, 17 Sep 2018 16:51:00 +0200 Subject: [PATCH] Surprisingly: configure more ~ factor out into ./configs/ + timezone, sound ~ wpa_supplicant hashed passwords + kdeconnect ~ writeBash -> writeDash --- config.nix | 222 ++++---------------- dot/vim.nix => configs/editors.nix | 211 ++++++++++--------- configs/graphics.nix | 326 +++++++++++++++++++++++++++++ configs/packages.nix | 86 ++++++++ configs/shells.nix | 63 ++++++ dot/i3.nix | 116 ---------- dot/i3blocks.nix | 176 ---------------- dot/nano.nix | 8 - dot/scripts.nix | 80 +++---- dot/terminal.nix | 1 - theme.nix | 29 ++- 11 files changed, 675 insertions(+), 643 deletions(-) rename dot/vim.nix => configs/editors.nix (70%) create mode 100644 configs/graphics.nix create mode 100644 configs/packages.nix create mode 100644 configs/shells.nix delete mode 100644 dot/i3.nix delete mode 100644 dot/i3blocks.nix delete mode 100644 dot/nano.nix diff --git a/config.nix b/config.nix index 06270f7..90c79bf 100644 --- a/config.nix +++ b/config.nix @@ -1,138 +1,52 @@ { config, lib, pkgs, ... }: let + scripts = import ./dot/scripts.nix pkgs; + constants = import ./constants.nix; + wallpaper = pkgs.copyPathToStore ./art/haskell-grey.png; theme = { gtk = { name = "Numix-SX-Dark"; package = pkgs.numix-sx-gtk-theme; }; icon = { name = "Papirus-Adapta-Nokto"; package = pkgs.papirus-icon-theme; }; }; - defaultApplications = { - terminal = "${pkgs.xfce.terminal}/bin/xfce4-terminal"; - webBrowser = "${pkgs.chromium}/bin/chromium-browser"; - fileManager = "${pkgs.gnome3.nautilus}/bin/nautilus"; - screenLocker = with import ./theme.nix; - "${pkgs.i3lock}/bin/i3lock -e -c ${lib.strings.removePrefix "#" black}"; - }; - wallpaper = pkgs.copyPathToStore ./art/haskell-grey.png; - scripts = import ./dot/scripts.nix pkgs defaultApplications; - constants = import ./constants.nix; in { imports = [ "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" + ./configs/shells.nix + ./configs/editors.nix + ./configs/graphics.nix + ./configs/packages.nix ]; nixpkgs.config = { allowUnfree = true; packageOverrides = - let nix-writers = builtins.fetchGit { url = https://cgit.krebsco.de/nix-writers/; ref = "tags/v2.1.0"; }; - in import "${nix-writers}/pkgs" pkgs; + let nix-writers = builtins.fetchGit { + url = https://cgit.krebsco.de/nix-writers/; + ref = "tags/v3.0.0"; + # sha256 = "066y18q19d35x5jjr3kdn1dwi7s1l12icr90s2vxwzif6ahnzmb3"; + }; in import "${nix-writers}/pkgs" pkgs; }; + time.timeZone = "Europe/Berlin"; + + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.bluetooth.enable = true; + security.sudo.enable = true; - security.sudo.extraConfig = "Defaults insults"; + security.sudo.extraConfig = "Defaults insults"; fonts.enableDefaultFonts = true; - fonts.fonts = with pkgs; [ powerline-fonts roboto font-awesome-ttf fira-code eb-garamond lmodern ]; - environment.systemPackages = with pkgs; [ - theme.icon.package theme.gtk.package - ffmpeg mpv youtubeDL - imagemagick - zathura - chromium google-chrome firefox lynx w3m firefoxPackages.tor-browser - lxappearance - libnotify - xfce.terminal - pamixer - gnome3.nautilus - git - ripgrep tree - whois - wget htop zip unzip - rlwrap - pmount - gnumake - (import ./dot/vim.nix pkgs) - ]; + users.mutableUsers = false; + users.users.kfm = { - createHome = true; - description = constants.user.name; - extraGroups = [ "wheel" ]; - group = "users"; + name = "kfm"; home = "/home/kfm"; - shell = pkgs.zsh; + createHome = true; + group = "users"; + extraGroups = [ "wheel" "audio" ]; password = "kfm"; - packages = with pkgs; [ - texlive.combined.scheme-tetex - franz - grive2 - gnuplot maxima - libreoffice-fresh - kdeconnect - par haskellPackages.pandoc haskellPackages.pandoc-citeproc biber - haskellPackages.hakyll - spotify gnome3.gnome-music audacity - calibre - inkscape - stack haskellPackages.hasktags haskellPackages.hindent haskellPackages.ghcid haskellPackages.hoogle - rustup - gcc tinycc ctags - python3 mypy - nodejs jo - perl ruby lua - nasm - ocaml fsharp swiProlog haskellPackages.idris - clojure racket-minimal - scala - ]; - }; - - environment.variables.EDITOR = pkgs.lib.mkForce "vim"; - - environment.shellAliases = - let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}"; - in { - ":r" = ''echo "You stupid!"''; - chrome-no-traces = "${pkgs.google-chrome}/bin/google-chrome-stable -incognito --user-data-dir=$HOME/.config/google-chrome/Incognito --disk-cache-dir=/dev/null --disk-cache-size=1"; - clipboard = "${pkgs.xclip}/bin/xclip -se c"; - external-ip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @resolver1.opendns.com"; - ghc = "${pkgs.stack}/bin/stack ghc --"; - ghci = "${pkgs.stack}/bin/stack ghc -- --interactive"; - ip = "${pkgs.iproute}/bin/ip -c"; - ocaml = rlwrap "${pkgs.ocaml}/bin/ocaml"; - tmux = "${pkgs.tmux}/bin/tmux -2"; - vi = "vim"; - } // scripts; - - services.xserver = with import ./constants.nix; { - enable = true; - layout = commaSep [ "de" "gr" "ru" ]; - xkbVariant = commaSep [ "T3" "polytonic" "phonetic_winkeys" ]; - xkbOptions = commaSep [ "terminate:ctrl_alt_bksp" "grp:alt_space_toggle" ]; - libinput.enable = true; - xautolock = { - enable = true; - time = 15; - locker = defaultApplications.screenLocker; - nowlocker = defaultApplications.screenLocker; - enableNotifier = true; - notifier = ''${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking soon" "The screen will lock in 10 seconds."''; - }; - displayManager.auto = { - enable = true; - user = "kfm"; - }; - desktopManager.xterm.enable = false; - desktopManager.wallpaper.mode = "fill"; - windowManager.default = "i3"; - windowManager.i3 = { - enable = true; - configFile = pkgs.writeText "i3.conf" (import ./dot/i3.nix pkgs defaultApplications); - extraPackages = []; - }; - }; - i18n = { - defaultLocale = "en_GB.UTF-8"; - consoleUseXkbConfig = true; - consoleColors = with import ./theme.nix; map (c: lib.strings.removePrefix "#" c) colorPalette; + shell = pkgs.zsh; }; services.cron = { @@ -142,15 +56,6 @@ in { ]; }; - services.compton = { - enable = true; - fade = true; - shadow = true; - menuOpacity = "0.9"; - shadowOpacity = "0.5"; - fadeDelta = 2; - }; - services.openssh.enable = true; programs.ssh = { startAgent = true; @@ -164,45 +69,6 @@ in { temperature = { night = 25000; day = 1000; }; }; - hardware.pulseaudio.enable = true; - hardware.bluetooth.enable = true; - - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestions.enable = true; - syntaxHighlighting.enable = true; - syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "cursor" "root" "line" ]; - interactiveShellInit = '' - setopt INTERACTIVE_COMMENTS - setopt MULTIOS - setopt AUTO_PUSHD - setopt AUTO_NAME_DIRS - setopt PUSHD_MINUS - setopt PUSHD_TO_HOME - ''; - promptInit = '' - PROMPT="%{$fg_bold[white]%}%~ \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")%#%{$reset_color%} " - RPROMPT='$(git_prompt_info)' - - ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[cyan]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*" - ''; - ohMyZsh.enable = true; - ohMyZsh.plugins = [ "common-aliases" ]; - - }; - programs.bash = { - promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) ''; - enableCompletion = true; - }; - - programs.command-not-found.enable = true; - - programs.java.enable = true; - programs.light.enable = true; - programs.tmux = { enable = true; extraTmuxConf = import ./dot/tmux.nix; @@ -210,8 +76,6 @@ in { terminal = "screen-256color"; }; - programs.nano.nanorc = import ./dot/nano.nix; - # networking.hostName = "scardanelli"; networking.hosts = { "192.168.178.27" = [ "printer.local" ]; @@ -219,10 +83,9 @@ in { networking.wireless.enable = true; networking.wireless.networks = { - Aether = { psk = "Kein ding sei wo das wort gebricht."; }; - "Asoziales Netzwerk" = { psk = "WirFragenDichNicht"; }; + Aether = { pskRaw = "e1b18af54036c5c9a747fe681c6a694636d60a5f8450f7dec0d76bc93e2ec85a"; }; + "Asoziales Netzwerk" = { pskRaw = "8e234041ec5f0cd1b6a14e9adeee9840ed51b2f18856a52137485523e46b0cb6"; }; }; - networking.wireless.userControlled.enable = true; home-manager.users.kfm = { gtk = { @@ -270,6 +133,8 @@ in { }; }; + services.kdeconnect.enable = true; + services.dunst = with import ./theme.nix; { enable = true; iconTheme = theme.icon; @@ -300,32 +165,17 @@ in { max_icon_size = 32; sticky_history = true; history_length = 20; - dmenu = "${pkgs.rofi}/bin/rofi -display-run 'dunst: ' -show run"; - browser = defaultApplications.webBrowser; + dmenu = "${pkgs.rofi}/bin/rofi -display-run dunst -show run"; + browser = "${pkgs.xdg_utils}/bin/xdg-open"; verbosity = "mesg"; corner_radius = 0; mouse_left_click = "do_action"; mouse_right_click = "close_current"; mouse_middle_click = "close_all"; }; - urgency_low = { - frame_color = veryDark; - background = veryDark; - foreground = gray.light; - timeout = 5; - }; - urgency_normal = { - frame_color = veryDark; - background = gray.light; - foreground = veryDark; - timeout = 10; - }; - urgency_critical = { - frame_color = veryDark; - background = red.dark; - foreground = veryDark; - timeout = 0; - }; + urgency_low = { frame_color = veryDark; background = veryDark; foreground = gray.light; timeout = 5; }; + urgency_normal = { frame_color = veryDark; background = gray.light; foreground = veryDark; timeout = 10; }; + urgency_critical = { frame_color = veryDark; background = red.dark; foreground = veryDark; timeout = 0; }; }; }; @@ -335,7 +185,7 @@ in { ".stack/config.yaml".text = import ./dot/stack.nix constants.user; ".config/zathura/zathurarc".text = "set selection-clipboard clipboard"; ".config/mpv/input.conf".text = import ./dot/mpv.nix; - ".config/xfce4/terminal/terminalrc".text = import ./dot/terminal.nix defaultApplications; + ".config/xfce4/terminal/terminalrc".text = import ./dot/terminal.nix; ".zshrc".text = "# nothing to see here"; }; }; diff --git a/dot/vim.nix b/configs/editors.nix similarity index 70% rename from dot/vim.nix rename to configs/editors.nix index 602c3d7..775a17f 100644 --- a/dot/vim.nix +++ b/configs/editors.nix @@ -1,48 +1,11 @@ -pkgs: -let vimrc = with import ../constants.nix; '' - if exists("g:loaded_airline") - set noshowmode laststatus=0 noruler - let g:airline#extensions#tabline#close_symbol = 'X' - let g:airline#extensions#tabline#enabled = 0 - let g:airline#extensions#tabline#left_alt_sep = '' - let g:airline#extensions#tabline#left_sep = '' - let g:airline#extensions#tabline#right_alt_sep = '' - let g:airline#extensions#tabline#right_sep = '' - let g:airline#extensions#tabline#show_close_button = 1 - let g:airline#extensions#tabline#show_tab_type = 0 - let g:airline#extensions#tabline#tab_min_count = 2 - let g:airline#extensions#tabline#tab_nr_type = 0 - let g:airline#extensions#tmuxline#enabled = 0 - let g:airline#extensions#wordcount#enabled = 1 - let g:airline_left_alt_sep = '' - let g:airline_left_sep = '' - let g:airline_right_alt_sep = '' - let g:airline_right_sep = '' - let g:airline_section_z = '%{line(".")}/%{line("$")} %{col(".")}' - endif - if exists("g:loaded_airline_themes") - let g:airline_theme='simple' - endif - - if exists("g:loaded_syntastic_plugin") - let g:syntastic_always_populate_loc_list = 1 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_open = 0 - let g:syntastic_check_on_wq = 0 - map ,s :SyntasticToggleMode - endif - - if exists("g:loaded_gundo") - nnoremap :GundoToggle - endif - +{ pkgs, ... }: +let vim_conf = with import ../constants.nix; '' " if tabular vmap a= :Tabularize /= vmap a; :Tabularize /:: vmap a- :Tabularize /-> colorscheme delek - set t_Co=256 filetype plugin indent on set nocompatible @@ -51,20 +14,18 @@ let vimrc = with import ../constants.nix; '' set number set path=$PWD/** set completeopt=menu,longest - set wildmode=longest,list,full - set wildignore+=${commaSep ignoredFiles} + set wildmode=longest,full,list wildignore+=${commaSep ignoredFiles} set shortmess+=aI set nowritebackup noswapfile set mouse=a set showmatch - set encoding=utf8 - set ffs=unix,dos,mac + set encoding=utf8 ffs=unix,dos,mac set smartindent set nowrap set nohlsearch set clipboard=unnamedplus,autoselect set nopaste - set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:⍽ showbreak=↪ + set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:⍽,trail:· showbreak=↪ set foldlevelstart=30 if exists("g:loaded_netrwPlugin") @@ -79,9 +40,7 @@ let vimrc = with import ../constants.nix; '' call matchadd('colorcolumn', '\%101v', 100) highlight folded ctermbg=black highlight colorcolumn ctermbg=red - highlight matchparen cterm=bold ctermbg=black ctermfg=white - highlight TrailSpace ctermbg=red guibg=darkred - match TrailSpace /\s\+$/ + highlight matchparen cterm=bold " undofile - This allows you to use undos after exiting and restarting " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo @@ -124,67 +83,117 @@ let vimrc = with import ../constants.nix; '' command! DiffSaved call s:DiffWithSaved() if has("autocmd") - autocmd filetype markdown,text set formatprg=par\ -w80 + autocmd bufnewfile,bufread *.4th set filetype=forth + autocmd bufnewfile,bufread *.asm set filetype=nasm + autocmd bufnewfile,bufread *.c set keywordprg=man\ 3 + autocmd bufnewfile,bufread *.conf set filetype=conf + autocmd bufnewfile,bufread *.do set filetype=sh + autocmd bufnewfile,bufread *.fs :packadd vim-fsharp | set filetype=fsharp + autocmd bufnewfile,bufread *.h set keywordprg=man\ 3 + autocmd bufnewfile,bufread *.md set filetype=markdown.pandoc + autocmd bufnewfile,bufread *.nix :packadd vim-nix + autocmd bufnewfile,bufread *.rust :packadd rust-vim deoplete-rust + autocmd bufnewfile,bufread *.tex :packadd vimtex | set filetype=tex + autocmd bufnewfile,bufread *.ts :packadd vim-typescript + autocmd bufnewfile,bufread config set filetype=conf + autocmd filetype haskell :packadd Hoogle autocmd filetype haskell set formatprg=hindent - autocmd filetype markdown,text set textwidth=80 + autocmd filetype javascript *.js :packadd vim-javascript + autocmd filetype make setlocal noexpandtab autocmd filetype markdown,text set formatoptions+=t + autocmd filetype markdown,text set formatprg=par\ -w80 + autocmd filetype markdown,text set textwidth=80 + autocmd bufreadpost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif - autocmd bufwritepre * :call StripTrailingWhitespaces() - autocmd bufnewfile,bufread *.md set filetype=markdown.pandoc - autocmd bufnewfile,bufread *.asm set filetype=nasm - autocmd bufnewfile,bufread *.tex :packadd vimtex | set filetype=tex - autocmd bufnewfile,bufread *.rust :packadd rust-vim deoplete-rust - autocmd bufnewfile,bufread *.nix :packadd vim-nix - autocmd filetype javascript *.js :packadd vim-javascript - autocmd bufnewfile,bufread *.ts :packadd vim-typescript - autocmd filetype haskell :packadd Hoogle - autocmd bufnewfile,bufread *.do set filetype=sh - autocmd bufnewfile,bufread config set filetype=conf - autocmd bufnewfile,bufread *.conf set filetype=conf - autocmd bufnewfile,bufread *.4th set filetype=forth - autocmd bufnewfile,bufread *.c set keywordprg=man\ 3 - autocmd bufnewfile,bufread *.h set keywordprg=man\ 3 - - autocmd filetype make setlocal noexpandtab - autocmd bufreadpre * setlocal foldmethod=indent + autocmd bufwritepre * :call StripTrailingWhitespaces() autocmd bufwinenter * if &fdm == 'indent' | setlocal foldmethod=manual | endif endif - ''; in -pkgs.vim_configurable.customize { - name = "vim"; - vimrcConfig.customRC = vimrc; - vimrcConfig.packages.vim = with pkgs.vimPlugins; { - start = [ - ctrlp - deoplete-nvim - supertab - syntastic - tabular - vim-airline - vim-airline-themes - vim-commentary - vim-eunuch - vim-fugitive - vim-gitgutter - vim-pandoc vim-pandoc-after vim-pandoc-syntax - vim-repeat - vim-sensible - vim-startify - vim-surround - ]; - opt = [ - Hoogle - deoplete-rust - idris-vim - vimtex - rust-vim - typescript-vim - vim-javascript - vim-nix - ]; - }; + + "if exists("g:loaded_airline") + set noshowmode laststatus=0 noruler + let g:airline#extensions#tabline#close_symbol = 'X' + let g:airline#extensions#tabline#enabled = 0 + let g:airline#extensions#tabline#left_alt_sep = '' + let g:airline#extensions#tabline#left_sep = '' + let g:airline#extensions#tabline#right_alt_sep = '' + let g:airline#extensions#tabline#right_sep = '' + let g:airline#extensions#tabline#show_close_button = 1 + let g:airline#extensions#tabline#show_tab_type = 0 + let g:airline#extensions#tabline#tab_min_count = 2 + let g:airline#extensions#tabline#tab_nr_type = 0 + let g:airline#extensions#tmuxline#enabled = 0 + let g:airline#extensions#wordcount#enabled = 1 + let g:airline_left_alt_sep = '' + let g:airline_left_sep = '' + let g:airline_right_alt_sep = '' + let g:airline_right_sep = '' + let g:airline_section_z = '%{line(".")}/%{line("$")} %{col(".")}' + "endif + "if exists("g:loaded_airline_themes") + let g:airline_theme='simple' + "endif +''; +in { + environment.variables.EDITOR = pkgs.lib.mkForce "vim"; + environment.shellAliases.vi = "vim"; + environment.shellAliases.view = "vim -R"; + + programs.nano.nanorc = '' + set autoindent + set boldtext + set morespace + set smarthome + set tabsize 4 + set tabstospaces + ''; + + environment.systemPackages = [( + with import {}; + pkgs.vim_configurable.customize { + name = "vim"; + vimrcConfig.customRC = vim_conf; + vimrcConfig.packages.vim = with pkgs.vimPlugins; { + start = [ + ctrlp + deoplete-nvim + supertab + syntastic + tabular + vim-airline vim-airline-themes + vim-commentary + vim-eunuch + vim-fugitive + vim-gitgutter + vim-pandoc vim-pandoc-after vim-pandoc-syntax + vim-repeat + vim-sensible + vim-startify + vim-surround + ]; + opt = [ + Hoogle + deoplete-rust + idris-vim + vimtex + rust-vim + typescript-vim + vim-javascript + vim-nix + (vimUtils.buildVimPluginFrom2Nix { + name = "vim-fsharp-2018-04-19"; + src = fetchFromGitHub { + owner = "fsharp"; + repo = "vim-fsharp"; + rev = "627db7d701747e8fd7924b6505c61e16a369fb72"; + sha256 = "00hhgn2p54faysx1ddccyhl9jnvddgxsczhv0np3mgzza6ls4838"; + }; + }) + ]; + }; + } + )]; } diff --git a/configs/graphics.nix b/configs/graphics.nix new file mode 100644 index 0000000..a322b94 --- /dev/null +++ b/configs/graphics.nix @@ -0,0 +1,326 @@ +{ pkgs, lib, ... }: +let + spotify_info = pkgs.writeBash "spotify.info" '' + STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$) + + if [[ "$STATUS" == 'Playing' ]]; then + printf '\uf1bc ' + printf '\uf04b' + elif [[ "$STATUS" == 'Paused' ]]; then + printf '\uf1bc ' + printf '\uf04c' + elif [[ "$STATUS" == 'Stopped' ]]; then + printf '\uf1bc ' + printf '\uf04d' + else + exit 1 + fi + + printf ' ' + + METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata') + ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$) + TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$) + + printf "%s \u2237 %s" "$ARTIST" "$TITLE" + ''; + battery_info = pkgs.writeBash "battery.info" '' + BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/" + [ -d BAT_DIR ] && cd BAT_DIR || exit 1 + + status=$(cat status) + charge_f=$((100 * $(cat charge_now) / $(cat charge_full))) + + if [[ "$charge_f" -lt 20 ]]; then + printf '\uf244' + elif [[ "$charge_f" -lt 40 ]]; then + printf '\uf243' + elif [[ "$charge_f" -lt 60 ]]; then + printf '\uf242' + elif [[ "$charge_f" -lt 80 ]]; then + printf '\uf241' + else + printf '\uf240' + fi + + printf ' ' + + if [[ "$status" == 'Charging' ]]; then + printf '\uf106' + elif [[ "$status" == 'Discharging' ]]; then + printf '\uf107' + elif [[ "$status" == 'Full' ]]; then + printf '\uf0e7' + else + printf '[%s]' "$status" + fi + + printf ' ' + + if [[ "$status" != 'Full' ]]; then + rate_raw=$(($(cat voltage_now) * $(cat power_now))) + rate=$(bc <<< "scale=1; $rate_raw / 10^12") + printf '%s\u2009W, ' "$rate" + fi + + charge_d=$((100 * $(cat charge_now) / $(cat charge_full))) + printf '%s%%\n' "$charge_d" + + if [[ "$status" == 'Discharging' ]]; then + if [[ "$charge_d" -lt 10 ]]; then + printf '\n#E41C28' + elif [[ "$charge_d" -lt 20 ]]; then + printf '\n#EEBF13' + fi + fi + ''; + volume_info = pkgs.writeBash "volume.info" '' + if [[ "$BLOCK_BUTTON" == 1 ]]; then + ${pkgs.pamixer}/bin/pamixer -i 5 + elif [[ "$BLOCK_BUTTON" == 3 ]]; then + ${pkgs.pamixer}/bin/pamixer -d 5 + elif [[ "$BLOCK_BUTTON" == 2 ]]; then + ${pkgs.pamixer}/bin/pamixer -t + fi + + if $(${pkgs.pamixer}/bin/pamixer --get-mute); then + printf '\uf026 0%%\n\n#EEBF13' + else + volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) + printf '\uf028 %s%%' "$volume" + fi + ''; + fancyDate = pkgs.writeC "fancy_date.c" {} '' + #include + #include + #include + + int main(void) { + time_t now = time(NULL); + struct tm *today = localtime(&now); + wchar_t roman_month = 0x2160 + today->tm_mon; + wprintf(L"%d\u2009%lc\u2009%d [%d]\n", today->tm_mday, roman_month, 1900 + today->tm_year, today->tm_yday/7 + 1); + return 0; + } + ''; + i3blocks_conf = with import ../theme.nix; '' + markup=pango + align=center + color=${white} + + [spotify] + command=${spotify_info} + interval=2 + + [separator] + + [volume] + command=${volume_info} + min_width= 100% + interval=once + signal=3 + + [separator] + + [brightness] + command=printf "%.1f%%" $(${pkgs.xorg.xbacklight}/bin/xbacklight) + label= + min_width= 100% + signal=2 + interval=once + + [separator] + + [cpu_usage] + command=cut -d' ' -f 1-3 < /proc/loadavg + label= + interval=2 + + [separator] + + [ram_usage] + command=free -h | grep "Mem" | awk '{print $3}' + label= + interval=2 + align=center + + [separator] + + [battery] + command=${battery_info} + interval=10 + instance=BAT1 + + [separator] + + [date] + command=${fancyDate} + interval=1 + label= + + [separator] + + [time] + command=date +'%H:%M' + interval=1 + label= + + [separator] + command=${pkgs.xkblayout-state}/bin/xkblayout-state print %s + label= + interval=2 + + [separator] + ''; + i3_conf = with import ../theme.nix; '' + set $mod Mod4 + + font pango:${uiFont.name} ${toString uiFont.size} + floating_modifier $mod + + hide_edge_borders both + new_window pixel 1 + new_float pixel 1 + + bindsym $mod+Return exec ${pkgs.xfce.terminal}/bin/xfce4-terminal + bindsym $mod+y exec ${pkgs.chromium}/bin/chrome-browser + bindsym $mod+t exec ${pkgs.xfce.thunar}/bin/thunar + bindsym $mod+Shift+w exec ${pkgs.xautolock}/bin/xautolock -locknow + bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -display-run — -show run + + bindsym $mod+Shift+q kill + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + bindsym $mod+p workspace prev + bindsym $mod+n workspace next + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + bindsym $mod+h split h + bindsym $mod+v split v + bindsym $mod+f fullscreen toggle + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + bindsym $mod+Shift+z floating toggle + bindsym $mod+Shift+c reload + bindsym $mod+Shift+r restart + + set $WS1 1 + set $WS2 2 + set $WS3 3 + set $WS4 4 + set $WS5 5 + set $WS6 6 + set $WS7 7 + set $WS8 8 + set $WS9 9 + set $WS10 10 + bindsym $mod+0 workspace $WS10 + bindsym $mod+1 workspace $WS1 + bindsym $mod+2 workspace $WS2 + bindsym $mod+3 workspace $WS3 + bindsym $mod+4 workspace $WS4 + bindsym $mod+5 workspace $WS5 + bindsym $mod+6 workspace $WS6 + bindsym $mod+7 workspace $WS7 + bindsym $mod+8 workspace $WS8 + bindsym $mod+9 workspace $WS9 + bindsym $mod+Shift+0 move container to workspace $WS10 + bindsym $mod+Shift+1 move container to workspace $WS1 + bindsym $mod+Shift+2 move container to workspace $WS2 + bindsym $mod+Shift+3 move container to workspace $WS3 + bindsym $mod+Shift+4 move container to workspace $WS4 + bindsym $mod+Shift+5 move container to workspace $WS5 + bindsym $mod+Shift+6 move container to workspace $WS6 + bindsym $mod+Shift+7 move container to workspace $WS7 + bindsym $mod+Shift+8 move container to workspace $WS8 + bindsym $mod+Shift+9 move container to workspace $WS9 + + bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks + bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks + bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks + bindsym XF86MonBrightnessUp exec --no-startup-id ${pkgs.light}/bin/light +A 10 && pkill -RTMIN+2 i3blocks + bindsym XF86MonBrightnessDown exec --no-startup-id ${pkgs.light}/bin/light -A 10 && pkill -RTMIN+2 i3blocks + + mode "  " { + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + bindsym Escape mode "default" + bindsym Space mode "default" + } + bindsym $mod+r mode "  " + + #class container-border container-bg fg indicator window-border + client.focused ${gray.dark} ${black} ${white} ${white} ${gray.medium} + client.focused_inactive ${black} ${black} ${gray.medium} ${white} ${black} + client.unfocused ${black} ${black} ${gray.medium} ${white} ${black} + client.urgent ${red.light} ${black} ${white} ${white} ${red.light} + client.placeholder ${black} ${black} ${gray.medium} ${white} ${black} + + bar { + status_command "${pkgs.i3blocks}/bin/i3blocks -c ${pkgs.writeText "i3blocks.conf" i3blocks_conf}" + position top + + font pango:${uiFont.name},FontAwesome ${toString uiFont.size} + separator_symbol " // " + colors { + separator ${gray.medium} + background ${black} + statusline ${gray.medium} + + # border bg fg + focused_workspace ${black} ${black} ${white} + active_workspace ${black} ${black} ${gray.medium} + inactive_workspace ${black} ${black} ${gray.medium} + urgent_workspace ${black} ${black} ${red.light} + binding_mode ${black} ${black} ${red.light} + } + } +''; +in { + services.xserver = with import ../constants.nix; with import ../theme.nix; { + enable = true; + layout = commaSep [ "de" "gr" "ru" ]; + xkbVariant = commaSep [ "T3" "polytonic" "phonetic_winkeys" ]; + xkbOptions = commaSep [ "terminate:ctrl_alt_bksp" "grp:alt_space_toggle" ]; + libinput.enable = true; + xautolock = let i3lock = "${pkgs.i3lock}/bin/i3lock -e -c ${lib.strings.removePrefix "#" black}"; in { + enable = true; + time = 15; + locker = i3lock; + nowlocker = i3lock; + enableNotifier = true; + notifier = ''${pkgs.libnotify}/bin/notify-send -u normal -a xautolock "Locking soon" "The screen will lock in 10 seconds."''; + }; + displayManager.auto = { enable = true; user = "kfm"; }; + desktopManager.xterm.enable = false; + desktopManager.wallpaper.mode = "fill"; + windowManager.default = "i3"; + windowManager.i3 = { + enable = true; + configFile = pkgs.writeText "i3.conf" i3_conf; + extraPackages = []; + }; + }; + + i18n = { + defaultLocale = "en_GB.UTF-8"; + consoleUseXkbConfig = true; + consoleColors = with import ../theme.nix; map (c: lib.strings.removePrefix "#" c) colorPalette; + }; + + services.compton = { + enable = true; + fade = true; + shadow = true; + menuOpacity = "0.9"; + shadowOpacity = "0.5"; + fadeDelta = 2; + }; +} diff --git a/configs/packages.nix b/configs/packages.nix new file mode 100644 index 0000000..a773d9a --- /dev/null +++ b/configs/packages.nix @@ -0,0 +1,86 @@ +{ pkgs, ... }: +with pkgs; +{ + fonts.fonts = [ + eb-garamond + fira-code + font-awesome-ttf + hasklig + lmodern + powerline-fonts + roboto + ]; + + environment.systemPackages = [ + chromium + ffmpeg + firefox firefoxPackages.tor-browser + git + gnumake + htop + imagemagick + libnotify + libreoffice-fresh + lxappearance + mpv + pamixer + pmount + ripgrep tree + rlwrap + w3m + wget + whois + xclip + xfce.ristretto + xfce.terminal + xfce.thunar + youtubeDL + zathura + zip unzip + ]; + + programs.command-not-found.enable = true; + programs.java.enable = true; + programs.light.enable = true; + + users.users.kfm.packages = [ + audacity + biber + calibre + clojure + ctags + franz + fsharp + gcc + gnuplot + grive2 + haskellPackages.ghcid + haskellPackages.hakyll + haskellPackages.hasktags + haskellPackages.hindent + haskellPackages.hoogle + haskellPackages.idris + haskellPackages.pandoc haskellPackages.pandoc-citeproc + inkscape + jo + lua + maxima + mypy + nasm + nodejs + ocaml + par + perl + python3 + racket-minimal + ruby + rustup + scala + spotify + stack + swiProlog + texlive.combined.scheme-tetex + tinycc + ]; + +} diff --git a/configs/shells.nix b/configs/shells.nix new file mode 100644 index 0000000..3ac4819 --- /dev/null +++ b/configs/shells.nix @@ -0,0 +1,63 @@ +{ pkgs, ... }: +let scripts = import ../dot/scripts.nix pkgs; +in { + environment.shellAliases = + let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}"; + in { + ":r" = ''echo "You stupid!"''; + clipboard = "${pkgs.xclip}/bin/xclip -se c"; + external-ip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @resolver1.opendns.com"; + ghc = "${pkgs.stack}/bin/stack ghc --"; + ghci = "${pkgs.stack}/bin/stack ghc -- --interactive"; + ip = "${pkgs.iproute}/bin/ip -c"; + ocaml = rlwrap "${pkgs.ocaml}/bin/ocaml"; + tmux = "${pkgs.tmux}/bin/tmux -2"; + gdrive = ''sh -c "cd ~/google-drive && ${pkgs.grive2}/bin/grive" >/dev/null 2>&1 &''; + } // scripts; + + environment.extraInit = '' + function mcd { + newdir='_mcd_command_failed_' + if [ -d "$1" ]; then + echo "$1 already exists." + newdir="$1" + else + if [ -n "$2" ]; then + command mkdir -p -m $1 "$2" && newdir="$2" + else + command mkdir -p "$1" && newdir="$1" + fi + fi + cd "$newdir" + } + ''; + + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "cursor" "root" "line" ]; + interactiveShellInit = '' + setopt INTERACTIVE_COMMENTS + setopt MULTIOS + setopt AUTO_NAME_DIRS + setopt PUSHD_MINUS PUSHD_TO_HOME AUTO_PUSHD + ''; + promptInit = '' + PROMPT="%{$fg_bold[white]%}%~ \$([[ \$? == 0 ]] && echo \"%{$fg_bold[green]%}\" || echo \"%{$fg_bold[red]%}\")%#%{$reset_color%} " + RPROMPT='$(git_prompt_info)' + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[cyan]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*" + ''; + ohMyZsh.enable = true; + ohMyZsh.plugins = [ "common-aliases" ]; + }; + + programs.bash = { + promptInit = ''PS1="$(tput bold)\w \$([[ \$? == 0 ]] && echo \"\[\033[1;32m\]\" || echo \"\[\033[1;31m\]\")\$$(tput sgr0) ''; + enableCompletion = true; + }; + +} diff --git a/dot/i3.nix b/dot/i3.nix deleted file mode 100644 index 50b8452..0000000 --- a/dot/i3.nix +++ /dev/null @@ -1,116 +0,0 @@ -pkgs: defaultApplications: -let theme = import ../theme.nix; in -with theme; -'' -set $mod Mod4 - -font pango:${uiFont.name} ${toString uiFont.size} -floating_modifier $mod - -hide_edge_borders both -new_window pixel 1 -new_float pixel 1 - -bindsym $mod+Return exec ${defaultApplications.terminal} -bindsym $mod+y exec ${defaultApplications.webBrowser} -bindsym $mod+t exec ${defaultApplications.fileManager} -bindsym $mod+Shift+w exec ${pkgs.xautolock}/bin/xautolock -locknow -bindsym $mod+Shift+q kill -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right -bindsym $mod+p workspace prev -bindsym $mod+n workspace next -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right -bindsym $mod+h split h -bindsym $mod+v split v -bindsym $mod+f fullscreen toggle -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split -bindsym $mod+Shift+z floating toggle -bindsym $mod+Shift+c reload -bindsym $mod+Shift+r restart -bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -display-run — -show run - -set $WS1 1 -set $WS2 2 -set $WS3 3 -set $WS4 4 -set $WS5 5 -set $WS6 6 -set $WS7 7 -set $WS8 8 -set $WS9 9 -set $WS10 10 -bindsym $mod+0 workspace $WS10 -bindsym $mod+1 workspace $WS1 -bindsym $mod+2 workspace $WS2 -bindsym $mod+3 workspace $WS3 -bindsym $mod+4 workspace $WS4 -bindsym $mod+5 workspace $WS5 -bindsym $mod+6 workspace $WS6 -bindsym $mod+7 workspace $WS7 -bindsym $mod+8 workspace $WS8 -bindsym $mod+9 workspace $WS9 -bindsym $mod+Shift+0 move container to workspace $WS10 -bindsym $mod+Shift+1 move container to workspace $WS1 -bindsym $mod+Shift+2 move container to workspace $WS2 -bindsym $mod+Shift+3 move container to workspace $WS3 -bindsym $mod+Shift+4 move container to workspace $WS4 -bindsym $mod+Shift+5 move container to workspace $WS5 -bindsym $mod+Shift+6 move container to workspace $WS6 -bindsym $mod+Shift+7 move container to workspace $WS7 -bindsym $mod+Shift+8 move container to workspace $WS8 -bindsym $mod+Shift+9 move container to workspace $WS9 - -bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks -bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks -bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks -bindsym XF86MonBrightnessUp exec --no-startup-id ${pkgs.light}/bin/light +A 10 && pkill -RTMIN+2 i3blocks -bindsym XF86MonBrightnessDown exec --no-startup-id ${pkgs.light}/bin/light -A 10 && pkill -RTMIN+2 i3blocks - -mode "  " { - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - bindsym Escape mode "default" - bindsym Space mode "default" -} -bindsym $mod+r mode "  " - -#class container-border container-bg fg indicator window-border -client.focused ${gray.dark} ${black} ${white} ${white} ${gray.dark} -client.focused_inactive ${black} ${black} ${gray.dark} ${white} ${black} -client.unfocused ${black} ${black} ${gray.dark} ${white} ${black} -client.urgent ${red.light} ${black} ${white} ${white} ${red.light} -client.placeholder ${black} ${black} ${gray.dark} ${white} ${black} - -bar { - status_command "${pkgs.i3blocks}/bin/i3blocks -c ${pkgs.writeTextFile { - name = "i3blocks.conf"; - text = import ./i3blocks.nix { inherit pkgs theme; }; - }}" - position top - - font pango:${uiFont.name},FontAwesome ${toString uiFont.size} - separator_symbol " // " - colors { - separator ${gray.dark} - background ${black} - statusline ${gray.dark} - - # border bg fg - focused_workspace ${black} ${black} ${white} - active_workspace ${black} ${black} ${gray.light} - inactive_workspace ${black} ${black} ${gray.dark} - urgent_workspace ${black} ${black} ${red.light} - binding_mode ${black} ${black} ${red.light} - } -} -'' diff --git a/dot/i3blocks.nix b/dot/i3blocks.nix deleted file mode 100644 index 70762a8..0000000 --- a/dot/i3blocks.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ pkgs, theme }: -let - spotify_info = pkgs.writeBash "spotify.info" '' - STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$) - - if [[ "$STATUS" == 'Playing' ]]; then - printf '\uf1bc ' - printf '\uf04b' - elif [[ "$STATUS" == 'Paused' ]]; then - printf '\uf1bc ' - printf '\uf04c' - elif [[ "$STATUS" == 'Stopped' ]]; then - printf '\uf1bc ' - printf '\uf04d' - else - exit 1 - fi - - printf ' ' - - METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata') - ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$) - TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$) - - printf "%s \u2237 %s" "$ARTIST" "$TITLE" - ''; - battery_info = pkgs.writeBash "battery.info" '' - BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/" - [ -d BAT_DIR ] && cd BAT_DIR || exit 1 - - status=$(cat status) - charge_f=$((100 * $(cat charge_now) / $(cat charge_full))) - - if [[ "$charge_f" -lt 20 ]]; then - printf '\uf244' - elif [[ "$charge_f" -lt 40 ]]; then - printf '\uf243' - elif [[ "$charge_f" -lt 60 ]]; then - printf '\uf242' - elif [[ "$charge_f" -lt 80 ]]; then - printf '\uf241' - else - printf '\uf240' - fi - - printf ' ' - - if [[ "$status" == 'Charging' ]]; then - printf '\uf106' - elif [[ "$status" == 'Discharging' ]]; then - printf '\uf107' - elif [[ "$status" == 'Full' ]]; then - printf '\uf0e7' - else - printf '[%s]' "$status" - fi - - printf ' ' - - if [[ "$status" != 'Full' ]]; then - rate_raw=$(($(cat voltage_now) * $(cat power_now))) - rate=$(bc <<< "scale=1; $rate_raw / 10^12") - printf '%s\u2009W, ' "$rate" - fi - - charge_d=$((100 * $(cat charge_now) / $(cat charge_full))) - printf '%s%%\n' "$charge_d" - - if [[ "$status" == 'Discharging' ]]; then - if [[ "$charge_d" -lt 10 ]]; then - printf '\n#E41C28' - elif [[ "$charge_d" -lt 20 ]]; then - printf '\n#EEBF13' - fi - fi - ''; - volume_info = pkgs.writeBash "volume.info" '' - if [[ "$BLOCK_BUTTON" == 1 ]]; then - ${pkgs.pamixer}/bin/pamixer -i 5 - elif [[ "$BLOCK_BUTTON" == 3 ]]; then - ${pkgs.pamixer}/bin/pamixer -d 5 - elif [[ "$BLOCK_BUTTON" == 2 ]]; then - ${pkgs.pamixer}/bin/pamixer -t - fi - - if $(${pkgs.pamixer}/bin/pamixer --get-mute); then - printf '\uf026 0%%\n\n#EEBF13' - else - volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) - printf '\uf028 %s%%' "$volume" - fi - ''; - fancyDate = pkgs.writeC "fancy_date.c" {} '' - #include - #include - #include - - int main(void) { - time_t now = time(NULL); - struct tm *today = localtime(&now); - wchar_t roman_month = 0x2160 + today->tm_mon; - wprintf(L"%d\u2009%lc\u2009%d [%d]\n", today->tm_mday, roman_month, 1900 + today->tm_year, today->tm_yday/7 + 1); - return 0; - } - ''; in -with theme; -'' -markup=pango -align=center -color=${white} - -[spotify] -command=${spotify_info} -interval=2 - -[separator] - -[volume] -command=${volume_info} -min_width= 100% -interval=once -signal=3 - -[separator] - -[brightness] -command=printf "%.1f%%" $(${pkgs.xorg.xbacklight}/bin/xbacklight) -label= -min_width= 100% -signal=2 -interval=once - -[separator] - -[cpu_usage] -command=cut -d' ' -f 1-3 < /proc/loadavg -label= -interval=2 - -[separator] - -[ram_usage] -command=free -h | grep "Mem" | awk '{print $3}' -label= -interval=2 -align=center - -[separator] - -[battery] -command=${battery_info} -#echo "$(cat /sys/class/power_supply/BAT1/capacity)% ($(cat /sys/class/power_supply/BAT1/status))" -interval=10 -instance=BAT1 - -[separator] - -[date] -command=${fancyDate} -interval=1 -label= - -[separator] - -[time] -command=date +'%H:%M' -interval=1 -label= - -[separator] -command=${pkgs.xkblayout-state}/bin/xkblayout-state print %s -label= -interval=2 - -[separator] -'' diff --git a/dot/nano.nix b/dot/nano.nix deleted file mode 100644 index 1ae00ad..0000000 --- a/dot/nano.nix +++ /dev/null @@ -1,8 +0,0 @@ -'' - set autoindent - set boldtext - set morespace - set smarthome - set tabsize 4 - set tabstospaces -'' diff --git a/dot/scripts.nix b/dot/scripts.nix index 77d9886..2671c33 100644 --- a/dot/scripts.nix +++ b/dot/scripts.nix @@ -1,4 +1,4 @@ -pkgs: defaultApplications: +pkgs: let bingWallpaper = pkgs.writeBash "bing-wallpaper.sh" '' PICTURE_DIR="$HOME/pictures/external/bing/" @@ -17,7 +17,7 @@ let fi done ''; - colorize = pkgs.writeBash "colorize.sh" '' + colorize = pkgs.writeDash "colorize.sh" '' highlight=$(which highlight 2>/dev/null) pygmentize=$(which pygmentize 2>/dev/null) @@ -40,7 +40,7 @@ let cat "$2" | colorize "$1" fi ''; - easyBackup = pkgs.writeBash "easy-backup.sh" '' + easyBackup = pkgs.writeDash "easy-backup.sh" '' if [ -d "$1" ]; then OUTPUT_ROOT=''${1}/backup/current rsync -hav --delete --stats --progress --exclude-from=$HOME/bin/backup.exclude $HOME/* $OUTPUT_ROOT/ @@ -149,22 +149,22 @@ let echo Compiler for "$ext" not found!;; esac ''; - gitPullAll = pkgs.writeBash "git-pull-all.sh" '' + gitPullAll = pkgs.writeDash "git-pull-all.sh" '' # store the current dir CUR_DIR=$(pwd) # Let the person running the script know what's going on. echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n" # Find all git repositories and update it to the master latest revision for i in $(find . -name ".git" | cut -c 3-); do - echo ""; - echo -e "\033[33m"+$i+"\033[0m"; - # We have to go to the .git parent directory to call the pull command - cd "$i"; - cd ..; - # finally pull - git pull origin master; - # lets get back to the CUR_DIR - cd $CUR_DIR + echo ""; + echo -e "\033[33m"+$i+"\033[0m"; + # We have to go to the .git parent directory to call the pull command + cd "$i"; + cd ..; + # finally pull + git pull origin master; + # lets get back to the CUR_DIR + cd $CUR_DIR done echo -e "\n\033[32mComplete!\033[0m\n" ''; @@ -172,40 +172,40 @@ let haskellDefinition = pkgs.writeBash "hdef.sh" '' paths="" while true; do - if [ -d "$1" ]; then - paths="$paths $1" - else - break - fi - shift + if [ -d "$1" ]; then + paths="$paths $1" + else + break + fi + shift done str="$1" shift lower=$(echo "$str" | tr A-Z a-z) if [ "''${lower:0:1}" == "''${str:0:1}" ]; then - expr="($str( |$)|[[:space:]]+$str[[:space:]]*::)" + expr="($str( |$)|[[:space:]]+$str[[:space:]]*::)" else - kws="(class|data|type|newtype)" - eow="([ \n\t]|$)" - expr="$kws[[:space:]]+($str$eow|[^=]+=>[[:space:]]+$str$eow)" + kws="(class|data|type|newtype)" + eow="([ \n\t]|$)" + expr="$kws[[:space:]]+($str$eow|[^=]+=>[[:space:]]+$str$eow)" fi ${haskellFind} $paths -print0 | xargs -0 grep -En --colour=never -A10 "$@" "^$expr" | ${gripe} hcol | ${highlight} $str ''; - haskellFind = pkgs.writeBash "hfind.sh" '' + haskellFind = pkgs.writeDash "hfind.sh" '' paths="" while true; do - if [ -d "$1" ]; then - paths="$paths $1" - else - break - fi - shift + if [ -d "$1" ]; then + paths="$paths $1" + else + break + fi + shift done find $paths \( -name "*.hs" -or -name "*.hsi" -or -name "*.lhs" -or -name "*.hs-boot" \) -a -not \( -name ".*" -or -path "*/_darcs/*" -o -name '.£*' \) "$@" ''; - haskellGrep = pkgs.writeBash "hgrep.sh" '' + haskellGrep = pkgs.writeDash "hgrep.sh" '' if [ -z "$1" -o "$1" == "--help" -o "$1" == "-h" ]; then echo "Usage: hg [PATH] IDENTIFIER [GREP OPTIONS...]" echo "Seaches for uses of the given Haskell identifier." @@ -214,17 +214,17 @@ let paths="" while true; do - if [ -d "$1" ]; then - paths="$paths $1" - else - break - fi - shift + if [ -d "$1" ]; then + paths="$paths $1" + else + break + fi + shift done colour=always if [ "$TERM" == "dumb" -o "$NO_COLORS" == "1" ]; then - colour=never + colour=never fi ${haskellFind} $paths -print0 | xargs -0 grep -nw --colour=$colour "$@" ''; @@ -278,7 +278,7 @@ let for line in sys.stdin: sys.stdout.write(reduce(lambda s, f: f(s), hlfuns, line)) ''; - haskellTags = pkgs.writeBash "htags.sh" '' + haskellTags = pkgs.writeDash "htags.sh" '' id="[a-z_][a-zA-Z0-9_\']*" ws="[ \\t]" ID="[A-Z][a-zA-Z0-9_\']*" @@ -633,7 +633,7 @@ let echo ''${1// /-} } eval $(${spotifyCli} eval) - ${defaultApplications.webBrowser} "http://genius.com/$(normalise "$SPOTIFY_ARTIST")-$(normalise "$SPOTIFY_TITLE")-lyrics" + ${pkgs.xdg_utils}/bin/xdg-open "http://genius.com/$(normalise "$SPOTIFY_ARTIST")-$(normalise "$SPOTIFY_TITLE")-lyrics" ''; in { compile = compile; diff --git a/dot/terminal.nix b/dot/terminal.nix index b8a807a..7a7a913 100644 --- a/dot/terminal.nix +++ b/dot/terminal.nix @@ -1,4 +1,3 @@ -defaultApplications: with import ../theme.nix; '' [Configuration] diff --git a/theme.nix b/theme.nix index b822de7..7e4f485 100644 --- a/theme.nix +++ b/theme.nix @@ -1,4 +1,4 @@ -{ +rec { uiFont = { name = "Roboto"; size = 10; }; terminalFont = { regular = { name = "Roboto Mono for Powerline"; }; @@ -11,19 +11,18 @@ white = "#ffffff"; black = "#000000"; veryDark = "#080808"; -} // rec { - colorPalette = [ - gray.dark red.dark green.dark yellow.dark blue.dark magenta.dark cyan.dark gray.light - gray.dark red.light green.light yellow.light blue.light magenta.light cyan.light gray.light - ]; - # Antares color scheme - gray = { light = "#bbbbbb"; dark = "#151515"; }; - red = { light = "#de575c"; dark = "#de575c"; }; - yellow = { light = "#ebe971"; dark = "#ebe971"; }; - green = { light = "#00b853"; dark = "#00b853"; }; - blue = { light = "#90d0f0"; dark = "#7fc6f0"; }; - magenta = { light = "#cf9ffa"; dark = "#cf9ffa"; }; - cyan = { light = "#4ae5e8"; dark = "#4ae5e8"; }; - } + colorPalette = [ + gray.dark red.dark green.dark yellow.dark blue.dark magenta.dark cyan.dark gray.light + gray.dark red.light green.light yellow.light blue.light magenta.light cyan.light gray.light + ]; + # Antares color scheme + gray = { light = "#bbbbbb"; dark = "#151515"; medium = "#aaaaaa"; }; + red = { light = "#de575c"; dark = "#de575c"; }; + yellow = { light = "#ebe971"; dark = "#ebe971"; }; + green = { light = "#00b853"; dark = "#00b853"; }; + blue = { light = "#90d0f0"; dark = "#7fc6f0"; }; + magenta = { light = "#cf9ffa"; dark = "#cf9ffa"; }; + cyan = { light = "#4ae5e8"; dark = "#4ae5e8"; }; +}