This commit is contained in:
Tim Schubert 2020-08-01 15:46:33 +02:00
parent b7b348c163
commit 3d86adb45f
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
41 changed files with 124 additions and 81 deletions

29
modules/colors.nix Normal file
View file

@ -0,0 +1,29 @@
{
foreground = "#a3a3a3";
foregroundBold = "#e8e8e8";
cursor = "#e8e8e8";
cursorForeground = "#1f2022";
background = "#292b2e";
color0 = "#1f2022";
color8 = "#585858";
color7 = "#a3a3a3";
color15 = "#f8f8f8";
color1 = "#f2241f";
color9 = "#f2241f";
color2 = "#67b11d";
color10 = "#67b11d";
color3 = "#b1951d";
color11 = "#b1951d";
color4 = "#4f97d7";
color12 = "#4f97d7";
color5 = "#a31db1";
color13 = "#a31db1";
color6 = "#2d9574";
color14 = "#2d9574";
color16 = "#ffa500";
color17 = "#b03060";
color18 = "#282828";
color19 = "#444155";
color20 = "#b8b8b8";
color21 = "#e8e8e8";
}

26
modules/common.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, pkgs, ... }:
let
colors = import ./colors.nix;
in {
imports = [
./vim
./tmux.nix
./zsh.nix
(import ./termite.nix {
config = config;
pkgs = pkgs;
colors = colors;
})
./gpg.nix
./ssh.nix
./git.nix
./gtk.nix
./xdg.nix
(import ./mako.nix {
config = config;
pkgs = pkgs;
colors = colors;
})
./keyring.nix
];
}

73
modules/fish.nix Normal file
View file

@ -0,0 +1,73 @@
{ config, pkgs, lib, ... }:
{
programs.fish = {
enable = true;
plugins = with pkgs; [
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "jethrokuan";
repo = "fzf";
rev = "c3defd4a922e97120503b45e26efa775bc672b50";
sha256 = "1k5b0nva0mbqc9830qhbcwxsi8d9b2p4ws1fq0bw9nkf2ripyp4p";
};
}
];
interactiveShellInit = ''
# fish git prompt
set __fish_git_prompt_show_informative_status 'yes'
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_showcolorhints 'yes'
set fish_greeting
# disable path shortening
set fish_prompt_pwd_dir_length 0
set -U FZF_LEGACY_KEYBINDINGS 0
set -x TERM xterm-256color
set -U fish_user_paths ~/bin $fish_user_paths
#if status is-interactive
#and not status is-login
#and not set -q TMUX
#and string match -qr "^xterm-.*" "$TERM"
# exec tmux
#end
'';
promptInit = ''
function fish_prompt
set last_status $status
printf '%s %s:%s ' \
(set_color red
echo $last_status) \
(set_color green
hostname) \
(set_color blue
prompt_pwd)
set_color normal
end
function fish_right_prompt
printf '%s' (__fish_git_prompt)
end
'';
shellAliases = {
gst = "git status";
gco = "git commit";
glo = "git log";
gad = "git add";
ls = "exa";
ll = "exa -l";
la = "exa -la";
mv = "mv -i";
cp = "cp -i";
};
};
home.packages = [ pkgs.exa ];
}

5
modules/git.nix Normal file
View file

@ -0,0 +1,5 @@
{ config, ... }:
{
programs.git.enable = true;
}

25
modules/gpg.nix Normal file
View file

@ -0,0 +1,25 @@
{ config, ... }:
{
programs.gpg = {
enable = true;
settings = {
fixed-list-mode = true;
keyid-format = "0xlong";
verify-options = "show-uid-validity";
list-options = "show-uid-validity";
cert-digest-algo = "SHA256";
use-agent = true;
keyserver = "hkps://keys.openpgp.org";
};
};
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = false;
};
programs.git.extraConfig = {
commit = { gpgSign = true; };
};
}

16
modules/gtk.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, pkgs, ... }:
{
gtk = {
enable = true;
theme.package = pkgs.gnome3.gnome-themes-extra;
theme.name = "Adwaita-dark";
iconTheme.package = pkgs.gnome3.adwaita-icon-theme;
iconTheme.name = "Adwaita";
font.package = pkgs.cantarell-fonts;
font.name = "Cantarell";
};
qt = {
enable = true;
platformTheme = "gtk";
};
}

