first cleanup of desktop stuff

This commit is contained in:
Ingolf Wagner 2023-02-17 00:41:22 +01:00
parent 46a05c6837
commit 6940d9a942
Signed by: palo
GPG key ID: 76BF5F1928B9618B
44 changed files with 1054 additions and 1424 deletions

View file

@ -0,0 +1,6 @@
{
imports = [
./gui
./network
];
}

View file

@ -0,0 +1,14 @@
{ pkgs, lib, ... }:
with lib;
{
options.components.gui = {
enable = lib.mkEnableOption "GUI configurations";
};
imports = [
./xorg/x11.nix
./home-manager
];
config = mkIf config.components.gui.enable { };
}

View file

@ -0,0 +1,317 @@
{ pkgs, lib, config, ... }:
with lib;
let
# todo : use kmonad
xmodmapConfig = pkgs.writeText "xmodmap" ''
!
! Swap Caps_Lock and Control_L
!
! replace capslock keys with Escape Keys
! remove Lock = Caps_Lock
clear Lock
add Lock = Scroll_Lock
keysym Caps_Lock = Escape
! Set Right function Key to Windows-key
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
! Map umlauts to RIGHT ALT + <key>
keycode 108 = Mode_switch
keysym e = e E EuroSign
keysym c = c C cent
keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp
'';
in
{
imports = [
./dunst.nix
./doom-emacs.nix
./ssh.nix
./i3.nix
];
config = lib.mkIf config.components.gui.enable {
# don't run autoload -U compinit && compinit before ~/.zshrc
programs.zsh.enableGlobalCompInit = false;
home-manager.users.mainUser = {
home.stateVersion = "22.11";
# a better cat
programs.bat = {
enable = true;
config.theme = "Gruvbox (light)";
};
# notify me when a command is finished
programs.noti.enable = true;
# a better ls
programs.exa = {
enable = true;
enableAliases = true;
};
# use z instead of cd
# use zi to fuzzy search through all registered directories
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# provide better `Ctrl+r` command in terminal
programs.mcfly = {
enable = true;
keyScheme = "vim";
fuzzySearchFactor = 3;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
defaultKeymap = "viins";
};
home.file.".config/bugwarrior/bugwarriorrc".text = ''
[general]
targets = terranix, github_private
static_fields = priority
log.level = INFO
[terranix]
service = github
github.login = mrVanDalo
github.token = @oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken
github.username = mrVanDalo
github.default_priority =
github.description_template = {{githubtitle}} {{githuburl}}
github.add_tags = github
github.project_name = terranix
github.involved_issues = True
github.query = org:terranix is:open
github.include_user_issues = False
github.include_user_repos = False
[github_private]
service = github
github.login = mrVanDalo
github.token = @oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken
github.username = mrVanDalo
github.description_template = {{githubtitle}} {{githuburl}}
github.add_tags = github
github.involved_issues = True
github.include_user_issues = True
github.include_user_repos = True
'';
xdg.configFile."ncmpcpp/config".text = ''
mpd_host = "pepe.private"
mpd_port = 6600
'';
programs.git = {
enable = true;
userName = "Ingolf Wagner";
userEmail = "contact@ingolf-wagner.de";
signing = {
key = "42AC51C9482D0834CF488AF1389EC2D64AC71EAC";
signByDefault = true;
};
ignores = [ "*.swp" "*~" ".idea" ".*penis.*" "result" ];
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
};
};
programs.gpg = {
enable = true;
settings = {
auto-key-locate = "local";
keyid-format = "long";
utf8-strings = "";
verbose = "";
with-fingerprint = "";
keyserver = "keyserver.ubuntu.com";
personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512";
default-preference-list =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
};
};
programs.htop = {
enable = true;
settings.highlight_base_name = true;
settings.tree_view = true;
};
xdg.configFile."albert/albert.conf".text = ''
[General]
hotkey=Meta+Space
showTray=false
telemetry=false
terminal=urxvt -e
[org.albert.extension.applications]
enabled=true
fuzzy=true
use_generic_name=true
use_keywords=true
[org.albert.extension.calculator]
enabled=true
[org.albert.extension.hashgenerator]
enabled=true
[org.albert.frontend.widgetboxmodel]
alwaysOnTop=true
clearOnHide=false
displayIcons=true
displayScrollbar=false
displayShadow=false
hideOnClose=false
hideOnFocusLoss=true
itemCount=5
showCentered=true
theme=SolarizedBrightViolet
'';
xdg.configFile."Code/User/settings.json".text = builtins.toJSON {
"keyboard.dispatch" = "keyCode";
"explorer.confirmDragAndDrop" = false;
"editor.tabSize" = 2;
"window.zoomLevel" = -1;
"git.enableSmartCommit" = true;
"files.autoSave" = "onFocusChange";
"terminal.integrated.setLocaleVariables" = true;
"terminal.external.linuxExec" = "xterm";
"explorer.confirmDelete" = false;
"todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ];
"workbench.colorTheme" = "Solarized Light";
};
xdg.configFile."mimeapps.list".text = ''
[Default Applications]
text/html=browser-select.desktop
x-scheme-handler/http=browser-select.desktop
x-scheme-handler/https=browser-select.desktop
x-scheme-handler/about=browser-select.desktop
x-scheme-handler/mailto=thunderbird.desktop;
x-scheme-handler/unknown=browser-select.desktop
x-scheme-handler/postman=Postman.desktop
image/png=sxiv.desktop
image/jpeg=sxiv.desktop
'';
# todo : still needed?
home.file.".xprofile".text = ''
# load keyboard mappings
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
# to allow sudo commands to access X
# todo : only allow the browsers and rambox access
${pkgs.xorg.xhost}/bin/xhost +
# no shitty pcspkr crap
${pkgs.xorg.xset}/bin/xset -b
# no sleeping monitor
${pkgs.xorg.xset}/bin/xset -dpms
${pkgs.xorg.xset}/bin/xset s off
${pkgs.flameshot}/bin/flameshot &
# cleanup xmonad
rm -f ~/.xmonad/xmonad.state
'';
xdg.configFile."khal/config".text = ''
[calendars]
[[local_calendar]]
path = ~/.calendars/*
type = discover
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M
'';
xdg.configFile."vdirsyncer/config".text = ''
[general]
# A folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.vdirsyncer/status/"
# CALDAV
[pair my_calendar]
a = "nextcloud_calendar"
b = "local_calendar"
collections = ["from a", "from b"]
[storage nextcloud_calendar]
type = "caldav"
url = "https://nextcloud.ingolf-wagner.de/"
username = "palo"
password.fetch = ["command", "${pkgs.pass}/bin/pass", "home/nextcloud/palo/nextcloudcmd-token"]
[storage local_calendar]
type = "filesystem"
path = "~/.calendars/"
fileext = ".ics"
'';
};
environment.systemPackages =
let
fixKeyboard = pkgs.writeScriptBin "fix-Keyboard" # sh
''
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
'';
fixXhost = pkgs.writeScriptBin "fix-xhost" # sh
''
${pkgs.xorg.xhost}/bin/xhost + &> /dev/null
'';
fixX = pkgs.writeScriptBin "fix-X" # sh
''
${fixKeyboard}/bin/fix-Keyboard
for file in `ls ~/.screenlayout`
do
echo $file
~/.screenlayout/$file &> /dev/null
RETURN_CODE=$?
if [[ $RETURN_CODE -eq 0 ]]
then
exit 0;
fi
done
'';
in
[
fixX
fixXhost
fixKeyboard
];
};
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.components.gui.enable {
home-manager.users.mainUser = {
programs.doom-emacs = {
enable = lib.mkDefault true;
doomPrivateDir = ./doom.d;
extraConfig = ''
;; "monospace" means use the system default. However, the default is usually two
;; points larger than I'd like, so I specify size 12 here.
(setq doom-font
(font-spec :family "Jetbrains Mono" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light))
;(setq doom-font
; (font-spec :family "Terminus" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light))
'';
emacsPackagesOverlay = self: super: {
# fixes https://github.com/vlaci/nix-doom-emacs/issues/394
gitignore-mode = pkgs.emacsPackages.git-modes;
gitconfig-mode = pkgs.emacsPackages.git-modes;
};
};
};
environment.systemPackages = [
pkgs.ripgrep
];
};
}

View file

@ -0,0 +1,267 @@
{ pkgs, config, lib, ... }:
{
config = lib.mkIf config.components.gui.enable {
home-manager.users.mainUser = {
services.dunst = {
enable = true;
settings = {
global = {
font = "JetBrains Mono";
# Allow a small subset of html markup:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
# If markup is not allowed, those tags will be stripped out of the
# message.
markup = "yes";
plain_text = "no";
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# Markup is allowed
format = ''
%a
<b>%s</b>
%b'';
# Sort messages by urgency.
sort = "yes";
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = "yes";
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = "center";
# The frequency with wich text that is longer than the notification
# window allows bounces back and forth.
# This option conflicts with "word_wrap".
# Set to 0 to disable.
bounce_freq = 0;
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 1;
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = "yes";
# Ignore newlines '\n' in notifications.
ignore_newline = "no";
# Hide duplicate's count and stack them
stack_duplicates = "yes";
hide_duplicates_count = "no";
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectevly.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "500x10-0+0";
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = "no";
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
idle_threshold = 0;
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing windowmanager is
# present (e.g. xcompmgr, compiz, etc.).
# transparency = 5
# Which monitor should the notifications be displayed on.
#monitor = keyboard
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a windowmanager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern windowmanagers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = "none";
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = "yes";
# Maximum amount of notifications kept in history
history_length = 15;
# Display indicators for URLs (U) and actions (A).
show_indicators = "no";
# The height of a single line. If the height is smaller than the
# font height, it will get raised to the font height.
# This adds empty space above and under the text.
line_height = 3;
# Draw a line of "separatpr_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 1;
# Padding between text and separator.
padding = 1;
# Horizontal padding.
horizontal_padding = 1;
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = "frame";
# Print a notification on startup.
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = true;
# dmenu path.
#dmenu = "${pkgs.dmenu}/bin/dmenu -p dunst:";
# Browser for opening urls in context menu.
# browser = /usr/bin/firefox -new-tab
# Align icons left/right/off
icon_position = "off";
max_icon_size = 80;
frame_width = 2;
frame_color = "#8EC07C";
};
shortcuts = {
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = "ctrl+space";
# Close all notifications.
close_all = "ctrl+shift+space";
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1".
#history = "ctrl+grave";
# Context menu.
context = "mod4+u";
};
urgency_low = {
frame_color = "#268bd2";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
urgency_normal = {
frame_color = "#b58900";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
urgency_critical = {
frame_color = "#dc322f";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
};
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format".
# Shell-like globbing will get expanded.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
# vim: ft=cfg
};
};
};
}

View file

@ -0,0 +1,365 @@
{ config, lib, pkgs, ... }:
let
cfg = config.home-manager.users.mainUser.xsession.windowManager.i3;
colorTheme =
let
theme = (import ../../../library/colorThemes.nix).solarized.light.hex;
in
theme // {
foreground = theme.base3;
background = theme.base03;
};
# switch to named workspaces
# todo : add version assert
i3-wk-switch = pkgs.i3-wk-switch.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "tmfink";
repo = "i3-wk-switch";
rev = "5f43bb8cbe7938eff476fc534b61c8fb6a700c8f";
sha256 = "sha256-DOBPI/wO+S8a6EzWJeVGODXeSixFl7SHTtHAq5DG8GU=";
};
});
backgroundCommand = pkgs.writers.writeDash "background" ''
${pkgs.xorg.xrandr}/bin/xrandr | grep " connected" | \
${pkgs.gnused}/bin/sed -E "s/primary //" | \
${pkgs.coreutils-full}/bin/cut -d' ' -f 3 | \
${pkgs.gnused}/bin/sed -E 's/\+.*$//g' | \
${pkgs.coreutils-full}/bin/sort -r | \
${pkgs.coreutils-full}/bin/head -n 1 | \
${pkgs.gawk}/bin/awk -F 'x' '{print "--width="$1" --height="$2}' | \
${pkgs.findutils}/bin/xargs \
${pkgs.polygon-art.polygon-art}/bin/rings \
/dev/shm/background.png && \
${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png
'';
in
{
config = lib.mkIf config.components.gui.enable {
home-manager.users.mainUser = {
programs.i3status-rust = {
enable = true;
bars = {
my = {
icons = "awesome5";
theme = "solarized-light";
# https://github.com/greshake/i3status-rust/blob/v0.22.0/doc/blocks.md
blocks = [
{
block = "cpu";
interval = 1;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
format_swap = "{swap_used_percents}";
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{
block = "battery";
interval = 10;
format = "{percentage} {time}";
}
{ block = "uptime"; }
{
block = "time";
interval = 60;
format = "%Y-%m-%d %R";
}
];
};
};
};
programs.kitty = {
enable = true;
# kitty +kitten themes
theme = "Gruvbox Light Hard";
settings = {
font_family = "JetBrains Mono";
bold_font = "auto";
italic_font = "auto";
bold_italic_font = "auto";
font_size = 11;
};
};
programs.alacritty = {
enable = true;
settings = {
import =
let
themes = pkgs.fetchFromGitHub {
owner = "alacritty";
repo = "alacritty-theme";
rev = "024c5c0dfb65197d5796e29e307b321af9a5e198";
sha256 = "sha256-zXyGXZSmmTup5o7Dx6he+57vSFpygR+GSD+3PTxDbVk=";
};
in
[ "${themes}/themes/gruvbox_light.yaml" ];
font = {
normal = {
family = "JetBrains Mono";
style = "Regular";
};
bold = {
family = "JetBrains Mono";
style = "Bold";
};
italic = {
family = "JetBrains Mono";
style = "Italic";
};
size = 6.0;
};
};
};
xsession.windowManager.i3 = {
enable = true;
extraConfig = ''
default_border pixel
'';
config = {
modifier = "Mod4";
terminal = "alacritty";
startup =
let
height = config.configuration.desktop.height;
width = config.configuration.desktop.width;
in
[
{ command = "${pkgs.albert}/bin/albert"; always = true; }
{ command = toString backgroundCommand; always = true; }
#{ command = "${pkgs.flameshot}/bin/flameshot"; always = true; }
# { command = "systemctl --user restart polybar"; always = true; notification = false; }
];
fonts = {
names = [ "JetBrains Mono" ];
size = 11.0;
};
bars =
with colorTheme;
let
selected = blue;
in
[{
mode = "hide";
hiddenState = "hide";
position = "top";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.users.users.mainUser.home}/.config/i3status-rust/config-my.toml";
fonts = {
names = [ "JetBrains Mono" ];
size = 11.0;
};
trayOutput = "primary";
colors = {
background = background;
statusline = background;
separator = background;
focusedWorkspace = {
border = selected;
background = base02;
text = foreground;
};
activeWorkspace = {
border = background;
background = base02;
text = foreground;
};
inactiveWorkspace = {
border = background;
background = base02;
text = foreground;
};
urgentWorkspace = {
border = red;
background = base02;
text = foreground;
};
bindingMode = {
border = red;
background = red;
text = background;
};
};
}];
colors = with colorTheme; {
background = background;
focused = {
background = blue;
border = blue;
childBorder = blue;
indicator = blue;
text = foreground;
};
focusedInactive = {
background = base01;
border = base01;
childBorder = base02;
indicator = base02;
text = foreground;
};
unfocused = {
background = base02;
border = base02;
childBorder = base02;
indicator = base02;
text = foreground;
};
urgent = {
background = orange;
border = orange;
childBorder = background;
indicator = background;
text = foreground;
};
};
keybindings = {
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/";
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+Shift+q" = "exit";
"${cfg.config.modifier}+q" = "kill";
"${cfg.config.modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right";
"${cfg.config.modifier}+j" = "focus next";
"${cfg.config.modifier}+k" = "focus prev";
"${cfg.config.modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right";
"${cfg.config.modifier}+h" = "split h";
"${cfg.config.modifier}+v" = "split v";
"${cfg.config.modifier}+f" = "fullscreen toggle";
"${cfg.config.modifier}+s" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed";
"${cfg.config.modifier}+e" = "layout toggle split";
"${cfg.config.modifier}+t" = "floating toggle";
#"${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+b" = "exec ${backgroundCommand}";
"${cfg.config.modifier}+p" = "focus parent";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show";
"${cfg.config.modifier}+1" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 1";
"${cfg.config.modifier}+2" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 2";
"${cfg.config.modifier}+3" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 3";
"${cfg.config.modifier}+4" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 4";
"${cfg.config.modifier}+5" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 5";
"${cfg.config.modifier}+6" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 6";
"${cfg.config.modifier}+7" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 7";
"${cfg.config.modifier}+8" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 8";
"${cfg.config.modifier}+9" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 9";
"${cfg.config.modifier}+0" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 10";
"${cfg.config.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.config.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.config.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.config.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.config.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.config.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.config.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.config.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.config.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.config.modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.config.modifier}+Escape" = "workspace back_and_forth";
# rename workspace
"${cfg.config.modifier}+n" = ''
exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: '
'';
"${cfg.config.modifier}+grave" =
let
script = pkgs.writers.writeBash "select-workspace" ''
set -e
set -o pipefail
${pkgs.i3}/bin/i3-msg -t get_workspaces | \
${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \
${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \
while read line
do
${i3-wk-switch}/bin/i3-wk-switch "$line"
done
'';
in
"exec ${script}";
"${cfg.config.modifier}+Shift+c" = "reload";
"${cfg.config.modifier}+Shift+r" = "restart";
"${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.config.modifier}+r" = "mode resize";
# multiple monitors
# autorandr --save docked # to save setup
# autorandr --save undocked # to save setup
# autorandr --change # automatically detects the setup
"${cfg.config.modifier}+BackSpace" =
let
xmodmapConfig = pkgs.writeText "xmodmap" ''
!
! Swap Caps_Lock and Control_L
!
! replace capslock keys with Escape Keys
! remove Lock = Caps_Lock
clear Lock
add Lock = Scroll_Lock
keysym Caps_Lock = Escape
! Set Right function Key to Windows-key
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
! Map umlauts to RIGHT ALT + <key>
keycode 108 = Mode_switch
keysym e = e E EuroSign
keysym c = c C cent
keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp
'';
script = pkgs.writers.writeBash "autorandr" ''
${pkgs.autorandr}/bin/autorandr --change
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
${backgroundCommand}
'';
in
"exec ${toString script}";
# like vimperator
"${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus";
};
};
};
};
};
}

View file

@ -0,0 +1,47 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.components.gui.enable {
home-manager.users.mainUser = {
programs.ssh.enable = true;
programs.ssh.matchBlocks = {
"*" = {
identityFile = "~/.ssh/palo_rsa.pub";
identitiesOnly = true;
};
"lassul.us" = {
user = "download";
port = 45621;
};
"*.r" = {
user = "root";
};
"*.secret" = {
user = "root";
};
"*.private" = {
user = "root";
};
"*.lan" = {
user = "root";
};
"github.com" = {
hostname = "ssh.github.com";
user = "root";
};
"es5.siteground.eu" = {
user = "ingolfwa";
port = 18765;
};
"*.onion" = {
user = "root";
};
#"*.compute.amazonaws.com".extraOptions = {
# ProxyCommand = ''
# sh -c "${pkgs.awscli2}/bin/aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
# '';
#};
};
};
};
}

View file

@ -1,21 +1,8 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.system.custom.x11;
in
{
options.system.custom.x11 = {
enable = mkEnableOption "enable x11";
autoLoginUser = mkOption {
type = with types; str;
description = "user to login";
};
};
config = mkIf cfg.enable {
config = mkIf config.components.gui.enable {
services.xserver = {
@ -26,7 +13,7 @@ in
displayManager = {
defaultSession = lib.mkDefault "none+i3";
autoLogin.enable = lib.mkDefault true;
autoLogin.user = cfg.autoLoginUser;
autoLogin.user = config.users.users.mainUser.name;
lightdm.enable = lib.mkDefault true;
};

View file

@ -4,7 +4,7 @@ with lib;
with types;
let
cfg = config.component.network.sshd;
cfg = config.components.network.sshd;
defaultRootKeyFiles = [ (toString ../../../assets/ssh/palo_rsa.pub) ];
in
{
@ -15,7 +15,7 @@ in
./known-hosts-public.nix
];
options.component.network.sshd = {
options.components.network.sshd = {
enable = mkOption {
type = bool;
default = true;

View file

@ -64,7 +64,7 @@
'';
services.openssh.enable = true;
component.network.sshd.onlyTincAccess = false;
components.network.sshd.onlyTincAccess = false;
nix.settings.max-jobs = lib.mkDefault 1;

View file

@ -2,6 +2,7 @@
imports = [
../../components
../../system/desktop
../../system/server/netdata.nix
@ -19,6 +20,8 @@
];
components.gui.enable = true;
services.nginx.enable = true;
networking.hostName = "cream";

View file

@ -64,7 +64,7 @@
'';
services.openssh.enable = true;
component.network.sshd.onlyTincAccess = false;
components.network.sshd.onlyTincAccess = false;
users.users.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw== contact@ingolf-wagner.de" ];

View file

@ -36,7 +36,6 @@
./system/font.nix
./system/mainUser.nix
./system/wifi.nix
./system/x11.nix
./system/on-failure.nix
];

View file

@ -10,7 +10,6 @@
./cachix.nix
./direnv.nix
./hoard.nix
./home-manager.nix
./mail-stuff.nix
#./mc.nix
./network.nix
@ -26,7 +25,7 @@
./wtf.nix
];
component.network.sshd.onlyTincAccess = lib.mkDefault true;
components.network.sshd.onlyTincAccess = lib.mkDefault true;
system.custom.suspend.enable = lib.mkDefault true;

View file

@ -1,396 +0,0 @@
{ pkgs, lib, config, ... }:
with lib;
let
xmodmapConfig = pkgs.writeText "xmodmap" ''
!
! Swap Caps_Lock and Control_L
!
! replace capslock keys with Escape Keys
! remove Lock = Caps_Lock
clear Lock
add Lock = Scroll_Lock
keysym Caps_Lock = Escape
! Set Right function Key to Windows-key
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
! Map umlauts to RIGHT ALT + <key>
keycode 108 = Mode_switch
keysym e = e E EuroSign
keysym c = c C cent
keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp
'';
in
{
imports = [
./home-manager/dunst.nix
./home-manager/doom-emacs.nix
./home-manager/ssh.nix
./home-manager/xmonad.nix
./home-manager/i3.nix
];
# don't run autoload -U compinit && compinit before ~/.zshrc
programs.zsh.enableGlobalCompInit = lib.mkForce false;
home-manager.users.mainUser = {
home.stateVersion = "22.11";
# nushell is the new shit yeah
programs.nushell = {
enable = lib.mkDefault true;
package = pkgs.unstable.nushell;
};
# a better cat
programs.bat = {
enable = true;
config.theme = "Solarized (light)";
};
# notify me when a command is finished
programs.noti.enable = true;
# a better ls
programs.exa = {
enable = true;
enableAliases = true;
};
# use z instead of cd
# use zi to fuzzy search through all registered directories
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# provide better `Ctrl+r` command in terminal
programs.mcfly = {
enable = true;
keyScheme = "vim";
#enableLightTheme = true;
fuzzySearchFactor = 3;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
defaultKeymap = "viins";
};
home.git-pull = {
enable = mkDefault false;
repositories = [
# krebs
#{
# source = "git@github.com:krebs/stockholm.git";
# target = "~/dev/krebs/stockholm";
#}
{
source = "git@github.com:krebs/rc3-map.git";
target = "~/dev/krebs/rc3-map";
}
# spaceleft
{
source = "git@git.space-left.org:space-left/rc3-map.git";
target = "~/dev/space-left/rc3-map";
}
# nixos
{
source = "git@github.com:mrVanDalo/home-manager-utils.git";
target = "~/dev/home-manager-utils";
}
{
source = "gitea@git.ingolf-wagner.de:palo/nixos-config.git";
target = "~/dev/nixos/nixos-config";
}
{
source = "gitea@git.ingolf-wagner.de:palo/nixos-private-assets.git";
target = "~/dev/nixos/nixos-private-assets";
}
{
source = "gitea@git.ingolf-wagner.de:palo/nixos-secrets.git";
target = "~/dev/nixos/nixos-secrets";
}
# terranix
{
source = "git@github.com:terranix/terranix.git";
target = "~/dev/terranix/terranix";
}
{
source = "git@github.com:terranix/terranix-website.git";
target = "~/dev/terranix/website";
}
{
source = "git@github.com:terranix/terranix-hcloud.git";
target = "~/dev/terranix/module-hcloud";
}
{
source = "git@github.com:terranix/terranix-module-github.git";
target = "~/dev/terranix/module-github";
}
{
source = "git@github.com:terranix/terranix-github-configuration.git";
target = "~/dev/terranix/configuration-github";
}
{
source = "git@github.com:terranix/terranix-examples.git";
target = "~/dev/terranix/examples";
}
{
source = "git@github.com:terranix/terranix-artwork.git";
target = "~/dev/terranix/artwork";
}
# private
{
source = "gitea@git.ingolf-wagner.de:palo/tech-ingolf-wagner-de.git";
target = "~/dev/tech.ingolf-wagner.de";
}
];
};
home.file.".config/bugwarrior/bugwarriorrc".text = ''
[general]
targets = terranix, github_private
static_fields = priority
log.level = INFO
[terranix]
service = github
github.login = mrVanDalo
github.token = @oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken
github.username = mrVanDalo
github.default_priority =
github.description_template = {{githubtitle}} {{githuburl}}
github.add_tags = github
github.project_name = terranix
github.involved_issues = True
github.query = org:terranix is:open
github.include_user_issues = False
github.include_user_repos = False
[github_private]
service = github
github.login = mrVanDalo
github.token = @oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken
github.username = mrVanDalo
github.description_template = {{githubtitle}} {{githuburl}}
github.add_tags = github
github.involved_issues = True
github.include_user_issues = True
github.include_user_repos = True
'';
xdg.configFile."ncmpcpp/config".text = ''
mpd_host = "pepe.private"
mpd_port = 6600
'';
programs.git = {
enable = true;
userName = "Ingolf Wagner";
userEmail = "contact@ingolf-wagner.de";
signing = {
key = "42AC51C9482D0834CF488AF1389EC2D64AC71EAC";
signByDefault = true;
};
ignores = [ "*.swp" "*~" ".idea" ".*penis.*" "result" ];
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
};
};
programs.gpg = {
enable = true;
settings = {
auto-key-locate = "local";
keyid-format = "long";
utf8-strings = "";
verbose = "";
with-fingerprint = "";
keyserver = "keyserver.ubuntu.com";
personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512";
default-preference-list =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
};
};
programs.htop = {
enable = true;
settings.highlight_base_name = true;
settings.tree_view = true;
};
xdg.configFile."albert/albert.conf".text = ''
[General]
hotkey=Meta+Space
showTray=false
telemetry=false
terminal=urxvt -e
[org.albert.extension.applications]
enabled=true
fuzzy=true
use_generic_name=true
use_keywords=true
[org.albert.extension.calculator]
enabled=true
[org.albert.extension.hashgenerator]
enabled=true
[org.albert.frontend.widgetboxmodel]
alwaysOnTop=true
clearOnHide=false
displayIcons=true
displayScrollbar=false
displayShadow=false
hideOnClose=false
hideOnFocusLoss=true
itemCount=5
showCentered=true
theme=SolarizedBrightViolet
'';
xdg.configFile."Code/User/settings.json".text = builtins.toJSON {
"keyboard.dispatch" = "keyCode";
"explorer.confirmDragAndDrop" = false;
"editor.tabSize" = 2;
"window.zoomLevel" = -1;
"git.enableSmartCommit" = true;
"files.autoSave" = "onFocusChange";
"terminal.integrated.setLocaleVariables" = true;
"terminal.external.linuxExec" = "xterm";
"explorer.confirmDelete" = false;
"todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ];
"workbench.colorTheme" = "Solarized Light";
};
xdg.configFile."mimeapps.list".text = ''
[Default Applications]
text/html=browser-select.desktop
x-scheme-handler/http=browser-select.desktop
x-scheme-handler/https=browser-select.desktop
x-scheme-handler/about=browser-select.desktop
x-scheme-handler/mailto=thunderbird.desktop;
x-scheme-handler/unknown=browser-select.desktop
x-scheme-handler/postman=Postman.desktop
image/png=sxiv.desktop
image/jpeg=sxiv.desktop
'';
home.file.".xprofile".text = ''
# load keyboard mappings
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
# to allow sudo commands to access X
# todo : only allow the browsers and rambox access
${pkgs.xorg.xhost}/bin/xhost +
# no shitty pcspkr crap
${pkgs.xorg.xset}/bin/xset -b
# no sleeping monitor
${pkgs.xorg.xset}/bin/xset -dpms
${pkgs.xorg.xset}/bin/xset s off
${pkgs.flameshot}/bin/flameshot &
# cleanup xmonad
rm -f ~/.xmonad/xmonad.state
'';
xdg.configFile."khal/config".text = ''
[calendars]
[[local_calendar]]
path = ~/.calendars/*
type = discover
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M
'';
xdg.configFile."vdirsyncer/config".text = ''
[general]
# A folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.vdirsyncer/status/"
# CALDAV
[pair my_calendar]
a = "nextcloud_calendar"
b = "local_calendar"
collections = ["from a", "from b"]
[storage nextcloud_calendar]
type = "caldav"
url = "https://nextcloud.ingolf-wagner.de/"
username = "palo"
password.fetch = ["command", "${pkgs.pass}/bin/pass", "home/nextcloud/vdirsyncer/password"]
[storage local_calendar]
type = "filesystem"
path = "~/.calendars/"
fileext = ".ics"
'';
};
environment.systemPackages =
let
library = import ../../library { inherit pkgs lib; };
fixKeyboard = pkgs.writeScriptBin "fix-Keyboard" # sh
''
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
'';
fixXhost = pkgs.writeScriptBin "fix-xhost" # sh
''
${pkgs.xorg.xhost}/bin/xhost + &> /dev/null
'';
fixX = pkgs.writeScriptBin "fix-X" # sh
''
${fixKeyboard}/bin/fix-Keyboard
for file in `ls ~/.screenlayout`
do
echo $file
~/.screenlayout/$file &> /dev/null
RETURN_CODE=$?
if [[ $RETURN_CODE -eq 0 ]]
then
exit 0;
fi
done
'';
in
[
fixX
fixXhost
(library.desktopFile fixX { longName = "fix X"; })
fixKeyboard
(library.desktopFile fixKeyboard { longName = "fix keyboard"; })
];
}

View file

@ -1,25 +0,0 @@
{ config, pkgs, lib, ... }: {
home-manager.users.mainUser = {
programs.doom-emacs = {
enable = lib.mkDefault true;
doomPrivateDir = ./doom.d;
extraConfig = ''
;; "monospace" means use the system default. However, the default is usually two
;; points larger than I'd like, so I specify size 12 here.
(setq doom-font
(font-spec :family "Jetbrains Mono" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light))
;(setq doom-font
; (font-spec :family "Terminus" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light))
'';
emacsPackagesOverlay = self: super: {
# fixes https://github.com/vlaci/nix-doom-emacs/issues/394
gitignore-mode = pkgs.emacsPackages.git-modes;
gitconfig-mode = pkgs.emacsPackages.git-modes;
};
};
};
environment.systemPackages = [
pkgs.ripgrep
];
}

View file

@ -1,264 +0,0 @@
{ pkgs, ... }: {
home-manager.users.mainUser = {
services.dunst = {
enable = false;
settings = {
global = {
font = "Iosevka Term 11";
# Allow a small subset of html markup:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
# If markup is not allowed, those tags will be stripped out of the
# message.
markup = "yes";
plain_text = "no";
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# Markup is allowed
format = ''
%a
<b>%s</b>
%b'';
# Sort messages by urgency.
sort = "yes";
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = "yes";
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = "center";
# The frequency with wich text that is longer than the notification
# window allows bounces back and forth.
# This option conflicts with "word_wrap".
# Set to 0 to disable.
bounce_freq = 0;
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 1;
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = "yes";
# Ignore newlines '\n' in notifications.
ignore_newline = "no";
# Hide duplicate's count and stack them
stack_duplicates = "yes";
hide_duplicates_count = "no";
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectevly.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "500x10-0+0";
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = "no";
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
idle_threshold = 0;
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing windowmanager is
# present (e.g. xcompmgr, compiz, etc.).
# transparency = 5
# Which monitor should the notifications be displayed on.
#monitor = keyboard
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a windowmanager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern windowmanagers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = "none";
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = "yes";
# Maximum amount of notifications kept in history
history_length = 15;
# Display indicators for URLs (U) and actions (A).
show_indicators = "no";
# The height of a single line. If the height is smaller than the
# font height, it will get raised to the font height.
# This adds empty space above and under the text.
line_height = 3;
# Draw a line of "separatpr_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 1;
# Padding between text and separator.
padding = 1;
# Horizontal padding.
horizontal_padding = 1;
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = "frame";
# Print a notification on startup.
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = true;
# dmenu path.
#dmenu = "${pkgs.dmenu}/bin/dmenu -p dunst:";
# Browser for opening urls in context menu.
# browser = /usr/bin/firefox -new-tab
# Align icons left/right/off
icon_position = "off";
max_icon_size = 80;
frame_width = 2;
frame_color = "#8EC07C";
};
shortcuts = {
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = "ctrl+space";
# Close all notifications.
close_all = "ctrl+shift+space";
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1".
#history = "ctrl+grave";
# Context menu.
context = "mod4+u";
};
urgency_low = {
frame_color = "#268bd2";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
urgency_normal = {
frame_color = "#b58900";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
urgency_critical = {
frame_color = "#dc322f";
foreground = "#002b36";
background = "#fdf6e3";
#timeout = 1;
};
};
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format".
# Shell-like globbing will get expanded.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
# vim: ft=cfg
};
};
}

View file

@ -1,365 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.home-manager.users.mainUser.xsession.windowManager.i3;
colorTheme =
let
theme = (import ../../../library/colorThemes.nix).solarized.light.hex;
in
theme // {
foreground = theme.base3;
background = theme.base03;
};
# switch to named workspaces
i3-wk-switch = pkgs.i3-wk-switch.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "tmfink";
repo = "i3-wk-switch";
rev = "5f43bb8cbe7938eff476fc534b61c8fb6a700c8f";
sha256 = "sha256-DOBPI/wO+S8a6EzWJeVGODXeSixFl7SHTtHAq5DG8GU=";
};
});
backgroundCommand = pkgs.writers.writeDash "background" ''
${pkgs.xorg.xrandr}/bin/xrandr | grep " connected" | \
${pkgs.gnused}/bin/sed -E "s/primary //" | \
${pkgs.coreutils-full}/bin/cut -d' ' -f 3 | \
${pkgs.gnused}/bin/sed -E 's/\+.*$//g' | \
${pkgs.coreutils-full}/bin/sort -r | \
${pkgs.coreutils-full}/bin/head -n 1 | \
${pkgs.gawk}/bin/awk -F 'x' '{print "--width="$1" --height="$2}' | \
${pkgs.findutils}/bin/xargs \
${pkgs.polygon-art.polygon-art}/bin/rings \
/dev/shm/background.png && \
${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png
'';
in
{
home-manager.users.mainUser = {
programs.i3status-rust = {
enable = true;
bars = {
my = {
icons = "awesome5";
theme = "solarized-light";
# https://github.com/greshake/i3status-rust/blob/v0.22.0/doc/blocks.md
blocks = [
{
block = "cpu";
interval = 1;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
format_swap = "{swap_used_percents}";
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{
block = "battery";
interval = 10;
format = "{percentage} {time}";
}
{ block = "uptime"; }
{
block = "time";
interval = 60;
format = "%Y-%m-%d %R";
}
];
};
};
};
programs.kitty = {
enable = true;
# kitty +kitten themes
theme = "Gruvbox Light Hard";
settings = {
font_family = "JetBrains Mono";
bold_font = "auto";
italic_font = "auto";
bold_italic_font = "auto";
font_size = 11;
};
};
programs.alacritty = {
enable = true;
settings = {
import =
let
themes = pkgs.fetchFromGitHub {
owner = "alacritty";
repo = "alacritty-theme";
rev = "024c5c0dfb65197d5796e29e307b321af9a5e198";
sha256 = "sha256-zXyGXZSmmTup5o7Dx6he+57vSFpygR+GSD+3PTxDbVk=";
};
in
[ "${themes}/themes/gruvbox_light.yaml" ];
font = {
normal = {
family = "JetBrains Mono";
style = "Regular";
};
bold = {
family = "JetBrains Mono";
style = "Bold";
};
italic = {
family = "JetBrains Mono";
style = "Italic";
};
size = 6.0;
};
};
};
xsession.windowManager.i3 = {
enable = true;
extraConfig = ''
default_border pixel
'';
config = {
modifier = "Mod4";
terminal = "alacritty";
startup =
let
height = config.configuration.desktop.height;
width = config.configuration.desktop.width;
in
[
{ command = "${pkgs.albert}/bin/albert"; always = true; }
{ command = toString backgroundCommand; always = true; }
#{ command = "${pkgs.flameshot}/bin/flameshot"; always = true; }
# { command = "systemctl --user restart polybar"; always = true; notification = false; }
];
fonts = {
names = [ "JetBrains Mono" ];
size = 11.0;
};
bars =
with colorTheme;
let
selected = blue;
in
[{
mode = "hide";
hiddenState = "hide";
position = "top";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.users.users.mainUser.home}/.config/i3status-rust/config-my.toml";
fonts = {
names = [ "JetBrains Mono" ];
size = 11.0;
};
trayOutput = "primary";
colors = {
background = background;
statusline = background;
separator = background;
focusedWorkspace = {
border = selected;
background = base02;
text = foreground;
};
activeWorkspace = {
border = background;
background = base02;
text = foreground;
};
inactiveWorkspace = {
border = background;
background = base02;
text = foreground;
};
urgentWorkspace = {
border = red;
background = base02;
text = foreground;
};
bindingMode = {
border = red;
background = red;
text = background;
};
};
}];
colors = with colorTheme; {
background = background;
focused = {
background = blue;
border = blue;
childBorder = blue;
indicator = blue;
text = foreground;
};
focusedInactive = {
background = base01;
border = base01;
childBorder = base02;
indicator = base02;
text = foreground;
};
unfocused = {
background = base02;
border = base02;
childBorder = base02;
indicator = base02;
text = foreground;
};
urgent = {
background = orange;
border = orange;
childBorder = background;
indicator = background;
text = foreground;
};
};
keybindings = {
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/";
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+Shift+q" = "exit";
"${cfg.config.modifier}+q" = "kill";
"${cfg.config.modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right";
"${cfg.config.modifier}+j" = "focus next";
"${cfg.config.modifier}+k" = "focus prev";
"${cfg.config.modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right";
"${cfg.config.modifier}+h" = "split h";
"${cfg.config.modifier}+v" = "split v";
"${cfg.config.modifier}+f" = "fullscreen toggle";
"${cfg.config.modifier}+s" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed";
"${cfg.config.modifier}+e" = "layout toggle split";
"${cfg.config.modifier}+t" = "floating toggle";
#"${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+b" = "exec ${backgroundCommand}";
"${cfg.config.modifier}+p" = "focus parent";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show";
"${cfg.config.modifier}+1" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 1";
"${cfg.config.modifier}+2" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 2";
"${cfg.config.modifier}+3" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 3";
"${cfg.config.modifier}+4" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 4";
"${cfg.config.modifier}+5" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 5";
"${cfg.config.modifier}+6" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 6";
"${cfg.config.modifier}+7" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 7";
"${cfg.config.modifier}+8" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 8";
"${cfg.config.modifier}+9" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 9";
"${cfg.config.modifier}+0" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 10";
"${cfg.config.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.config.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.config.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.config.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.config.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.config.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.config.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.config.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.config.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.config.modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.config.modifier}+Escape" = "workspace back_and_forth";
# rename workspace
"${cfg.config.modifier}+n" = ''
exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: '
'';
"${cfg.config.modifier}+grave" =
let
script = pkgs.writers.writeBash "select-workspace" ''
set -e
set -o pipefail
${pkgs.i3}/bin/i3-msg -t get_workspaces | \
${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \
${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \
while read line
do
${i3-wk-switch}/bin/i3-wk-switch "$line"
done
'';
in
"exec ${script}";
"${cfg.config.modifier}+Shift+c" = "reload";
"${cfg.config.modifier}+Shift+r" = "restart";
"${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.config.modifier}+r" = "mode resize";
# multiple monitors
# autorandr --save docked # to save setup
# autorandr --save undocked # to save setup
# autorandr --change # automatically detects the setup
"${cfg.config.modifier}+BackSpace" =
let
xmodmapConfig = pkgs.writeText "xmodmap" ''
!
! Swap Caps_Lock and Control_L
!
! replace capslock keys with Escape Keys
! remove Lock = Caps_Lock
clear Lock
add Lock = Scroll_Lock
keysym Caps_Lock = Escape
! Set Right function Key to Windows-key
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
! Map umlauts to RIGHT ALT + <key>
keycode 108 = Mode_switch
keysym e = e E EuroSign
keysym c = c C cent
keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp
'';
script = pkgs.writers.writeBash "autorandr" ''
${pkgs.autorandr}/bin/autorandr --change
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
${backgroundCommand}
'';
in
"exec ${toString script}";
# like vimperator
"${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus";
};
};
};
};
}

View file

@ -1,262 +0,0 @@
{ pkgs, lib, config, ... }:
let
user = "mainUser";
userName = config.users.users.mainUser.name;
home = config.users.users.mainUser.home;
fontSize = config.programs.custom.urxvt.fontSize;
startupBanner = pkgs.fetchurl {
url =
"https://github.com/NixOS/nixos-homepage/raw/master/logo/nix-wiki.png";
sha256 = "1hrz7wr7i0b2bips60ygacbkmdzv466lsbxi22hycg42kv4m0173";
};
ticks = "\"''\"";
in
{
environment.systemPackages = [
# needed for the SPC p g
pkgs.universal-ctags
pkgs.nodePackages.tern
pkgs.emacs
];
# download git repositories into the home folder
systemd.services =
let
clone = repository: folder: branch: {
enable = true;
wantedBy = [ "multi-user.target" ];
description = "clone ${repository} to ${folder}";
serviceConfig.User = userName;
unitConfig.ConditionPathExists = "!${folder}";
script = ''
${pkgs.git}/bin/git clone ${repository} --branch ${branch} ${folder}
'';
};
in
{
spacemacs-pull =
clone "https://github.com/syl20bnr/spacemacs" "${home}/.emacs.d" "master";
# todo move this to spacevim.nix
spacevim-pull =
clone "https://github.com/SpaceVim/SpaceVim.git" "${home}/.SpaceVim"
"master";
};
home-manager.users."${user}" = {
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-init.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-init.el") in your dotspacemacs/init function
;; overrides of dotspacemacs/init ()
(setq
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press <SPC> T n to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one lixft:inconsolata:pixelsizeght)
dotspacemacs-themes '(solarized-light solarized-dark)
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed. (default 'official)
dotspacemacs-startup-banner "${startupBanner}"
;; Default font, or prioritized list of fonts. `powerline-scale' allows to
;; quickly tweak the mode-line size to make separators look not too crappy.
dotspacemacs-default-font '("Terminus"
:size ${toString fontSize}
:weight normal
:width normal
:powerline-scale 1.1)
) ;; eof
'';
home.file.".spacemacs.d/hook-layers.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-layers.el") in your dotspacemacs/layers function
(let
((user-layers dotspacemacs-configuration-layers))
(setq
dotspacemacs-configuration-layers
(append user-layers
'( python
ansible
rust
windows-scripts
javascript
typescript
html
yaml
auto-completion
git
markdown
restclient
emacs-lisp
nixos
spell-checking
syntax-checking
systemd
lua
terraform
graphviz
c-c++
;; (haskell :variables
;; haskell-enable-hindent t
;; haskell-completion-backend 'lsp
;; haskell-enable-hindent-style "gibiansky"
;; haskell-process-type 'cabal-new-repl)
))))
(let
((user-packages dotspacemacs-additional-packages ))
(setq
dotspacemacs-additional-packages
(append user-packages
'(
;; lsp-mode
;; lsp-ui
;; lsp-haskell
direnv
))))
'';
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-user-config.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-user-config.el") in your dotspacemacs/user-config function
;; turn of smartparens mode off globally
;; https://github.com/Fuco1/smartparens
;;(spacemacs/toggle-smartparens-globally-off)
;;(remove-hook 'prog-mode-hook #'smartparens-mode)
(setq powerline-default-separator 'nil)
(let ((n 2))
(setq coffee-tab-width n)
(setq javascript-indent-level n)
(setq js-indent-level n)
(setq js2-basic-offset n)
(setq web-mode-markup-indent-offset n)
(setq web-mode-css-indent-offset n)
(setq web-mode-code-indent-offset n)
(setq css-indent-offset n))
;; configure indent function correctly
(add-hook 'nix-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq indent-line-function (quote nix-indent-line))))
;; lsp setup for haskell
;; hie-wrapper must be configured in the direnv setup
;; make sure cabal update was executed once on the machine
;; (setq lsp-haskell-process-path-hie "hie-wrapper")
;; (setq lsp-response-timeout 60)
;; (require 'lsp-haskell)
;; (add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-mode-hook #'direnv-update-environment)
;; setup run-assoc
;; in dired mode use C-<RETURN> to open file in associated program
(load "~/.spacemacs.d/run-assoc.el")
(setq associated-program-alist
'(
("${pkgs.evince}/bin/evince" "\\.pdf$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.odt$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.ods$")
${
let
suffixes = [ "jpg" "jpeg" "png" ];
rule = suffix: ''("${pkgs.sxiv}/bin/sxiv" "\\.${suffix}$")'';
in lib.concatStringsSep "\n " (builtins.map rule suffixes)
}
${
let
suffixes = [ "mp4" "mkv" "avi" ];
rule = suffix: ''("${pkgs.mpv}/bin/mpv" "\\.${suffix}$")'';
in lib.concatStringsSep "\n " (builtins.map rule suffixes)
}
)
)
'';
home.file.".spacemacs.d/run-assoc.el".source = pkgs.fetchurl {
url = "https://www.emacswiki.org/emacs/download/run-assoc.el";
sha256 = "1rg0pa09zfslgqnhbqvaa6vdi2fmanrpyzq67ppiin0h1kdgs4im";
};
home.file.".ctags.d/terraform.ctags".text = ''
--langdef=terraform
--langmap=terraform:.tf.tfvars
--regex-terraform=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/r,Resource/
--regex-terraform=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/d,Data/
--regex-terraform=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/
--regex-terraform=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/
--regex-terraform=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/
--regex-terraform=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/
--regex-terraform=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/
'';
home.file.".spacemacs.d/old/polymode.el".text = ''
;; not used at the moment
(define-hostmode poly-nix-hostmode
:mode 'nix-mode)
(define-innermode poly-nix-lisp-metadata-innermode
:mode 'emacs-lisp-mode
:head-matcher (rx "/* lisp */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-shell-metadata-innermode
:mode 'shell-script-mode
:head-matcher (rx "/* sh */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-python-metadata-innermode
:mode 'python-mode
:head-matcher (rx "/* python */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-haskell-metadata-innermode
:mode 'haskell-mode
:head-matcher (rx "/* haskell */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-polymode poly-nix-mode
:hostmode 'poly-nix-hostmode
:innermodes '(poly-nix-lisp-metadata-innermode
poly-nix-shell-metadata-innermode
poly-nix-haskell-metadata-innermode
poly-nix-python-metadata-innermode))
;; remove nix-mode from auto load and replace it with poly-nix-mode
(setq auto-mode-alist (rassq-delete-all 'nix-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.nix\\'" . poly-nix-mode))
'';
};
}

View file

@ -1,40 +0,0 @@
{ lib, pkgs, ... }: {
environment.systemPackages =
let
spacevimRepo = pkgs.fetchgit {
url = "https://github.com/SpaceVim/SpaceVim.git";
rev = "9b354e05b4716b645ba6366e1265a5048a0c23d5";
sha256 = "1mn28hf857kp0jmbgd89cf5mk4dg53jcbqqrbr9zi3b854sa9ads";
};
vimRc = pkgs.writeText "vimrc" ''
" search/grep case insensitive
:set ignorecase
" tabs should always be 2 spaces
set et ts=2 sts=2 sw=2
" show Trailing Whitespaces
:set list listchars=tab:»·,trail:
" start spacevim
source ${spacevimRepo}/init.vim
" configure command cross
"":hi CursorLine cterm=NONE ctermbg=0 guibg=#073642
"":hi CursorColumn cterm=NONE ctermbg=0 guibg=#073642
""set cursorline
""set cursorcolumn
" disable noisy indentLine
let g:indentLine_enabled = 0
'';
in
[
# vim
(pkgs.writers.writeDashBin "spacevim" ''
exec ${pkgs.neovim}/bin/nvim -u ${vimRc} "$@"
'')
];
}

View file

@ -1,45 +0,0 @@
{ pkgs, lib, ... }:
with lib; {
home-manager.users.mainUser = {
programs.ssh.enable = true;
programs.ssh.matchBlocks = {
"*" = {
identityFile = "~/.ssh/palo_rsa.pub";
identitiesOnly = true;
};
"lassul.us" = {
user = "download";
port = 45621;
};
"*.r" = {
user = "root";
};
"*.secret" = {
user = "root";
};
"*.private" = {
user = "root";
};
"*.lan" = {
user = "root";
};
"github.com" = {
hostname = "ssh.github.com";
user = "root";
};
"es5.siteground.eu" = {
user = "ingolfwa";
port = 18765;
};
"*.onion" = {
user = "root";
};
#"*.compute.amazonaws.com".extraOptions = {
# ProxyCommand = ''
# sh -c "${pkgs.awscli2}/bin/aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
# '';
#};
};
};
}

View file

@ -2,11 +2,6 @@
environment.systemPackages = with pkgs; [ xclip xtrlock-pam xorg.xev ];
system.custom.x11 = {
enable = lib.mkDefault true;
autoLoginUser = config.users.users.mainUser.name;
};
system.custom.fonts.enable = true;
# xinput list < to show devices