mirror of
https://github.com/kmein/niveum
synced 2026-03-16 18:21:07 +01:00
- configs/i3.nix: niveum-terminal → niphas-terminal, etc. - configs/graphical/home-manager.nix: same - configs/default.nix: same - flake.nix: remove the three overlay aliases
331 lines
12 KiB
Nix
331 lines
12 KiB
Nix
{
|
||
config,
|
||
pkgs,
|
||
lib,
|
||
...
|
||
}:
|
||
let
|
||
klem = pkgs.klem.override {
|
||
options.dmenu = "${pkgs.dmenu}/bin/dmenu -i -p klem";
|
||
options.scripts = {
|
||
"p.r paste" = pkgs.writers.writeDash "p.r" ''
|
||
${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \
|
||
| ${pkgs.coreutils}/bin/tail --lines=1 \
|
||
| ${pkgs.gnused}/bin/sed 's/\\<r\\>/krebsco.de/'
|
||
'';
|
||
"envs.sh paste" = pkgs.writers.writeDash "envs-host" ''
|
||
${pkgs.curl}/bin/curl -F "file=@-" https://envs.sh
|
||
'';
|
||
# this segfaults
|
||
# "envs.sh mirror" = pkgs.writers.writeDash "envs-mirror" ''
|
||
# ${pkgs.curl}/bin/curl -F "url=$(${pkgs.coreutils}/bin/cat)" https://envs.sh
|
||
# '';
|
||
"envs.sh shorten" = pkgs.writers.writeDash "envs-shorten" ''
|
||
${pkgs.curl}/bin/curl -F "shorten=$(${pkgs.coreutils}/bin/cat)" https://envs.sh
|
||
'';
|
||
"go.r shorten" = pkgs.writers.writeDash "go.r" ''
|
||
${pkgs.curl}/bin/curl -fSs http://go.r -F "uri=$(${pkgs.coreutils}/bin/cat)"
|
||
'';
|
||
"4d2.org paste" = pkgs.writers.writeDash "4d2-paste" ''
|
||
${pkgs.curl}/bin/curl -F "file=@-" https://depot.4d2.org/
|
||
'';
|
||
"0x0.st shorten" = pkgs.writers.writeDash "0x0.st" ''
|
||
${pkgs.curl}/bin/curl -fSs https://0x0.st -F "shorten=$(${pkgs.coreutils}/bin/cat)"
|
||
'';
|
||
"rot13" = pkgs.writers.writeDash "rot13" ''
|
||
${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
|
||
'';
|
||
"ipa" = pkgs.writers.writeDash "ipa" ''
|
||
${pkgs.ipa}/bin/ipa
|
||
'';
|
||
"betacode" = pkgs.writers.writeDash "betacode" ''
|
||
${pkgs.betacode}/bin/betacode
|
||
'';
|
||
"curl" = pkgs.writers.writeDash "curl" ''
|
||
${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)"
|
||
'';
|
||
ocr = pkgs.writers.writeDash "ocr" ''
|
||
${pkgs.tesseract4}/bin/tesseract -l eng+deu - stdout
|
||
'';
|
||
emojai = pkgs.writers.writeDash "emojai" ''
|
||
${pkgs.curl}/bin/curl https://www.emojai.app/api/generate -X POST -H 'Content-Type: application/json' --data-raw "$(${pkgs.jq}/bin/jq -sR '{emoji:.}')" | ${pkgs.jq}/bin/jq -r .result
|
||
'';
|
||
};
|
||
};
|
||
in
|
||
{
|
||
age.secrets = {
|
||
github-token-i3status-rust = {
|
||
file = ../secrets/github-token-i3status-rust.age;
|
||
owner = config.users.users.me.name;
|
||
group = config.users.users.me.group;
|
||
mode = "400";
|
||
};
|
||
openweathermap-api-key = {
|
||
file = ../secrets/openweathermap-api-key.age;
|
||
owner = config.users.users.me.name;
|
||
group = config.users.users.me.group;
|
||
mode = "400";
|
||
};
|
||
miniflux-api-token = {
|
||
file = ../secrets/miniflux-api-token.age;
|
||
owner = config.users.users.me.name;
|
||
group = config.users.users.me.group;
|
||
mode = "400";
|
||
};
|
||
};
|
||
|
||
environment.systemPackages = [
|
||
pkgs.xsecurelock
|
||
];
|
||
environment.sessionVariables = {
|
||
XSECURELOCK_NO_COMPOSITE = "1";
|
||
XSECURELOCK_BACKGROUND_COLOR = "navy";
|
||
XSECURELOCK_PASSWORD_PROMPT = "time_hex";
|
||
};
|
||
|
||
services.displayManager.defaultSession = "none+i3";
|
||
services.xserver = {
|
||
windowManager.i3 = {
|
||
enable = true;
|
||
package = pkgs.i3;
|
||
};
|
||
};
|
||
|
||
services.xserver = {
|
||
monitorSection = ''Option "DPMS" "false"'';
|
||
serverFlagsSection = ''
|
||
Option "BlankTime" "0"
|
||
Option "StandbyTime" "0"
|
||
Option "SuspendTime" "0"
|
||
Option "OffTime" "0"
|
||
'';
|
||
extraConfig = ''
|
||
Section "Extensions"
|
||
Option "DPMS" "Disable"
|
||
EndSection
|
||
'';
|
||
};
|
||
|
||
home-manager.users.me =
|
||
let
|
||
modifier = "Mod4";
|
||
infoWorkspace = "ℹ";
|
||
messageWorkspace = "✉";
|
||
modes.resize = {
|
||
"Escape" = ''mode "default"'';
|
||
"Return" = ''mode "default"'';
|
||
"h" = "resize shrink width 10 px or 5 ppt";
|
||
"j" = "resize grow height 10 px or 5 ppt";
|
||
"k" = "resize shrink height 10 px or 5 ppt";
|
||
"l" = "resize grow width 10 px or 5 ppt";
|
||
};
|
||
gaps.inner = 4;
|
||
floating = {
|
||
titlebar = false;
|
||
border = 1;
|
||
};
|
||
bars =
|
||
let
|
||
position = "bottom";
|
||
in
|
||
[
|
||
(lib.recursiveUpdate config.home-manager.users.me.stylix.targets.i3.exportedBarConfig {
|
||
workspaceButtons = true;
|
||
mode = "hide"; # "dock";
|
||
inherit position;
|
||
statusCommand = toString (
|
||
pkgs.writers.writeDash "i3status-rust" ''
|
||
export I3RS_GITHUB_TOKEN="$(cat ${config.age.secrets.github-token-i3status-rust.path})"
|
||
export OPENWEATHERMAP_API_KEY="$(cat ${config.age.secrets.openweathermap-api-key.path})"
|
||
exec ${config.home-manager.users.me.programs.i3status-rust.package}/bin/i3status-rs ${config.home-manager.users.me.home.homeDirectory}/.config/i3status-rust/config-${position}.toml
|
||
''
|
||
);
|
||
fonts = {
|
||
names = [
|
||
"${config.stylix.fonts.sansSerif.name}"
|
||
"FontAwesome 6 Free"
|
||
];
|
||
size = config.stylix.fonts.sizes.desktop * 0.8;
|
||
};
|
||
})
|
||
];
|
||
window = {
|
||
titlebar = false;
|
||
border = 2;
|
||
hideEdgeBorders = "smart";
|
||
commands = [
|
||
{
|
||
criteria = {
|
||
class = "floating";
|
||
};
|
||
command = "floating enable";
|
||
}
|
||
{
|
||
criteria = {
|
||
class = "fzfmenu";
|
||
};
|
||
command = "floating enable";
|
||
}
|
||
{
|
||
criteria = {
|
||
class = ".*";
|
||
};
|
||
command = "border pixel 2";
|
||
}
|
||
{
|
||
criteria = {
|
||
class = "mpv";
|
||
};
|
||
command = lib.strings.concatStringsSep ", " [
|
||
"floating enable"
|
||
"sticky enable"
|
||
"fullscreen disable"
|
||
"resize set 640 480"
|
||
"move position mouse"
|
||
];
|
||
}
|
||
];
|
||
};
|
||
colors =
|
||
let
|
||
background = config.lib.stylix.colors.withHashtag.base00;
|
||
in
|
||
{
|
||
unfocused = {
|
||
border = lib.mkForce background;
|
||
childBorder = lib.mkForce background;
|
||
};
|
||
};
|
||
keybindings =
|
||
lib.listToAttrs (
|
||
map (
|
||
x: lib.nameValuePair "${modifier}+Shift+${toString x}" "move container to workspace ${toString x}"
|
||
) (lib.range 1 9)
|
||
)
|
||
// lib.listToAttrs (
|
||
map (x: lib.nameValuePair "${modifier}+${toString x}" "workspace ${toString x}") (lib.range 1 9)
|
||
)
|
||
// {
|
||
"${modifier}+i" = "workspace ${infoWorkspace}";
|
||
"${modifier}+m" = "workspace ${messageWorkspace}";
|
||
|
||
"${modifier}+Shift+h" = "move left 25 px";
|
||
"${modifier}+Shift+j" = "move down 25 px";
|
||
"${modifier}+Shift+k" = "move up 25 px";
|
||
"${modifier}+Shift+l" = "move right 25 px";
|
||
"${modifier}+h" = "focus left";
|
||
"${modifier}+j" = "focus down";
|
||
"${modifier}+k" = "focus up";
|
||
"${modifier}+l" = "focus right";
|
||
|
||
# "${modifier}+Shift+b" = "move container to workspace prev";
|
||
# "${modifier}+Shift+n" = "move container to workspace next";
|
||
# "${modifier}+b" = "workspace prev";
|
||
# "${modifier}+n" = "workspace next";
|
||
|
||
"${modifier}+Shift+c" = "reload";
|
||
"${modifier}+Shift+q" = "kill";
|
||
"${modifier}+Shift+r" = "restart";
|
||
|
||
"${modifier}+z" = "sticky toggle";
|
||
"${modifier}+Shift+z" = "floating toggle";
|
||
|
||
"${modifier}+Shift+s" = "move scratchpad";
|
||
"${modifier}+s" = ''[class="^(?i)(?!obsidian).*"] scratchpad show'';
|
||
"${modifier}+o" = ''[class="obsidian"] scratchpad show'';
|
||
|
||
"${modifier}+c" = "split h";
|
||
"${modifier}+e" = "layout toggle split";
|
||
"${modifier}+f" = "fullscreen toggle";
|
||
"${modifier}+r" = "mode resize";
|
||
"${modifier}+v" = "split v";
|
||
"${modifier}+w" = "layout tabbed";
|
||
"${modifier}+q" = "exec ${config.services.clipmenu.package}/bin/clipmenu";
|
||
|
||
"${modifier}+Return" = "exec ${lib.getExe pkgs.niphas-terminal}";
|
||
"${modifier}+t" = "exec ${lib.getExe pkgs.niphas-file-browser}";
|
||
"${modifier}+y" = "exec ${lib.getExe pkgs.niphas-web-browser}";
|
||
|
||
"${modifier}+d" =
|
||
"exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}";
|
||
"${modifier}+Shift+d" = "exec ${lib.getExe pkgs.notemenu}";
|
||
"${modifier}+p" = "exec rofi-pass";
|
||
"${modifier}+Shift+p" = "exec rofi-pass --insert";
|
||
"${modifier}+u" = "exec ${lib.getExe pkgs.unicodmenu}";
|
||
"${modifier}+Shift+u" =
|
||
"exec ${pkgs.writers.writeDash "last-unicode" ''${pkgs.xdotool}/bin/xdotool type --delay 1000 "$(${pkgs.gawk}/bin/awk 'END{print $1}' ~/.cache/unicodmenu)"''}";
|
||
|
||
"${modifier}+F7" = "exec ${pkgs.writers.writeDash "showkeys-toggle" ''
|
||
if ${pkgs.procps}/bin/pgrep screenkey; then
|
||
exec ${pkgs.procps}/bin/pkill screenkey
|
||
else
|
||
exec ${pkgs.screenkey}/bin/screenkey
|
||
fi
|
||
''}";
|
||
"${modifier}+F12" = "exec ${klem}/bin/klem";
|
||
"XF86AudioLowerVolume" = "exec ${lib.getExe pkgs.pamixer} -d 5";
|
||
"XF86AudioMute" = "exec ${lib.getExe pkgs.pamixer} -t";
|
||
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5";
|
||
"XF86Calculator" = "exec ${lib.getExe pkgs.st} -c floating -e ${pkgs.bc}/bin/bc";
|
||
"XF86AudioPause" = "exec ${lib.getExe pkgs.playerctl} play-pause";
|
||
"XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause";
|
||
"XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
|
||
"XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
|
||
"XF86AudioStop" = "exec ${lib.getExe pkgs.playerctl} stop";
|
||
|
||
# key names detected with xorg.xev:
|
||
# XF86WakeUp (fn twice)
|
||
# XF86Battery (fn f3)
|
||
# XF86Sleep (fn f4) - actually suspends
|
||
# XF86WLAN
|
||
# XF86WebCam (fn f6)
|
||
# XF86TouchpadToggle (fn f8)
|
||
# XF86Suspend (fn f12) - actually suspends to disk
|
||
# Num_Lock (fn Roll) - numlocks
|
||
# XF86Audio{Prev,Next,Mute,Play,Stop}
|
||
# XF86Forward
|
||
# XF86Back
|
||
# XF86Launch1 (thinkvantage)
|
||
};
|
||
in
|
||
{
|
||
stylix.targets.i3.enable = true;
|
||
|
||
xsession.windowManager.i3 = {
|
||
enable = true;
|
||
extraConfig = ''
|
||
bindsym --release ${modifier}+Shift+w exec xsecurelock
|
||
|
||
exec "${lib.getExe pkgs.obsidian}"
|
||
for_window [class="obsidian"] , move scratchpad
|
||
|
||
assign [class="message"] ${messageWorkspace}
|
||
exec "${pkgs.writers.writeDash "irc" "exec ${lib.getExe pkgs.alacritty} --class message -e ssh weechat@makanek -t tmux attach-session -t IM"}"
|
||
exec "${pkgs.writers.writeDash "email" "exec ${lib.getExe pkgs.alacritty} --class message -e aerc"}"
|
||
|
||
exec --no-startup-id ${pkgs.xss-lock}/bin/xss-lock -- xsecurelock
|
||
'';
|
||
config = {
|
||
inherit
|
||
modifier
|
||
gaps
|
||
modes
|
||
bars
|
||
floating
|
||
window
|
||
colors
|
||
;
|
||
keybindings = keybindings // {
|
||
"${modifier}+F9" = "exec ${pkgs.redshift}/bin/redshift -O 4000 -b 0.85";
|
||
"${modifier}+F10" = "exec ${pkgs.redshift}/bin/redshift -x";
|
||
"Print" = "exec flameshot gui";
|
||
# "${modifier}+Shift+x" = "exec ${move-to-new-workspace}";
|
||
# "${modifier}+x" = "exec ${new-workspace}";
|
||
"XF86Display" = "exec ${lib.getExe pkgs.dmenu-randr}";
|
||
};
|
||
};
|
||
};
|
||
};
|
||
}
|