7
modules/keyring.nix Normal file
View file

@ -0,0 +1,7 @@
{ config, ... }:
{
services.gnome-keyring = {
enable = true;
components = [ "pkcs11" "secrets" "ssh" ];
};
}

24
modules/mako.nix Normal file
View file

@ -0,0 +1,24 @@
{ config, pkgs, colors, ...}:
{
programs.mako = {
enable = true;
anchor = "bottom-right";
backgroundColor = colors.color8;
borderColor = colors.color0;
defaultTimeout = -1;
font = "Source Code Pro 8";
format = ''<b>%a</b> %s\n%b'';
height = 100;
#groupBy = "app-name";
icons = false;
ignoreTimeout = false;
layer = "overlay";
margin = "0,0,0";
maxVisible = 200;
padding = "0";
progressColor = colors.color4;
sort = "+time";
textColor = colors.foreground;
width = 400;
};
}

143
modules/metis.nix Normal file
View file

@ -0,0 +1,143 @@
{ config, pkgs, lib, ... }:
let
userEnv = {
XDISPLAY=":0";
TERMINAL="xterm-256color";
EDITOR = "vim";
PAGER = "less";
MAILDIR = "\$HOME/.var/mail";
MBLAZE = "\$HOME/.config/mblaze";
NOTMUCH_CONFIG = "\$HOME/.config/notmuch/config";
#GDK_BACKEND= "x11";
MOZ_ENABLE_WAYLAND= "1";
SSH_ASKPASS = "${pkgs.lxqt.lxqt-openssh-askpass}/bin/lxqt-openssh-askpass";
};
unstable = import <nixpkgs-unstable> {};
in
{
imports = [
./common.nix
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.sessionVariables = userEnv;
systemd.user.sessionVariables = userEnv;
home.packages = with pkgs; [
sqlite
clang
gitAndTools.git-bug
pypi2nix
libnotify
aspellDicts.en
aspellDicts.de
aspellDicts.en-science
aspellDicts.en-computers
aspell
xorg.xev
evince
gnumake
graphviz
xwayland
slurp
grim
jq
lxqt.lxqt-openssh-askpass
xdg_utils
pwgen
mkpasswd
irssi
mumble
slic3r
nfs-utils
lsof
samba
chromium
bc
brightnessctl
file
fzf
gimp
gnupg
inkscape
inotify-tools
jmtpfs
ldns
libreoffice
mblaze
nmap
pass
pavucontrol
clang-tools
pinentry
playerctl
i3blocks
python3
python38Packages.dateutil
spotify
sshfs-fuse
tdesktop
#texlive.combined.scheme-full
#tor-browser-bundle-bin
virtmanager
whois
youtube-dl
zathura
unzip
anki
bluez-tools
texlive-tubslatex
openssl
audio-recorder
qt5.qttools
emacs
qt5.qtwayland
swayidle
mako
swaylock
kanshi
termite
bemenu
xss-lock
htop
gnome3.nautilus
gnome3.eog
imagemagick
corefonts
mpv
firefox-bin
] ++ (with unstable; [
thunderbird-bin
python38Packages.managesieve
android-studio
cachix
keepassxc
signal-desktop
minecraft
]);
services.syncthing = {
enable = true;
tray = false;
};
services.screen-locker = {
enable = false;
inactiveInterval = 5;
lockCmd = "~/bin/lock-session";
};
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "19.09";
}

25
modules/profile.nix Normal file
View file

@ -0,0 +1,25 @@
{ config, pkgs, lib, ... }:
{
programs.bash = {
enable = true;
profileExtra = ''
export TERM="xterm-256color"
export EDITOR="vim"
alias gst="git status"
alias gco="git commit";
alias glo="git log";
alias gad="git add";
alias ls="exa";
alias ll="exa -l";
alias la="exa -la";
alias mv="mv -i";
alias cp="cp -i";
'';
};
home.packages = [
pkgs.exa
pkgs.fzf
];
}

6
modules/ssh.nix Normal file
View file

@ -0,0 +1,6 @@
{ config, ... }:
{
programs.ssh = {
enable = true;
};
}

306
modules/sway/config Normal file
View file

@ -0,0 +1,306 @@
set $wallpaper ~/.config/nixpkgs/sway/wallpaper
set $foreground #a3a3a3ff
set $background #1f2022e5
set $dark_black #1f2022ff
set $light_black #282828ff
set $dark_red #444155ff
set $light_red #585858ff
set $dark_green #b8b8b8ff
set $light_green #a3a3a3ff
set $dark_yellow #e8e8e8ff
set $light_yellow #f8f8f8ff
set $dark_blue #f2241fff
set $light_blue #ffa500ff
set $dark_magenta #b1951dff
set $light_magenta #67b11dff
set $dark_cyan #2d9574ff
set $light_cyan #4f97d7ff
set $dark_white #a31db1ff
set $light_white #b03060ff
xwayland enable
# global modifier key
set $mod Mod4
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# the font to be used for i3bar and window decorations
font pango:Source Code Pro 8
bindsym $mod+Return exec termite
bindsym $mod+Space exec bemenu-run
# switch keyboard to neo
#bindsym $mod+F1 exec neo-key
#bindsym $mod+F2 exec eu-key
# kill focused window
bindsym $mod+Shift+q kill
# toggle moving floating windows with the mouse
floating_modifier $mod
# toggle tiling / floating
bindsym $mod+Shift+f floating toggle
# resize window (you can also use the mouse for that)
mode "resize" {
# resize windows with hjkl
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# back to normal mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
# switch to resize mode
bindsym $mod+r mode "resize"
# set border width of new window
default_border pixel 1
# keep focus within current container?
focus_wrapping no
# focus goes to window if mouse is moved onto it
focus_follows_mouse yes
# enter fullscreen mode for the focused container
bindsym $mod+o fullscreen
# default orientation of new windows
default_orientation horizontal
# split in horizontal orientation
bindsym $mod+b split h
# split in vertical orientation
bindsym $mod+shift+b split v
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+x layout toggle all
# name workspaces
set $1 1
set $2 2
set $3 3
set $4 4
set $5 5
set $6 6
set $7 7
set $8 8
set $9 9
set $10 10
# default mode
workspace_layout tabbed
# automatically jump back to previous workspace
workspace_auto_back_and_forth yes
# messaging
workspace 2 output LVDS-1
# web and doc
workspace 1 output VGA-1
# editor and IDE
workspace 3 output DP-2
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# focus latest urgent window
bindsym $mod+Shift+1 [urgent=latest] focus
# focus the parent container
bindsym $mod+Up focus parent
# focus the child container
bindsym $mod+Down focus child
# focus tiling/floating
bindsym $mod+f focus mode_toggle
# focus workspace
bindsym $mod+1 workspace number $1
bindsym $mod+2 workspace number $2
bindsym $mod+3 workspace number $3
bindsym $mod+4 workspace number $4
bindsym $mod+5 workspace number $5
bindsym $mod+6 workspace number $6
bindsym $mod+7 workspace number $7
bindsym $mod+8 workspace number $8
bindsym $mod+9 workspace number $9
bindsym $mod+0 workspace number $10
bindsym $mod+n workspace next_on_output
bindsym $mod+p workspace prev_on_output
# focus different outputs (displays)
bindsym $mod+shift+h focus output left
bindsym $mod+shift+j focus output down
bindsym $mod+shift+k focus output up
bindsym $mod+shift+l focus output right
# show the first scratchpad window
bindsym $mod+minus scratchpad show
set $mode_move "move"
bindsym $mod+m mode "$mode_move"
mode "$mode_move" {
# move focused container
bindsym h move left ;mode "default"
bindsym j move down ;mode "default"
bindsym k move up ;mode "default"
bindsym l move right;mode "default"
bindsym 1 move container to workspace number $1 ;mode "default"
bindsym 2 move container to workspace number $2 ;mode "default"
bindsym 3 move container to workspace number $3 ;mode "default"
bindsym 4 move container to workspace number $4 ;mode "default"
bindsym 5 move container to workspace number $5 ;mode "default"
bindsym 6 move container to workspace number $6 ;mode "default"
bindsym 7 move container to workspace number $7 ;mode "default"
bindsym 8 move container to workspace number $8 ;mode "default"
bindsym 9 move container to workspace number $9 ;mode "default"
bindsym 0 move container to workspace number $10 ;mode "default"
bindsym n move container to workspace next_on_output;mode "default"
bindsym p move container to workspace prev_on_output;mode "default"
# move focused workspace to output
bindsym shift+h move workspace to output left ; mode "default"
bindsym shift+j move workspace to output down ; mode "default"
bindsym shift+k move workspace to output up ; mode "default"
bindsym shift+l move workspace to output right ; mode "default"
bindsym shift+n move container to output next ; mode "default"
bindsym shift+p move container to output prev ; mode "default"
# make the currently focused window a scratchpad
bindsym minus move scratchpad; mode "default"
# Move container to the current position of the cursor
bindsym m move position mouse; mode "default"
bindsym Escape mode "default"
}
# lock the screen
bindsym $mod+equal exec ~/bin/lock-session
# control volume
bindsym --locked XF86AudioRaiseVolume exec amixer set 'Master' 5%+ && pkill -RTMIN+10 i3blocks
bindsym --locked XF86AudioLowerVolume exec amixer set 'Master' 5%- && pkill -RTMIN+10 i3blocks
bindsym --locked XF86AudioMute exec amixer set Master toggle && pkill -RTMIN+10 i3blocks
bindsym --locked --to-code XF86AudioMicMute exec --no-startup-id pactl set-source-mute 1 toggle
# control media player
bindsym --locked XF86AudioPlay exec playerctl play-pause && pkill -RTMIN+11 i3blocks
bindsym --locked XF86LaunchA exec playerctl play-pause && pkill -RTMIN+11 i3blocks
bindsym --locked XF86AudioNext exec playerctl next && pkill -RTMIN+11 i3blocks
bindsym --locked XF86Explorer exec playerctl next && pkill -RTMIN+11 i3blocks
bindsym --locked XF86AudioPrev exec playerctl previous && pkill -RTMIN+11 i3blocks
bindsym --locked XF86Search exec playerctl previous && pkill -RTMIN+11 i3blocks
# control screen brightness
bindsym --locked XF86MonBrightnessUp exec brightnessctl set -d intel_backlight +5%
bindsym --locked XF86MonBrightnessDown exec brightnessctl set -d intel_backlight 5%-
# Basic bar configuration using the Base16 variables.
bar {
id bar
status_command i3blocks
mode dock
modifier $mod
position bottom
strip_workspace_numbers yes
workspace_buttons yes
#output LVDS-1
colors {
background $background
separator $light_green
statusline $foreground
# State Border BG Text
focused_workspace $light_black $dark_cyan $background
active_workspace $light_black $dark_green $background
inactive_workspace $dark_black $background $foreground
urgent_workspace $light_black $dark_red $background
binding_mode $light_black $dark_magenta $background
}
}
#hide_edge_borders both
bindsym XF86Launch1 exec aplay ~/lib/sounds/wortwitzklingel-mono.wav
# Basic color configuration using the Base16 variables for windows and borders.
# Property Name Border BG Text Indicator Child Border
client.focused $light_black $dark_cyan $background $dark_cyan $dark_cyan
client.focused_inactive $light_black $dark_green $background $dark_green $dark_green
client.unfocused $light_black $background $foreground $dark_white $dark_white
client.urgent $light_black $dark_red $background $dark_red $dark_red
client.placeholder $light_black $dark_magenta $background $dark_magenta $dark_magenta
input * {
xkb_layout eu
xkb_model pc105+inet
xkb_options caps:escape
natural_scroll enabled
}
input 2:7:SynPS/2_Synaptics_TouchPad {
# disables the input device
events disabled
}
output VGA-1 {
background $wallpaper fill
pos 0 0
}
output DP-2 {
background $wallpaper fill
pos 1280 0
}
output LVDS-1 {
background $wallpaper fill
pos 3840 0
}
seat * {
hide_cursor 5000
}
assign [app_id="thunderbird"] workspace 1
assign [app_id="telegramdesktop"] workspace 1
assign [app_id="firefox" title="Riot.*"] workspace 1
assign [app_id="firefox" title="Instant messaging.*"] workspace 1
assign [app_id="firefox" title="Threema Web.*"] workspace 1
assign [app_id="firefox" title="chaos\.social.*"] workspace 1
assign [app_id="thunderbird" title="Write:.*"] workspace 3
assign [app_id="firefox"] workspace 2
assign [app_id="jetbrains-studio"] workspace 3
assign [app_id="org.keepassxc.KeePassXC"] workspace 10
exec xset s off
exec mako
#exec swayidle -w timeout 300 '$HOME/bin/lock-session' timeout 240 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep '$HOME/bin/lock-session' lock '$HOME/bin/lock-session'
#exec redshift
#exec keepassxc
#exec firefox
#exec thunderbird
#exec riot-desktop

34
modules/sway/default.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, pkgs, lib, colors, ...}:
let
unstable = import <nixpkgs-unstable> {};
in {
home.packages = with pkgs; [
qt5.qtwayland
swayidle
xwayland
mako
kanshi
i3blocks
termite
bemenu
xss-lock
] ++ (with unstable; [
swaylock
]);
wayland.windowManager.sway = {
enable = true;
config = null;
extraConfig = (builtins.readFile ./config);
extraSessionCommands = ''
export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
'';
};
}

BIN
modules/sway/wallpaper Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

55
modules/termite.nix Normal file
View file

@ -0,0 +1,55 @@
{ config, pkgs, colors, ... }:
{
programs.termite = {
enable = true;
allowBold = true;
audibleBell = false;
clickableUrl = true;
dynamicTitle = true;
font = "Source Code Pro 10";
mouseAutohide = false;
scrollOnOutput = false;
scrollOnKeystroke = true;
scrollbackLines = -1;
searchWrap = true;
urgentOnBell = true;
cursorBlink = "off";
cursorShape = "block";
sizeHints = false;
scrollbar = "off";
colorsExtra = ''
foreground = ${colors.foreground}
foreground_bold = ${colors.foregroundBold}
cursor = ${colors.cursor}
cursor_foreground = ${colors.cursorForeground}
background = ${colors.background}
color0 = ${colors.background}
color8 = ${colors.color8}
color7 = ${colors.color7}
color15 = ${colors.color15}
color1 = ${colors.color1}
color9 = ${colors.color9}
color2 = ${colors.color2}
color10 = ${colors.color10}
color3 = ${colors.color3}
color11 = ${colors.color11}
color4 = ${colors.color4}
color12 = ${colors.color12}
color5 = ${colors.color5}
color13 = ${colors.color13}
color6 = ${colors.color6}
color14 = ${colors.color14}
color16 = ${colors.color16}
color17 = ${colors.color17}
color18 = ${colors.color18}
color19 = ${colors.color19}
color20 = ${colors.color20}
color21 = ${colors.color21}
'';
};
# Add font that is used in config
home.packages = [
pkgs.source-code-pro
];
}

14
modules/tmux.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, ... }:
{
programs.tmux = {
enable = true;
terminal = "xterm-256color";
extraConfig = ''
set -g status on
set-option -g set-titles on
set-option -g automatic-rename on
set-window-option -g mode-keys vi
'';
};
}

