linted
This commit is contained in:
atagen 2025-02-02 16:57:31 +11:00
parent 4e99a0e323
commit 7485de646a
95 changed files with 2743 additions and 2282 deletions

View file

@ -2,160 +2,201 @@
pkgs,
lib,
config,
inputs,
...
}: let
services = let
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
in [
swaynotificationcenter
sway-audio-idle-inhibit
];
errata = let
inherit (pkgs) sirula avizo playerctl;
in [
sirula
avizo
playerctl
];
extraServices = let
inherit (pkgs) swayidle swaybg systemd niri-unstable avizo;
in [
{
name = "swaybg";
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
}
{
name = "avizo-service";
value = "${lib.getExe' avizo "avizo-service"}";
}
{
name = "swayidle";
value = let
lock = lib.getExe pkgs.swaylock;
niri = lib.getExe niri-unstable;
systemctl = lib.getExe' systemd "systemctl";
in ''
${lib.getExe swayidle} -w \
timeout 1800 '${systemctl} suspend' \
timeout 600 '${niri} msg action power-off-monitors' \
timeout 599 '${lock} -f' \
before-sleep '${lock} -f'
'';
}
];
in {
}:
let
services =
let
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
in
[
swaynotificationcenter
sway-audio-idle-inhibit
];
errata =
let
inherit (pkgs) sirula avizo playerctl;
in
[
sirula
avizo
playerctl
];
extraServices =
let
inherit (pkgs)
swayidle
swaybg
systemd
niri-unstable
avizo
;
in
[
{
name = "swaybg";
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
}
{
name = "avizo-service";
value = "${lib.getExe' avizo "avizo-service"}";
}
{
name = "swayidle";
value =
let
niri = lib.getExe niri-unstable;
systemctl = lib.getExe' systemd "systemctl";
in
''
${lib.getExe swayidle} -w \
timeout 1800 '${systemctl} suspend' \
timeout 600 '${niri} msg action power-off-monitors'
'';
}
];
in
{
home.packages = errata;
ezServices = builtins.listToAttrs (
(map (entry: {
name = "${lib.strings.toLower entry.pname}";
value = "${lib.getExe entry}";
})
services)
name = "${lib.strings.toLower entry.pname}";
value = "${lib.getExe entry}";
}) services)
++ extraServices
);
programs.niri.settings = let
inherit (lib) range nameValuePair mapAttrs';
inherit (builtins) listToAttrs replaceStrings;
inherit (config.lib.niri) actions;
in {
binds = let
hBinds = {
H = "left";
L = "right";
};
vBinds = {
J = "down";
K = "up";
};
makeDirBind = mods: cmd: keys:
mapAttrs' (
key: dir:
nameValuePair
"${mods}+${key}"
{action = actions."${replaceStrings ["$DIR"] ["${dir}"] "${cmd}"}";}
)
keys;
makeWsBind = mods: cmd:
listToAttrs (map (num: {
name = "${mods}+${builtins.toString num}";
value = {action."${cmd}" = num;};
}) (range 0 6));
programs.niri.settings =
let
inherit (lib) range nameValuePair mapAttrs';
inherit (builtins) listToAttrs replaceStrings;
inherit (config.lib.niri) actions;
in
{
"Mod+D".action.spawn = "sirula";
"Mod+F".action.spawn = "firefox";
"Mod+E".action.spawn = "nautilus";
"Mod+Return".action.spawn = "kitty";
"Mod+Shift+E".action.spawn = "wlogout";
"Mod+Equal".action.spawn = "keepassxc";
"Mod+Shift+Q".action = actions.close-window;
"Mod+Shift+S".action = actions.screenshot;
"Mod+R".action = actions.switch-preset-column-width;
"Mod+Shift+R".action = actions.maximize-column;
"XF86AudioRaiseVolume".action.spawn = ["volumectl" "-u" "up"];
"XF86AudioLowerVolume".action.spawn = ["volumectl" "-u" "down"];
"XF86AudioMute".action.spawn = ["volumectl" "toggle-mute"];
"XF86AudioStop".action.spawn = ["playerctl" "stop"];
"XF86AudioPlay".action.spawn = ["playerctl" "play-pause"];
"XF86AudioNext".action.spawn = ["playerctl" "next"];
"XF86AudioPrev".action.spawn = ["playerctl" "previous"];
}
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
// makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds
// makeWsBind "Mod" "focus-workspace"
// makeWsBind "Mod+Shift" "move-window-to-workspace";
outputs = {
"Unknown-1".enable = false;
"DP-1" = {
variable-refresh-rate = true;
scale = 1;
{
binds =
let
hBinds = {
H = "left";
L = "right";
};
vBinds = {
J = "down";
K = "up";
};
makeDirBind =
mods: cmd: keys:
mapAttrs' (
key: dir:
nameValuePair "${mods}+${key}" {
action = actions."${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}";
}
) keys;
makeWsBind =
mods: cmd:
listToAttrs (
map (num: {
name = "${mods}+${builtins.toString num}";
value = {
action."${cmd}" = num;
};
}) (range 0 6)
);
in
{
"Mod+D".action.spawn = "sirula";
"Mod+F".action.spawn = "firefox";
"Mod+E".action.spawn = "nautilus";
"Mod+Return".action.spawn = "kitty";
"Mod+Shift+E".action.spawn = "wlogout";
"Mod+Equal".action.spawn = "keepassxc";
"Mod+Shift+Q".action = actions.close-window;
"Mod+Shift+S".action = actions.screenshot;
"Mod+R".action = actions.switch-preset-column-width;
"Mod+Shift+R".action = actions.maximize-column;
"XF86AudioRaiseVolume".action.spawn = [
"volumectl"
"-u"
"up"
];
"XF86AudioLowerVolume".action.spawn = [
"volumectl"
"-u"
"down"
];
"XF86AudioMute".action.spawn = [
"volumectl"
"toggle-mute"
];
"XF86AudioStop".action.spawn = [
"playerctl"
"stop"
];
"XF86AudioPlay".action.spawn = [
"playerctl"
"play-pause"
];
"XF86AudioNext".action.spawn = [
"playerctl"
"next"
];
"XF86AudioPrev".action.spawn = [
"playerctl"
"previous"
];
"Mod+Space".action = actions.toggle-window-floating;
}
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
// makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds
// makeWsBind "Mod" "focus-workspace"
// makeWsBind "Mod+Shift" "move-window-to-workspace";
outputs = {
# "Unknown-1".enable = false;
"DP-1" = {
transform.rotation = 90;
scale = 1;
};
"DP-2" = {
variable-refresh-rate = true;
scale = 1;
};
};
"HDMI-A-2" = {
transform.rotation = 90;
scale = 1;
input = {
warp-mouse-to-focus = true;
};
};
input = {
warp-mouse-to-focus = true;
};
cursor = {
hide-after-inactive-ms = 5000;
hide-when-typing = true;
size = 16;
theme = pkgs.rice.cursor.name;
};
layout = {
always-center-single-column = true;
gaps = 24;
default-column-width.proportion = 0.5;
preset-column-widths =
map
(p: {proportion = p;})
[
cursor = {
hide-after-inactive-ms = 5000;
hide-when-typing = true;
size = 16;
theme = pkgs.rice.cursor.name;
};
layout = {
always-center-single-column = true;
gaps = 24;
default-column-width.proportion = 0.5;
preset-column-widths = map (p: { proportion = p; }) [
(2.0 / 3.0)
0.5
(1.0 / 3.0)
];
focus-ring = let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in {
active = {color = pal.bright.yellow;};
inactive = {color = pal.normal.black;};
focus-ring =
let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in
{
active = {
color = pal.bright.yellow;
};
inactive = {
color = pal.normal.black;
};
};
};
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
};
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
};
programs.swaylock = {
enable = true;
settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black;
};
programs.ironbar = {
enable = true;
@ -178,20 +219,20 @@ in {
}
];
end = [
{type = "clock";}
{type = "tray";}
{ type = "clock"; }
{ type = "tray"; }
];
};
};
};
systemd.user.services.ironbar = {
Unit.PartOf = ["graphical-session.target"];
Unit.PartOf = [ "graphical-session.target" ];
Unit.After = [
"graphical-session.target"
"niri.service"
];
Install.WantedBy = ["graphical-session.target"];
Install.WantedBy = [ "graphical-session.target" ];
};
xdg.configFile = {
@ -211,17 +252,19 @@ in {
term_command = "kitty {}"
'';
"sirula/style.css".text = let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in ''
#root-box {
background-color: ${pal.normal.black};
color: ${pal.normal.yellow};
font-family: '${pkgs.rice.fonts.sans.name}';
}
/* what's the name of the highlighted search text?
color: ${pal.normal.white};
*/
'';
"sirula/style.css".text =
let
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
in
''
#root-box {
background-color: ${pal.normal.black};
color: ${pal.normal.yellow};
font-family: '${pkgs.rice.fonts.sans.name}';
}
/* what's the name of the highlighted search text?
color: ${pal.normal.white};
*/
'';
};
}