Compare commits

..

No commits in common. "1e0e83b9340129939e2516fa62da5e3cb5a9badc" and "dd96ede0c820cf91d9e50023c6c3374b4bb5426a" have entirely different histories.

39 changed files with 1048 additions and 1334 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

View File

@ -21,36 +21,18 @@
"type": "github"
}
},
"musnix": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1715993859,
"narHash": "sha256-hBPn1xF4Wspf6kJ+SR9FHy9vRUFmtJEZjrTLIWjFib8=",
"owner": "musnix",
"repo": "musnix",
"rev": "3ba4dba298a4720d51db6269f97038601f3fe2c1",
"type": "github"
},
"original": {
"owner": "musnix",
"repo": "musnix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715266358,
"narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=",
"owner": "NixOS",
"lastModified": 1712168706,
"narHash": "sha256-XP24tOobf6GGElMd0ux90FEBalUtw6NkBSVh/RlA6ik=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f1010e0469db743d14519a1efd37e23f8513d714",
"rev": "1487bdea619e4a7a53a4590c475deabb5a9d1bfb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
@ -71,27 +53,10 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1715668745,
"narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"musnix": "musnix",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
"unstable": "unstable"
}

View File

@ -15,8 +15,6 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
musnix = {url = "github:musnix/musnix";};
};
outputs = {
@ -53,7 +51,6 @@
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
inputs.musnix.nixosModules.musnix
];
};
};

View File

@ -74,28 +74,7 @@
console.keyMap = "de";
# Enable CUPS to print documents.
services.printing = {
enable = true;
drivers = [pkgs.samsung-unified-linux-driver];
};
services.avahi = {
enable = true;
nssmdns = true;
openFirewall = true;
};
hardware.printers = {
ensurePrinters = [
{
name = "Samsung_ML-1630W_Series";
location = "luhbots";
deviceUri = "dnssd://Samsung%20ML-1630W%20Series%20(SEC00159937E684)._pdl-datastream._tcp.local/";
model = "samsung/ML-1630W.ppd";
ppdOptions = {
PageSize = "A4";
};
}
];
};
services.printing.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;

View File