42
modules/vim/default.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, fetchFromGitHub, ... }:
let
myFtplugins = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "myFtplugins";
version = "2010-11-06";
src = vim/plugins/myFtplugins;
};
spacemacsTheme = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "spacemacs-theme";
version = "2.0.1";
src = pkgs.fetchFromGitHub {
owner = "colepeters";
repo = "spacemacs-theme.vim";
rev = "056bba9bd05a2c97c63c28216a1c232cfb91529e";
sha256 = "0iy3i6waigk759p2z59mrxkjc0p412y7d8zf3cjak4a9sh1sh6qz";
};
};
in
{
programs.vim = {
enable = true;
extraConfig = builtins.readFile ./vimrc;
plugins = [
pkgs.vimPlugins.vim-nix
#pkgs.vimPlugins.kotlin-vim
pkgs.vimPlugins.ale
pkgs.vimPlugins.fzf-vim
pkgs.vimPlugins.rust-vim
pkgs.vimPlugins.base16-vim
pkgs.vimPlugins.typescript-vim
pkgs.vimPlugins.vim-airline
pkgs.vimPlugins.vim-airline-themes
pkgs.vimPlugins.vim-fish
spacemacsTheme
#pkgs.vimPlugins.vim-gnupg
#pkgs.vimPlugins.vim-l9
pkgs.vimPlugins.vim-ledger
#pkgs.vimPlugins.clang_complete
];
};
}

