From 456e8d50276cdb6559e652cc2ac534410ac5d185 Mon Sep 17 00:00:00 2001 From: kmein Date: Wed, 12 Sep 2018 00:04:55 +0200 Subject: [PATCH] Configure some more ~ Use nix-writers ~ Split packages between system and user + Add screen locking + Log in automatically + Add redshift + Add dunst ~ Use X11 for the wallpaper ~ Fix vim config --- config.nix | 190 ++++++++++++++++++++++++++++++++++------------- dot/ghci.nix | 2 +- dot/i3.nix | 2 +- dot/i3blocks.nix | 16 ++-- dot/terminal.nix | 23 +++--- dot/vim.nix | 82 ++++++++++---------- 6 files changed, 198 insertions(+), 117 deletions(-) diff --git a/config.nix b/config.nix index 04f0968..47884f4 100644 --- a/config.nix +++ b/config.nix @@ -15,51 +15,72 @@ let }; wallpaper = pkgs.copyPathToStore ./art/haskell-grey.png; in { - imports = [ "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" ]; - nixpkgs.config.allowUnfree = true; + imports = [ + "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" + ]; + + nixpkgs.config = { + packageOverrides = + let nix-writers = builtins.fetchGit { + url = https://cgit.krebsco.de/nix-writers/; + ref = "tags/v2.1.0"; + }; in import "${nix-writers}/pkgs" pkgs; + allowUnfree = true; + }; security.sudo.enable = true; fonts.fonts = with pkgs; [ powerline-fonts roboto font-awesome-ttf fira-code eb-garamond lmodern ]; environment.systemPackages = [ theme.icon.package theme.gtk.package] ++ (with pkgs; [ - stack haskellPackages.hasktags - rustup - gcc tinycc ctags - python3 mypy - nodejs jo - perl ruby lua - nasm - ocaml fsharp swiProlog haskellPackages.idris - clojure racket-minimal - jdk scala - ffmpeg mpv youtubeDL - inkscape imagemagick - zathura calibre - spotify gnome3.gnome-music audacity - - par haskellPackages.pandoc biber - + imagemagick + zathura google-chrome firefox lynx w3m firefoxPackages.tor-browser - lxappearance + libnotify xfce.terminal xorg.xbacklight pamixer gnome3.nautilus - kdeconnect git ripgrep tree whois wget htop zip unzip tmux - texlive.combined.scheme-minimal rlwrap - libreoffice-fresh pmount gnumake - franz - grive2 - geogebra gnuplot maxima ]); + users.users.kfm = { + createHome = true; + description = fullName; + extraGroups = [ "wheel" "networkmanager" ]; + group = "users"; + home = "/home/kfm"; + shell = pkgs.zsh; + password = "kfm"; + packages = with pkgs; [ + texlive.combined.scheme-minimal + franz + grive2 + gnuplot maxima + libreoffice-fresh + kdeconnect + par haskellPackages.pandoc biber + spotify gnome3.gnome-music audacity + calibre + inkscape + stack haskellPackages.hasktags + rustup + gcc tinycc ctags + python3 mypy + nodejs jo + perl ruby lua + nasm + ocaml fsharp swiProlog haskellPackages.idris + clojure racket-minimal + jdk scala + ]; + }; + environment.shellAliases = let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}"; in @@ -74,13 +95,23 @@ in { external-ip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @resolver1.opendns.com"; }; - # networking.hostname = "scardanelli"; + programs.slock.enable = true; + services.xserver = { enable = true; layout = "de, gr, ru"; xkbVariant = "T3, polytonic, phonetic_winkeys"; xkbOptions = "terminate:ctrl_alt_bksp, grp:alt_space_toggle"; libinput.enable = true; + xautolock = { + enable = true; + time = 15; + locker = "${pkgs.slock}/bin/slock"; + nowlocker = "${pkgs.slock}/bin/slock"; + enableNotifier = true; + notifier = ''${pkgs.libnotify}/bin/notify-send "Locking soon."''; + }; + /* displayManager.lightdm = { enable = true; background = wallpaper; @@ -97,14 +128,19 @@ in { ''; }; }; - windowManager = { - default = "i3"; - i3 = { - enable = true; - configFile = pkgs.writeText "i3.conf" (import ./dot/i3.nix { - inherit pkgs defaultApplications wallpaper; - }); - }; + */ + 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 { + inherit pkgs defaultApplications wallpaper; + }); }; }; i18n.consoleUseXkbConfig = true; @@ -116,8 +152,16 @@ in { fadeDelta = 2; menuOpacity = "0.95"; }; + services.openssh.enable = true; + services.redshift = { + enable = true; + latitude = "52"; + longitude = "13"; + temperature = { night = 25000; day = 1000; }; + }; + hardware.pulseaudio.enable = true; hardware.bluetooth.enable = true; @@ -139,7 +183,7 @@ in { PROMPT="%{$fg_bold[white]%}%~ \$([[ \$? == 0 ]] && echo \"%{$fg_bold[blue]%}\" || echo \"%{$fg_bold[red]%}\")%#%{$reset_color%} " RPROMPT='$(git_prompt_info)' - ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*" ''; @@ -151,17 +195,7 @@ in { enableCompletion = true; }; - programs.vim.defaultEditor = true; - - users.users.kfm = { - createHome = true; - description = fullName; - extraGroups = [ "wheel" "networkmanager" ]; - group = "users"; - home = "/home/kfm"; - shell = pkgs.zsh; - password = "kfm"; - }; + # programs.vim.defaultEditor = true; networking.networkmanager.enable = true; @@ -237,7 +271,7 @@ in { scrollbar = false; borderWidth = 0; lines = 5; - font = "${uiFont.name} ${toString uiFont.size}"; + font = "${uiFont.name} ${toString (uiFont.size + 1)}"; colors = { window = { background = black; border = black; separator = gray.dark; }; rows = { @@ -253,10 +287,60 @@ in { services.dunst = with import ./theme.nix; { enable = true; - iconTheme = { package = theme.icon.package; name = theme.icon.name; size = "64x64"; }; - settings.global = { - transparency = 20; - font = "${uiFont.name} ${toString uiFont.size}"; + iconTheme = theme.icon; + settings = { + global = { + transparency = 10; + font = "${uiFont.name} ${toString uiFont.size}"; + geometry = "300x5-30+20"; + frame_color = veryDark; + follow = "mouse"; + indicate_hidden = true; + notification_height = 0; + separator_height = 2; + padding = 8; + horizontal_padding = 8; + separator_color = "auto"; + sort = true; + markup = "full"; + format = ''%a\n%s\n%b''; + alignment = "left"; + show_age_threshold = 60; + bounce_freq = 0; + word_wrap = true; + ellipsize = "middle"; + ignore_newline = false; + stack_duplicates = true; + hide_duplicate_count = false; + max_icon_size = 32; + sticky_history = true; + history_length = 20; + dmenu = "${pkgs.rofi}/bin/rofi -display-run 'dunst: ' -show run"; + browser = defaultApplications.webBrowser; + 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 = light; + timeout = 5; + }; + urgency_normal = { + frame_color = veryDark; + background = light; + foreground = veryDark; + timeout = 10; + }; + urgency_critical = { + frame_color = veryDark; + background = red.dark; + foreground = veryDark; + timeout = 0; + }; }; }; @@ -270,7 +354,7 @@ in { ".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 { inherit defaultApplications; }; + ".background-image".source = wallpaper; }; }; - } diff --git a/dot/ghci.nix b/dot/ghci.nix index 99d1f14..942cd64 100644 --- a/dot/ghci.nix +++ b/dot/ghci.nix @@ -8,4 +8,4 @@ :def unpl \x -> return $ ":!${pkgs.haskellPackages.pointful}/bin/pointful \"" ++ x ++ "\"" :set prompt "\o033[1m%s\o033[1;34m λ\o033[0m " '' -#:def djinn \x -> return $ ":!echo \"" ++ x ++ "\" | ${pkgs.haskellPackages.djinn}/bin/djinn /dev/stdin" +# :def djinn \x -> return $ ":!echo \"" ++ x ++ "\" | ${pkgs.haskell.packages.ghc7102.djinn}/bin/djinn /dev/stdin" diff --git a/dot/i3.nix b/dot/i3.nix index f76b09d..52484b2 100644 --- a/dot/i3.nix +++ b/dot/i3.nix @@ -14,6 +14,7 @@ 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 @@ -114,5 +115,4 @@ bar { } exec --no-startup-id ${pkgs.networkmanagerapplet}/bin/nm-applet -exec --no-startup-id ${pkgs.feh}/bin/feh --bg-fill ${wallpaper} '' diff --git a/dot/i3blocks.nix b/dot/i3blocks.nix index 62c978d..478f60b 100644 --- a/dot/i3blocks.nix +++ b/dot/i3blocks.nix @@ -1,8 +1,6 @@ { pkgs, theme }: let - spotify_info = pkgs.writeScript "spotify.info" '' - #!/bin/bash - + 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 @@ -26,8 +24,7 @@ let printf "%s \u2237 %s" "$ARTIST" "$TITLE" ''; - battery_info = pkgs.writeScript "battery.info" '' - #!/usr/bin/env bash + battery_info = pkgs.writeBash "battery.info" '' cd "/sys/class/power_supply/$BLOCK_INSTANCE/" status=$(cat status) @@ -76,8 +73,7 @@ let fi fi ''; - volume_info = pkgs.writeScript "volume.info" '' - #!/usr/bin/env bash + volume_info = pkgs.writeBash "volume.info" '' if [[ "$BLOCK_BUTTON" == 1 ]]; then ${pkgs.pamixer}/bin/pamixer -i 5 elif [[ "$BLOCK_BUTTON" == 3 ]]; then @@ -93,11 +89,11 @@ let printf '\uf028 %s%%' "$volume" fi ''; - fancyDate = pkgs.writeScript "fancy_date.py" '' - #!/usr/bin/env python3 + fancyDate = pkgs.writePython3 "fancy_date.py" {} '' from datetime import datetime now = datetime.now() - print(now.strftime("%d\u2009{}\u2009%Y ⟨%V⟩").format(chr(0x2160 + (now.month - 1)))) + print(now.strftime("%d\u2009{}\u2009%Y ⟨%V⟩") + .format(chr(0x2160 + (now.month - 1)))) ''; in with theme; '' diff --git a/dot/terminal.nix b/dot/terminal.nix index f236cbb..2e004c9 100644 --- a/dot/terminal.nix +++ b/dot/terminal.nix @@ -2,25 +2,26 @@ with import ../theme.nix; '' [Configuration] +BackgroundDarkness=0.95 +BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT +ColorBackground=${veryDark} +ColorCursor=${light} +ColorForeground=${light} +ColorPalette=${dark};${red.dark};${green.dark};${yellow.dark};${blue.dark};${magenta.dark};${cyan.dark};${light};${dark};${red.light};${green.light};${yellow.light};${blue.light};${magenta.light};${cyan.light};${light} FontName=${terminalFont.regular.name} ${toString terminalFont.size} MiscAlwaysShowTabs=FALSE MiscBell=TRUE -MiscMenubarDefault=FALSE -MiscToolbarDefault=FALSE +MiscBordersDefault=FALSE MiscConfirmClose=FALSE MiscCursorBlinks=TRUE MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK -MiscBordersDefault=FALSE +MiscHighlightUrls=TRUE +MiscMenubarDefault=FALSE MiscMiddleClickOpensUri=TRUE +MiscMouseAutohide=FALSE MiscMouseWheelZoom=TRUE MiscRewrapOnResize=TRUE +MiscToolbarDefault=FALSE +ScrollingBar=TERMINAL_SCROLLBAR_NONE TitleMode=TERMINAL_TITLE_HIDE -MiscMouseAutohide=FALSE -MiscHighlightUrls=TRUE -BackgroundDarkness=0.95 -BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT -ColorPalette=${dark};${red.dark};${green.dark};${yellow.dark};${blue.dark};${magenta.dark};${cyan.dark};${light};${dark};${red.light};${green.light};${yellow.light};${blue.light};${magenta.light};${cyan.light};${light} -ColorBackground=${veryDark} -ColorForeground=${light} -ColorCursor=${light} '' diff --git a/dot/vim.nix b/dot/vim.nix index ece1e0a..2db0114 100644 --- a/dot/vim.nix +++ b/dot/vim.nix @@ -1,41 +1,41 @@ '' filetype off -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(".") + 1}/%{line("$")}' -endif -if exists("g:loaded_airline_themes") - let g:airline_theme='simple' -endif +" 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_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 +" if exists("g:loaded_gundo") +nnoremap :GundoToggle +" endif " if supertab let g:SuperTabDefaultCompletionType = '' @@ -67,14 +67,14 @@ set nopaste set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:⍽ showbreak=↪ set foldlevelstart=30 -if exists("g:loaded_netrwPlugin") - let g:netrw_banner=0 - let g:netrw_browse_split=4 - let g:netrw_altv=1 " open splits to the right - let g:netrw_liststyle=3 " tree view - let g:netrw_list_hide=netrw_gitignore#Hide() - let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' -endif +" if exists("g:loaded_netrwPlugin") +let g:netrw_banner=0 +let g:netrw_browse_split=4 +let g:netrw_altv=1 " open splits to the right +let g:netrw_liststyle=3 " tree view +let g:netrw_list_hide=netrw_gitignore#Hide() +let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' +" endif call matchadd('colorcolumn', '\%101v', 100) highlight folded ctermbg=black