@ -1,15 +1,26 @@
{...}: {
{
pkgs,
inputs,
...
}: {
imports = [
../../modules/home
# sway as windowmanager
../../modules/home-manager/sway.nix
# zsh config
../../modules/home-manager/zsh.nix
# foot terminal emulator
../../modules/home-manager/foot.nix
# often used terminal programs
../../modules/home-manager/btop.nix
../../modules/home-manager/bat.nix
../../modules/home-manager/lazygit.nix
../../modules/home-manager/git.nix
# use mpd for music
../../modules/home-manager/mpd.nix
# email config
../../modules/home-manager/thunderbird.nix
];
shell.enable = true;
git.enable = true;
music.enable = true;
sway.enable = true;
sway.laptop = true;
myPrograms.enable = true;
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "max";
@ -24,8 +35,53 @@
# release notes.
home.stateVersion = "23.11"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
unzip
nextcloud-client
firefox
thunderbird
xournalpp
prismlauncher
steam
blender
betaflight-configurator
loudgain
youtube-dl
dconf
distrobox
libqalculate
sops
pwvucontrol
qpwgraph
discord
libreoffice-fresh
mate.caja
libsForQt5.okular
mpv
gimp
freecad
flatpak
wine
unstable.gyroflow
prusa-slicer
];
home.sessionVariables = {
EDITOR = "${pkgs.neovim}/bin/nvim";
};
xdg.enable = true;
services.nextcloud-client.enable = true;
services.udiskie = {
enable = true;
automount = true;
notify = true;
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

View File

@ -0,0 +1,10 @@
{...}: {
programs.bat = {
enable = true;
config = {
map-syntax = ["*.ino:C++"];
theme = "Solarized (dark)";
style = "numbers,changes,header-filename,header-filesize";
};
};
}

View File

@ -0,0 +1,37 @@
{pkgs, ...}: {
programs.btop = {
enable = true;
settings = {
color_theme = "${pkgs.btop}/share/btop/themes/adapta.theme";
theme_background = true;
rounded_corners = true;
graph_symbol = "braille";
shown_boxes = "proc cpu mem net";
update_ms = 1000;
proc_sorting = "cpu lazy";
proc_colors = true;
proc_gradient = true;
proc_per_core = true;
proc_mem_bytes = true;
cpu_graph_upper = "total";
cpu_single_graph = true;
show_uptime = true;
check_temp = true;
cpu_sensor = "Auto";
show_coretemp = true;
temp_scale = "celsius";
base_10_sizes = false;
show_cpu_freq = true;
clock_format = "%H:%M";
background_update = true;
mem_graphs = true;
show_swap = true;
show_io_stat = true;
net_download = 128;
net_upload = 128;
net_auto = false;
show_battery = true;
selected_battery = "Auto";
};
};
}

View File

@ -0,0 +1,30 @@
{...}: {
programs.foot = {
enable = true;
settings = {
main = {
font = "FiraCode Nerd Font Mono:size=10";
dpi-aware = "yes";
};
colors = {
regular0 = "222222"; # black
regular1 = "cc9393"; # red
regular2 = "7f9f7f"; # green
regular3 = "d0bf8f"; # yellow
regular4 = "8cd0d3"; # blue
regular5 = "dc8cc3"; # magenta
regular6 = "93e0e3"; # cyan
regular7 = "dcdccc"; # white
bright0 = "666666"; # black
bright1 = "dca3a3"; # red
bright2 = "bfebbf"; # green
bright3 = "f0dfaf"; # yellow
bright4 = "8cd0d3"; # blue
bright5 = "fcace3"; # magenta
bright6 = "b3ffff"; # cyan
bright7 = "ffffff"; # white
};
};
};
}

View File

@ -0,0 +1,24 @@
{...}: {
programs.git = {
enable = true;
extraConfig = {
fetch.parallel = 0;
init.defaultBranch = "main";
pull.rebase = true;
};
delta = {
enable = true;
options = {
decorations = {
commit-decoration-style = "bold yellow box ul";
file-decoration-style = "none";
file-style = "bold yellow ul";
};
features = "decorations";
whitespace-error-style = "22 reverse";
};
};
userEmail = "max.kaenner@gmail.com";
userName = "Max Känner";
};
}

View File

@ -0,0 +1,12 @@
{...}: {
programs.lazygit = {
enable = true;
settings = {
gui = {
shwoRandomTip = false;
nerdFontsVersion = "3";
border = "rounded";
};
};
};
}

View File

@ -0,0 +1,17 @@
{pkgs, ...}: {
home.packages = with pkgs; [
mpc-cli
ymuse
];
services.mpd = {
enable = true;
musicDirectory = "/home/max/Music/";
network.startWhenNeeded = true;
extraConfig = ''
restore_paused "yes"
auto_update "yes"
'';
};
services.mpd-mpris.enable = true;
services.mpdris2.enable = true;
}

View File

@ -0,0 +1,604 @@
{
config,
pkgs,
lib,
...
}: let
schema = "org.gnome.desktop.a11y.applications";
key = "screen-keyboard-enabled";
squeekboard_toggle = pkgs.writeShellScriptBin "squeekboard_toggle" ''
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
gsettings set ${schema} ${key} false
else
gsettings set ${schema} ${key} true
fi
'';
squeekboard_format = pkgs.writeShellScriptBin "squeekboard_format" ''
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
echo '{ "text": "󰌌", "tooltip": "enabled", "percentage": 100 }'
else
echo '{ "text": "󰌐", "tooltip": "disabled", "percentage": 0 }'
fi
'';
rotate_lisgd = pkgs.writeShellScriptBin "rotate_lisgd" ''
# PREV_ORIENTATION and ORIENTATION are given by rot8
LISGD_INPUT=/dev/input/event14
# open nwggrid by swiping up from the bottom edge
LISGD_ACTIONS=("1,DU,B,*,R,${pkgs.sway}/bin/swaymsg exec ${pkgs.nwg-launchers}/bin/nwggrid -client")
# close window by swiping down with 3 fingers
LISGD_ACTIONS+=("3,UD,*,L,R,${pkgs.sway}/bin/swaymsg kill")
# move window left by swiping left with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move left")
# move window down by swiping down with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move down")
# move window up by swiping up with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move up")
# move window right by swiping right with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move right")
LISGD_ACTION_OPTIONS=()
for str in "''${LISGD_ACTIONS[@]}"; do
LISGD_ACTION_OPTIONS+=("-g" "$str")
done
${pkgs.killall}/bin/killall lisgd
${pkgs.lisgd}/bin/lisgd -v -d "$LISGD_INPUT" "''${LISGD_ACTION_OPTIONS[@]}" &
'';
# bash script to let dbus know about impotant env variables and
# propagate them to relevent services run at the end of sway config
dbus-sway-environment = pkgs.writeShellScriptBin "dbus-sway-environment" ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
in {
home.packages = with pkgs; [
waybar # status bar
swaylock # screen locking
swayidle # automatic screen locking after system idle time
kanshi # hotswap displays
foot # terminal
keepassxc # used for secrets instead of gnome-keyring
];
wayland.windowManager.sway = {
enable = true;
systemd = {
enable = true;
xdgAutostart = false;
};
wrapperFeatures = {
gtk = true;
};
config = {
output = let
bgdir = "~/Documents/Blender/desktop background Informatiker";
bg1080 = bgdir + "/render 1080p new color.png";
bg1080vert = bgdir + "/render 1080p hochkant new.png";
bg4k = bgdir + "/render 4K new color.png";
in {
eDP-1 = {
bg = "'${bg1080}' fit";
};
HDMI-A-1 = {
bg = "'${bg4k}' fit";
};
DP-3 = {
bg = "'${bg1080}' fit";
};
DP-4 = {
bg = "'${bg1080}' fit";
};
DP-5 = {
bg = "'${bg1080vert}' fit";
};
DP-6 = {
bg = "'${bg1080}' fit";
};
DP-7 = {
bg = "'${bg1080vert}' fit";
};
};
input = {
"*" = {
xkb_layout = "de";
xkb_options = "caps:ctrl_modifier";
xkb_numlock = "enable";
};
"type:touchpad" = {
tap = "enable";
natural_scroll = "enable";
};
# map laptop touchscreen to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C" = {
map_to_output = "'AU Optronics 0x4B2D Unknown'";
};
# map laptop stylus to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C_Stylus" = {
map_to_output = "'AU Optronics 0x4B2D Unknown'";
};
};
modifier = "Mod4";
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
# special workspaces
"${modifier}+1" = "workspace main";
"${modifier}+2" = "workspace term";
"${modifier}+3" = "workspace msg";
"${modifier}+4" = "workspace music";
"${modifier}+Shift+1" = "move container to workspace main";
"${modifier}+Shift+2" = "move container to workspace term";
"${modifier}+Shift+3" = "move container to workspace msg";
"${modifier}+Shift+4" = "move container to workspace music";
# screen capture
"${modifier}+Print" = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
"${modifier}+Shift+Print" = ''exec ${pkgs.wf-recorder}/bin/wf-recorder -g "$(${pkgs.slurp}/bin/slurp)" -f "$HOME/Videos/screencapture_$(${pkgs.coreutils}/bin/date +%F-%T).mp4"'';
# brightness
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
# volume
"XF86AudioRaiseVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +1%'";
"XF86AudioLowerVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -1%'";
"XF86AudioMute" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle'";
# custom pause mode similar to typical system shutdown menus
"${modifier}+F12" = "mode pause-break";
};
menu = "${pkgs.nwg-launchers}/bin/nwggrid -client";
# use foot as default terminal
terminal = "foot";
assigns = {
"main" = [{app_id = "firefox";}];
"term" = [{app_id = "foot-startup";}];
"msg" = [{title = "\\[Locked\\] - KeePassXC$";}];
};
bars = [];
fonts = {
names = ["FiraCode Nerd Font"];
size = 11.0;
};
modes = {
pause-break = {
e = "exec --no-startup-id swaymsg exit, mode default";
s = "exec --no-startup-id ${pkgs.dash}/bin/dash -c '${pkgs.swaylock}/bin/swaylock & systemctl suspend-then-hibernate', mode default";
r = "exec --no-startup-id systemctl reboot";
End = "exec --no-startup-id systemctl poweroff";
Return = "mode default";
Escape = "mode default";
};
};
startup = [
{command = "${dbus-sway-environment}/bin/dbus-sway-environment";}
{command = "${configure-gtk}/bin/configure-gtk";}
{command = "${pkgs.squeekboard}/bin/squeekboard";}
{command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${pkgs.nwg-launchers}/bin/nwggrid-server -fp";}
{command = "${pkgs.keepassxc}/bin/keepassxc";}
{command = "${pkgs.waybar}/bin/waybar";}
{command = "${pkgs.foot}/bin/foot -a foot-startup";}
{command = "${pkgs.networkmanagerapplet}/bin/nm-applet";}
];
defaultWorkspace = "main";
workspaceAutoBackAndForth = true;
workspaceOutputAssign = [
{
workspace = "main";
output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"];
}
{
workspace = "term";
output = ["DP-5" "DP-4" "DP-7" "eDP-1"];
}
{
workspace = "msg";
output = ["eDP-1"];
}
{
workspace = "music";
output = ["eDP-1"];
}
{
workspace = "5";
output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"];
}
];
colors = {
background = "#00000000";
focused = {
border = "#00FFEE";
background = "#4477AA";
text = "#F0F0F0";
childBorder = "#00FFEE";
indicator = "#00AA88";
};
focusedInactive = {
border = "#626262";
background = "#444444";
text = "#F0F0F0";
childBorder = "#626262";
indicator = "#00AA88";
};
placeholder = {
border = "#313131";
background = "#222222";
text = "#F0F0F0";
childBorder = "#313131";
indicator = "#005544";
};
unfocused = {
border = "#313131";
background = "#222222";
text = "#F0F0F0";
childBorder = "#313131";
indicator = "#00AA88";
};
urgent = {
border = "#FF3131";
background = "#882222";
text = "#F0F0F0";
childBorder = "#FF3131";
indicator = "#00AA88";
};
};
focus.mouseWarping = true;
gaps = {
inner = 5;
smartGaps = true;
smartBorders = "no_gaps";
};
window.titlebar = false;
};
extraConfig = ''
bindswitch --reload --locked lid:on exec "[ $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq '. | length') -gt 1 ] && ${pkgs.sway}/bin/swaymsg output eDP-1 disable"
bindswitch --reload --locked lid:off output eDP-1 enable
'';
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 26;
modules-left = ["sway/workspaces" "sway/mode"];
modules-center = ["sway/window"];
modules-right = ["mpd" "tray" "custom/squeekboard" "sway/language" "clock" "backlight" "battery" "network"];
"sway/workspaces" = {
disable-scroll = true;
all-outputs = false;
format = "<span size='150%'>{icon}</span> {name}";
format-icons = {
"main" = "󰈹";
"term" = "";
"msg" = "󰷹";
"music" = "󰫔";
"urgent" = "";
"focused" = "";
"default" = "";
};
};
"mpd" = {
format = "{stateIcon}{consumeIcon}{randomIcon}{repeatIcon}{singleIcon} {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) {volume}";
format-stopped = "{stateIcon}{randomIcon}{repeatIcon}{singleIcon} Stopped {volume}";
format-disconnected = "";
unkown-tag = "N/A";
interval = 2;
consume-icons = {
on = "󰮯 ";
off = "";
};
random-icons = {
on = "󰒟 ";
off = "󰒞 ";
};
repeat-icons = {
on = "󰑖 ";
off = "󰑗 ";
};
single-icons = {
on = "󰑘 ";
off = "";
};
state-icons = {
paused = "󰏤 ";
playing = "󰐊 ";
};
max-length = 50;
};
"tray" = {
spacing = 10;
};
"custom/squeekboard" = {
format = "{}";
exec = "${squeekboard_format}/bin/squeekboard_format";
return-type = "json";
exec-on-event = true;
interval = 2;
on-click = "${squeekboard_toggle}/bin/squeekboard_toggle";
};
"sway/language" = {
format = "{shortDescription}";
tooltip = false;
};
"clock" = {
interval = 60;
format = "{:%a %d.%m %I:%M}";
};
"backlight" = {
format = "{percent}% {icon}";
format-icons = ["󰹐" "󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨"];
};
"battery" = {
format = "{capacity}% {icon}";
format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
"network" = {
format-wifi = "{essid} ({signalStrength}%) 󰖩";
format-ethernet = "{ipaddr}/{cidr} 󰈀";
tooltip-format = "{ifname} via {gwaddr} 󰌘";
format-disconnected = "󰌙";
};
};
};
style = ./waybar.css;
};
services.kanshi = {
enable = true;
profiles = {
laptop.outputs = [
{
criteria = "eDP-1";
position = "0,0";
}
];
dock_luhbots = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE GRCPH83";
position = "0,0";
}
{
criteria = "NEC Corporation E243WMi 7X313185NB";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots2 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 8YCPH83";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 59118576NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots3 = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 53DCH83";
position = "0,0";
}
{
criteria = "Dell Inc. DELL U2412M 0FFXD46I4U5S";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-6"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-7"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-6"
];
};
dock_luhbots4 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL P2422HE 4BXL9M3";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 75309334NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-3"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-3"
];
};
laptop_hannspree = {
outputs = [
{
criteria = "eDP-1";
position = "320,1440";
}
{
criteria = "HannStar Display Corp HC281UPB ";
position = "0,0";
mode = "3840x2160@60";
scale = 1.5;
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to HDMI-A-1"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to HDMI-A-1"
];
};
};
};
# Theming
gtk = {
enable = true;
cursorTheme = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors-white";
size = 24;
};
iconTheme = {
package = pkgs.whitesur-icon-theme;
name = "WhiteSur-dark";
};
theme = {
package = pkgs.whitesur-gtk-theme;
name = "WhiteSur-Dark";
};
gtk3.extraConfig = {
gtk-dialogs-use-header = false;
gtk-cursor-theme-size = 0;
gtk-toolbar-style = "GTK_TOOLBAR_BOTH_HORIZ";
gtk-toolbar-icon-style = "GTK_ICON_SIZE_LARGE_TOOLBAR";
gtk-button-images = 0;
gtk-menu-images = 0;
gtk-enable-event-sounds = 0;
gtk-enable-input-feedback-sounds = 1;
gtk-xft-antialias = 1;
gtk-xft-hinting = 1;
gtk-xft-hintstyle = "hintslight";
gtk-xft-rgba = "none";
};
};
home.pointerCursor = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors-white";
size = 24;
x11.enable = true;
x11.defaultCursor = "capitaine-cursors-white";
};
xsession.enable = true;
home.file."tofi" = {
enable = true;
target = ".config/tofi/config";
text = ''
# fullscreen theming
width = 100%
height = 100%
border-width = 0
outline-width = 0
padding-top = 32
result-spacing = 25
font = FiraCode Nerd Font
background-color = #000D
text-color = #00FFEE
selection-color = #EEFF00
hint-font = false
# search behavior
history = true
fuzzy-match = true
'';
};
services.mako = {
enable = true;
actions = true;
anchor = "top-right";
backgroundColor = "#313131";
borderColor = "#00FFEE";
progressColor = "#338833";
textColor = "#e0e0e0";
extraConfig = ''
[urgency=low]
border-color=#008877
'';
borderRadius = 10;
borderSize = 2;
height = 100;
width = 400;
defaultTimeout = 10000; # ms
font = "FiraCode Nerd Font 11";
icons = true;
markup = true;
};
}

