home.nix: cleanup/split to desktop.nix

auto-flake-update
Yorick van Pelt 2021-05-29 18:32:09 +02:00
parent a688758401
commit a74e669f24
Signed by: yorick
GPG Key ID: D8D3CC6D951384DE
2 changed files with 218 additions and 308 deletions

View File

@ -0,0 +1,188 @@
{ pkgs, options, ... }:
let
bin = pkgs.callPackage /home/yorick/dotfiles/bin { };
font = {
__toString = self: "${self.name} ${self.size}";
name = "DejaVu Sans Mono";
size = "11";
};
in
{
# TODO: waybar module from home-manager
xdg.configFile."waybar" = {
source = ./waybar;
recursive = true;
onChange = "systemctl --user restart waybar";
};
programs.mako.enable = true;
services = {
libinput-gestures.enable = true;
gpg-agent.extraConfig = ''
pinentry-program ${pkgs.pinentry_gnome}/bin/pinentry-gnome3
'';
};
wayland.windowManager.sway = {
enable = true;
config = {
bars = [
];
gaps.inner = 5;
modifier = "Mod4";
window.hideEdgeBorders = "smart";
fonts = [ (toString font) ];
window.border = 2;
floating.modifier = "Mod4";
keybindings = with pkgs;
(builtins.head (builtins.head
options.wayland.windowManager.sway.config.type.getSubModules).imports).options.keybindings.default
// (let
exec = pkg: cmd: "exec --no-startup-id ${pkg}/bin/${cmd}";
mod = "Mod4";
in {
"${mod}+Shift+c" = "kill";
"${mod}+j" = "focus left";
"${mod}+k" = "focus right";
"${mod}+d" = "layout toggle split";
"${mod}+i" =
"exec --no-startup-id bash /home/yorick/dotfiles/bin/invert.sh";
#"${mod}+ctrl+l" = "exec --no-startup-id loginctl lock-session";
"${mod}+ctrl+l" =
"exec --no-startup-id sleep 1s && pkill -USR1 swayidle";
"${mod}+Return" = "exec alacritty";
"${mod}+Escape" = "workspace back_and_forth";
"${mod}+0" = "workspace 10";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+Left" = "move left";
"${mod}+Shift+Right" = "move right";
"${mod}+Shift+Up" = "move up";
"${mod}+Shift+Down" = "move down";
"${mod}+Ctrl+Right" = "move workspace to output right";
"${mod}+Ctrl+Left" = "move workspace to output left";
"${mod}+Ctrl+Up" = "move workspace to output up";
"${mod}+Ctrl+Down" = "move workspace to output down";
"XF86MonBrightnessUp" = exec light "light -A 5";
"XF86MonBrightnessDown" = exec light "light -U 5";
"ctrl+XF86MonBrightnessUp" = exec light "light -A 1";
"ctrl+XF86MonBrightnessDown" = exec light "light -U 1";
"XF86AudioLowerVolume" = exec alsaUtils "amixer set Master 1%-";
"XF86AudioRaiseVolume" = exec alsaUtils "amixer set Master 1%+";
"XF86AudioMute" = exec alsaUtils "amixer set Master toggle";
"${mod}+Shift+s" = exec bin.screenshot_public "screenshot_public";
"Print" = exec bin.screenshot_public "screenshot_public";
"${mod}+Shift+t" =
"exec --no-startup-id /home/yorick/dotfiles/bin/toggle_solarized.sh";
"--locked ${mod}+x" = "exec /home/yorick/dotfiles/bin/docked.sh";
"${mod}+p" = "exec /home/yorick/dotfiles/bin/ala-fzf-pass.sh";
#"${mod}+p" = exec rofi-pass "rofi-pass";
"${mod}+e" = exec pkgs.wldash "wldash start-or-kill";
"--locked ${mod}+bracketleft" =
"exec --no-startup-id /home/yorick/dotfiles/bin/sunplate.sh 0";
"--locked ${mod}+bracketright" =
"exec --no-startup-id /home/yorick/dotfiles/bin/sunplate.sh 1";
});
};
systemdIntegration = true;
extraConfig = ''
workspace_auto_back_and_forth yes
input "1267:8400:ELAN_Touchscreen" {
map_to_output eDP-1
}
output "Unknown 0x00000000" {
position 0 0
bg "/home/yorick/Downloads/wallpapers/beyond-4k-2560×1440.jpg" fill
}
output "BenQ Corporation BenQ GW2765 36H03689019" {
position 2560 0
bg "/home/yorick/Downloads/wallpapers/beyond-4k-2560×1440.jpg" fill
}
output "eDP-1" {
# disable
}
input "1739:30383:DLL075B:01_06CB:76AF_Touchpad" {
natural_scroll enabled
tap enabled
dwt enabled
# middle_emulation enabled
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_options caps:escape
}
for_window [title="TelegramDesktop"] fullscreen enable
for_window [app_id="ala-fzf"] floating enable
exec mako
exec swayidle timeout 300 'swaymsg "output * dpms off"; swaylock' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock'
'';
};
# programs.firefox = {
# enable = true;
# package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
# forceWayland = true;
# };
# };
home.sessionVariables = {
MOZ_USE_XINPUT2 = "1";
MOZ_ENABLE_WAYLAND = "1";
EDITOR = "emacsclient";
#GDK_BACKEND = "wayland";
TERMINAL = "alacritty";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORM = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
XCURSOR_THEME = "Adwaita";
XCURSOR_PATH = "${pkgs.gnome3.adwaita-icon-theme}/share/icons";
XDG_CURRENT_DESKTOP = "sway";
};
systemd.user.services.waybar = {
Unit = {
Description = "waybar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = ''
${pkgs.waybar}/bin/waybar
'';
};
};
systemd.user.services.gebaard = {
Unit = {
Description = "gebaard";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = ''
${pkgs.gebaar-libinput}/bin/gebaard
'';
};
};
home.packages = with pkgs; [
envs.de
gebaar-libinput
grim
eagle
libreoffice
obs-studio-dmabuf
obs-wlrobs
slack
slurp
swaybg
swayidle
swaylock
waybar
waypipe
wl-clipboard
wldash
zoom-us
];
}