View file

@ -0,0 +1,11 @@
let b:ale_fixers = ['clang-format', 'remove_trailing_lines', 'trim_whitespace']
let b:ale_linters = ['clangd']
"setlocal tabstop=8 expandtab shiftwidth=2 smarttab
" GNU Coding Standards
setlocal cindent
setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
setlocal shiftwidth=2
setlocal softtabstop=2
setlocal textwidth=79
setlocal fo-=ro fo+=cql

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,2 @@
" Set up :make to use fish for syntax checking.
compiler fish

View file

@ -0,0 +1,3 @@
class Foo {
fun
}

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
let b:ale_fixers = ['prettier', 'eslint']
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
setlocal expandtab
setlocal shiftwidth=4
setlocal softtabstop=4
let g:ale_kotlin_languageserver_executable = "/home/tim/src/kotlin-language-server/server/build/install/server/bin/kotlin-language-server"

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=4
setlocal softtabstop=4

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,4 @@
" Check Python files with flake8 and pylint.
let b:ale_linters = ['flake8', 'pylint']
" Fix Python files with autopep8 and yapf.
let b:ale_fixers = ['autopep8', 'yapf', 'add_blank_lines_for_python_control_statements', 'autopep8', 'remove_trailing_lines', 'reorder-python-imports', 'trim_whitespace']