View File

@ -0,0 +1,104 @@
{...}: {
accounts.email.accounts = {
"google max" = {
address = "max.kaenner@gmail.com";
userName = "max.kaenner@gmail.com";
realName = "Max Känner";
flavor = "gmail.com";
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
primary = true;
};
"google informatiker" = {
address = "kaenner9@gmail.com";
userName = "kaenner9@gmail.com";
realName = "Max Känner";
flavor = "gmail.com";
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
};
"uni" = {
address = "max.kaenner@stud.uni-hannover.de";
userName = "max.kaenner@stud.uni-hannover.de";
realName = "Max Känner";
imap = {
host = "mail.stud.uni-hannover.de";
port = 993;
tls = {
enable = true;
useStartTls = false;
};
};
smtp = {
host = "smtp.uni-hannover.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
"luhbots" = {
address = "max.kaenner@luhbots.de";
userName = "max.kaenner@luhbots.de";
realName = "Max Känner";
imap = {
host = "luhbots.de";
port = 993;
tls = {
enable = true;
useStartTls = false;
};
};
smtp = {
host = "luhbots.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
"gymstolz" = {
address = "max.kaenner@gym-stolz.de";
userName = "max.kaenner";
realName = "Max Känner";
imap = {
host = "gym-stolz.de";
port = 143;
tls = {
enable = true;
useStartTls = true;
};
};
smtp = {
host = "gym-stolz.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
};
programs.thunderbird = {
enable = true;
profiles.default = {
isDefault = true;
};
};
}

View File

@ -32,6 +32,14 @@ window#waybar {
padding-right: 3px;
}
#tray {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}
#custom-squeekboard {
border-width: 1px;
border-style: none none none solid;
@ -40,13 +48,6 @@ window#waybar {
padding-right: 10px;
}
#tray {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}
#language {
border-width: 1px;
border-style: none none none solid;
@ -54,20 +55,7 @@ window#waybar {
padding-left: 3px;
padding-right: 3px;
}
#network {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}
#backlight {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}
#clock {
border-width: 1px;
border-style: none none none solid;
@ -75,6 +63,15 @@ window#waybar {
padding-left: 3px;
padding-right: 3px;
}
#backlight {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}
#battery {
border-width: 1px;
border-style: none none none solid;
@ -83,10 +80,10 @@ window#waybar {
padding-right: 3px;
}
#battery.warning {
background-color: #ffd760
}
#battery.critical {
background-color: #ff4040
#network {
border-width: 1px;
border-style: none none none solid;
border-color: #444444;
padding-left: 3px;
padding-right: 3px;
}

