This commit is contained in:
Tim Schubert 2020-02-28 17:05:29 +01:00
commit c1ab1afd4e
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
28 changed files with 560 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
private/
home.nix

29
colors.nix Normal file
View file

@ -0,0 +1,29 @@
{
foreground = "#a3a3a3";
foregroundBold = "#e8e8e8";
cursor = "#e8e8e8";
cursorForeground = "#1f2022";
background = "#1f2022";
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";
}

17
common.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
imports = [
./vim
./fish.nix
./tmux.nix
(import ./termite.nix {
config = config;
pkgs = pkgs;
colors = import ./colors.nix;
})
./gpg.nix
./ssh.nix
./git.nix
./gtk.nix
];
}

1
config.nix Normal file
View file

@ -0,0 +1 @@
{ allowUnfree = true; }

72
fish.nix Normal file
View file

@ -0,0 +1,72 @@
{ config, pkgs, ... }:
{
programs.fish = {
enable = true;
# plugins = [
# {
# name = "fzf";
# src = pkgs.fetchFromGithub {
# owner = "jethrokuan";
# repo = "fzf";
# rev = "7f4c0b6d9545126a1bdf30279e6b1ab6ffedc299";
# sha256 = "0c5i7sdrsp0q3vbziqzdyqn4fmp235ax4mn4zslrswvn8g3fvdyh";
# };
# }
# ];
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
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
git.nix Normal file
View file

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

21
gpg.nix Normal file
View file

@ -0,0 +1,21 @@
{ 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;
};
}

10
gtk.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
gtk = {
theme.package = pkgs.gnome-themes-extra;
theme.name = "Adwaita Dark:";
iconTheme.package = pkgs.adwaita-icon-theme;
iconTheme.name = "Adwaita";
font.package = pkgs.cantarell-fonts;
};
}

107
metis.nix Normal file
View file

@ -0,0 +1,107 @@
{ config, pkgs, lib, ... }:
let
userEnv = {
EDITOR = "vim";
PAGER = "less";
MAILDIR = "\$HOME/.var/mail";
MBLAZE = "\$HOME/.config/mblaze";
MBLAZE_PAGER = "cat";
NOTMUCH_CONFIG = "\$HOME/.config/notmuch/config";
PASSWORD_STORE_DIR = "\$HOME/src/password-store";
SSH_AGENT_SOCKET = "\$XDG_RUNTIME_DIR/ssh-agent";
};
in
{
imports = [
./common.nix
./private/metis
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.sessionVariables = userEnv;
systemd.user.sessionVariables = userEnv;
home.packages = with pkgs; [
firefox-bin
chromium
android-studio
bc
brightnessctl
file
fzf
gimp
gnupg
inkscape
inotify-tools
jmtpfs
keepassxc
ldns
libreoffice
mblaze
mpv
nmap
pandoc
pass
pavucontrol
pinentry
playerctl
i3blocks
python3
python38Packages.dateutil
spotify
sshfs-fuse
tdesktop
texlive.combined.scheme-full
thunderbird-bin
tor-browser-bundle-bin
virtmanager
whois
youtube-dl
zathura
unzip
anki
bluez-tools
];
services.syncthing = {
enable = true;
tray = false;
};
services.screen-locker = {
enable = true;
inactiveInterval = 5;
lockCmd = "\${pkgs.swaylock}/bin/swaylock";
};
xdg = {
enable = true;
mimeApps = {
enable = true;
#associations.added = {
#};
#defaultApplications = {
#};
};
userDirs = {
download ="\$HOME/tmp";
music = "\$HOME/lib/music";
videos ="\$HOME/lib/videos";
pictures = "\$HOME/lib/pictures";
documents = "\$HOME/lib";
desktop = "$HOME/tmp";
};
};
# 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";
}

6
ssh.nix Normal file
View file

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

55
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
];
}

15
tmux.nix Normal file
View file

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

30
vim/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, pkgs, lib, fetchFromGitHub, ... }:
let
myFtplugins = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "myFtplugins";
version = "2010-11-06";
src = vim/plugins/myFtplugins;
};
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
#pkgs.vimPlugins.vim-gnupg
#pkgs.vimPlugins.vim-l9
pkgs.vimPlugins.vim-ledger
];
};
}

View file

@ -0,0 +1 @@
let b:ale_fixers = ['clang-format', 'remove_trailing_lines', 'trim_whitespace']

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']}
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

144
vim/vimrc Normal file
View file

@ -0,0 +1,144 @@
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 base16-spacemacs
" 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_warn_about_trailing_whitespace = 1
let g:ale_warn_about_trailing_lines = 1
let g:ale_completion_tsserver_autoimport = 1
" Use ALE and also some plugin 'foobar' as completion sources for all code.
"let g:deoplete#sources = {'_': ['ale']}
"let g:deoplete#enable_at_startup = 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