View File

@ -1,18 +1,14 @@
{ lib, config, options, pkgs, ... }:
let
bin = pkgs.callPackage /home/yorick/dotfiles/bin { };
dpi = 109;
font = {
__toString = self: "${self.name} ${self.size}";
name = "DejaVu Sans Mono";
size = "11";
};
y-firefox = pkgs.wrapFirefox pkgs.latest.firefox-beta-bin.unwrapped {
forceWayland = true;
browserName = "firefox";
};
thefuck-alias = shell: pkgs.runCommand "thefuck-alias" {
TF_SHELL = shell;
} "${pkgs.thefuck}/bin/thefuck -a > $out";
in {
imports = [ ./arbtt.nix ./libinput-gestures.nix ];
imports = [ ./arbtt.nix ./libinput-gestures.nix ./desktop.nix ];
nixpkgs = {
config.allowUnfree = true;
inherit (import /home/yorick/dotfiles/config.nix) overlays;
@ -134,7 +130,18 @@ in {
compression = true;
serverAliveInterval = 120;
controlMaster = "auto";
matchBlocks = rec {
matchBlocks = let
lumigod = hostname: {
inherit hostname;
port = 2233;
user = "yorick.van.pelt";
};
lumivpn = {
user = "yorick.van.pelt";
# verified by wireguard key
extraOptions.StrictHostKeyChecking = "no";
};
in rec {
"pub.yori.cc" = {
user = "public";
identityFile = "~/.ssh/id_rsa_pub";
@ -144,11 +151,6 @@ in {
hostname = "karpenoktem.nl";
port = 33933;
};
"jupiter.serokell.io" = jupiter;
jupiter = {
hostname = "jupiter.serokell.io";
port = 17788;
};
athena = {
hostname = "athena.lumi.guide";
user = "yorick.van.pelt";
@ -158,60 +160,21 @@ in {
user = "yorick.van.pelt";
port = 4222;
};
styx = {
hostname = "10.110.0.1";
user = "yorick.van.pelt";
port = 2233;
};
styx = lumigod "10.110.0.1";
"*.lumi.guide" = { user = "yorick.van.pelt"; };
nyx = {
hostname = "nyx.lumi.guide";
user = "yorick.van.pelt";
port = 2233;
};
zeus = {
hostname = "zeus.lumi.guide";
user = "yorick.van.pelt";
port = 2233;
};
ponos = {
hostname = "ponos.lumi.guide";
user = "yorick.van.pelt";
port = 2233;
};
medusa = {
hostname = "lumi.guide";
user = "yorick.van.pelt";
port = 2233;
};
zeus = lumigod "zeus.lumi.guide";
ponos = lumigod "ponos.lumi.guide";
medusa = lumigod "lumi.guide";
# signs
"10.108.0.*" = {
user = "yorick.van.pelt";
port = 4222;
# verified by wireguard key
extraOptions.StrictHostKeyChecking = "no";
};
"10.109.0.*" = {
user = "yorick.van.pelt";
# verified by wireguard key
extraOptions.StrictHostKeyChecking = "no";
};
"10.110.0.*" = {
port = 2233;
user = "yorick.van.pelt";
# verified by wireguard key
extraOptions.StrictHostKeyChecking = "no";
};
"10.111.0.*" = {
user = "yorick.van.pelt";
# verified by wireguard key
extraOptions.StrictHostKeyChecking = "no";
};
"10.108.0.*" = lumivpn // { port = 4222; };
"10.109.0.*" = lumivpn;
"10.110.0.*" = lumivpn // { port = 2233; };
"10.111.0.*" = lumivpn;
"192.168.42.*" = {
user = "yorick.van.pelt";
#proxyJump = "athena";
};
# "192.168.178.*" = {
# only if wired
# extraOptions.Compression = "no";
# };
};
@ -231,15 +194,7 @@ in {
nsp = "nix-shell -p";
};
interactiveShellInit = ''
function fuck -d "Correct your previous console command"
set -l fucked_up_command $history[1]
env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command
if [ "$unfucked_command" != "" ]
eval $unfucked_command
builtin history delete --exact --case-sensitive -- $fucked_up_command
builtin history merge ^ /dev/null
end
end
source ${thefuck-alias "fish"}
starship init fish | source
source ~/dotfiles/nr.fish
'';
@ -253,65 +208,12 @@ in {
nsp = "nix-shell -p";
};
initExtra = ''
#eval $(thefuck --alias)
function fuck () {
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=bash;
export TF_ALIAS=fuck;
export TF_SHELL_ALIASES=$(alias);
export TF_HISTORY=$(fc -ln -10);
export PYTHONIOENCODING=utf-8;
TF_CMD=$(
thefuck THEFUCK_ARGUMENT_PLACEHOLDER $@
) && eval $TF_CMD;
unset TF_HISTORY;
export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
history -s $TF_CMD;
}
# This script was automatically generated by the broot function
# More information can be found in https://github.com/Canop/broot
# This function starts broot and executes the command
# it produces, if any.
# It's needed because some shell commands, like `cd`,
# have no useful effect if executed in a subshell.
function br {
f=$(mktemp)
(
set +e
broot --outcmd "$f" "$@"
code=$?
if [ "$code" != 0 ]; then
rm -f "$f"
exit "$code"
fi
)
code=$?
if [ "$code" != 0 ]; then
return "$code"
fi
d=$(<"$f")
rm -f "$f"
eval "$d"
}
source ${thefuck-alias "fish"}
eval "$(broot --print-shell-function bash)"
eval "$(starship init bash)"
'';
'';
};
};
xresources.properties = {
"*font" = "xft:${font.name}:size=${font.size}:antialias=true:hinting=true";
"rofi.font" = toString font;
"Emacs.font" = "${font.name}-${font.size}";
"Xft.dpi" = dpi;
"*dpi" = dpi;
};
# xresources.extraConfig = builtins.readFile (
# pkgs.fetchFromGitHub {
# owner = "solarized";
# repo = "xresources";
# rev = "025ceddbddf55f2eb4ab40b05889148aab9699fc";
# sha256 = "0lxv37gmh38y9d3l8nbnsm1mskcv10g3i83j0kac0a2qmypv1k9f";
# } + "/Xresources.dark");
home.file.".emacs.d/init.el" = {
source = (toString /home/yorick/dotfiles/emacs/.emacs.d/init.el);
};
@ -319,162 +221,24 @@ in {
player = mpv --cache 2048
default-stream = best
'';
xdg.configFile."waybar" = {
source = ./waybar;
recursive = true;
onChange = "systemctl --user restart waybar";
};
programs.mako.enable = true;
services = {
lorri.enable = true;
#arbtt.enable = true;
libinput-gestures.enable = false;
gpg-agent = {
enable = true;
enableSshSupport = true;
extraConfig = ''
pinentry-program ${pkgs.pinentry_gnome}/bin/pinentry-gnome3
'';
};
# redshift = {
# enable = false;
# latitude = "51.8";
# longitude = "5.8";
# temperature = {
# day = 6500;
# night = 5500;
# };
# };
};
wayland.windowManager.sway = {
enable = true;
#package = pkgs.i3-gaps;
config = {
bars = [
#{ position = "top"; command = "swaybar"; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs /home/yorick/dotfiles/i3/status.toml"; }
];
gaps.inner = 5;
modifier = "Mod4";
window.hideEdgeBorders = "smart";
fonts = [ (toString font) ];
window.border = 2;
floating.modifier = "Mod4";
keybindings = with pkgs;
(builtins.head (builtins.head
options.wayland.windowManager.sway.config.type.getSubModules).imports).options.keybindings.default
// (let
exec = pkg: cmd: "exec --no-startup-id ${pkg}/bin/${cmd}";
mod = "Mod4";
in {
"${mod}+Shift+c" = "kill";
"${mod}+j" = "focus left";
"${mod}+k" = "focus right";
"${mod}+d" = "layout toggle split";
"${mod}+i" =
"exec --no-startup-id bash /home/yorick/dotfiles/bin/invert.sh";
#"${mod}+ctrl+l" = "exec --no-startup-id loginctl lock-session";
"${mod}+ctrl+l" =
"exec --no-startup-id sleep 1s && pkill -USR1 swayidle";
"${mod}+Return" = "exec alacritty";
"${mod}+Escape" = "workspace back_and_forth";
"${mod}+0" = "workspace 10";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+Left" = "move left";
"${mod}+Shift+Right" = "move right";
"${mod}+Shift+Up" = "move up";
"${mod}+Shift+Down" = "move down";
"${mod}+Ctrl+Right" = "move workspace to output right";
"${mod}+Ctrl+Left" = "move workspace to output left";
"${mod}+Ctrl+Up" = "move workspace to output up";
"${mod}+Ctrl+Down" = "move workspace to output down";
"XF86MonBrightnessUp" = exec light "light -A 5";
"XF86MonBrightnessDown" = exec light "light -U 5";
"ctrl+XF86MonBrightnessUp" = exec light "light -A 1";
"ctrl+XF86MonBrightnessDown" = exec light "light -U 1";
"XF86AudioLowerVolume" = exec alsaUtils "amixer set Master 1%-";
"XF86AudioRaiseVolume" = exec alsaUtils "amixer set Master 1%+";
"XF86AudioMute" = exec alsaUtils "amixer set Master toggle";
"${mod}+Shift+s" = exec bin.screenshot_public "screenshot_public";
"Print" = exec bin.screenshot_public "screenshot_public";
"${mod}+Shift+t" =
"exec --no-startup-id /home/yorick/dotfiles/bin/toggle_solarized.sh";
"--locked ${mod}+x" = "exec /home/yorick/dotfiles/bin/docked.sh";
"${mod}+p" = "exec /home/yorick/dotfiles/bin/ala-fzf-pass.sh";
#"${mod}+p" = exec rofi-pass "rofi-pass";
"${mod}+e" = exec pkgs.wldash "wldash start-or-kill";
"--locked ${mod}+bracketleft" =
"exec --no-startup-id /home/yorick/dotfiles/bin/sunplate.sh 0";
"--locked ${mod}+bracketright" =
"exec --no-startup-id /home/yorick/dotfiles/bin/sunplate.sh 1";
});
};
systemdIntegration = true;
extraConfig = ''
workspace_auto_back_and_forth yes
input "1267:8400:ELAN_Touchscreen" {
map_to_output eDP-1
}
output "Unknown 0x00000000" {
position 0 0
bg "/home/yorick/Downloads/wallpapers/beyond-4k-2560×1440.jpg" fill
}
output "BenQ Corporation BenQ GW2765 36H03689019" {
position 2560 0
bg "/home/yorick/Downloads/wallpapers/beyond-4k-2560×1440.jpg" fill
}
output "eDP-1" {
# disable
}
input "1739:30383:DLL075B:01_06CB:76AF_Touchpad" {
natural_scroll enabled
tap enabled
dwt enabled
# middle_emulation enabled
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_options caps:escape
}
for_window [title="TelegramDesktop"] fullscreen enable
for_window [app_id="ala-fzf"] floating enable
exec mako
exec swayidle timeout 300 'swaymsg "output * dpms off"; swaylock' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock'
'';
};
xsession.initExtra = "xrandr --dpi ${toString dpi}";
home.sessionVariables = {
MOZ_USE_XINPUT2 = "1";
MOZ_ENABLE_WAYLAND = "1";
EDITOR = "emacsclient";
#GDK_BACKEND = "wayland";
TERMINAL = "alacritty";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORM = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
XCURSOR_THEME = "Adwaita";
XCURSOR_PATH = "${pkgs.gnome3.adwaita-icon-theme}/share/icons";
XDG_CURRENT_DESKTOP = "sway";
};
home.packages = with pkgs.envs;
[ apps code de games pdf media misc scripts coins js ] ++ (with pkgs; [
[ apps code games pdf media misc scripts coins js ] ++ (with pkgs; [
github-cli
libreoffice
nix-tree
virt-manager
watchman
gnome3.gcr.out # alacritty
waybar
slurp
grim
wl-clipboard
wldash
gebaar-libinput
notmuch
gmailieer
afew
swaybg
swayidle
swaylock
broot
starship
fd
@ -485,10 +249,8 @@ in {
nixfmt
linuxPackages.perf
pssh
slack
smartmontools
vim
waypipe
xdg_utils
nix-top
nix-diff
@ -498,34 +260,9 @@ in {
minecraft
unzip
exa
obs-studio-dmabuf
obs-wlrobs
zoom-us
cachix
eagle
y-firefox
]); # qtwayland
# programs.firefox = {
# enable = true;
# package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
# forceWayland = true;
# };
# };
systemd.user.services.waybar = {
Unit = {
Description = "waybar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = ''
${pkgs.waybar}/bin/waybar
'';
};
};
# systemd.user.services.gmi = {
# Unit = {
# Description = "gmi";
@ -548,21 +285,6 @@ in {
# };
# Install.WantedBy = [ "timers.target" ];
# };
systemd.user.services.gebaard = {
Unit = {
Description = "gebaard";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = ''
${pkgs.gebaar-libinput}/bin/gebaard
'';
};
};
home.file.".gnupg/gpg.conf".text = ''
no-greeting