View File

@ -0,0 +1,79 @@
{pkgs, ...}: {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "emacs";
dotDir = ".config/zsh";
history.expireDuplicatesFirst = true;
history.path = "$ZDOTDIR/.zsh_history";
historySubstringSearch.enable = true;
shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first";
diff = "${pkgs.diffutils}/bin/diff --color=auto";
grep = "${pkgs.gnugrep}/bin/grep --color=auto";
ip = "${pkgs.iproute2}/bin/ip --color=auto";
mkdir = "${pkgs.coreutils}/bin/mkdir -p";
gst = "${pkgs.git}/bin/git status";
gc = "${pkgs.git}/bin/git commit";
ga = "${pkgs.git}/bin/git add";
gpl = "${pkgs.git}/bin/git pull";
gpu = "${pkgs.git}/bin/git push";
gd = "${pkgs.git}/bin/git diff";
gch = "${pkgs.git}/bin/git checkout";
gs = "${pkgs.git}/bin/git switch";
gre = "${pkgs.git}/bin/git restore";
gr = "${pkgs.git}/bin/git remote";
gcl = "${pkgs.git}/bin/git clone";
glg = "${pkgs.git}/bin/git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
gb = "${pkgs.git}/bin/git branch";
gm = "${pkgs.git}/bin/git merge";
gf = "${pkgs.git}/bin/git fetch";
};
syntaxHighlighting.enable = true;
syntaxHighlighting.highlighters = ["main" "brackets"];
initExtra = ''
# auto completion
bindkey '^I' complete-word
bindkey '^[[Z' autosuggest-accept
# backspace
bindkey '^[[3' delete-char
# home / end go to beginning / end of line
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
# ctrl+arrow jump word
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
# ctrl+entf and ctrl+backspace delete word
bindkey '^[[3;5~' delete-word
bindkey '^H' backward-delete-word
'';
};
programs.starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
add_newline = false;
command_timeout = 5000;
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
cmd_duration = {
min_time = 500;
show_milliseconds = true;
};
};
};
programs.zoxide = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
options = ["--cmd cd"];
};
home.packages = with pkgs; [neovim];
}

View File

@ -1,3 +0,0 @@
{...}: {
imports = [./git ./music ./programs ./shell ./sway];
}

View File

@ -1,40 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.git;
in {
imports = [./lazygit.nix];
options = {
git.enable = lib.mkEnableOption "git";
};
config = lib.mkIf cfg.enable {
git.lazygit.enable = lib.mkDefault true;
programs.git = {
enable = true;
extraConfig = {
fetch.parallel = 0;
init.defaultBranch = "main";
pull.rebase = true;
};
delta = {
enable = true;
options = {
decorations = {
commit-decoration-style = "bold yellow box ul";
file-decoration-style = "none";
file-style = "bold yellow ul";
};
features = "decorations";
whitespace-error-style = "22 reverse";
};
};
userEmail = "max.kaenner@gmail.com";
userName = "Max Känner";
};
};
}

View File

@ -1,24 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.git.lazygit;
in {
options = {
git.lazygit.enable = lib.mkEnableOption "lazygit, a git tui";
};
config = lib.mkIf cfg.enable {
programs.lazygit = {
enable = true;
settings = {
gui = {
shwoRandomTip = false;
nerdFontsVersion = "3";
border = "rounded";
};
};
};
};
}

View File

@ -1,18 +0,0 @@
{
lib,
config,
inputs,
...
}: let
cfg = config.music;
in {
imports = [./mpd.nix];
options = {
music.enable = lib.mkEnableOption "make the system ready for listening to music";
};
config = lib.mkIf cfg.enable {
music.mpd.enable = lib.mkDefault true;
};
}

View File

