port to flakes

This commit is contained in:
Tim Schubert 2021-06-13 13:43:21 +02:00
parent deaa4fb75c
commit 2d9150098e
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
76 changed files with 721 additions and 315 deletions

View file

@ -0,0 +1,91 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.dadada.home.alacritty;
in
{
options.dadada.home.alacritty = {
enable = mkEnableOption "Enable alacritty config";
};
config = mkIf cfg.enable {
fonts.fontconfig.enable = true;
home.packages = [
pkgs.source-code-pro
];
programs.alacritty = {
enable = true;
settings = {
scrolling.history = 0;
font = {
size = 10;
normal = {
family = "Source Code Pro";
style = "Regular";
};
bold = {
family = "Source Code Pro";
style = "Bold";
};
italic = {
family = "Source Code Pro";
style = "Italic";
};
bold_italic = {
family = "Source Code Pro";
style = "Bold Italic";
};
};
shell.program = "tmux";
window.decorations = "none";
colors = {
# Base16 Spacemacs 256 - alacritty color config
# Nasser Alshammari (https://github.com/nashamri/spacemacs-theme)
# Default colors
primary = {
background = "0x1f2022";
foreground = "0xa3a3a3";
};
# Colors the cursor will use if `custom_cursor_colors` is true
cursor = {
text = "0x1f2022";
cursor = "0xa3a3a3";
};
# Normal colors
normal = {
black = "0x1f2022";
red = "0xf2241f";
green = "0x67b11d";
yellow = "0xb1951d";
blue = "0x4f97d7";
magenta = "0xa31db1";
cyan = "0x2d9574";
white = "0xa3a3a3";
};
# Bright colors
bright = {
black = "0x585858";
red = "0xf2241f";
green = "0x67b11d";
yellow = "0xb1951d";
blue = "0x4f97d7";
magenta = "0xa31db1";
cyan = "0x2d9574";
white = "0xf8f8f8";
};
indexed_colors = [
{ index = 16; color = "0xffa500"; }
{ index = 17; color = "0xb03060"; }
{ index = 18; color = "0x282828"; }
{ index = 19; color = "0x444155"; }
{ index = 20; color = "0xb8b8b8"; }
{ index = 21; color = "0xe8e8e8"; }
];
};
};
};
};
}

40
home/modules/colors.nix Normal file
View file

@ -0,0 +1,40 @@
{ config, lib, ... }:
with lib;
{
options.dadada.home.colors = mkOption {
type = types.attrs;
description = "Color scheme";
};
config = {
dadada.home.colors = {
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";
};
};
}

21
home/modules/default.nix Normal file
View file

@ -0,0 +1,21 @@
{
alacritty = ./alacritty;
colors = ./colors.nix;
direnv = ./direnv.nix;
fish = ./fish.nix;
git = ./git.nix;
gpg = ./gpg.nix;
gtk = ./gtk.nix;
keyring = ./keyring.nix;
kitty = ./kitty;
mako = ./mako.nix;
session = ./session.nix;
ssh = ./ssh.nix;
sway = ./sway;
syncthing = ./syncthing.nix;
termite = ./termite.nix;
tmux = ./tmux.nix;
vim = ./vim;
xdg = ./xdg.nix;
zsh = ./zsh.nix;
}

16
home/modules/direnv.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.home.direnv;
in
{
options.dadada.home.direnv = {
enable = mkEnableOption "Enable direnv config";
};
config = mkIf cfg.enable {
programs.direnv = {
enable = true;
enableZshIntegration = true;
};
};
}

80
home/modules/fish.nix Normal file
View file

@ -0,0 +1,80 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.home.fish;
in
{
options.dadada.home.fish = {
enable = mkEnableOption "Enable fish config";
};
config = mkIf cfg.enable {
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 ];
};
}

13
home/modules/git.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.git;
in
{
options.dadada.home.git = {
enable = mkEnableOption "Enable git config";
};
config = mkIf cfg.enable {
programs.git.enable = true;
};
}

35
home/modules/gpg.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.gpg;
in
{
options.dadada.home.gpg = {
enable = mkEnableOption "Enable GnuPG config";
};
config = mkIf cfg.enable {
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;
pinentryFlavor = "gnome3";
};
programs.git.extraConfig = {
commit = { gpgSign = true; };
};
};
}