View file

@ -0,0 +1,2 @@
let b:ale_linters = {'rust': ['rustc', 'rls', 'rust-analyzer']}
let b:ale_fixers = {'rust': ['rustfmt']}

View file

@ -0,0 +1,3 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,5 @@
let b:ale_fixers = ['prettier', 'eslint', 'tsserver']
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

View file

@ -0,0 +1,4 @@
setlocal expandtab
setlocal shiftwidth=2
setlocal softtabstop=2

143
modules/vim/vimrc Normal file
View file

@ -0,0 +1,143 @@
filetype plugin on
filetype indent on
set autoread
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
" no command execution from modeline
set nomodeline
" Turn on the Wild menu
set wildmenu
" Enable hidden buffers
set hidden
" Clipboard copy & paste
"set clipboard=unnamedplus
" Always show current position
set ruler
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Inenteremental search
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" Do not show matching brackets when text indicator is over them
" set noshowmatch
" let loaded_matchparen = 1
" No annoying sound on errors
set noerrorbells
set novisualbell
set wrap
set linebreak
set nolist " list disables linebreak
" Enable syntax highlighting
syntax enable
if (has("termguicolors"))
set termguicolors
endif
set t_Co=256
set background=dark
colorscheme spacemacs-theme
" Use tabs for indent
set smarttab
set smartindent
set autoindent
set copyindent
set preserveindent
set wildmode=longest,list,full
set wildmenu
set cursorline
set number
set relativenumber
" Transparency
"hi Normal guibg=NONE ctermbg=NONE
"set list!
"set listchars=trail:⛤,extends:⟩,precedes:⟨,nbsp:␣,conceal:…
" Map leader to do extra key combinations
let mapleader = " "
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<Enter>
" Fast saving
nmap <leader>w :w!<Enter>
" Buffer switching
nmap <leader>bb :Buffers<Enter>
nmap <leader>bl :Buffers<Enter>
nmap <leader>bn :bnext<Enter>
nmap <leader>bp :bprevious<Enter>
nmap <leader>ll :Lines<Enter>
nmap <leader>mm :Marks<Enter>
nmap <leader>ww :Windows<Enter>
nmap <leader>hh :History/<Enter>
nmap <leader>rr :reg<Enter>
" finding files
nmap <leader>ff :Files<Enter>
nmap <leader>pp :FufDir<Enter>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
nmap <leader>sp :ALEFindReferences<Enter>
nmap <leader>ss :ALESymbolSearch<Enter>
nmap <leader>gd :ALEGoToDefinition<Enter>
nmap <leader>?? :ALEHover<Enter>
" Enable completion where available.
" This setting must be set before ALE is loaded.
let g:ale_completion_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_warn_about_trailing_whitespace = 1
let g:ale_warn_about_trailing_lines = 1
let g:ale_completion_tsserver_autoimport = 1
"let g:ale_lint_on_text_changed = 'never'
" You can disable this option too
" if you don't want linters to run on opening a file
"let g:ale_lint_on_enter = 0
" Set airline theme
let g:airline_theme='base16_spacemacs'
" Load all plugins now.
" Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" Load all of the helptags now, after plugins have been loaded.
" All messages and errors will be ignored.
silent! helptags ALL
set omnifunc=ale#completion#OmniFunc