@ -1,30 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.music.mpd;
in {
options = {
music.mpd.enable = lib.mkEnableOption "Music Player Daemon";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
mpc-cli
ymuse
];
services.mpd = {
enable = true;
musicDirectory = "${config.home.homeDirectory}/Music/";
network.startWhenNeeded = true;
extraConfig = ''
restore_paused "yes"
auto_update "yes"
'';
};
services.mpd-mpris.enable = true;
services.mpdris2.enable = true;
};
}

View File

@ -1,50 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.myPrograms;
in {
imports = [./foot.nix ./thunderbird.nix ./nextcloud.nix ./udiskie.nix];
options = {
myPrograms.enable = lib.mkEnableOption "programs for desktop use";
};
config = lib.mkIf cfg.enable {
myPrograms.foot.enable = lib.mkDefault true;
myPrograms.thunderbird.enable = lib.mkDefault true;
myPrograms.nextcloud.enable = lib.mkDefault true;
myPrograms.udiskie.enable = lib.mkDefault true;
home.packages = with pkgs; [
unzip
firefox
xournalpp
prismlauncher
steam
blender
betaflight-configurator
loudgain
youtube-dl
dconf
distrobox
libqalculate
sops
pwvucontrol
qpwgraph
discord
libreoffice-fresh
mate.caja
libsForQt5.okular
mpv
gimp
freecad
flatpak
wine
unstable.gyroflow
prusa-slicer
];
};
}

View File

@ -1,42 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.myPrograms.foot;
in {
options = {
myPrograms.foot.enable = lib.mkEnableOption "foot, a lightweight wayland terminal emulator";
};
config = lib.mkIf cfg.enable {
programs.foot = {
enable = true;
settings = {
main = {
font = "FiraCode Nerd Font Mono:size=10";
dpi-aware = "yes";
};
colors = {
regular0 = "222222"; # black
regular1 = "cc9393"; # red
regular2 = "7f9f7f"; # green
regular3 = "d0bf8f"; # yellow
regular4 = "8cd0d3"; # blue
regular5 = "dc8cc3"; # magenta
regular6 = "93e0e3"; # cyan
regular7 = "dcdccc"; # white
bright0 = "666666"; # black
bright1 = "dca3a3"; # red
bright2 = "bfebbf"; # green
bright3 = "f0dfaf"; # yellow
bright4 = "8cd0d3"; # blue
bright5 = "fcace3"; # magenta
bright6 = "b3ffff"; # cyan
bright7 = "ffffff"; # white
};
};
};
};
}

View File

@ -1,15 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.myPrograms.nextcloud;
in {
options = {
myPrograms.nextcloud.enable = lib.mkEnableOption "nextcloud client";
};
config = lib.mkIf cfg.enable {
services.nextcloud-client.enable = true;
};
}

View File