21
home/modules/gtk.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.dadada.home.gtk;
in
{
options.dadada.home.gtk = {
enable = mkEnableOption "Enable GTK config";
};
config = mkIf cfg.enable {
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";
};
};
}

16
home/modules/keyring.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.keyring;
in
{
options.dadada.home.keyring = {
enable = mkEnableOption "Enable keyring config";
};
config = mkIf cfg.enable {
services.gnome-keyring = {
enable = false;
components = [ "pkcs11" "secrets" ];
};
};
}

62
home/modules/kitty/config Normal file
View file

@ -0,0 +1,62 @@
font_family monospace
font_size 9
bold_font auto
italic_font auto
bold_italic_font auto
copy_on_select no
clipboard_control no-append write-clipboard read-clipboard
allow_hyperlinks yes
detect_urls yes
strip_trailing_spaces never
window_alert_on_bell yes
enable_audio_bell yes
bell_on_tab yes
tab_bar_style hide
scrollback_lines 20000
map ctrl+shift+v no_op
map ctrl+shift+c no_op
background #1f2022
foreground #a3a3a3
selection_background #a3a3a3
selection_foreground #1f2022
url_color #b8b8b8
cursor #a3a3a3
active_border_color #585858
inactive_border_color #282828
active_tab_background #1f2022
active_tab_foreground #a3a3a3
inactive_tab_background #282828
inactive_tab_foreground #b8b8b8
tab_bar_background #282828
# normal
color0 #1f2022
color1 #f2241f
color2 #67b11d
color3 #b1951d
color4 #4f97d7
color5 #a31db1
color6 #2d9574
color7 #a3a3a3
# bright
color8 #585858
color9 #f2241f
color10 #67b11d
color11 #b1951d
color12 #4f97d7
color13 #a31db1
color14 #2d9574
color15 #f8f8f8
# extended base16 colors
color16 #ffa500
color17 #b03060
color18 #282828
color19 #444155
color20 #b8b8b8
color21 #e8e8e8
#shell tmux

View file

@ -0,0 +1,17 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.dadada.home.kitty;
in
{
options.dadada.home.kitty = {
enable = mkEnableOption "Enable kitty config";
};
config = mkIf cfg.enable {
programs.kitty = {
enable = true;
extraConfig = builtins.readFile ./config;
};
home.packages = [ pkgs.source-code-pro ];
};
}

33
home/modules/mako.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, colors, ... }:
with lib;
let
cfg = config.dadada.home.mako;
in
{
options.dadada.home.mako = {
enable = mkEnableOption "Enable mako config";
};
config = mkIf cfg.enable {
programs.mako = {
enable = true;
anchor = "bottom-right";
backgroundColor = colors.color8;
borderColor = colors.color0;
#defaultTimeout = -1;
font = "Source Code Pro 10";
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;
};
};
}

View file

@ -0,0 +1,20 @@
[
./colors.nix
./direnv.nix
./fish.nix
./git.nix
./gpg.nix
./gtk.nix
./keyring.nix
./kitty
./mako.nix
./session.nix
./ssh.nix
./sway
./syncthing.nix
./termite.nix
./tmux.nix
./vim
./xdg.nix
./zsh.nix
]

23
home/modules/session.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.session;
in
{
options.dadada.home.session = {
enable = mkEnableOption "Enable session variable management";
sessionVars = mkOption {
description = "Session variables";
type = types.attrs;
default = { };
example = ''
EDITOR = "vim";
PAGER = "less";
'';
};
};
config = mkIf cfg.enable {
home.sessionVariables = cfg.sessionVars;
systemd.user.sessionVariables = cfg.sessionVars;
};
}

15
home/modules/ssh.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.ssh;
in
{
options.dadada.home.ssh = {
enable = mkEnableOption "Enable SSH config";
};
config = mkIf cfg.enable {
programs.ssh = {
enable = true;
};
};
}

283
home/modules/sway/config Normal file
View file

@ -0,0 +1,283 @@
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 alacritty
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 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 i3status
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
}
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

View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, colors, ... }:
with lib;
let
cfg = config.dadada.home.sway;
in
{
options.dadada.home.sway = {
enable = mkEnableOption "Enable Sway config";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
qt5.qtwayland
swayidle
xwayland
mako
kanshi
kitty
i3status
kitty
bemenu
xss-lock
swaylock
brightnessctl
playerctl
];
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
'';
};
};
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.home.syncthing;
in
{
options.dadada.home.syncthing = {
enable = mkEnableOption "Enable Syncthing config";
};
config = mkIf cfg.enable {
services.syncthing = {
enable = true;
tray = false;
};
};
}