43
modules/work.nix Normal file
View file

@ -0,0 +1,43 @@
{ config, pkgs, lib, ... }:
let
userEnv = {
EDITOR = "vim";
PAGER = "less";
};
in
{
imports = [
./common.nix
#./private/work
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.sessionVariables = userEnv;
home.packages = with pkgs; [
firefox-bin
chromium
android-studio
file
fzf
gnupg
libreoffice
pinentry
python3
spotify
sshfs-fuse
unzip
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "19.09";
}

42
modules/xdg.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, ... }:
let
apps = {
"x-scheme-handler/mailto" = "userapp-Thunderbird-PB7NI0.desktop";
"message/rfc822" = "userapp-Thunderbird-PB7NI0.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/ftp" = "firefox.desktop";
"x-scheme-handler/chrome" = "firefox.desktop";
"text/html" = "firefox.desktop";
"application/x-extension-htm" = "firefox.desktop";
"application/x-extension-html" = "firefox.desktop";
"application/x-extension-shtml" = "firefox.desktop";
"application/xhtml+xml" = "firefox.desktop";
"application/x-extension-xhtml" = "firefox.desktop";
"application/x-extension-xht" = "firefox.desktop";
"text/plain" = "vim.desktop";
"application/pdf" = "org.pwmt.zathura.desktop";
};
in {
xdg = {
enable = true;
mimeApps = {
enable = false;
associations.added = apps;
defaultApplications = apps;
};
userDirs = {
download ="\$HOME/tmp";
music = "\$HOME/lib/music";
videos ="\$HOME/lib/videos";
pictures = "\$HOME/lib/pictures";
documents = "\$HOME/lib";
desktop = "$HOME/tmp";
};
};
home.packages = with pkgs; [
firefox-bin
xdg_utils
zathura
];
}

53
modules/zsh.nix Normal file
View file

@ -0,0 +1,53 @@
{ config, pkgs, lib, ... }:
{
programs.fzf.enableZshIntegration = true;
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
autocd = true;
sessionVariables = {
TERM = "xterm-256color";
EDITOR = "vim";
};
history = {
extended = true;
ignoreDups = true;
ignoreSpace = true;
save = 100000;
share = true;
};
plugins = [
];
initExtra = ''
source ~/.nix-profile/share/zsh-git-prompt/zshrc.sh
source ~/.nix-profile/share/fzf/key-bindings.zsh
source ~/.nix-profile/share/fzf/completion.zsh
preexec() { echo -n -e "\033]0;$1\007" }
PROMPT="%F{red}%?%f %F{green}%m%f:%F{blue}%~%f "
RPROMPT='$(git_super_status)'
#NIX_BUILD_SHELL="${pkgs.zsh}/bin/zsh"
'';
profileExtra = ''
'';
shellAliases = {
gst = "git status";
gco = "git commit";
glo = "git log";
gad = "git add";
ls = "exa";
ll = "exa -l";
la = "exa -la";
mv = "mv -i";
cp = "cp -i";
};
};
home.packages = [
pkgs.exa
pkgs.zsh-git-prompt
];
}