@ -1,116 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.myPrograms.thunderbird;
in {
options = {
myPrograms.thunderbird.enable = lib.mkEnableOption "thunderbird, a email client";
};
config = lib.mkIf cfg.enable {
accounts.email.accounts = {
"google max" = {
address = "max.kaenner@gmail.com";
userName = "max.kaenner@gmail.com";
realName = "Max Känner";
flavor = "gmail.com";
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
primary = true;
};
"google informatiker" = {
address = "kaenner9@gmail.com";
userName = "kaenner9@gmail.com";
realName = "Max Känner";
flavor = "gmail.com";
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
};
"uni" = {
address = "max.kaenner@stud.uni-hannover.de";
userName = "max.kaenner@stud.uni-hannover.de";
realName = "Max Känner";
imap = {
host = "mail.stud.uni-hannover.de";
port = 993;
tls = {
enable = true;
useStartTls = false;
};
};
smtp = {
host = "smtp.uni-hannover.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
"luhbots" = {
address = "max.kaenner@luhbots.de";
userName = "max.kaenner@luhbots.de";
realName = "Max Känner";
imap = {
host = "luhbots.de";
port = 993;
tls = {
enable = true;
useStartTls = false;
};
};
smtp = {
host = "luhbots.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
"gymstolz" = {
address = "max.kaenner@gym-stolz.de";
userName = "max.kaenner";
realName = "Max Känner";
imap = {
host = "gym-stolz.de";
port = 143;
tls = {
enable = true;
useStartTls = true;
};
};
smtp = {
host = "gym-stolz.de";
port = 587;
tls = {
enable = true;
useStartTls = true;
};
};
thunderbird.enable = true;
};
};
programs.thunderbird = {
enable = true;
profiles.default = {
isDefault = true;
};
};
};
}

View File

@ -1,19 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.myPrograms.udiskie;
in {
options = {
myPrograms.udiskie.enable = lib.mkEnableOption "auto media mounting";
};
config = lib.mkIf cfg.enable {
services.udiskie = {
enable = true;
automount = true;
notify = true;
};
};
}

View File

@ -1,22 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.shell.bat;
in {
options = {
shell.bat.enable = lib.mkEnableOption "bat, a cat replacement with syntax highlighting";
};
config = lib.mkIf cfg.enable {
programs.bat = {
enable = true;
config = {
map-syntax = ["*.ino:C++"];
theme = "Solarized (dark)";
style = "numbers,changes,header-filename,header-filesize";
};
};
};
}

View File

@ -1,50 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.shell.btop;
in {
options = {
shell.btop.enable = lib.mkEnableOption "btop, a system monitor";
};
config = lib.mkIf cfg.enable {
programs.btop = {
enable = true;
settings = {
color_theme = "${pkgs.btop}/share/btop/themes/adapta.theme";
theme_background = true;
rounded_corners = true;
graph_symbol = "braille";
shown_boxes = "proc cpu mem net";
update_ms = 1000;
proc_sorting = "cpu lazy";
proc_colors = true;
proc_gradient = true;
proc_per_core = true;
proc_mem_bytes = true;
cpu_graph_upper = "total";
cpu_single_graph = true;
show_uptime = true;
check_temp = true;
cpu_sensor = "Auto";
show_coretemp = true;
temp_scale = "celsius";
base_10_sizes = false;
show_cpu_freq = true;
clock_format = "%H:%M";
background_update = true;
mem_graphs = true;
show_swap = true;
show_io_stat = true;
net_download = 128;
net_upload = 128;
net_auto = false;
show_battery = true;
selected_battery = "Auto";
};
};
};
}

View File

@ -1,20 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.shell;
in {
imports = [./zsh.nix ./bat.nix ./btop.nix ./neovim.nix];
options = {
shell.enable = lib.mkEnableOption "my shell environment";
};
config = lib.mkIf cfg.enable {
shell.zsh.enable = lib.mkDefault true;
shell.neovim.enable = lib.mkDefault true;
shell.btop.enable = lib.mkDefault true;
shell.bat.enable = lib.mkDefault true;
};
}

View File

@ -1,19 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.shell.neovim;
in {
options = {
shell.neovim.enable = lib.mkEnableOption "neovim";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [neovim];
home.sessionVariables = {
EDITOR = "${pkgs.neovim}/bin/nvim";
};
};
}

View File

@ -1,88 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.shell.zsh;
in {
options = {
shell.zsh.enable = lib.mkEnableOption "Zsh, an advanced shell";
};
config = lib.mkIf cfg.enable {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "emacs";
dotDir = ".config/zsh";
history.expireDuplicatesFirst = true;
history.path = "$ZDOTDIR/.zsh_history";
historySubstringSearch.enable = true;
shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons -a --group-directories-first";
diff = "${pkgs.diffutils}/bin/diff --color=auto";
grep = "${pkgs.gnugrep}/bin/grep --color=auto";
ip = "${pkgs.iproute2}/bin/ip --color=auto";
mkdir = "${pkgs.coreutils}/bin/mkdir -p";
gst = "${pkgs.git}/bin/git status";
gc = "${pkgs.git}/bin/git commit";
ga = "${pkgs.git}/bin/git add";
gpl = "${pkgs.git}/bin/git pull";
gpu = "${pkgs.git}/bin/git push";
gd = "${pkgs.git}/bin/git diff";
gch = "${pkgs.git}/bin/git checkout";
gs = "${pkgs.git}/bin/git switch";
gre = "${pkgs.git}/bin/git restore";
gr = "${pkgs.git}/bin/git remote";
gcl = "${pkgs.git}/bin/git clone";
glg = "${pkgs.git}/bin/git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
gb = "${pkgs.git}/bin/git branch";
gm = "${pkgs.git}/bin/git merge";
gf = "${pkgs.git}/bin/git fetch";
};
syntaxHighlighting.enable = true;
syntaxHighlighting.highlighters = ["main" "brackets"];
initExtra = ''
# auto completion
bindkey '^I' complete-word
bindkey '^[[Z' autosuggest-accept
# backspace
bindkey '^[[3' delete-char
# home / end go to beginning / end of line
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
# ctrl+arrow jump word
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
# ctrl+entf and ctrl+backspace delete word
bindkey '^[[3;5~' delete-word
bindkey '^H' backward-delete-word
'';
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
command_timeout = 5000;
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
cmd_duration = {
min_time = 500;
show_milliseconds = true;
};
};
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = ["--cmd cd"];
};
};
}

View File

@ -1,228 +0,0 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.sway;
rotate_lisgd = pkgs.writeShellScriptBin "rotate_lisgd" ''
# PREV_ORIENTATION and ORIENTATION are given by rot8
LISGD_INPUT=/dev/input/event14
# open nwggrid by swiping up from the bottom edge
LISGD_ACTIONS=("1,DU,B,*,R,${pkgs.sway}/bin/swaymsg exec ${pkgs.nwg-launchers}/bin/nwggrid -client")
# close window by swiping down with 3 fingers
LISGD_ACTIONS+=("3,UD,*,L,R,${pkgs.sway}/bin/swaymsg kill")
# move window left by swiping left with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move left")
# move window down by swiping down with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move down")
# move window up by swiping up with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move up")
# move window right by swiping right with 2 fingers
LISGD_ACTIONS+=("2,UD,*,*,R,${pkgs.sway}/bin/swaymsg move right")
LISGD_ACTION_OPTIONS=()
for str in "''${LISGD_ACTIONS[@]}"; do
LISGD_ACTION_OPTIONS+=("-g" "$str")
done
${pkgs.killall}/bin/killall lisgd
${pkgs.lisgd}/bin/lisgd -v -d "$LISGD_INPUT" "''${LISGD_ACTION_OPTIONS[@]}" &
'';
# bash script to let dbus know about impotant env variables and
# propagate them to relevent services run at the end of sway config
dbus-sway-environment = pkgs.writeShellScriptBin "dbus-sway-environment" ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
in {
imports = [./kanshi.nix ./waybar.nix ./theme.nix ./mako.nix];
options = {
sway.enable = lib.mkEnableOption "sway, a lightweight window manager";
sway.laptop = lib.mkEnableOption "laptop config";
};
config = lib.mkIf cfg.enable {
sway.kanshi.enable = lib.mkDefault true;
sway.waybar.enable = lib.mkDefault true;
sway.theming.enable = lib.mkDefault true;
sway.mako.enable = lib.mkDefault true;
sway.waybar.battery = lib.mkIf cfg.laptop (lib.mkDefault true);
sway.waybar.backlight = lib.mkIf cfg.laptop (lib.mkDefault true);
sway.waybar.squeekboard = lib.mkIf cfg.laptop (lib.mkDefault true);
home.packages = with pkgs; [
swaylock # screen locking
swayidle # automatic screen locking after system idle time
foot # terminal
keepassxc # used for secrets instead of gnome-keyring
];
wayland.windowManager.sway = {
enable = true;
systemd = {
enable = true;
xdgAutostart = false;
};
wrapperFeatures = {
gtk = true;
};
config = {
output = let
bgdir = ../../../assets;
bg1080 = bgdir + "/bg1080.png";
bg1080vert = bgdir + "/bg1080vert.png";
bg4k = bgdir + "/bg4k.png";
in
lib.mkIf cfg.laptop {
eDP-1 = {
bg = "'${bg1080}' fit";
};
HDMI-A-1 = {
bg = "'${bg4k}' fit";
};
DP-3 = {
bg = "'${bg1080}' fit";
};
DP-4 = {
bg = "'${bg1080}' fit";
};
DP-5 = {
bg = "'${bg1080vert}' fit";
};
DP-6 = {
bg = "'${bg1080}' fit";
};
DP-7 = {
bg = "'${bg1080vert}' fit";
};
};
input = {
"*" = {
xkb_layout = "de";
xkb_options = "caps:ctrl_modifier";
xkb_numlock = "enable";
};
"type:touchpad" = lib.mkIf cfg.laptop {
tap = "enable";
natural_scroll = "enable";
};
# map laptop touchscreen to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C" = lib.mkIf cfg.laptop {
map_to_output = "'AU Optronics 0x4B2D Unknown'";
};
# map laptop stylus to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C_Stylus" = lib.mkIf cfg.laptop {
map_to_output = "'AU Optronics 0x4B2D Unknown'";
};
};
modifier = "Mod4";
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
# special workspaces
"${modifier}+1" = "workspace main";
"${modifier}+2" = "workspace term";
"${modifier}+3" = "workspace msg";
"${modifier}+4" = "workspace music";
"${modifier}+Shift+1" = "move container to workspace main";
"${modifier}+Shift+2" = "move container to workspace term";
"${modifier}+Shift+3" = "move container to workspace msg";
"${modifier}+Shift+4" = "move container to workspace music";
# screen capture
"${modifier}+Print" = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
"${modifier}+Shift+Print" = ''exec ${pkgs.wf-recorder}/bin/wf-recorder -g "$(${pkgs.slurp}/bin/slurp)" -f "$HOME/Videos/screencapture_$(${pkgs.coreutils}/bin/date +%F-%T).mp4"'';
# brightness
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
# volume
"XF86AudioRaiseVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +1%'";
"XF86AudioLowerVolume" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -1%'";
"XF86AudioMute" = "exec '${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle'";
# custom pause mode similar to typical system shutdown menus
"${modifier}+F12" = "mode pause-break";
};
menu = "${pkgs.nwg-launchers}/bin/nwggrid -client";
# use foot as default terminal
terminal = "${pkgs.foot}/bin/foot";
assigns = {
"main" = [{app_id = "firefox";}];
"term" = [{app_id = "foot-startup";}];
"msg" = [{title = "\\[Locked\\] - KeePassXC$";}];
};
bars = [];
modes = {
pause-break = {
e = "exec --no-startup-id swaymsg exit, mode default";
s = "exec --no-startup-id ${pkgs.dash}/bin/dash -c '${pkgs.swaylock}/bin/swaylock & systemctl suspend-then-hibernate', mode default";
r = "exec --no-startup-id systemctl reboot";
End = "exec --no-startup-id systemctl poweroff";
Return = "mode default";
Escape = "mode default";
};
};
startup =
[
{command = "${dbus-sway-environment}/bin/dbus-sway-environment";}
{command = "${pkgs.nwg-launchers}/bin/nwggrid-server -fp";}
{command = "${pkgs.keepassxc}/bin/keepassxc";}
{command = "${pkgs.foot}/bin/foot -a foot-startup";}
{command = "${pkgs.networkmanagerapplet}/bin/nm-applet";}
]
++ lib.optionals cfg.laptop [
{command = "${pkgs.squeekboard}/bin/squeekboard";}
{command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${rotate_lisgd}/bin/rotate_lisgd";}
];
defaultWorkspace = "main";
workspaceAutoBackAndForth = true;
workspaceOutputAssign = lib.mkIf cfg.laptop [
{
workspace = "main";
output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"];
}
{
workspace = "term";
output = ["DP-5" "DP-4" "DP-7" "eDP-1"];
}
{
workspace = "msg";
output = ["eDP-1"];
}
{
workspace = "music";
output = ["eDP-1"];
}
{
workspace = "5";
output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"];
}
];
};
extraConfig = lib.mkIf cfg.laptop ''
bindswitch --reload --locked lid:on exec "[ $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq '. | length') -gt 1 ] && ${pkgs.sway}/bin/swaymsg output eDP-1 disable"
bindswitch --reload --locked lid:off output eDP-1 enable
'';
};
};
}