69
home/modules/termite.nix Normal file
View file

@ -0,0 +1,69 @@
{ config
, lib
, pkgs
, colors ? ../../lib/colors.nix
, ...
}:
with lib;
let
cfg = config.dadada.home.termite;
in
{
options.dadada.home.termite = {
enable = mkEnableOption "Enable termite config";
};
config = mkIf cfg.enable {
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
];
};
}

25
home/modules/tmux.nix Normal file
View file

@ -0,0 +1,25 @@
{ config, lib, ... }:
with lib;
let
cfg = config.dadada.home.tmux;
in
{
options.dadada.home.tmux = {
enable = mkEnableOption "Enable tmux config";
};
config = mkIf cfg.enable {
programs.tmux = {
enable = true;
terminal = "xterm-256color";
extraConfig = ''
set -g automatic-rename on
set -g mode-keys vi
set -g mouse on
set -g set-clipboard external
set -g set-titles on
set -g status on
set-window-option -g mode-keys vi
'';
};
};
}

View file

@ -0,0 +1,41 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.home.vim;
vimPlugins = pkgs.callPackage ../../../pkgs/vimPlugins { };
in
{
options.dadada.home.vim = {
enable = mkEnableOption "Enable VIM config";
};
config = mkIf cfg.enable {
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-gitgutter
vimPlugins.vim-buftabline
vimPlugins.spacemacsTheme
vimPlugins.filetype
pkgs.vimPlugins.vim-ledger
];
};
home.packages = with pkgs; [
languagetool
nixpkgs-fmt
shellcheck
perl530Packages.PerlCritic
];
};
}

149
home/modules/vim/vimrc Normal file
View file

@ -0,0 +1,149 @@
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
set mouse=a
" 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>bl :Buffers<Enter>
nmap <leader>bd :bdelete<Enter>
nmap <leader>bn :bnext<Enter>
nmap <leader>bp :bprevious<Enter>
" List things
nmap <leader>hl :History/<Enter>
nmap <leader>ll :Lines<Enter>
nmap <leader>ml :Marks<Enter>
nmap <leader>rl :reg<Enter>
nmap <leader>wl :Windows<Enter>
" finding files
nmap <leader>ff :Files<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>fr :ALEFindReferences<Enter>
nmap <leader>gd :ALEGoToDefinition<Enter>
nmap <leader>hh :ALEHover<Enter>
nmap <leader>ss :ALESymbolSearch <C-R><C-A><Enter>
nmap <leader>rn :ALERename<Enter>
nmap <leader>rf :ALERefactor<Enter>
nmap <leader>ca :ALE<Enter>
nmap <leader>fx :ALEFix<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 = 0
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_languagetool_executable = 'languagetool-commandline'
let g:ale_set_quickfix = 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

50
home/modules/xdg.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }:
with 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";
};
cfg = config.dadada.home.xdg;
in
{
options.dadada.home.xdg = {
enable = mkEnableOption "Enable XDG config";
};
config = mkIf cfg.enable {
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
xdg_utils
zathura
];
};
}

75
home/modules/zsh.nix Normal file
View file

@ -0,0 +1,75 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.dadada.home.zsh;
in
{
options.dadada.home.zsh = {
enable = mkEnableOption "Enable ZSH config";
};
config = mkIf cfg.enable {
programs.fzf.enableZshIntegration = true;
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableVteIntegration = true;
autocd = true;
sessionVariables = {
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
bindkey '^n' autosuggest-accept
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 = {
ga = "git add";
gc = "git commit";
gd = "git diff";
gf = "git fetch";
gl = "git log";
gpu = "git push";
gpul = "git pull";
grb = "git rebase";
gre = "git reflog";
gs = "git status";
gsh = "git show";
gst = "git status";
gsta = "git stash";
gstap = "git stash apply";
ls = "exa";
la = "exa -a";
ll = "exa -la --no-filesize --changed --time-style=long-iso --git --octal-permissions --no-permissions --no-user --ignore-glob=\".git\"";
mv = "mv -i";
cp = "cp -i";
};
};
home.packages = with pkgs; [
fzf
exa
zsh-git-prompt
tmux
];
};
}