style: nix fmt

This commit is contained in:
Kat Inskip 2025-07-13 05:10:57 -07:00
parent 7913481b66
commit 6e0cc170eb
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
112 changed files with 1977 additions and 1739 deletions

View file

@ -10,7 +10,7 @@
}; };
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
# TODO: https://github.com/catppuccin/nix/issues/601 # TODO: https://github.com/catppuccin/nix/issues/601
catppuccin.url = "github:catppuccin/nix";#/194881dd2ad6303bc2d49f9ce484d127372d7465"; catppuccin.url = "github:catppuccin/nix"; #/194881dd2ad6303bc2d49f9ce484d127372d7465";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
# to allow non-nix 2.4 evaluation # to allow non-nix 2.4 evaluation
flake-compat = { flake-compat = {

View file

@ -1,6 +1,5 @@
{ {
inputs, inputs,
pkgs,
... ...
}: }:
inputs.flake-utils.lib.eachDefaultSystem (system: let inputs.flake-utils.lib.eachDefaultSystem (system: let

View file

@ -1,5 +1,6 @@
{ config, lib, pkgs, ... }: let {
inherit (config.catppuccin) sources; config,
inherit (lib) mkBefore; lib,
in { ...
}: {
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
home.pointerCursor = { home.pointerCursor = {
enable = true; enable = true;
package = pkgs.graphite-cursors; package = pkgs.graphite-cursors;

View file

@ -27,19 +27,19 @@ in {
services.swww.enable = true; services.swww.enable = true;
wayland.windowManager.hyprland = let wayland.windowManager.hyprland = let
import-gsettings = pkgs.writeShellScriptBin "import-gsettings" '' import-gsettings = pkgs.writeShellScriptBin "import-gsettings" ''
# usage: import-gsettings # usage: import-gsettings
config="''${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" config="''${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi if [ ! -f "$config" ]; then exit 1; fi
gnome_schema="org.gnome.desktop.interface" gnome_schema="org.gnome.desktop.interface"
gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
${pkgs.glib}/bin/gsettings set "$gnome_schema" gtk-theme "$gtk_theme" ${pkgs.glib}/bin/gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" icon-theme "$icon_theme" ${pkgs.glib}/bin/gsettings set "$gnome_schema" icon-theme "$icon_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme" ${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
''; '';
in { in {
enable = true; enable = true;
@ -56,8 +56,7 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
package = inputs.hyprland.packages.${pkgs.system}.hyprland; package = inputs.hyprland.packages.${pkgs.system}.hyprland;
settings = { settings = {
# TODO: break it up # TODO: break it up
windowrule = let windowrule = [
in [
"suppressevent fullscreen, class:steam_app_default" "suppressevent fullscreen, class:steam_app_default"
"workspace 2, class:steam_app_default" "workspace 2, class:steam_app_default"
"suppressevent maximize, class:.*" "suppressevent maximize, class:.*"
@ -87,10 +86,12 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
++ (list.map ( ++ (list.map (
workspace: "${toString workspace},monitor:DP-1${commonOptions}" workspace: "${toString workspace},monitor:DP-1${commonOptions}"
) (list.range 2 10)) ) (list.range 2 10))
++ [ "11,monitor:DP-2,default:true"] ++ (list.map ( ++ ["11,monitor:DP-2,default:true"]
++ (list.map (
workspace: "${toString workspace},monitor:DP-2${commonOptions}" workspace: "${toString workspace},monitor:DP-2${commonOptions}"
) (list.range 12 20)); ) (list.range 12 20));
/*list.concat (list.generate ( /*
list.concat (list.generate (
x: let x: let
ws = let ws = let
c = (x + 1) / 10; c = (x + 1) / 10;
@ -155,7 +156,8 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
uwsmCmd = lib.optionalString parent.programs.uwsm.enable "uwsm app -- "; uwsmCmd = lib.optionalString parent.programs.uwsm.enable "uwsm app -- ";
uwsmApp = cmd: uwsmCmd + cmd; uwsmApp = cmd: uwsmCmd + cmd;
uwsmSingleApp = cmd: "pgrep ${cmd} || ${uwsmCmd + cmd}"; uwsmSingleApp = cmd: "pgrep ${cmd} || ${uwsmCmd + cmd}";
in [ in
[
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next" ", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
@ -226,8 +228,16 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
in [ in [
"$mod, ${ws}, workspace, ${toString (x + 1)}" "$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" "$mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}"
"$mod, F${if ws == "0" then "10" else ws}, workspace, ${toString (x + 11)}" "$mod, F${
"$mod SHIFT, F${if ws == "0" then "10" else ws}, movetoworkspacesilent, ${toString (x + 11)}" if ws == "0"
then "10"
else ws
}, workspace, ${toString (x + 11)}"
"$mod SHIFT, F${
if ws == "0"
then "10"
else ws
}, movetoworkspacesilent, ${toString (x + 11)}"
"$mod ALT, ${ws}, split-workspace, ${toString (x + 1)}" "$mod ALT, ${ws}, split-workspace, ${toString (x + 1)}"
] ]

View file

@ -1,4 +1,8 @@
{ inputs, pkgs, ... }: { {
inputs,
pkgs,
...
}: {
programs.hyprlock = { programs.hyprlock = {
enable = true; enable = true;
package = inputs.hyprlock.packages.${pkgs.system}.hyprlock; package = inputs.hyprlock.packages.${pkgs.system}.hyprlock;

View file

@ -3,128 +3,128 @@ _: {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
style = '' style = ''
* { * {
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: Monaspace Krypton, monospace; font-family: Monaspace Krypton, monospace;
font-size: 13px; font-size: 13px;
min-height: 0; min-height: 0;
} }
window#waybar { window#waybar {
all:unset; all:unset;
} }
.modules-left, .modules-right, .modules-center { .modules-left, .modules-right, .modules-center {
background: alpha(@base, 0.9); background: alpha(@base, 0.9);
box-shadow: 0px 0px 2px rgba(0,0,0,0.6); box-shadow: 0px 0px 2px rgba(0,0,0,0.6);
color: @text; color: @text;
padding: 5px; padding: 5px;
margin: 2px 4px; margin: 2px 4px;
border: 1px solid @lavender; border: 1px solid @lavender;
} }
tooltip { tooltip {
background: rgba(43, 48, 59, 0.5); background: rgba(43, 48, 59, 0.5);
border: 1px solid rgba(100, 114, 125, 0.5); border: 1px solid rgba(100, 114, 125, 0.5);
} }
tooltip label { tooltip label {
color: white; color: white;
} }
#workspaces { #workspaces {
border-right: 1px solid @surface2; border-right: 1px solid @surface2;
} }
#workspaces button.persistent { #workspaces button.persistent {
background: @theme_unfocused_bg_color; background: @theme_unfocused_bg_color;
color: @subtext1; color: @subtext1;
} }
#workspaces button { #workspaces button {
padding: 2px 5px; padding: 2px 5px;
background: @surface0; background: @surface0;
border-bottom: 3px solid transparent; border-bottom: 3px solid transparent;
} }
#workspaces button.empty { #workspaces button.empty {
background: @crust; background: @crust;
color: @subtext1; color: @subtext1;
} }
#workspaces button.visible { #workspaces button.visible {
background: @pink; background: @pink;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
border-bottom: 3px solid @rosewater; border-bottom: 3px solid @rosewater;
} }
#workspaces button.urgent { #workspaces button.urgent {
background: @red; background: @red;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
} }
#workspaces button.active, #workspaces button.focused { #workspaces button.active, #workspaces button.focused {
background: @theme_selected_bg_color; background: @theme_selected_bg_color;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }
#window { #window {
padding: 0 10px; padding: 0 10px;
} }
window#waybar.empty #window { window#waybar.empty #window {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
#mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { #mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris {
padding: 0 5px; padding: 0 5px;
margin: 0 5px; margin: 0 5px;
} }
#mpris { #mpris {
color: @mantle; color: @mantle;
} }
#mpris.playing { #mpris.playing {
background-color: @lavender; background-color: @lavender;
} }
#mpris.paused { #mpris.paused {
background-color: @mauve; background-color: @mauve;
} }
#mpris.stopped { #mpris.stopped {
background-color: @rosewater; background-color: @rosewater;
} }
#mode { #mode {
background: #64727D; background: #64727D;
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }
#clock { #clock {
} }
#battery { #battery {
} }
#battery.charging { #battery.charging {
color: white; color: white;
background-color: #26A65B; background-color: #26A65B;
} }
@keyframes blink { @keyframes blink {
to { to {
background-color: #ffffff; background-color: #ffffff;
color: black; color: black;
} }
} }
#battery.warning:not(.charging) { #battery.warning:not(.charging) {
background: #f53c3c; background: #f53c3c;
color: white; color: white;
animation-name: blink; animation-name: blink;
@ -132,7 +132,7 @@ window#waybar.empty #window {
animation-timing-function: steps(12); animation-timing-function: steps(12);
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
''; '';
settings.main = { settings.main = {
layer = "top"; layer = "top";
@ -150,7 +150,6 @@ window#waybar.empty #window {
"mpris" "mpris"
]; ];
modules-right = [ modules-right = [
"privacy" "privacy"
"bluetooth" "bluetooth"

View file

@ -1,6 +1,9 @@
{ config, lib, ... }: let {
config,
lib,
...
}: let
inherit (config.catppuccin) sources; inherit (config.catppuccin) sources;
inherit (lib) mkBefore;
cfg = config.catppuccin.sway; cfg = config.catppuccin.sway;
theme = "${sources.sway}/catppuccin-${cfg.flavor}"; theme = "${sources.sway}/catppuccin-${cfg.flavor}";
in { in {

View file

@ -1,14 +1,13 @@
{ {
pkgs, pkgs,
lib, lib,
std, std,
config, config,
... ...
}: }: let
let
inherit (std) list; inherit (std) list;
inherit (lib.modules) mkMerge; inherit (lib.modules) mkMerge;
inherit (lib) mkOptionDefault mkDefault mapAttrs; inherit (lib) mkDefault mapAttrs;
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
maim maim
@ -35,7 +34,10 @@ in {
}; };
workspaceNamer = num: let workspaceNamer = num: let
numStr = builtins.toString num; numStr = builtins.toString num;
in if workspaceNames ? ${numStr} then "${numStr}:${workspaceNames.${numStr}}" else "${numStr}:${numStr}"; in
if workspaceNames ? ${numStr}
then "${numStr}:${workspaceNames.${numStr}}"
else "${numStr}:${numStr}";
lockCommand = "sh -c '${pkgs.i3lock-fancy-rapid}/bin/i3lock 5 3 & sleep 5 && xset dpms force off'"; lockCommand = "sh -c '${pkgs.i3lock-fancy-rapid}/bin/i3lock 5 3 & sleep 5 && xset dpms force off'";
@ -49,9 +51,10 @@ in {
displayWorkspace = display: workspace: '' displayWorkspace = display: workspace: ''
workspace "${workspaceNamer (builtins.toString workspace)}" output ${display} workspace "${workspaceNamer (builtins.toString workspace)}" output ${display}
''; '';
displayBindings = list.map (v: displayWorkspace "DP-2" v) (list.range 1 9) displayBindings =
++ [ (displayWorkspace "DP-2" 10) ] list.map (v: displayWorkspace "DP-2" v) (list.range 1 9)
++ list.map (v: displayWorkspace "HDMI-0" (11+v)) (list.range 1 12); ++ [(displayWorkspace "DP-2" 10)]
++ list.map (v: displayWorkspace "HDMI-0" (11 + v)) (list.range 1 12);
displayBindingsStr = lib.concatLines displayBindings; displayBindingsStr = lib.concatLines displayBindings;
in '' in ''
${displayBindingsStr} ${displayBindingsStr}
@ -70,8 +73,14 @@ in {
}; };
startup = [ startup = [
{ command = "~/.screenlayout/main.sh"; notification = false; } {
{ command = "blueman-applet"; notification = false; } command = "~/.screenlayout/main.sh";
notification = false;
}
{
command = "blueman-applet";
notification = false;
}
]; ];
keybindings = let keybindings = let
@ -107,7 +116,8 @@ in {
"${mod}+Shift+g" = ''mode "${gapsMode}"''; "${mod}+Shift+g" = ''mode "${gapsMode}"'';
"${mod}+Delete" = ''mode "${actionMode}"''; "${mod}+Delete" = ''mode "${actionMode}"'';
}; };
in mkMerge (map mapDefaultAttrs ([ normalBindings ] ++ workspaceBindings)); in
mkMerge (map mapDefaultAttrs ([normalBindings] ++ workspaceBindings));
assigns = { assigns = {
${workspaceNamer 2} = [ ${workspaceNamer 2} = [
@ -255,7 +265,7 @@ in {
focusedStatusline = "$text"; focusedStatusline = "$text";
focusedSeparator = "$base"; focusedSeparator = "$base";
focusedWorkspace = { focusedWorkspace = {
border ="$base"; border = "$base";
background = "$mauve"; background = "$mauve";
text = "$crust"; text = "$crust";
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.i3status-rust = { programs.i3status-rust = {
enable = true; enable = true;
bars = { bars = {
@ -70,4 +70,4 @@
}; };
}; };
}; };
} }

View file

@ -1,4 +1,8 @@
{ pkgs, config, ... }: { {
pkgs,
config,
...
}: {
home.packages = [ home.packages = [
config.programs.rofi.finalPackage config.programs.rofi.finalPackage
]; ];

View file

@ -1,2 +1,2 @@
{pkgs, ...}: { _: {
} }

View file

@ -1,4 +1,7 @@
{ pkgs, config, ... }: { {
pkgs,
...
}: {
programs.niri.settings.spawn-at-startup = let programs.niri.settings.spawn-at-startup = let
import-gsettings = pkgs.writeShellScriptBin "import-gsettings" '' import-gsettings = pkgs.writeShellScriptBin "import-gsettings" ''
# usage: import-gsettings # usage: import-gsettings

View file

@ -1,4 +1,4 @@
{ config, ... }: { {config, ...}: {
services.avizo = { services.avizo = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, std, ... }: let {
config,
pkgs,
lib,
std,
...
}: let
inherit (std) list; inherit (std) list;
inherit (lib.modules) mkMerge; inherit (lib.modules) mkMerge;
in { in {
@ -14,7 +20,10 @@ in {
bindWorkspace "0" 10 bindWorkspace "0" 10
) )
]; ];
in mkMerge (workspaceBindings ++ [{ in
mkMerge (workspaceBindings
++ [
{
# Transcribed: https://github.com/sodiboo/niri-flake/issues/483 # Transcribed: https://github.com/sodiboo/niri-flake/issues/483
# thank you Pacman99 you chad :3 # thank you Pacman99 you chad :3
"Mod+Q".action.close-window = {}; "Mod+Q".action.close-window = {};
@ -141,5 +150,6 @@ in {
"Mod+Escape".action.spawn = ["${config.programs.wlogout.package}/bin/wlogout" "-p" "layer-shell"]; "Mod+Escape".action.spawn = ["${config.programs.wlogout.package}/bin/wlogout" "-p" "layer-shell"];
"Mod+Shift+Escape".action.spawn = ["${config.programs.swaylock.package}/bin/swaylock" "-f"]; "Mod+Shift+Escape".action.spawn = ["${config.programs.swaylock.package}/bin/swaylock" "-f"];
#"Print".action.spawn = ["${pkgs.grimblast}/bin/grimblast" "copy" "area"]; #"Print".action.spawn = ["${pkgs.grimblast}/bin/grimblast" "copy" "area"];
}]); }
]);
} }

View file

@ -1,4 +1,7 @@
{ config, pkgs, ... }: { {
config,
...
}: {
catppuccin.cursors.enable = true; catppuccin.cursors.enable = true;
home.pointerCursor = { home.pointerCursor = {
dotIcons.enable = true; dotIcons.enable = true;

View file

@ -5,7 +5,6 @@
... ...
}: let }: let
inherit (config.base16) palette; inherit (config.base16) palette;
inherit (lib.modules) mkForce;
in { in {
systemd.user.services = { systemd.user.services = {
mako = { mako = {

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: let {
config,
pkgs,
lib,
...
}: let
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
@ -40,10 +45,10 @@ in {
gaps = 10; gaps = 10;
always-center-single-column = true; always-center-single-column = true;
preset-column-widths = [ preset-column-widths = [
{ proportion = 0.33333; } {proportion = 0.33333;}
{ proportion = 0.5; } {proportion = 0.5;}
{ proportion = 0.66667; } {proportion = 0.66667;}
{ proportion = 1.0; } {proportion = 1.0;}
]; ];
default-column-width = { default-column-width = {
proportion = 1.0; proportion = 1.0;

View file

@ -1,4 +1,8 @@
{ pkgs, config, ... }: { {
pkgs,
config,
...
}: {
services.swayidle = { services.swayidle = {
enable = true; enable = true;
timeouts = [ timeouts = [

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
package = pkgs.swaylock-effects; package = pkgs.swaylock-effects;

View file

@ -3,128 +3,128 @@ _: {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
style = '' style = ''
* { * {
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: Monaspace Krypton, monospace; font-family: Monaspace Krypton, monospace;
font-size: 13px; font-size: 13px;
min-height: 0; min-height: 0;
} }
window#waybar { window#waybar {
all:unset; all:unset;
} }
.modules-left, .modules-right, .modules-center { .modules-left, .modules-right, .modules-center {
background: alpha(@base, 0.9); background: alpha(@base, 0.9);
box-shadow: 0px 0px 2px rgba(0,0,0,0.6); box-shadow: 0px 0px 2px rgba(0,0,0,0.6);
color: @text; color: @text;
padding: 5px; padding: 5px;
margin: 2px 4px; margin: 2px 4px;
border: 1px solid @lavender; border: 1px solid @lavender;
} }
tooltip { tooltip {
background: rgba(43, 48, 59, 0.5); background: rgba(43, 48, 59, 0.5);
border: 1px solid rgba(100, 114, 125, 0.5); border: 1px solid rgba(100, 114, 125, 0.5);
} }
tooltip label { tooltip label {
color: white; color: white;
} }
#workspaces { #workspaces {
border-right: 1px solid @surface2; border-right: 1px solid @surface2;
} }
#workspaces button.persistent { #workspaces button.persistent {
background: @theme_unfocused_bg_color; background: @theme_unfocused_bg_color;
color: @subtext1; color: @subtext1;
} }
#workspaces button { #workspaces button {
padding: 2px 5px; padding: 2px 5px;
background: @surface0; background: @surface0;
border-bottom: 3px solid transparent; border-bottom: 3px solid transparent;
} }
#workspaces button.empty { #workspaces button.empty {
background: @crust; background: @crust;
color: @subtext1; color: @subtext1;
} }
#workspaces button.visible { #workspaces button.visible {
background: @pink; background: @pink;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
border-bottom: 3px solid @rosewater; border-bottom: 3px solid @rosewater;
} }
#workspaces button.urgent { #workspaces button.urgent {
background: @red; background: @red;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
} }
#workspaces button.active, #workspaces button.focused { #workspaces button.active, #workspaces button.focused {
background: @theme_selected_bg_color; background: @theme_selected_bg_color;
color: @theme_selected_fg_color; color: @theme_selected_fg_color;
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }
#window { #window {
padding: 0 10px; padding: 0 10px;
} }
window#waybar.empty #window { window#waybar.empty #window {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
#mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { #mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris {
padding: 0 5px; padding: 0 5px;
margin: 0 5px; margin: 0 5px;
} }
#mpris { #mpris {
color: @mantle; color: @mantle;
} }
#mpris.playing { #mpris.playing {
background-color: @lavender; background-color: @lavender;
} }
#mpris.paused { #mpris.paused {
background-color: @mauve; background-color: @mauve;
} }
#mpris.stopped { #mpris.stopped {
background-color: @rosewater; background-color: @rosewater;
} }
#mode { #mode {
background: #64727D; background: #64727D;
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }
#clock { #clock {
} }
#battery { #battery {
} }
#battery.charging { #battery.charging {
color: white; color: white;
background-color: #26A65B; background-color: #26A65B;
} }
@keyframes blink { @keyframes blink {
to { to {
background-color: #ffffff; background-color: #ffffff;
color: black; color: black;
} }
} }
#battery.warning:not(.charging) { #battery.warning:not(.charging) {
background: #f53c3c; background: #f53c3c;
color: white; color: white;
animation-name: blink; animation-name: blink;
@ -132,7 +132,7 @@ window#waybar.empty #window {
animation-timing-function: steps(12); animation-timing-function: steps(12);
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
''; '';
settings.main = { settings.main = {
layer = "top"; layer = "top";
@ -149,7 +149,6 @@ window#waybar.empty #window {
"mpris" "mpris"
]; ];
modules-right = [ modules-right = [
"privacy" "privacy"
"bluetooth" "bluetooth"

View file

@ -3,11 +3,9 @@ _: {
{ {
draw-border-with-background = false; draw-border-with-background = false;
clip-to-geometry = true; clip-to-geometry = true;
geometry-corner-radius = geometry-corner-radius = let
let
r = 5.0; r = 5.0;
in in {
{
bottom-left = r; bottom-left = r;
bottom-right = r; bottom-right = r;
top-left = r; top-left = r;
@ -16,23 +14,23 @@ _: {
} }
{ {
matches = [ { app-id = "^firefox$"; } ]; matches = [{app-id = "^firefox$";}];
open-on-workspace = "browser"; open-on-workspace = "browser";
} }
{ {
matches = [ matches = [
{ app-id = "^vesktop$"; } {app-id = "^vesktop$";}
{ app-id = "^discord$"; } {app-id = "^discord$";}
{ app-id = "^org.telegram.desktop$"; } {app-id = "^org.telegram.desktop$";}
]; ];
open-on-workspace = "chat"; open-on-workspace = "chat";
} }
{ {
matches = [ { app-id = "^steam_app_default$"; } ]; matches = [{app-id = "^steam_app_default$";}];
open-on-workspace = "vidya"; open-on-workspace = "vidya";
} }
{ {
matches = [ { app-id = "^spotify$"; } ]; matches = [{app-id = "^spotify$";}];
open-on-workspace = "media"; open-on-workspace = "media";
} }
]; ];

View file

@ -1,4 +1,9 @@
{ lib, pkgs, inputs, ... }: let {
lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkForce; inherit (lib) mkForce;
qtct = '' qtct = ''
[Appearance] [Appearance]
@ -176,7 +181,7 @@ in {
gnomeShellTheme = mkForce false; gnomeShellTheme = mkForce false;
}; };
}; };
dconf.settings = mkForce { }; dconf.settings = mkForce {};
gtk.enable = true; gtk.enable = true;
# https://git.gay/olivia/fur/src/branch/main/modules/home/theming/qt/default.nix # https://git.gay/olivia/fur/src/branch/main/modules/home/theming/qt/default.nix
qt = { qt = {

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
home.packages = [ home.packages = [
pkgs.magic-wormhole pkgs.magic-wormhole
]; ];

View file

@ -2,9 +2,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }: {
inherit (lib.generators) toJSON;
in {
home.packages = with pkgs; [ home.packages = with pkgs; [
(discord-krisp.override { (discord-krisp.override {
withOpenASAR = true; withOpenASAR = true;

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
calibre calibre
pkgs.kdePackages.okular pkgs.kdePackages.okular

View file

@ -1,7 +1,7 @@
{ config, lib, ... }: let {
inherit (lib.attrsets) listToAttrs nameValuePair; lib,
inherit (lib.modules) mkMerge; ...
in { }: {
programs.firefox.profiles.main = { programs.firefox.profiles.main = {
containersForce = true; containersForce = true;
containers = { containers = {
@ -31,4 +31,3 @@ in {
}; };
}; };
} }

View file

@ -1,11 +1,15 @@
{pkgs, nur, ...}: let {
pkgs,
nur,
...
}: let
defaultFont = "Monaspace Krypton"; defaultFont = "Monaspace Krypton";
in { in {
home.sessionVariables = { home.sessionVariables = {
BROWSER = "firefox"; BROWSER = "firefox";
}; };
home.packages = [ pkgs.ff2mpv-rust ]; home.packages = [pkgs.ff2mpv-rust];
programs.firefox = { programs.firefox = {
nativeMessagingHosts = [ nativeMessagingHosts = [
pkgs.ff2mpv-rust pkgs.ff2mpv-rust

View file

@ -1,4 +1,4 @@
{ nur, ... }: { {nur, ...}: {
programs.firefox.profiles.main.extensions = { programs.firefox.profiles.main.extensions = {
packages = with nur.repos.rycee.firefox-addons; [ packages = with nur.repos.rycee.firefox-addons; [
mtab mtab
@ -28,7 +28,7 @@
userDefinedCols = null; userDefinedCols = null;
}; };
extras = { extras = {
snow = { enabled = "off"; }; snow = {enabled = "off";};
}; };
hotkeys = { hotkeys = {
activationKey = " "; activationKey = " ";
@ -46,9 +46,9 @@
textColor = "#ffffff"; textColor = "#ffffff";
textSize = 3.75; textSize = 3.75;
type = "afternoon-morning"; type = "afternoon-morning";
weather = { unitsType = "f"; }; weather = {unitsType = "f";};
}; };
options = { showOptionsButton = true; }; options = {showOptionsButton = true;};
search = { search = {
assist = { assist = {
conversions = true; conversions = true;
@ -75,7 +75,7 @@
}; };
title = { title = {
defaultTitle = "Mew Tab"; defaultTitle = "Mew Tab";
dynamic = { enabled = true; }; dynamic = {enabled = true;};
faviconType = "default"; faviconType = "default";
}; };
ui = { ui = {
@ -92,7 +92,7 @@
highlightColor = "#ffffff20"; highlightColor = "#ffffff20";
style = "glass"; style = "glass";
}; };
user = { name = "kat"; }; user = {name = "kat";};
wallpaper = { wallpaper = {
enabled = false; enabled = false;
filters = { filters = {

View file

@ -1,4 +1,4 @@
{ nur, ... }: { {nur, ...}: {
programs.firefox.profiles.main = { programs.firefox.profiles.main = {
extensions = { extensions = {
packages = with nur.repos.rycee.firefox-addons; [ packages = with nur.repos.rycee.firefox-addons; [

View file

@ -1,4 +1,4 @@
{ nur, ... }: { {nur, ...}: {
programs.firefox.profiles.main.extensions = { programs.firefox.profiles.main.extensions = {
packages = with nur.repos.rycee.firefox-addons; [ packages = with nur.repos.rycee.firefox-addons; [
ublock-origin ublock-origin

View file

@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
lib, lib,
inputs,
... ...
}: let }: let
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;

View file

@ -1,4 +1,8 @@
{pkgs, inputs, ... }: let {
pkgs,
inputs,
...
}: let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system};
in { in {
programs.spicetify = { programs.spicetify = {
@ -11,7 +15,9 @@ in {
experimentalFeatures = true; experimentalFeatures = true;
windowManagerPatch = true; windowManagerPatch = true;
colorScheme = "CatppuccinMocha"; colorScheme = "CatppuccinMocha";
theme = spicePkgs.themes.text // { theme =
spicePkgs.themes.text
// {
additionalCss = '' additionalCss = ''
:root { :root {
--font-family: 'Monaspace Krypton', monospace; --font-family: 'Monaspace Krypton', monospace;

View file

@ -1,7 +1,7 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.taskwarrior = { programs.taskwarrior = {
enable = true; enable = true;
package = pkgs.taskwarrior3; package = pkgs.taskwarrior3;
}; };
home.packages = [ pkgs.taskwarrior-tui ]; home.packages = [pkgs.taskwarrior-tui];
} }

View file

@ -7,14 +7,14 @@
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (std) string set; inherit (std) string set;
initLua = (pkgs.replaceVars ./init.lua ({ initLua = pkgs.replaceVars ./init.lua ({
base16ShellPath = config.base16.shell.package; base16ShellPath = config.base16.shell.package;
catppuccin_flavour = config.catppuccin.flavor; catppuccin_flavour = config.catppuccin.flavor;
inherit (config.base16) defaultSchemeName; inherit (config.base16) defaultSchemeName;
defaultSchemeSlug = config.base16.defaultScheme.slug; defaultSchemeSlug = config.base16.defaultScheme.slug;
} }
// set.map (_: col: string.justifyRight 2 "0" (builtins.toString col.ansiIndex)) // set.map (_: col: string.justifyRight 2 "0" (builtins.toString col.ansiIndex))
(set.filter (var: _: string.hasInfix "base" var) config.base16.defaultScheme))); (set.filter (var: _: string.hasInfix "base" var) config.base16.defaultScheme));
in { in {
home.sessionVariables = mkIf config.programs.neovim.enable {EDITOR = "nvim";}; home.sessionVariables = mkIf config.programs.neovim.enable {EDITOR = "nvim";};
programs.neovim = { programs.neovim = {

View file

@ -98,10 +98,10 @@ in {
"sidequest" "sidequest"
"ungoogled-chromium" "ungoogled-chromium"
]; ];
flake = self;
makeAliasForBin = package: nameValuePair package "nix run kat#${package}"; makeAliasForBin = package: nameValuePair package "nix run kat#${package}";
packages' = builtins.listToAttrs (map makeAliasForBin packages); packages' = builtins.listToAttrs (map makeAliasForBin packages);
in mkMerge [ in
mkMerge [
packages' packages'
{ {
nixdirfmt = "nixpkgs-fmt $(fd -e nix)"; nixdirfmt = "nixpkgs-fmt $(fd -e nix)";

View file

@ -1,10 +1,10 @@
{
{ config, lib, pkgs, ... }: config,
lib,
with lib; pkgs,
...
let }:
with lib; let
cfg = config.xsession.windowManager.i3; cfg = config.xsession.windowManager.i3;
commonOptions = import ./i3/options.nix { commonOptions = import ./i3/options.nix {
@ -14,10 +14,26 @@ let
configModule = types.submodule { configModule = types.submodule {
options = { options = {
inherit (commonOptions) inherit
fonts window floating focus assigns modifier workspaceLayout (commonOptions)
workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu fonts
terminal defaultWorkspace workspaceOutputAssign; window
floating
focus
assigns
modifier
workspaceLayout
workspaceAutoBackAndForth
keycodebindings
colors
bars
startup
gaps
menu
terminal
defaultWorkspace
workspaceOutputAssign
;
keybindings = mkOption { keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str); type = types.attrsOf (types.nullOr types.str);
@ -68,25 +84,55 @@ let
moduleName = "i3"; moduleName = "i3";
}; };
inherit (commonFunctions) inherit
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr (commonFunctions)
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString keybindingsStr
fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr; keycodebindingsStr
modeStr
assignStr
barStr
gapsStr
floatingCriteriaStr
windowCommandsStr
colorSetStr
windowBorderString
fontConfigStr
keybindingDefaultWorkspace
keybindingsRest
workspaceOutputStr
;
startupEntryStr = { command, always, notification, workspace, ... }: startupEntryStr = {
command,
always,
notification,
workspace,
...
}:
concatStringsSep " " [ concatStringsSep " " [
(if always then "exec_always" else "exec") (
(if (notification && workspace == null) then "" else "--no-startup-id") if always
(if (workspace == null) then then "exec_always"
command else "exec"
else )
"i3-msg 'workspace ${workspace}; exec ${command}'") (
if (notification && workspace == null)
then ""
else "--no-startup-id"
)
(
if (workspace == null)
then command
else "i3-msg 'workspace ${workspace}; exec ${command}'"
)
]; ];
configFile = pkgs.writeText "i3.conf" (concatStringsSep "\n" configFile = pkgs.writeText "i3.conf" (concatStringsSep "\n"
((if cfg.config != null then ((
with cfg.config; if cfg.config != null
([ cfg.extraConfigEarly] ++ [ then
with cfg.config; ([cfg.extraConfigEarly]
++ [
(fontConfigStr fonts) (fontConfigStr fonts)
"floating_modifier ${floating.modifier}" "floating_modifier ${floating.modifier}"
(windowBorderString window floating) (windowBorderString window floating)
@ -94,7 +140,11 @@ let
"focus_wrapping ${focus.wrapping}" "focus_wrapping ${focus.wrapping}"
"focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}"
"focus_on_window_activation ${focus.newWindow}" "focus_on_window_activation ${focus.newWindow}"
"mouse_warping ${if focus.mouseWarping then "output" else "none"}" "mouse_warping ${
if focus.mouseWarping
then "output"
else "none"
}"
"workspace_layout ${workspaceLayout}" "workspace_layout ${workspaceLayout}"
"workspace_auto_back_and_forth ${ "workspace_auto_back_and_forth ${
lib.hm.booleans.yesNo workspaceAutoBackAndForth lib.hm.booleans.yesNo workspaceAutoBackAndForth
@ -105,21 +155,24 @@ let
"client.urgent ${colorSetStr colors.urgent}" "client.urgent ${colorSetStr colors.urgent}"
"client.placeholder ${colorSetStr colors.placeholder}" "client.placeholder ${colorSetStr colors.placeholder}"
"client.background ${colors.background}" "client.background ${colors.background}"
(keybindingsStr { keybindings = keybindingDefaultWorkspace; }) (keybindingsStr {keybindings = keybindingDefaultWorkspace;})
(keybindingsStr { keybindings = keybindingsRest; }) (keybindingsStr {keybindings = keybindingsRest;})
(keycodebindingsStr keycodebindings) (keycodebindingsStr keycodebindings)
] ++ mapAttrsToList (modeStr false) modes ]
++ mapAttrsToList assignStr assigns ++ map barStr bars ++ mapAttrsToList (modeStr false) modes
++ mapAttrsToList assignStr assigns
++ map barStr bars
++ optional (gaps != null) gapsStr ++ optional (gaps != null) gapsStr
++ map floatingCriteriaStr floating.criteria ++ map floatingCriteriaStr floating.criteria
++ map windowCommandsStr window.commands ++ map startupEntryStr startup ++ map windowCommandsStr window.commands
++ map startupEntryStr startup
++ map workspaceOutputStr workspaceOutputAssign) ++ map workspaceOutputStr workspaceOutputAssign)
else else []
[ ]) ++ [ cfg.extraConfig ])); )
++ [cfg.extraConfig]));
# Validates the i3 configuration # Validates the i3 configuration
checkI3Config = checkI3Config = pkgs.runCommandLocal "i3-config" {buildInputs = [cfg.package];} ''
pkgs.runCommandLocal "i3-config" { buildInputs = [ cfg.package ]; } ''
# We have to make sure the wrapper does not start a dbus session # We have to make sure the wrapper does not start a dbus session
export DBUS_SESSION_BUS_ADDRESS=1 export DBUS_SESSION_BUS_ADDRESS=1
@ -131,19 +184,18 @@ let
}; };
cp ${configFile} $out cp ${configFile} $out
''; '';
in { in {
meta.maintainers = with maintainers; [ sumnerevans ]; meta.maintainers = with maintainers; [sumnerevans];
options = { options = {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = mkEnableOption "i3 window manager"; enable = mkEnableOption "i3 window manager";
package = mkPackageOption pkgs "i3" { }; package = mkPackageOption pkgs "i3" {};
config = mkOption { config = mkOption {
type = types.nullOr configModule; type = types.nullOr configModule;
default = { }; default = {};
description = "i3 configuration options."; description = "i3 configuration options.";
}; };
@ -155,20 +207,20 @@ in {
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
description = description = "Extra configuration lines to add to ~/.config/i3/config.";
"Extra configuration lines to add to ~/.config/i3/config.";
}; };
}; };
}; };
config = mkMerge [ (mkIf cfg.enable (mkMerge [ config = mkMerge [
(mkIf cfg.enable (mkMerge [
{ {
assertions = [ assertions = [
(hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs (hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs
platforms.linux) platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [cfg.package];
xsession.windowManager.command = "${cfg.package}/bin/i3"; xsession.windowManager.command = "${cfg.package}/bin/i3";
@ -186,12 +238,14 @@ in {
}; };
} }
(mkIf (cfg.config != null) { (mkIf (cfg.config != null) {
warnings = (optional (isList cfg.config.fonts) warnings =
(optional (isList cfg.config.fonts)
"Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.")
++ flatten (map (b: ++ flatten (map (b:
optional (isList b.fonts) optional (isList b.fonts)
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.")
cfg.config.bars) ++ [ cfg.config.bars)
++ [
(mkIf (any (s: s.workspace != null) cfg.config.startup) (mkIf (any (s: s.workspace != null) cfg.config.startup)
("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, "
+ "use 'xsession.windowManager.i3.config.assigns' instead." + "use 'xsession.windowManager.i3.config.assigns' instead."
@ -202,7 +256,8 @@ in {
]; ];
}) })
])) ]))
{xsession.windowManager.i3.config.keybindings = mapAttrs (n: mkOptionDefault) { {
xsession.windowManager.i3.config.keybindings = mapAttrs (_n: mkOptionDefault) {
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+Shift+q" = "kill"; "${cfg.config.modifier}+Shift+q" = "kill";
"${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}";
@ -235,8 +290,7 @@ in {
"${cfg.config.modifier}+Shift+c" = "reload"; "${cfg.config.modifier}+Shift+c" = "reload";
"${cfg.config.modifier}+Shift+r" = "restart"; "${cfg.config.modifier}+Shift+r" = "restart";
"${cfg.config.modifier}+Shift+e" = "${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.config.modifier}+r" = "mode resize"; "${cfg.config.modifier}+r" = "mode resize";
}; };

View file

@ -1,31 +1,40 @@
{
{ cfg, config, lib, moduleName }: cfg,
config,
with lib; lib,
moduleName,
rec { }:
criteriaStr = criteria: with lib; rec {
let criteriaStr = criteria: let
toCriteria = k: v: toCriteria = k: v:
if builtins.isBool v then if builtins.isBool v
(if v then "${k}" else "") then
else (
''${k}="${v}"''; if v
then "${k}"
else ""
)
else ''${k}="${v}"'';
in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]"; in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]";
keybindingDefaultWorkspace = filterAttrs (n: v: keybindingDefaultWorkspace = filterAttrs (_n: v:
cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace) cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace)
cfg.config.keybindings; cfg.config.keybindings;
keybindingsRest = filterAttrs (n: v: keybindingsRest = filterAttrs (_n: v:
cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace) cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace)
cfg.config.keybindings; cfg.config.keybindings;
keybindingsStr = { keybindings, bindsymArgs ? "", indent ? "" }: keybindingsStr = {
keybindings,
bindsymArgs ? "",
indent ? "",
}:
concatStringsSep "\n" (mapAttrsToList (keycomb: action: concatStringsSep "\n" (mapAttrsToList (keycomb: action:
optionalString (action != null) "${indent}bindsym ${ optionalString (action != null) "${indent}bindsym ${
lib.optionalString (bindsymArgs != "") "${bindsymArgs} " lib.optionalString (bindsymArgs != "") "${bindsymArgs} "
}${keycomb} ${action}") keybindings); }${keycomb} ${action}")
keybindings);
keycodebindingsStr = keycodebindings: keycodebindingsStr = keycodebindings:
concatStringsSep "\n" (mapAttrsToList (keycomb: action: concatStringsSep "\n" (mapAttrsToList (keycomb: action:
@ -40,7 +49,7 @@ rec {
c.indicator c.indicator
c.childBorder c.childBorder
]; ];
barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ]; barColorSetStr = c: concatStringsSep " " [c.border c.background c.text];
modeStr = bindkeysToCode: name: keybindings: '' modeStr = bindkeysToCode: name: keybindings: ''
mode "${name}" { mode "${name}" {
@ -57,23 +66,42 @@ rec {
(map (c: "assign ${criteriaStr c} ${workspace}") criteria); (map (c: "assign ${criteriaStr c} ${workspace}") criteria);
fontConfigStr = let fontConfigStr = let
toFontStr = { names, style ? "", size ? "" }: toFontStr = {
optionalString (names != [ ]) concatStringsSep " " names,
(remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]); style ? "",
in fontCfg: size ? "",
if isList fontCfg then }:
toFontStr { names = fontCfg; } optionalString (names != []) concatStringsSep " "
(remove "" ["font" "pango:${concatStringsSep ", " names}" style size]);
in
fontCfg:
if isList fontCfg
then toFontStr {names = fontCfg;}
else else
toFontStr { toFontStr {
inherit (fontCfg) names style; inherit (fontCfg) names style;
size = toString fontCfg.size; size = toString fontCfg.size;
}; };
barStr = { id, fonts, mode, hiddenState, position, workspaceButtons barStr = {
, workspaceNumbers, command, statusCommand, colors, trayOutput, trayPadding id,
, extraConfig, ... }: fonts,
let colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { }; mode,
in concatMapStrings (x: x + "\n") (indent (lists.subtractLists [ "" null ] hiddenState,
position,
workspaceButtons,
workspaceNumbers,
command,
statusCommand,
colors,
trayOutput,
trayPadding,
extraConfig,
...
}: let
colorsNotNull = lib.filterAttrs (_n: v: v != null) colors != {};
in
concatMapStrings (x: x + "\n") (indent (lists.subtractLists ["" null]
(flatten [ (flatten [
"bar {" "bar {"
(optionalString (id != null) "id ${id}") (optionalString (id != null) "id ${id}")
@ -92,7 +120,7 @@ rec {
(optionalString (trayOutput != null) "tray_output ${trayOutput}") (optionalString (trayOutput != null) "tray_output ${trayOutput}")
(optionalString (trayPadding != null) (optionalString (trayPadding != null)
"tray_padding ${toString trayPadding}") "tray_padding ${toString trayPadding}")
(optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [ (optionals colorsNotNull (indent (lists.subtractLists ["" null] [
"colors {" "colors {"
(optionalString (colors.background != null) (optionalString (colors.background != null)
"background ${colors.background}") "background ${colors.background}")
@ -117,13 +145,13 @@ rec {
(optionalString (colors.bindingMode != null) (optionalString (colors.bindingMode != null)
"binding_mode ${barColorSetStr colors.bindingMode}") "binding_mode ${barColorSetStr colors.bindingMode}")
"}" "}"
]) { })) ]) {}))
extraConfig extraConfig
"}" "}"
])) { }); ])) {});
gapsStr = with cfg.config.gaps; gapsStr = with cfg.config.gaps;
concatStringsSep "\n" (lists.subtractLists [ "" null ] [ concatStringsSep "\n" (lists.subtractLists ["" null] [
(optionalString (inner != null) "gaps inner ${toString inner}") (optionalString (inner != null) "gaps inner ${toString inner}")
(optionalString (outer != null) "gaps outer ${toString outer}") (optionalString (outer != null) "gaps outer ${toString outer}")
(optionalString (horizontal != null) (optionalString (horizontal != null)
@ -137,30 +165,41 @@ rec {
(optionalString (smartBorders != "off") "smart_borders ${smartBorders}") (optionalString (smartBorders != "off") "smart_borders ${smartBorders}")
]); ]);
windowBorderString = window: floating: windowBorderString = window: floating: let
let titlebarString = {
titlebarString = { titlebar, border, ... }: titlebar,
"${if titlebar then "normal" else "pixel"} ${toString border}"; border,
in concatStringsSep "\n" [ ...
}: "${
if titlebar
then "normal"
else "pixel"
} ${toString border}";
in
concatStringsSep "\n" [
"default_border ${titlebarString window}" "default_border ${titlebarString window}"
"default_floating_border ${titlebarString floating}" "default_floating_border ${titlebarString floating}"
]; ];
floatingCriteriaStr = criteria: floatingCriteriaStr = criteria: "for_window ${criteriaStr criteria} floating enable";
"for_window ${criteriaStr criteria} floating enable"; windowCommandsStr = {
windowCommandsStr = { command, criteria, ... }: command,
"for_window ${criteriaStr criteria} ${command}"; criteria,
workspaceOutputStr = item: ...
let outputs = concatMapStringsSep " " strings.escapeNixString item.output; }: "for_window ${criteriaStr criteria} ${command}";
workspaceOutputStr = item: let
outputs = concatMapStringsSep " " strings.escapeNixString item.output;
in ''workspace "${item.workspace}" output ${outputs}''; in ''workspace "${item.workspace}" output ${outputs}'';
indent = list: indent = list: {
{ includesWrapper ? true, level ? 1 }: includesWrapper ? true,
let prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2)); level ? 1,
}: let
in (lib.imap1 (i: v: prefix = concatStringsSep "" (lib.genList (_x: " ") (level * 2));
"${if includesWrapper && (i == 1 || i == (lib.length list)) then in lib.imap1 (i: v: "${
v if includesWrapper && (i == 1 || i == (lib.length list))
else then v
"${prefix}${v}"}") list); else "${prefix}${v}"
}")
list;
} }

View file

@ -1,8 +1,12 @@
{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }: {
config,
with lib; lib,
moduleName,
let cfg,
pkgs,
capitalModuleName ? moduleName,
}:
with lib; let
isI3 = moduleName == "i3"; isI3 = moduleName == "i3";
isSway = !isI3; isSway = !isI3;
@ -12,7 +16,7 @@ let
options = { options = {
names = mkOption { names = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ "monospace" ]; default = ["monospace"];
defaultText = literalExpression ''[ "monospace" ]''; defaultText = literalExpression ''[ "monospace" ]'';
description = '' description = ''
List of font names list used for window titles. Only FreeType fonts are supported. List of font names list used for window titles. Only FreeType fonts are supported.
@ -42,7 +46,8 @@ let
}; };
startupModule = types.submodule { startupModule = types.submodule {
options = { options =
{
command = mkOption { command = mkOption {
type = types.str; type = types.str;
description = "Command that will be executed on startup."; description = "Command that will be executed on startup.";
@ -53,7 +58,8 @@ let
default = false; default = false;
description = "Whether to run command on each ${moduleName} restart."; description = "Whether to run command on each ${moduleName} restart.";
}; };
} // optionalAttrs isI3 { }
// optionalAttrs isI3 {
notification = mkOption { notification = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -73,16 +79,23 @@ let
''; '';
}; };
}; };
}; };
barModule = types.submodule { barModule = types.submodule {
options = let options = let
versionAtLeast2009 = versionAtLeast stateVersion "20.09"; versionAtLeast2009 = versionAtLeast stateVersion "20.09";
mkNullableOption = { type, default, ... }@args: mkNullableOption = {
mkOption (args // { type,
default,
...
} @ args:
mkOption (args
// {
type = types.nullOr type; type = types.nullOr type;
default = if versionAtLeast2009 then null else default; default =
if versionAtLeast2009
then null
else default;
defaultText = literalExpression '' defaultText = literalExpression ''
null for state version 20.09, as example otherwise null for state version 20.09, as example otherwise
''; '';
@ -91,7 +104,7 @@ let
in { in {
fonts = mkOption { fonts = mkOption {
type = with types; either (listOf str) fontOptions; type = with types; either (listOf str) fontOptions;
default = { }; default = {};
example = literalExpression '' example = literalExpression ''
{ {
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
@ -119,19 +132,19 @@ let
}; };
mode = mkNullableOption { mode = mkNullableOption {
type = types.enum [ "dock" "hide" "invisible" ]; type = types.enum ["dock" "hide" "invisible"];
default = "dock"; default = "dock";
description = "Bar visibility mode."; description = "Bar visibility mode.";
}; };
hiddenState = mkNullableOption { hiddenState = mkNullableOption {
type = types.enum [ "hide" "show" ]; type = types.enum ["hide" "show"];
default = "hide"; default = "hide";
description = "The default bar mode when 'bar.mode' == 'hide'."; description = "The default bar mode when 'bar.mode' == 'hide'.";
}; };
position = mkNullableOption { position = mkNullableOption {
type = types.enum [ "top" "bottom" ]; type = types.enum ["top" "bottom"];
default = "bottom"; default = "bottom";
description = "The edge of the screen ${moduleName}bar should show up."; description = "The edge of the screen ${moduleName}bar should show up.";
}; };
@ -145,8 +158,7 @@ let
workspaceNumbers = mkNullableOption { workspaceNumbers = mkNullableOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = description = "Whether workspace numbers should be displayed within the workspace buttons.";
"Whether workspace numbers should be displayed within the workspace buttons.";
}; };
command = mkOption { command = mkOption {
@ -154,14 +166,17 @@ let
default = let default = let
# If the user uses the "system" Sway (i.e. cfg.package == null) then the bar has # If the user uses the "system" Sway (i.e. cfg.package == null) then the bar has
# to come from a different package # to come from a different package
pkg = if isSway && isNull cfg.package then pkgs.sway else cfg.package; pkg =
if isSway && (cfg.package == null)
then pkgs.sway
else cfg.package;
in "${pkg}/bin/${moduleName}bar"; in "${pkg}/bin/${moduleName}bar";
defaultText = "i3bar"; defaultText = "i3bar";
description = "Command that will be used to start a bar."; description = "Command that will be used to start a bar.";
example = if isI3 then example =
"\${pkgs.i3}/bin/i3bar -t" if isI3
else then "\${pkgs.i3}/bin/i3bar -t"
"\${pkgs.waybar}/bin/waybar"; else "\${pkgs.waybar}/bin/waybar";
}; };
statusCommand = mkNullableOption { statusCommand = mkNullableOption {
@ -194,24 +209,21 @@ let
focusedBackground = mkOption { focusedBackground = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = description = "Background color of the bar on the currently focused monitor output.";
"Background color of the bar on the currently focused monitor output.";
example = "#000000"; example = "#000000";
}; };
focusedStatusline = mkOption { focusedStatusline = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = description = "Text color to be used for the statusline on the currently focused monitor output.";
"Text color to be used for the statusline on the currently focused monitor output.";
example = "#ffffff"; example = "#ffffff";
}; };
focusedSeparator = mkOption { focusedSeparator = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = description = "Text color to be used for the separator on the currently focused monitor output.";
"Text color to be used for the separator on the currently focused monitor output.";
example = "#666666"; example = "#666666";
}; };
@ -272,12 +284,11 @@ let
background = "#900000"; background = "#900000";
text = "#ffffff"; text = "#ffffff";
}; };
description = description = "Border, background and text color for the binding mode indicator";
"Border, background and text color for the binding mode indicator";
}; };
}; };
}; };
default = { }; default = {};
description = '' description = ''
Bar color settings. All color classes can be specified using submodules Bar color settings. All color classes can be specified using submodules
with 'border', 'background', 'text', fields and RGB color hex-codes as values. with 'border', 'background', 'text', fields and RGB color hex-codes as values.
@ -291,7 +302,10 @@ let
trayOutput = mkNullableOption { trayOutput = mkNullableOption {
type = types.str; type = types.str;
# Sway/Wayland doesn't have the concept of a primary output. The default for sway is to show it on all outputs # Sway/Wayland doesn't have the concept of a primary output. The default for sway is to show it on all outputs
default = if isI3 then "primary" else "*"; default =
if isI3
then "primary"
else "*";
description = "Where to output tray."; description = "Where to output tray.";
}; };
@ -384,7 +398,7 @@ let
in { in {
fonts = mkOption { fonts = mkOption {
type = with types; either (listOf str) fontOptions; type = with types; either (listOf str) fontOptions;
default = { }; default = {};
example = literalExpression '' example = literalExpression ''
{ {
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
@ -400,14 +414,17 @@ in {
options = { options = {
titlebar = mkOption { titlebar = mkOption {
type = types.bool; type = types.bool;
default = if versionOlder stateVersion "23.05" then default =
(isI3 && (cfg.config.gaps == null)) if versionOlder stateVersion "23.05"
else then (isI3 && (cfg.config.gaps == null))
true; else true;
defaultText = if isI3 then '' defaultText =
if isI3
then ''
true for state version 23.05 true for state version 23.05
config.gaps == null for state version < 23.05 config.gaps == null for state version < 23.05
'' else '' ''
else ''
true for state version 23.05 true for state version 23.05
false for state version < 23.05 false for state version < 23.05
''; '';
@ -422,31 +439,33 @@ in {
hideEdgeBorders = mkOption { hideEdgeBorders = mkOption {
type = let type = let
i3Options = [ "none" "vertical" "horizontal" "both" "smart" ]; i3Options = ["none" "vertical" "horizontal" "both" "smart"];
swayOptions = i3Options ++ [ "smart_no_gaps" ]; swayOptions = i3Options ++ ["smart_no_gaps"];
in if isI3 then in
types.enum i3Options if isI3
else then types.enum i3Options
types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions)); else types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions));
default = "none"; default = "none";
description = "Hide window borders adjacent to the screen edges."; description = "Hide window borders adjacent to the screen edges.";
}; };
commands = mkOption { commands = mkOption {
type = types.listOf windowCommandModule; type = types.listOf windowCommandModule;
default = [ ]; default = [];
description = '' description = ''
List of commands that should be executed on specific windows. List of commands that should be executed on specific windows.
See {option}`for_window` ${moduleName}wm option documentation. See {option}`for_window` ${moduleName}wm option documentation.
''; '';
example = [{ example = [
{
command = "border pixel 1"; command = "border pixel 1";
criteria = { class = "XTerm"; }; criteria = {class = "XTerm";};
}]; }
];
}; };
}; };
}; };
default = { }; default = {};
description = "Window titlebar and border settings."; description = "Window titlebar and border settings.";
}; };
@ -455,14 +474,17 @@ in {
options = { options = {
titlebar = mkOption { titlebar = mkOption {
type = types.bool; type = types.bool;
default = if versionOlder stateVersion "23.05" then default =
(isI3 && (cfg.config.gaps == null)) if versionOlder stateVersion "23.05"
else then (isI3 && (cfg.config.gaps == null))
true; else true;
defaultText = if isI3 then '' defaultText =
if isI3
then ''
true for state version 23.05 true for state version 23.05
config.gaps == null for state version < 23.05 config.gaps == null for state version < 23.05
'' else '' ''
else ''
true for state version 23.05 true for state version 23.05
false for state version < 23.05 false for state version < 23.05
''; '';
@ -479,24 +501,22 @@ in {
type = types.str; type = types.str;
default = cfg.config.modifier; default = cfg.config.modifier;
defaultText = "${moduleName}.config.modifier"; defaultText = "${moduleName}.config.modifier";
description = description = "Modifier key or keys that can be used to drag floating windows.";
"Modifier key or keys that can be used to drag floating windows.";
example = "Mod4"; example = "Mod4";
}; };
criteria = mkOption { criteria = mkOption {
type = types.listOf criteriaModule; type = types.listOf criteriaModule;
default = [ ]; default = [];
description = description = "List of criteria for windows that should be opened in a floating mode.";
"List of criteria for windows that should be opened in a floating mode.";
example = [ example = [
{ "title" = "Steam - Update News"; } {"title" = "Steam - Update News";}
{ "class" = "Pavucontrol"; } {"class" = "Pavucontrol";}
]; ];
}; };
}; };
}; };
default = { }; default = {};
description = "Floating window settings."; description = "Floating window settings.";
}; };
@ -504,7 +524,7 @@ in {
type = types.submodule { type = types.submodule {
options = { options = {
newWindow = mkOption { newWindow = mkOption {
type = types.enum [ "smart" "urgent" "focus" "none" ]; type = types.enum ["smart" "urgent" "focus" "none"];
default = "smart"; default = "smart";
description = '' description = ''
This option modifies focus behavior on new window activation. This option modifies focus behavior on new window activation.
@ -515,24 +535,38 @@ in {
}; };
followMouse = mkOption { followMouse = mkOption {
type = if isSway then type =
types.either (types.enum [ "yes" "no" "always" ]) types.bool if isSway
else then types.either (types.enum ["yes" "no" "always"]) types.bool
types.bool; else types.bool;
default = if isSway then "yes" else true; default =
if isSway
then "yes"
else true;
description = "Whether focus should follow the mouse."; description = "Whether focus should follow the mouse.";
apply = val: apply = val:
if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val; if (isSway && isBool val)
then (lib.hm.booleans.yesNo val)
else val;
}; };
wrapping = mkOption { wrapping = mkOption {
type = types.enum [ "yes" "no" "force" "workspace" ]; type = types.enum ["yes" "no" "force" "workspace"];
default = { default =
i3 = if cfg.config.focus.forceWrapping then "force" else "yes"; {
i3 =
if cfg.config.focus.forceWrapping
then "force"
else "yes";
# the sway module's logic was inverted and incorrect, # the sway module's logic was inverted and incorrect,
# so preserve it for backwards compatibility purposes # so preserve it for backwards compatibility purposes
sway = if cfg.config.focus.forceWrapping then "yes" else "no"; sway =
}.${moduleName}; if cfg.config.focus.forceWrapping
then "yes"
else "no";
}.${
moduleName
};
description = '' description = ''
Whether the window focus commands automatically wrap around the edge of containers. Whether the window focus commands automatically wrap around the edge of containers.
@ -551,10 +585,10 @@ in {
}; };
mouseWarping = mkOption { mouseWarping = mkOption {
type = if isSway then type =
types.oneOf [ types.bool (types.enum [ "container" "output" ]) ] if isSway
else then types.oneOf [types.bool (types.enum ["container" "output"])]
types.bool; else types.bool;
default = true; default = true;
description = '' description = ''
Whether mouse cursor should be warped to the center of the window when switching focus Whether mouse cursor should be warped to the center of the window when switching focus
@ -563,13 +597,13 @@ in {
}; };
}; };
}; };
default = { }; default = {};
description = "Focus related settings."; description = "Focus related settings.";
}; };
assigns = mkOption { assigns = mkOption {
type = types.attrsOf (types.listOf criteriaModule); type = types.attrsOf (types.listOf criteriaModule);
default = { }; default = {};
description = '' description = ''
An attribute set that assigns applications to workspaces based An attribute set that assigns applications to workspaces based
on criteria. on criteria.
@ -583,14 +617,14 @@ in {
}; };
modifier = mkOption { modifier = mkOption {
type = types.enum [ "Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5" ]; type = types.enum ["Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5"];
default = "Mod1"; default = "Mod1";
description = "Modifier key that is used for all default keybindings."; description = "Modifier key that is used for all default keybindings.";
example = "Mod4"; example = "Mod4";
}; };
workspaceLayout = mkOption { workspaceLayout = mkOption {
type = types.enum [ "default" "stacking" "tabbed" ]; type = types.enum ["default" "stacking" "tabbed"];
default = "default"; default = "default";
example = "tabbed"; example = "tabbed";
description = '' description = ''
@ -613,12 +647,12 @@ in {
keycodebindings = mkOption { keycodebindings = mkOption {
type = types.attrsOf (types.nullOr types.str); type = types.attrsOf (types.nullOr types.str);
default = { }; default = {};
description = '' description = ''
An attribute set that assigns keypress to an action using key code. An attribute set that assigns keypress to an action using key code.
See <https://i3wm.org/docs/userguide.html#keybindings>. See <https://i3wm.org/docs/userguide.html#keybindings>.
''; '';
example = { "214" = "exec /bin/script.sh"; }; example = {"214" = "exec /bin/script.sh";};
}; };
colors = mkOption { colors = mkOption {
@ -700,7 +734,7 @@ in {
}; };
}; };
}; };
default = { }; default = {};
description = '' description = ''
Color settings. All color classes can be specified using submodules Color settings. All color classes can be specified using submodules
with 'border', 'background', 'text', 'indicator' and 'childBorder' fields with 'border', 'background', 'text', 'indicator' and 'childBorder' fields
@ -713,7 +747,10 @@ in {
bars = mkOption { bars = mkOption {
type = types.listOf barModule; type = types.listOf barModule;
default = if versionAtLeast stateVersion "20.09" then [{ default =
if versionAtLeast stateVersion "20.09"
then [
{
mode = "dock"; mode = "dock";
hiddenState = "hide"; hiddenState = "hide";
position = "bottom"; position = "bottom";
@ -721,7 +758,7 @@ in {
workspaceNumbers = true; workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status"; statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = { fonts = {
names = [ "monospace" ]; names = ["monospace"];
size = 8.0; size = 8.0;
}; };
trayOutput = "primary"; trayOutput = "primary";
@ -755,8 +792,9 @@ in {
text = "#ffffff"; text = "#ffffff";
}; };
}; };
}] else }
[ { } ]; ]
else [{}];
defaultText = literalExpression "see code"; defaultText = literalExpression "see code";
description = '' description = ''
${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely. ${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely.
@ -765,13 +803,15 @@ in {
startup = mkOption { startup = mkOption {
type = types.listOf startupModule; type = types.listOf startupModule;
default = [ ]; default = [];
description = '' description = ''
Commands that should be executed at startup. Commands that should be executed at startup.
See <https://i3wm.org/docs/userguide.html#_automatically_starting_applications_on_i3_startup>. See <https://i3wm.org/docs/userguide.html#_automatically_starting_applications_on_i3_startup>.
''; '';
example = if isI3 then example =
if isI3
then
literalExpression '' literalExpression ''
[ [
{ command = "systemctl --user restart polybar"; always = true; notification = false; } { command = "systemctl --user restart polybar"; always = true; notification = false; }
@ -859,7 +899,7 @@ in {
}; };
smartBorders = mkOption { smartBorders = mkOption {
type = types.enum [ "on" "off" "no_gaps" ]; type = types.enum ["on" "off" "no_gaps"];
default = "off"; default = "off";
description = '' description = ''
This option controls whether to disable container borders on This option controls whether to disable container borders on
@ -876,17 +916,20 @@ in {
terminal = mkOption { terminal = mkOption {
type = types.str; type = types.str;
default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot"; default =
if isI3
then "i3-sensible-terminal"
else "${pkgs.foot}/bin/foot";
description = "Default terminal to run."; description = "Default terminal to run.";
example = "alacritty"; example = "alacritty";
}; };
menu = mkOption { menu = mkOption {
type = types.str; type = types.str;
default = if isSway then default =
"${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --" if isSway
else then "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --"
"${pkgs.dmenu}/bin/dmenu_run"; else "${pkgs.dmenu}/bin/dmenu_run";
description = "Default launcher to use."; description = "Default launcher to use.";
example = "bemenu-run"; example = "bemenu-run";
}; };
@ -896,7 +939,9 @@ in {
default = null; default = null;
description = '' description = ''
The default workspace to show when ${ The default workspace to show when ${
if isSway then "sway" else "i3" if isSway
then "sway"
else "i3"
} is launched. } is launched.
This must to correspond to the value of the keybinding of the default workspace. This must to correspond to the value of the keybinding of the default workspace.
''; '';
@ -904,8 +949,7 @@ in {
}; };
workspaceOutputAssign = mkOption { workspaceOutputAssign = mkOption {
type = with types; type = with types; let
let
workspaceOutputOpts = submodule { workspaceOutputOpts = submodule {
options = { options = {
workspace = mkOption { workspace = mkOption {
@ -924,15 +968,19 @@ in {
example = "eDP"; example = "eDP";
description = '' description = ''
Name(s) of the output(s) from {command}` Name(s) of the output(s) from {command}`
${if isSway then "swaymsg" else "i3-msg"} -t get_outputs ${
if isSway
then "swaymsg"
else "i3-msg"
} -t get_outputs
`. `.
''; '';
}; };
}; };
}; };
in listOf workspaceOutputOpts; in
default = [ ]; listOf workspaceOutputOpts;
default = [];
description = "Assign workspaces to outputs."; description = "Assign workspaces to outputs.";
}; };
} }

View file

@ -4,18 +4,14 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
inherit (lib) mkOption types; inherit (lib) mkOption types;
palette = palette =
(pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json")) (pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json"))
.${config.catppuccin.flavor}.colors; .${config.catppuccin.flavor}.colors;
in in {
{ options.palette = mkOption {type = types.attrsOf types.raw;};
options.palette = mkOption { type = types.attrsOf types.raw; };
config = { config = {
inherit palette; inherit palette;
}; };
} }

View file

@ -1,4 +1,4 @@
{ lib, ... }: { {lib, ...}: {
programs.zsh.initContent = lib.mkBefore '' programs.zsh.initContent = lib.mkBefore ''
source /etc/static/zshrc source /etc/static/zshrc
''; '';

View file

@ -66,7 +66,9 @@ in {
linux = "linux"; linux = "linux";
home = "linux"; home = "linux";
} }
.${string.toLower config.type}; .${
string.toLower config.type
};
in "${config.arch}-${kernel}"; in "${config.arch}-${kernel}";
folder = folder =
{ {
@ -77,7 +79,9 @@ in {
windows = "windows"; windows = "windows";
home = "home"; home = "home";
} }
.${string.toLower config.type}; .${
string.toLower config.type
};
modules = mkMerge [ modules = mkMerge [
(mkIf (config.folder != "linux") [ (mkIf (config.folder != "linux") [
# per-OS modules # per-OS modules
@ -107,7 +111,7 @@ in {
} }
// args); // args);
in in
args: sys args; sys;
home = args: let home = args: let
renamedArgs = set.rename "specialArgs" "extraSpecialArgs" args; renamedArgs = set.rename "specialArgs" "extraSpecialArgs" args;
renamedArgsWithPkgs = renamedArgsWithPkgs =
@ -123,7 +127,9 @@ in {
darwin = inputs.darwin.lib.darwinSystem; darwin = inputs.darwin.lib.darwinSystem;
macos = inputs.darwin.lib.darwinSystem; macos = inputs.darwin.lib.darwinSystem;
} }
.${string.toLower config.type} .${
string.toLower config.type
}
or null; or null;
built = mkOptionDefault (mapNullable (builder: built = mkOptionDefault (mapNullable (builder:
builder { builder {

View file

@ -1,4 +1,8 @@
{ pkgs, inputs, ... }: { {
pkgs,
inputs,
...
}: {
programs.nh = { programs.nh = {
enable = true; enable = true;
package = inputs.nh.packages.${pkgs.system}.nh; package = inputs.nh.packages.${pkgs.system}.nh;

View file

@ -1,4 +1,4 @@
{ pkgs, ...}: { {pkgs, ...}: {
nix = { nix = {
gc = { gc = {
automatic = true; automatic = true;

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
environment.systemPackages = [ environment.systemPackages = [
pkgs.magic-wormhole pkgs.magic-wormhole
]; ];

View file

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
with lib; let with lib; let
@ -30,7 +29,8 @@ in {
sops.secrets.tailscale-key = mkIf cfg.enable { sops.secrets.tailscale-key = mkIf cfg.enable {
sopsFile = ./secrets.yaml; sopsFile = ./secrets.yaml;
}; };
/* systemd.services.tailscale-autoconnect = mkIf cfg.enable rec { /*
systemd.services.tailscale-autoconnect = mkIf cfg.enable rec {
description = "Automatic connection to Tailscale"; description = "Automatic connection to Tailscale";
# make sure tailscale is running before trying to connect to tailscale # make sure tailscale is running before trying to connect to tailscale
@ -72,6 +72,7 @@ in {
# otherwise authenticate with tailscale # otherwise authenticate with tailscale
${getExe tailscale} up ${advertiseExitNode} -authkey $(cat ${config.sops.secrets.tailscale-key.path}) ${getExe tailscale} up ${advertiseExitNode} -authkey $(cat ${config.sops.secrets.tailscale-key.path})
''; '';
};*/ };
*/
}; };
} }

View file

@ -1,4 +1,8 @@
{ pkgs, inputs, ... }: { {
pkgs,
inputs,
...
}: {
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
withUWSM = true; withUWSM = true;
@ -14,9 +18,11 @@
''; '';
services.clipboard-sync.enable = true; services.clipboard-sync.enable = true;
/*services.displayManager.sddm = { /*
services.displayManager.sddm = {
enable = true; enable = true;
package = pkgs.kdePackages.sddm; package = pkgs.kdePackages.sddm;
wayland.enable = true; wayland.enable = true;
};*/ };
*/
} }

View file

@ -9,4 +9,3 @@
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.niri = { programs.niri = {
enable = true; enable = true;
package = pkgs.niri-unstable; package = pkgs.niri-unstable;

View file

@ -1,6 +1,5 @@
{ {
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib.types) submodule loaOf; inherit (lib.types) submodule loaOf;

View file

@ -1,6 +1,5 @@
{ {
pkgs, pkgs,
inputs,
... ...
}: { }: {
hardware.graphics = { hardware.graphics = {
@ -9,7 +8,7 @@
driversi686Linux.mesa driversi686Linux.mesa
]; ];
}; };
programs.gamescope = { programs.gamescope = {
enable = true; enable = true;
package = pkgs.gamescope; package = pkgs.gamescope;
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, inputs, ... }: { _: {
programs.steam = { programs.steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; remotePlay.openFirewall = true;

View file

@ -1,10 +1,11 @@
{pkgs, ... }: { {pkgs, ...}: {
programs.envision = { programs.envision = {
enable = true; enable = true;
openFirewall = true; # This is set true by default openFirewall = true; # This is set true by default
}; };
/*services.wivrn = { /*
services.wivrn = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
package = pkgs.wivrn.override { cudaSupport = true; }; package = pkgs.wivrn.override { cudaSupport = true; };
@ -30,7 +31,8 @@
#]; #];
}; };
}; };
};*/ };
*/
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wlx-overlay-s wlx-overlay-s
@ -39,7 +41,7 @@
]; ];
networking.firewall = { networking.firewall = {
allowedTCPPorts = [ 9757 ]; allowedTCPPorts = [9757];
allowedUDPPorts = [ 9757 ]; allowedUDPPorts = [9757];
}; };
} }

View file

@ -1,4 +1,8 @@
{ config, lib, ... }: let {
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault; inherit (lib.modules) mkIf mkDefault;
in { in {
gensokyo-zone = { gensokyo-zone = {
@ -16,7 +20,8 @@ in {
shared.enable = mkDefault true; shared.enable = mkDefault true;
#domain = mkIf config.gensokyo-zone.access.local.enable "local.${domain}"; #domain = mkIf config.gensokyo-zone.access.local.enable "local.${domain}";
}; };
/*krb5 = { /*
krb5 = {
enable = mkDefault true; enable = mkDefault true;
sssd = { sssd = {
enable = mkDefault true; enable = mkDefault true;
@ -27,7 +32,8 @@ in {
nfs.enable = mkDefault true; nfs.enable = mkDefault true;
#nfs.debug.enable = true; #nfs.debug.enable = true;
ipa.enable = mkDefault true; ipa.enable = mkDefault true;
};*/ };
*/
dns = { dns = {
enable = mkDefault true; enable = mkDefault true;
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
boot.zfs.package = pkgs.zfs_cachyos; boot.zfs.package = pkgs.zfs_cachyos;
boot.kernelPackages = pkgs.linuxPackages_cachyos; boot.kernelPackages = pkgs.linuxPackages_cachyos;
} }

View file

@ -14,7 +14,7 @@
"context.properties" = [ "context.properties" = [
{ {
name = "libpipewire-module-protocol-pulse"; name = "libpipewire-module-protocol-pulse";
args = { }; args = {};
} }
]; ];
"pulse.properties" = { "pulse.properties" = {
@ -33,7 +33,7 @@
services.pipewire.extraConfig.pipewire-pulse."91-discord-latency" = { services.pipewire.extraConfig.pipewire-pulse."91-discord-latency" = {
pulse.rules = [ pulse.rules = [
{ {
matches = [ { "application.process.binary" = "Discord"; } ]; matches = [{"application.process.binary" = "Discord";}];
actions = { actions = {
update-props = { update-props = {
"pulse.min.quantum" = "1024/48000"; "pulse.min.quantum" = "1024/48000";

View file

@ -1,6 +1,6 @@
_: { _: {
services.rustdesk-server = { services.rustdesk-server = {
enable = true; enable = true;
relayHosts = [ "100.89.32.57" ]; relayHosts = ["100.89.32.57"];
}; };
} }

View file

@ -16,7 +16,7 @@ in
legacyPackages = pkgs; legacyPackages = pkgs;
packages = set.merge [pkgs wrappers.packages]; packages = set.merge [pkgs wrappers.packages];
checks = checks // formatting.checks; checks = checks // formatting.checks;
formatter = formatting.formatter; inherit (formatting) formatter;
} }
// systems // systems
// shells // shells

View file

@ -10,7 +10,7 @@
inputs.neorg-overlay.overlays.default inputs.neorg-overlay.overlays.default
inputs.niri.overlays.niri inputs.niri.overlays.niri
(import tree.packages.default {inherit inputs tree;}) (import tree.packages.default {inherit inputs tree;})
(final: prev: { (_final: prev: {
wivrn = prev.wivrn.override { cudaSupport = true; }; wivrn = prev.wivrn.override {cudaSupport = true;};
}) })
] ]

View file

@ -1,5 +1,12 @@
{ lib, stdenv, fetchFromGitLab, glib, gettext, substituteAll, gnome-menus }: {
lib,
stdenv,
fetchFromGitLab,
glib,
gettext,
substituteAll,
gnome-menus,
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gnome-shell-extension-arcmenu"; pname = "gnome-shell-extension-arcmenu";
version = "63"; version = "63";
@ -19,10 +26,11 @@ stdenv.mkDerivation rec {
]; ];
buildInputs = [ buildInputs = [
glib gettext glib
gettext
]; ];
makeFlags = [ "INSTALLBASE=${placeholder "out"}/share/gnome-shell/extensions" ]; makeFlags = ["INSTALLBASE=${placeholder "out"}/share/gnome-shell/extensions"];
passthru = { passthru = {
extensionUuid = "arcmenu@arcmenu.com"; extensionUuid = "arcmenu@arcmenu.com";
@ -32,7 +40,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "Application menu for GNOME Shell, designed to provide a more traditional user experience and workflow"; description = "Application menu for GNOME Shell, designed to provide a more traditional user experience and workflow";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ dkabot ]; maintainers = with maintainers; [dkabot];
homepage = "https://gitlab.com/arcmenu/ArcMenu"; homepage = "https://gitlab.com/arcmenu/ArcMenu";
}; };
} }

View file

@ -3,7 +3,6 @@
stdenvNoCC, stdenvNoCC,
fetchgit, fetchgit,
openssh, openssh,
findutils,
... ...
}: }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {

View file

@ -1,10 +1,6 @@
{ {
stdenv,
lib, lib,
fetchFromGitHub, fetchFromGitHub,
pkg-config,
cmake,
setuptools,
python, python,
}: let }: let
cppyy = python.buildPythonPackage rec { cppyy = python.buildPythonPackage rec {
@ -26,4 +22,5 @@
license = licenses.bsd3Lbnl; license = licenses.bsd3Lbnl;
}; };
}; };
in cppyy in
cppyy

View file

@ -18,9 +18,7 @@
webkitgtk_4_1, webkitgtk_4_1,
cargo-tauri, cargo-tauri,
desktop-file-utils, desktop-file-utils,
}: }: let
let
webkitgtk_4_1' = webkitgtk_4_1.override { webkitgtk_4_1' = webkitgtk_4_1.override {
enableExperimental = true; enableExperimental = true;
}; };
@ -30,13 +28,12 @@ let
hash = "sha256-d9vaKLrl8RYNcHnE1iGN49ov6U/Y+9XpEsio+c1Sguc="; hash = "sha256-d9vaKLrl8RYNcHnE1iGN49ov6U/Y+9XpEsio+c1Sguc=";
meta = { meta = {
homepage = "https://github.com/uwu/shelter"; homepage = "https://github.com/uwu/shelter";
sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; # actually, minified JS sourceProvenance = [lib.sourceTypes.binaryBytecode]; # actually, minified JS
license = lib.licenses.cc0; license = lib.licenses.cc0;
}; };
}; };
in in
rustPlatform.buildRustPackage (finalAttrs: {
rustPlatform.buildRustPackage (finalAttrs: {
pname = "dorion"; pname = "dorion";
version = "6.7.1"; version = "6.7.1";
@ -190,5 +187,4 @@ rustPlatform.buildRustPackage (finalAttrs: {
lib.sourceTypes.fromSource lib.sourceTypes.fromSource
]; ];
}; };
}) })

View file

@ -1,5 +1,4 @@
{ {
lib,
stdenv, stdenv,
fetchFromGitHub, fetchFromGitHub,
extra-cmake-modules, extra-cmake-modules,

View file

@ -5,10 +5,11 @@
cachix, cachix,
jq, jq,
nix, nix,
curl curl,
}: let }: let
inherit (lib) makeBinPath; inherit (lib) makeBinPath;
in writeShellScriptBin "nf-build-system" '' in
writeShellScriptBin "nf-build-system" ''
export PATH="$PATH:${lib.makeBinPath [ export PATH="$PATH:${lib.makeBinPath [
git git
cachix cachix
@ -17,4 +18,4 @@ in writeShellScriptBin "nf-build-system" ''
curl curl
]}" ]}"
exec ${./build-system.sh} "$@" exec ${./build-system.sh} "$@"
'' ''

View file

@ -5,10 +5,11 @@
cachix, cachix,
jq, jq,
nix, nix,
curl curl,
}: let }: let
inherit (lib) makeBinPath; inherit (lib) makeBinPath;
in writeShellScriptBin "nf-update" '' in
writeShellScriptBin "nf-update" ''
export PATH="$PATH:${lib.makeBinPath [ export PATH="$PATH:${lib.makeBinPath [
git git
cachix cachix
@ -17,4 +18,4 @@ in writeShellScriptBin "nf-update" ''
curl curl
]}" ]}"
exec ${./update.sh} "$@" exec ${./update.sh} "$@"
'' ''

View file

@ -58,9 +58,9 @@ fi
git add flake.lock git add flake.lock
env \ env \
GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch \ GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch \
GIT_{COMMITTER,AUTHOR}_NAME="flake cron job" \ GIT_{COMMITTER,AUTHOR}_NAME="flake cron job" \
git commit --message="chore(ci): flake update" git commit --message="chore(ci): flake update"
if [[ ${GITHUB_REF-} = refs/heads/${NF_UPDATE_BRANCH-main} ]]; then if [[ ${GITHUB_REF-} = refs/heads/${NF_UPDATE_BRANCH-main} ]]; then
git push origin HEAD:${NF_UPDATE_BRANCH-main} git push origin HEAD:${NF_UPDATE_BRANCH-main}

View file

@ -90,9 +90,9 @@ main() {
send_discord_message "Performing database optimization" send_discord_message "Performing database optimization"
systemctl stop matrix-synapse systemctl stop matrix-synapse
export PGHOST=/var/run/postgresql/ export PGHOST=/var/run/postgresql/
export PGDATABASE=matrix-synapse export PGDATABASE=matrix-synapse
export PGUSER=matrix-synapse export PGUSER=matrix-synapse
sudo -u postgres psql matrix-synapse <<_EOF sudo -u postgres psql matrix-synapse <<_EOF
BEGIN; BEGIN;
@ -151,7 +151,7 @@ _EOF
send_discord_message "Matrix-synapse optimization process finished - send_discord_message "Matrix-synapse optimization process finished -
Database: ${db_before_size} -> ${db_after_size} (${db_ratio}%), Database: ${db_before_size} -> ${db_after_size} (${db_ratio}%),
Media store: ${media_before_size} -> ${media_after_size} (${media_ratio}%), Media store: ${media_before_size} -> ${media_after_size} (${media_ratio}%),
Filesystem usage: ${fs_before_usage} -> ${fs_after_usage}" Filesystem usage: ${fs_before_usage} -> ${fs_after_usage}"
} }
# Run the main function # Run the main function

View file

@ -7,7 +7,6 @@ _: let
inputs, inputs,
... ...
}: let }: let
inherit (lib.lists) singleton;
inherit (lib.attrsets) nameValuePair listToAttrs; inherit (lib.attrsets) nameValuePair listToAttrs;
datasets = [ datasets = [
"root" "root"
@ -16,10 +15,15 @@ _: let
"home" "home"
"var" "var"
]; ];
datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { datasetEntry = dataset:
nameValuePair (
if dataset == "root"
then "/"
else "/${dataset}"
) {
device = "zpool/${dataset}"; device = "zpool/${dataset}";
fsType = "zfs"; fsType = "zfs";
options = [ "zfsutil" ]; options = ["zfsutil"];
}; };
datasetEntries = listToAttrs (map datasetEntry datasets); datasetEntries = listToAttrs (map datasetEntry datasets);
@ -40,7 +44,8 @@ _: let
}; };
}; };
in { in {
imports = (with tree.nixos.profiles; [ imports =
(with tree.nixos.profiles; [
graphical graphical
wireless wireless
gaming gaming
@ -48,7 +53,8 @@ _: let
++ (with tree.nixos.environments; [ ++ (with tree.nixos.environments; [
#hyprland #hyprland
niri niri
]) ++ (with inputs.nixos-hardware.outputs.nixosModules; [ ])
++ (with inputs.nixos-hardware.outputs.nixosModules; [
common-pc common-pc
common-pc-ssd common-pc-ssd
common-cpu-amd common-cpu-amd
@ -138,7 +144,9 @@ _: let
supportedFilesystems = ["ntfs" "zfs"]; supportedFilesystems = ["ntfs" "zfs"];
}; };
fileSystems = datasetEntries // { fileSystems =
datasetEntries
// {
"/boot" = drives.boot.result; "/boot" = drives.boot.result;
}; };

View file

@ -6,7 +6,6 @@ _: let
config, config,
... ...
}: let }: let
inherit (lib.lists) singleton;
inherit (lib.attrsets) nameValuePair listToAttrs; inherit (lib.attrsets) nameValuePair listToAttrs;
datasets = [ datasets = [
"root" "root"
@ -15,10 +14,15 @@ _: let
"home" "home"
"var" "var"
]; ];
datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { datasetEntry = dataset:
nameValuePair (
if dataset == "root"
then "/"
else "/${dataset}"
) {
device = "zpool/${dataset}"; device = "zpool/${dataset}";
fsType = "zfs"; fsType = "zfs";
options = [ "zfsutil" ]; options = ["zfsutil"];
}; };
datasetEntries = listToAttrs (map datasetEntry datasets); datasetEntries = listToAttrs (map datasetEntry datasets);
@ -65,7 +69,9 @@ _: let
niri niri
]); ]);
fileSystems = datasetEntries // { fileSystems =
datasetEntries
// {
"/boot" = drives.boot.result; "/boot" = drives.boot.result;
}; };

View file

@ -1,7 +1,9 @@
{ pkgs, ... }: { _: {
projectRootFile = "flake.nix"; projectRootFile = "flake.nix";
programs = { programs = {
alejandra.enable = true; alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
terraform.enable = true; terraform.enable = true;
beautysh.enable = true; beautysh.enable = true;
}; };