View File

@ -1,144 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.sway.kanshi;
in {
options = {
sway.kanshi.enable = lib.mkEnableOption "kanshi, a dynamic display recognizer";
sway.kanshi.laptop = lib.mkEnableOption "laptop workspaces";
};
config = lib.mkIf cfg.enable {
services.kanshi = {
enable = true;
profiles = lib.mkIf cfg.laptop {
laptop.outputs = [
{
criteria = "eDP-1";
position = "0,0";
}
];
dock_luhbots = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE GRCPH83";
position = "0,0";
}
{
criteria = "NEC Corporation E243WMi 7X313185NB";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots2 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 8YCPH83";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 59118576NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-5"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-4"
];
};
dock_luhbots3 = {
outputs = [
{
criteria = "eDP-1";
position = "0,1080";
}
{
criteria = "Dell Inc. DELL U2422HE 53DCH83";
position = "0,0";
}
{
criteria = "Dell Inc. DELL U2412M 0FFXD46I4U5S";
transform = "90";
position = "1920,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-6"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-7"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-6"
];
};
dock_luhbots4 = {
outputs = [
{
criteria = "eDP-1";
position = "1080,1080";
}
{
criteria = "Dell Inc. DELL P2422HE 4BXL9M3";
position = "1080,0";
}
{
criteria = "NEC Corporation E243WMi 75309334NB";
transform = "90";
position = "0,0";
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to DP-3"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to DP-4"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to DP-3"
];
};
laptop_hannspree = {
outputs = [
{
criteria = "eDP-1";
position = "320,1440";
}
{
criteria = "HannStar Display Corp HC281UPB ";
position = "0,0";
mode = "3840x2160@60";
scale = 1.5;
}
];
exec = [
"${pkgs.sway}/bin/swaymsg workspace 1, move workspace to HDMI-A-1"
"${pkgs.sway}/bin/swaymsg workspace 2, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 3, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 4, move workspace to eDP-1"
"${pkgs.sway}/bin/swaymsg workspace 5, move workspace to HDMI-A-1"
];
};
};
};
};
}

View File

@ -1,29 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.sway.mako;
in {
options = {
sway.mako.enable = lib.mkEnableOption "mako, a notification deamon";
};
config = lib.mkIf cfg.enable {
services.mako = {
enable = true;
actions = true;
anchor = "top-right";
borderRadius = 10;
borderSize = 2;
height = 100;
width = 400;
defaultTimeout = 10000; # ms
font = "FiraCode Nerd Font 11";
icons = true;
markup = true;
};
};
}

View File

