nixfiles/home-manager/modules/ezpcusr.nix
2021-03-29 15:22:47 -07:00

1007 lines
29 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ezpcusr;
elm-format-working = pkgs.elmPackages.elm-format.overrideAttrs (_: { doCheck = false; });
flameshot = pkgs.flameshot.overrideAttrs (super: {
src = builtins.fetchGit {
url = "https://github.com/flameshot-org/flameshot.git";
rev = "f24bae0a18ae59b5937ceee6d466b928d5f4c65f";
};
});
swaypkg = pkgs.sway.override {
sway-unwrapped =
pkgs.sway-unwrapped.override { wlroots = pkgs.wlroots; };
extraSessionCommands =
config.wayland.windowManager.sway.extraSessionCommands;
extraOptions = config.wayland.windowManager.sway.extraOptions;
withBaseWrapper = config.wayland.windowManager.sway.wrapperFeatures.base;
withGtkWrapper = config.wayland.windowManager.sway.wrapperFeatures.gtk;
};
selshot = pkgs.writeScript "selshot.sh" (
if cfg.wayland then ''
#!${pkgs.zsh}/bin/zsh
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" $1
'' else ''
#!${pkgs.zsh}/bin/zsh
${flameshot}/bin/flameshot gui -r > $1
''
);
selvid = pkgs.writeScript "selvid.sh" ''
#!${pkgs.zsh}/bin/zsh
${pkgs.wf-recorder}/bin/wf-recorder -g "$(${pkgs.slurp}/bin/slurp)" -f $1
'';
getscrloc = pkgs.writeScript "getscrloc.sh" ''
#!${pkgs.zsh}/bin/zsh
mkdir -p "$HOME/Pictures/Screenshots"
echo "$HOME/Pictures/Screenshots/$(date +%F_%T).''${1:-png}"
'';
copyBin =
if cfg.wayland then
"${pkgs.wl-clipboard}/bin/wl-copy"
else
"${pkgs.xclip}/bin/xclip -selection clipboard";
pasteBin =
if cfg.wayland then
"${pkgs.wl-clipboard}/bin/wl-paste"
else
"${pkgs.xclip}/bin/xclip -selection clipboard -o";
# rofiBin = if cfg.wayland then "${pkgs..wofi}/bin/wofi" else "${pkgs.rofi}/bin/rofi";
rofiBin = "${pkgs.rofi}/bin/rofi";
scrsaveclip = pkgs.writeScript "scr-save-clip.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc})
${selshot} $LOC
${copyBin} -t image/png < $LOC
'';
scrsaveup =
if cfg.uploadScript != null then
pkgs.writeScript "scr-save-up.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc})
${selshot} $LOC
${cfg.uploadScript} $LOC | xargs echo -n | ${copyBin}
notify-send "Screenshot Uploaded!"
''
else
null;
scrvidsaveclip = pkgs.writeScript "scr-vid-save-clip.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc} mp4)
${selvid} $LOC
${copyBin} -t video/mp4 < $LOC
'';
scrvidsaveup =
if cfg.uploadScript != null then
pkgs.writeScript "scr-vid-save-up.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc} mp4)
${selvid} $LOC
${cfg.uploadScript} $LOC | ${pkgs.findutils}/bin/xargs echo -n | ${copyBin}
notify-send "Screen Recording Uploaded!"
''
else
null;
scrvidstop = pkgs.writeScript "scr-vid-stop.sh" ''
#!${pkgs.zsh}/bin/zsh
${pkgs.procps}/bin/pkill -2 wf-recorder
'';
um = pkgs.writeScript "update-music.sh" ''
#!${pkgs.bash}/bin/bash
${pkgs.mpc_cli}/bin/mpc update --wait && ${pkgs.mpc_cli}/bin/mpc clear && ${pkgs.mpc_cli}/bin/mpc ls | ${pkgs.mpc_cli}/bin/mpc add
'';
ezDrv =
pkgs.runCommand "ez"
{ }
(
''
mkdir -p $out/bin
ln -s ${selshot} $out/bin/selshot
ln -s ${selvid} $out/bin/selvid
ln -s ${getscrloc} $out/bin/getscrloc
ln -s ${scrsaveclip} $out/bin/scrsaveclip
ln -s ${scrvidsaveclip} $out/bin/scrvidsaveclip
ln -s ${scrvidstop} $out/bin/scrvidstop
ln -s ${um} $out/bin/um
'' + (
if cfg.uploadScript != null then ''
ln -s ${cfg.uploadScript} $out/bin/upload_file
ln -s ${scrsaveup} $out/bin/scrsaveup
ln -s ${scrvidsaveup} $out/bin/scrvidsaveup
'' else
""
)
);
# TODO: why wont this work in an overlay
pnpm2nix =
pkgs.callPackage
(
builtins.fetchGit {
url = "https://github.com/notgne2/pnpm2nix.git";
rev = "d2863404330c6646800a49e73240e29e3265b594";
}
)
{ };
# mudl = pnpm2nix.mkPnpmPackage {
# src = builtins.fetchGit {
# url = "https://git.wizbos.club/notgne2/mudl.git";
# rev = "a34af57de345dd6788e2b3cc67c41fe5de62ade6";
# };
# };
mudl =
let
src = builtins.fetchGit {
url = "https://git.wizbos.club/notgne2/mudl.git";
rev = "2c1b6545d2f98f0649e5df03c7d86a8d28bb15e5";
};
in
pkgs.runCommandNoCC "mudl" { } ''
mkdir -p $out/bin
cp ${src}/index.js $out/bin/mudl
chmod +x $out/bin/mudl
'';
rofiMenu =
if cfg.wayland then
"${rofiBin} -show drun -show-icons -run-command 'swaymsg exec -- {cmd}'"
else
"${rofiBin} -show drun -show-icons";
swayConfig = {
enable = true;
config = {
terminal = "kitty";
modifier = "Mod4";
keybindings =
let
musicRofi = pkgs.writeScript "music-rofi" ''
#!${pkgs.fish}/bin/fish
${pkgs.mpc_cli}/bin/mpc -f "%position% - %artist% - %album% - %title%" playlist | ${rofiBin} -dmenu -i | ${pkgs.coreutils}/bin/cut -d " " -f 1 | ${pkgs.findutils}/bin/xargs ${pkgs.mpc_cli}/bin/mpc play
'';
# ugly stupid way of doing things but im lazy
bwRofi = pkgs.writeScript "bw-rofi" ''
#!${pkgs.bash}/bin/bash
export BW_SESSION="${cfg.bitwardenSession}"
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
CHOSEN=$(echo "$USERLIST" | ${rofiBin} -dmenu -i)
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
NTH=$(expr $NUMBER - 1)
echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].login.password" | ${copyBin}
'';
# very ugly stupid way of doing things but im still lazy
bwRofiOtp = pkgs.writeScript "bw-rofi-otp" ''
#!${pkgs.bash}/bin/bash
export BW_SESSION="${cfg.bitwardenSession}"
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
CHOSEN=$(echo "$USERLIST" | ${rofiBin} -dmenu -i)
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
NTH=$(expr $NUMBER - 1)
ID=$(echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].id")
${pkgs.bitwarden-cli}/bin/bw get totp $ID | ${copyBin}
'';
# reeeeeeeeeeee ugly
emojiRofi =
let
# emojiTxt = builtins.toFile "emojis.txt" (builtins.readFile ../data/emojis.txt);
emojiTxt = toString ../data/emojis.txt;
in
pkgs.writeScript "rofi-emoji" ''
line=$(${pkgs.coreutils}/bin/cat ${emojiTxt} | ${rofiBin} -dmenu -i)
${pkgs.coreutils}/bin/echo ''${line::1} | ${copyBin}
${pkgs.coreutils}/bin/sleep 0.3
${pkgs.xdotool}/bin/xdotool type "''${line::1}"
'';
magicMudl = pkgs.writeScript "magic-mudl" ''
#!${pkgs.bash}/bin/bash
SOURCE=$(${pasteBin})
notify-send "Downloading $SOURCE"
${mudl}/bin/mudl "$SOURCE"
notify-send "Download complete"
'';
configPlace =
if cfg.wayland then
config.wayland.windowManager.sway
else
config.xsession.windowManager.i3;
alphabet = [
"${if cfg.wayland then "Ctrl" else "Control"}"
"${if cfg.wayland then "Alt" else "Mod1"}"
"${if cfg.wayland then "Ctrl" else "Control"}+${if cfg.wayland then "Alt" else "Mod1"}"
];
char = n: builtins.elemAt alphabet ((n - 1) / 10);
in
lib.mkOptionDefault (
cfg.keybindings // lib.listToAttrs (
map
(
n: {
name = "${configPlace.config.modifier}+${char (n - 10)}+${
toString (lib.mod n 10)
}";
value = "workspace ${toString n}";
}
)
(lib.lists.range 11 (10 * (builtins.length alphabet) + 10))
)
// lib.listToAttrs (
map
(
n: {
name = "${configPlace.config.modifier}+Shift+${char (n - 10)}+${
toString (lib.mod n 10)
}";
value = "move container to workspace ${toString n}";
}
)
(lib.lists.range 11 (10 * (builtins.length alphabet) + 10))
) // (
let
volumeUp = (
if cfg.haddr != null then
"exec ${pkgs.qt5.qttools.bin}/bin/qdbus --system org.bluez ${cfg.haddr} org.bluez.MediaControl1.VolumeUp || "
else
"exec "
)
+ "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
volumeDown = (
if cfg.haddr != null then
"exec ${pkgs.qt5.qttools.bin}/bin/qdbus --system org.bluez ${cfg.haddr} org.bluez.MediaControl1.VolumeDown || "
else
"exec "
)
+ "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
in
{
"Print" = "exec ${scrsaveclip}";
"Shift+Print" =
if cfg.uploadScript != null then "exec ${scrsaveup}" else "nop";
"${if cfg.wayland then "Ctrl" else "Control"}+Print" =
"exec ${scrvidsaveclip}";
"${if cfg.wayland then "Ctrl" else "Control"}+${if cfg.wayland then "Alt" else "Mod1"
}+Print" = "exec ${scrvidstop}";
"${configPlace.config.modifier}+minus" = volumeDown;
"${configPlace.config.modifier}+equal" = volumeUp;
"XF86AudioRaiseVolume" = volumeUp;
"XF86AudioLowerVolume" = volumeDown;
"XF86AudioMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 10";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 10";
"${configPlace.config.modifier}+semicolon" =
"exec ${pkgs.light}/bin/light -U 10";
"${configPlace.config.modifier}+apostrophe" =
"exec ${pkgs.light}/bin/light -A 10";
# Previous/next but change the shuffle/random state before action (and change back afterwards)
"${configPlace.config.modifier}+Shift+bracketright" =
"exec ${pkgs.mpc_cli}/bin/mpc random && ${pkgs.mpc_cli}/bin/mpc next && ${pkgs.mpc_cli}/bin/mpc random";
"${configPlace.config.modifier}+Shift+bracketleft" =
"exec ${pkgs.mpc_cli}/bin/mpc random && ${pkgs.mpc_cli}/bin/mpc prev && ${pkgs.mpc_cli}/bin/mpc random";
"Shift+XF86AudioNext" =
"exec ${pkgs.mpc_cli}/bin/mpc random && ${pkgs.mpc_cli}/bin/mpc next && ${pkgs.mpc_cli}/bin/mpc random";
# Previous/next
"${configPlace.config.modifier}+bracketright" =
"exec ${pkgs.mpc_cli}/bin/mpc next";
"${configPlace.config.modifier}+bracketleft" =
"exec ${pkgs.mpc_cli}/bin/mpc prev";
"XF86AudioNext" = "exec ${pkgs.mpc_cli}/bin/mpc next";
"XF86AudioPrev" = "exec ${pkgs.mpc_cli}/bin/mpc prev";
# Toggle play/pause
"XF86AudioPlay" = "exec ${pkgs.mpc_cli}/bin/mpc toggle";
"XF86AudioPause" = "exec ${pkgs.mpc_cli}/bin/mpc toggle";
"${configPlace.config.modifier}+backslash" =
"exec ${pkgs.mpc_cli}/bin/mpc toggle";
"${configPlace.config.modifier}+m" = "exec ${musicRofi}";
# "${configPlace.config.modifier}+Shift+m" = "exec ${magicMudl}";
"${configPlace.config.modifier}+p" = "exec ${bwRofi}";
"${configPlace.config.modifier}+t" = "exec ${bwRofiOtp}";
"${configPlace.config.modifier}+o" = "exec ${emojiRofi}";
"${configPlace.config.modifier}+0" = "workspace 10";
"${configPlace.config.modifier}+Shift+0" =
"move container to workspace 10";
"${if cfg.wayland then "Ctrl" else "Control"}+${if cfg.wayland then "Alt" else "Mod1"
}+l" =
let
lockBin =
if cfg.wayland then
"${pkgs.swaylock}/bin/swaylock"
else
"${pkgs.i3lock}/bin/i3lock";
in
"exec ${lockBin} ${cfg.swaylockArgs}";
}
)
);
menu = rofiMenu;
bars =
if (cfg.babybar || cfg.wayland != true) then [
{
position = "top";
colors = config.colors.i3BarColors;
}
] else
[ ];
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 5;
outer = 5;
};
};
};
mainConfig = {
systemd.user.services.flameshot = {
Unit = {
Description = "Flameshot screenshot tool";
After = [
"graphical-session-pre.target"
"polybar.service"
"stalonetray.service"
"taffybar.service"
];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${flameshot}/bin/flameshot";
Restart = "on-abort";
};
};
xdg.configFile."flameshot/flameshot.ini".text = ''
[General]
buttons=@Variant(\0\0\0\x7f\0\0\0\vQList<int>\0\0\0\0\n\0\0\0\0\0\0\0\x2\0\0\0\x3\0\0\0\x5\0\0\0\x6\0\0\0\x12\0\0\0\xf\0\0\0\x13\0\0\0\b\0\0\0\n)
contrastOpacity=142
contrastUiColor=#0ee900
disabledTrayIcon=false
drawColor=#ff0000
drawThickness=9
savePath=/dev/null
uiColor=#6a00a3
'';
services.keynav.enable = true;
services.clipmenu.enable = true;
colors.enable = true;
fonts.enable = true;
ez.codium.enable = true;
ez.chromium.enable = true;
services.lorri.enable = true;
services.blueman-applet = {
enable = cfg.bluetooth;
};
systemd.user.services.mpris-proxy = mkIf cfg.bluetooth {
Unit.Description = "Mpris proxy";
Unit.After = [ "network.target" "sound.target" ];
Service.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
Install.WantedBy = [ "default.target" ];
};
systemd.user.services.ydotoold = {
Unit = {
Description = "Generic command-line automation tool (no X!) ";
PartOf = "graphical-session.target";
};
Service.ExecStart = "${pkgs.ydotool}/bin/ydotoold";
Install = { WantedBy = [ "graphical-session.target" ]; };
};
# systemd.user.services.pulseaudio-dlna = {
# Unit = {
# Description =
# "A lightweight streaming server which brings DLNA / UPNP and Chromecast support to PulseAudio and Linux";
# After = [ "network.target" "sound.target" ];
# };
# Service = {
# ExecStart = "${pkgs.pulseaudio-dlna}/bin/pulseaudio-dlna --port 10291";
# Environment =
# let
# toolPaths = makeBinPath [ pkgs.pulseaudio pkgs.dbus ];
# in
# [ "PATH=${toolPaths}" ];
# type = "idle";
# };
# Install = { WantedBy = [ "default.target" ]; };
# };
xdg.configFile."fish/functions/humanize_duration.fish".source =
pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/fishpkg/fish-humanize-duration/master/humanize_duration.fish";
sha256 = "0abjc9dab8sx2lr28dp36vy9c4rd95badiypbkfjyvdxd9nig6zr";
};
home.sessionVariables = { BW_SESSION = cfg.bitwardenSession; };
services.mpd = {
enable = true;
musicDirectory = "${config.home.homeDirectory}/Music";
};
gtk = {
enable = true;
iconTheme = {
package = cfg.favIcons.package;
name = cfg.favIcons.name;
};
};
qt = {
enable = true;
platformTheme = "gtk";
};
programs.kitty = {
enable = true;
settings = {
background_opacity = "0.70";
dynamic_background_opacity = true;
};
};
xdg.configFile."neofetch/config.conf".text =
let
image = builtins.path {
name = "nixos_circlejerk.png";
path = ../data/nixos_circlejerk.png;
};
in
''
image_source="${image}"
image_backend="kitty"
'';
programs.mpv.config = {
enable = true;
profile = "gpu-hq";
ytdl-format = "bestvideo+bestaudio";
cache-default = 4000000;
};
fonts.fontconfig.enable = true;
home.packages = with pkgs;
[
flameshot
# needed for fish done stuff
jq
direnv
ezDrv
mudl
bitwarden-cli
kitty
pavucontrol
mpv
youtube-dl
xorg.xkill
maim
slop
ark
gwenview
notify-osd
libnotify
ffmpeg
id3v2
imagemagick
gimp
mumble
libreoffice
mpc_cli
nix-index
]
++ (
if cfg.developer then [
openvpn
gitAndTools.hub
morph
nmap
nixpkgs-fmt
] else
[ ]
);
programs.rofi = {
enable = true;
terminal = "kitty";
borderWidth = 0;
lines = 30;
};
};
waylandConfig = {
home.sessionVariables = {
QT_QPA_PLATFORM = "wayland-egl;xcb";
MOZ_ENABLE_WAYLAND = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
ECORE_EVAS_ENGINE = "wayland_egl";
ELM_ENGINE = "wayland_egl";
_JAVA_AWT_WM_NONREPARENTING = "1";
XDG_CURRENT_DESKTOP = "Unity";
};
programs.waybar = {
enable = cfg.babybar != true;
systemd.enable = true;
settings = [
({
modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" "mpd" ];
modules-right = (if cfg.battery then [ "battery" ] else [ ])
++ [ "pulseaudio" "network" "memory" "cpu" "temperature" "tray" ];
position = "left";
width = 50;
height = null;
modules.network.format-wifi = "{signalStrength}% ";
modules.network.format-alt = "{ipaddr}";
modules.pulseaudio.format = "{volume}% ";
modules.memory.format = "{}% ";
modules.mpd.rotate = 90;
modules.temperature = {
format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" ];
};
} // cfg.waybarConfig)
];
style =
(
builtins.readFile "${pkgs.waybar}/etc/xdg/waybar/style.css" + "\n" + config.colors.waybarCss + "\n" + ''
#clock, #battery, #cpu, #memory, #network, #pulseaudio, #tray, #mode, #temperature, #clock, #mpd {
margin: 3px 0;
padding: 5px 2px;
}
* {
font-family: "${config.fonts.favFont.name}";
font-size: ${toString config.fonts.favFont.size}px;
}
''
);
};
xdg.configFile."gebaar/gebaard.toml".text = ''
[commands.swipe.three]
left_up = ""
right_up = ""
up = ""
left_down = ""
right_down = ""
down = "${rofiMenu}"
left = "${pkgs.ydotool}/bin/ydotool key Alt+Left"
right = "${pkgs.ydotool}/bin/ydotool key Alt+Right"
[commands.swipe.four]
left_up = ""
right_up = ""
up = ""
left_down = ""
right_down = ""
down = ""
left = ""
right = ""
'';
systemd.user.services.gebaard = {
Unit = {
Description =
" A Super Simple WM Independent Touchpad Gesture Daemon for libinput ";
PartOf = "graphical-session.target";
};
Service.ExecStart = "${pkgs.gebaar-libinput}/bin/gebaard";
Install = { WantedBy = [ "sway-session.target" ]; };
};
programs.mako.enable = true;
systemd.user.services.swayidle = mkIf cfg.screensaver.enable {
Unit = {
Description = "Idle manager for Wayland";
PartOf = "sway-session.target";
};
Service.ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w \
timeout ${
toString cfg.screensaver.lockTime
} 'swaylock -f ${cfg.swaylockArgs}' \
timeout ${
toString cfg.screensaver.offTime
} 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f ${cfg.swaylockArgs}'
'';
Install = { WantedBy = [ "sway-session.target" ]; };
};
wayland.windowManager.sway = mkMerge [
swayConfig
{
config = { output = cfg.outputOptions; };
package = lib.mkDefault swaypkg;
extraConfig =
let
oguri-swaybg = pkgs.writeScript "oguri-swaybg" ''
#!/bin/sh
set -e
set -o pipefail
outputs=""
images=""
while getopts o:i:m:c: OPTION; do
case $OPTION in
o)
outputs="''${outputs}[output $OPTARG]\n"
;;
i)
outputs="''${outputs}image=$OPTARG\n"
;;
m)
outputs="''${outputs}scaling-mode=$OPTARG\n"
;;
c) ;; # No color support.
esac
done
printf "''${outputs}\n" | ${pkgs.oguri}/bin/oguri -c /dev/stdin
'';
in
''
swaybg_command ${oguri-swaybg}
'';
systemdIntegration = true;
wrapperFeatures.gtk = true;
}
];
home.packages = with pkgs; [
waybar
wl-clipboard # important actually, for vim and other things
swaylock
pkgs.swayidle
xwayland
rxvt_unicode
dmenu
libappindicator-gtk3
pipewire
xdg-desktop-portal
xdg-desktop-portal-wlr
];
};
xConfig =
let
allOutputs =
builtins.attrValues
cfg.outputOptions;
mainOutput =
if
builtins.length
allOutputs >= 1 then
builtins.elemAt
(allOutputs)
0 else null;
mainWallpaper =
if mainOutput != null &&
builtins.hasAttr
"bg"
mainOutput then mainOutput.bg else null;
mainWallpaperSplit =
if mainWallpaper != null then
lib.splitString
" "
mainWallpaper else null;
mainWallpaperImgRaw =
if mainWallpaperSplit != null then
builtins.elemAt
mainWallpaperSplit
0 else null;
mainWallpaperImg =
if mainWallpaperImgRaw != null then
lib.replaceStrings
[ "$HOME" ]
[ "%h" ]
mainWallpaperImgRaw else null;
mainWallpaperDisplayMaybe =
if mainWallpaperSplit != null then
builtins.elemAt
mainWallpaperSplit
1 else null;
mainWallpaperDisplay = if mainWallpaperDisplayMaybe != null then mainWallpaperDisplayMaybe else "fill";
in
{
systemd.user.services =
if mainWallpaperImg != null then {
background = {
Unit = {
Description = "Set the wallpaper";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh --bg-${mainWallpaperDisplay} ${mainWallpaperImg}";
IOSchedulingClass = "idle";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
} else { };
services.picom = {
enable = true;
vSync = true;
#refreshRate = 144;
blur = true;
package = pkgs.picom.overrideAttrs (
_: {
src = builtins.fetchGit {
url = "https://github.com/ibhagwan/picom";
ref = "next-rebase";
rev = "6d87428f78a46bea295e0a21d23c4b56133aadc3";
};
}
);
experimentalBackends = true;
blurExclude = [
"window_type = 'dock'"
"window_type = 'desktop'"
"_GTK_FRAME_EXTENTS@:c"
"class_g = 'slop'"
];
extraOptions = ''
blur:
{
method = "kawase";
strength = 4;
kern = "3x3box";
deviation = 5.0;
};
'';
};
xsession = {
enable = true;
windowManager.i3 = swayConfig;
};
services.dunst = {
enable = true;
settings = {
global = {
geometry = "300x5-30+50";
padding = 8;
horizontal_padding = 8;
transparency = 10;
};
};
};
};
in
{
options.ezpcusr = {
enable = mkEnableOption "Enable simple PC user config";
wayland = mkOption {
default = true;
description = "Enable wayland config (disabling this is experimental)";
};
babybar = mkOption {
default = false;
description = ''Switch to using the "baby" swaybar rather than waybar'';
};
keybindings = mkOption {
description = "Keyboard shortcuts";
default = { };
type = types.attrsOf (types.nullOr types.str);
};
uploadScript = mkOption {
type = types.nullOr types.package;
default = null;
description =
"A path to a script that takes a path to a file and returns a URL";
};
bitwardenSession = mkOption {
description = "Session key for bitwarden";
default = "";
type = types.str;
};
outputOptions = mkOption {
description = "Additional output options";
default = { };
type = types.attrsOf (types.attrsOf types.str);
};
waybarConfig = mkOption {
description = "Waybar config";
default = { };
};
makoArgs = mkOption {
description = "Args for mako notification displayer";
default = "";
type = types.str;
};
swaylockArgs = mkOption {
description = "Args for swaylock lock screen";
default = "";
type = types.str;
};
screensaver = mkOption {
description = "ezpcusr screensaver";
default = { };
type = types.submodule {
options = {
enable = mkOption {
type = types.bool;
default = true;
description = "Enable ezpcusr's screensaver";
};
lockTime = mkOption {
type = types.int;
default = 300;
description = "Time until your screen locks";
};
offTime = mkOption {
type = types.int;
default = 600;
description = "Time until your screen turns off";
};
};
};
};
favIcons = mkOption {
description = "Your favourite icons pack";
default = { };
type = types.submodule {
options = {
name = mkOption {
type = types.str;
default = "Papirus-Dark";
description = "Name of your icon pack";
};
package = mkOption {
type = types.package;
default = pkgs.papirus-icon-theme;
description = "Package for your icon pack";
};
};
};
};
developer = mkOption {
type = types.bool;
default = true;
description = "Enable developer tools";
};
gaming = mkOption {
type = types.bool;
default = false;
description = "If this PC is used for gaming";
};
bluetooth = mkOption {
type = types.bool;
default = false;
description = "If this PC has bluetooth support";
};
haddr = mkOption {
type = types.nullOr types.str;
default = null;
description = "address for ur bluetooth headphones";
};
battery = mkOption {
type = types.bool;
default = false;
description = "If this PC has a battery";
};
tiling = mkOption {
type = types.bool;
default = true;
description = "If you are based and redpilled, and want a tiling WM (deprecated)";
};
};
config = mkIf cfg.enable (
mkMerge [
mainConfig
(mkIf cfg.wayland waylandConfig)
(mkIf (cfg.wayland != true) xConfig)
]
);
}