@ -1,130 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.sway.theming;
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
in {
options = {
sway.theming.enable = lib.mkEnableOption "theming for sway";
};
config = lib.mkIf cfg.enable {
wayland.windowManager.sway.config = {
fonts = {
names = ["FiraCode Nerd Font"];
size = 11.0;
};
colors = {
background = "#00000000";
focused = {
border = "#00FFEE";
background = "#4477AA";
text = "#F0F0F0";
childBorder = "#00FFEE";
indicator = "#00AA88";
};
focusedInactive = {
border = "#626262";
background = "#444444";
text = "#F0F0F0";
childBorder = "#626262";
indicator = "#00AA88";
};
placeholder = {
border = "#313131";
background = "#222222";
text = "#F0F0F0";
childBorder = "#313131";
indicator = "#005544";
};
unfocused = {
border = "#313131";
background = "#222222";
text = "#F0F0F0";
childBorder = "#313131";
indicator = "#00AA88";
};
urgent = {
border = "#FF3131";
background = "#882222";
text = "#F0F0F0";
childBorder = "#FF3131";
indicator = "#00AA88";
};
};
focus.mouseWarping = true;
gaps = {
inner = 5;
smartGaps = true;
smartBorders = "no_gaps";
};
window.titlebar = false;
startup = [
{command = "${configure-gtk}/bin/configure-gtk";}
];
};
gtk = {
enable = true;
cursorTheme = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors-white";
size = 24;
};
iconTheme = {
package = pkgs.whitesur-icon-theme;
name = "WhiteSur-dark";
};
theme = {
package = pkgs.whitesur-gtk-theme;
name = "WhiteSur-Dark";
};
gtk3.extraConfig = {
gtk-dialogs-use-header = false;
gtk-cursor-theme-size = 0;
gtk-toolbar-style = "GTK_TOOLBAR_BOTH_HORIZ";
gtk-toolbar-icon-style = "GTK_ICON_SIZE_LARGE_TOOLBAR";
gtk-button-images = 0;
gtk-menu-images = 0;
gtk-enable-event-sounds = 0;
gtk-enable-input-feedback-sounds = 1;
gtk-xft-antialias = 1;
gtk-xft-hinting = 1;
gtk-xft-hintstyle = "hintslight";
gtk-xft-rgba = "none";
};
};
home.pointerCursor = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors-white";
size = 24;
x11.enable = true;
x11.defaultCursor = "capitaine-cursors-white";
};
xsession.enable = true;
services.mako = {
backgroundColor = "#313131";
borderColor = "#00FFEE";
progressColor = "#338833";
textColor = "#e0e0e0";
extraConfig = ''
[urgency=low]
border-color=#008877
'';
};
};
}

View File

@ -1,142 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.sway.waybar;
schema = "org.gnome.desktop.a11y.applications";
key = "screen-keyboard-enabled";
squeekboard_toggle = pkgs.writeShellScriptBin "squeekboard_toggle" ''
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
gsettings set ${schema} ${key} false
else
gsettings set ${schema} ${key} true
fi
'';
squeekboard_format = pkgs.writeShellScriptBin "squeekboard_format" ''
if [ "$(gsettings get ${schema} ${key})" == "true" ]; then
echo '{ "text": "󰌌", "tooltip": "enabled", "percentage": 100 }'
else
echo '{ "text": "󰌐", "tooltip": "disabled", "percentage": 0 }'
fi
'';
in {
options = {
sway.waybar.enable = lib.mkEnableOption "waybar, a status bar for wayland compositors";
sway.waybar.squeekboard = lib.mkEnableOption "squeekboard";
sway.waybar.mpd = lib.mkEnableOption "mpd";
sway.waybar.battery = lib.mkEnableOption "battery";
sway.waybar.backlight = lib.mkEnableOption "backlight";
};
config = lib.mkIf cfg.enable {
wayland.windowManager.sway.config.startup = [{command = "${pkgs.waybar}/bin/waybar";}];
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 26;
modules-left = ["sway/workspaces" "sway/mode"];
modules-center = ["sway/window"];
modules-right = ["mpd" "tray" "custom/squeekboard" "sway/language" "clock" "backlight" "battery" "network"];
"sway/workspaces" = {
disable-scroll = true;
all-outputs = false;
format = "<span size='150%'>{icon}</span> {name}";
format-icons = {
"main" = "󰈹";
"term" = "";
"msg" = "󰷹";
"music" = "󰫔";
"urgent" = "";
"focused" = "";
"default" = "";
};
};
"mpd" = lib.mkIf cfg.mpd {
format = "{stateIcon}{consumeIcon}{randomIcon}{repeatIcon}{singleIcon} {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) {volume}";
format-stopped = "{stateIcon}{randomIcon}{repeatIcon}{singleIcon} Stopped {volume}";
format-disconnected = "";
unkown-tag = "N/A";
interval = 2;
consume-icons = {
on = "󰮯 ";
off = "";
};
random-icons = {
on = "󰒟 ";
off = "󰒞 ";
};
repeat-icons = {
on = "󰑖 ";
off = "󰑗 ";
};
single-icons = {
on = "󰑘 ";
off = "";
};
state-icons = {
paused = "󰏤 ";
playing = "󰐊 ";
};
max-length = 50;
};
"tray" = {
spacing = 10;
};
"custom/squeekboard" = lib.mkIf cfg.squeekboard {
format = "{}";
exec = "${squeekboard_format}/bin/squeekboard_format";
return-type = "json";
exec-on-event = true;
interval = 2;
on-click = "${squeekboard_toggle}/bin/squeekboard_toggle";
};
"sway/language" = {
format = "{shortDescription}";
tooltip = false;
};
"clock" = {
interval = 60;
format = "{:%a %d.%m %H:%M}";
};
"backlight" = lib.mkIf cfg.backlight {
format = "{percent}% {icon}";
format-icons = ["󰹐" "󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨"];
};
"battery" = lib.mkIf cfg.battery {
format = "{capacity}% {icon}";
format-charging = "{capacity}% {icon}󱐋";
format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
states = {
warning = 30;
critical = 15;
};
};
"network" = {
format-wifi = "{essid} ({signalStrength}%) 󰖩";
format-ethernet = "{ipaddr}/{cidr} 󰈀";
tooltip-format = "{ifname} via {gwaddr} 󰌘";
format-disconnected = "󰌙";
};
};
};
style = ./waybar.css;
};
};
}

View File

@ -21,8 +21,7 @@
# echo using sudo so we get feedback after unlocking
sudo echo "Beginning rebuild"
# Rebuild, output simplified errors, log trackebacks
# sudo nixos-rebuild switch &>nixos-switch.log || (${pkgs.coreutils}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
sudo nixos-rebuild switch
sudo nixos-rebuild switch &>nixos-switch.log || (${pkgs.coreutils}/bin/cat nixos-switch.log | ${pkgs.gnugrep}/bin/grep --color error && false)
# Get current generation metadata
current=$(nixos-rebuild list-generations | ${pkgs.gnugrep}/bin/grep current)

33
rebuild.sh Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# A rebuild script that commits on a successful build
set -e
# cd to your config dir
pushd ~/dotfiles/nixos/
# Edit your config
$EDITOR
# Autoformat your nix files
alejandra . #&>/dev/null
# Shows your changes
git diff -U0 *.nix
echo "NixOS Rebuilding..."
# Rebuild, output simplified errors, log trackebacks
sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false)
# Get current generation metadata
current=$(nixos-rebuild list-generations | grep current)
# Commit all changes with the gereation metadata
git commit -am "$current"
# Back to where you were
popd
# Notify all OK!
notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available