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,12 +56,11 @@ ${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:.*"
"tile, class:battle\.net\.exe" "tile, class:battle\.net\.exe"
"renderunfocused, class:discord, initialTitle:Discord" "renderunfocused, class:discord, initialTitle:Discord"
@ -87,21 +86,23 @@ ${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 ( /*
x: let list.concat (list.generate (
ws = let x: let
c = (x + 1) / 10; ws = let
in c = (x + 1) / 10;
builtins.toString (x + 1 - (c * 10)); in
in [ builtins.toString (x + 1 - (c * 10));
"${toString x},monitor:DP-1" in [
"${toString (x + 10)},monitor:DP-2${commonOptions}" "${toString x},monitor:DP-1"
] "${toString (x + 10)},monitor:DP-2${commonOptions}"
) ]
10); )
10);
*/ */
env = [ env = [
"MOZ_ENABLE_WAYLAND,1" "MOZ_ENABLE_WAYLAND,1"
@ -141,9 +142,9 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
"$mod ALT, mouse:272, resizewindow" "$mod ALT, mouse:272, resizewindow"
]; ];
bindl = [ bindl = [
", XF86AudioPlay, exec, playerctl play-pause" ", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
]; ];
binde = [ binde = [
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
@ -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,9 +228,17 @@ ${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,136 +3,136 @@ _: {
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;
animation-duration: 0.5s; animation-duration: 0.5s;
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,10 +1,13 @@
{ 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 {
xsession.windowManager.i3.extraConfigEarly = '' xsession.windowManager.i3.extraConfigEarly = ''
${builtins.readFile theme} ${builtins.readFile theme}
''; '';
} }

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
@ -18,42 +17,46 @@ in {
]; ];
services.i3gopher.enable = true; services.i3gopher.enable = true;
xsession.windowManager.i3 = let xsession.windowManager.i3 = let
modifier = "Mod4"; modifier = "Mod4";
other_modifier = "Mod1"; other_modifier = "Mod1";
mod = modifier; mod = modifier;
mod2 = other_modifier; mod2 = other_modifier;
runCommand = "${config.programs.rofi.finalPackage}/bin/rofi -show combi -modes combi"; runCommand = "${config.programs.rofi.finalPackage}/bin/rofi -show combi -modes combi";
workspaceNames = { workspaceNames = {
"1" = " Term"; "1" = " Term";
"2" = " GW2"; "2" = " GW2";
"3" = " GW1"; "3" = " GW1";
"4" = " Web"; "4" = " Web";
"11" = " IM"; "11" = " IM";
"12" = " Web"; "12" = " Web";
"13" = " Media"; "13" = " Media";
"14" = " Music"; "14" = " Music";
}; };
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'";
actionMode = "(l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"; actionMode = "(l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
gapsMode = "Gaps: (o) outer, (i) inner"; gapsMode = "Gaps: (o) outer, (i) inner";
gapsOuterMode = "Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)"; gapsOuterMode = "Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)";
gapsInnerMode = "Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)"; gapsInnerMode = "Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)";
in { in {
enable = true; enable = true;
extraConfig = let extraConfig = let
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)]
displayBindingsStr = lib.concatLines displayBindings; ++ list.map (v: displayWorkspace "HDMI-0" (11 + v)) (list.range 1 12);
in '' displayBindingsStr = lib.concatLines displayBindings;
in ''
${displayBindingsStr} ${displayBindingsStr}
for_window [class="^steam_app_default$"] floating enable, fullscreen disable, resize set width 3840 px height 2132 px, move position center, border pixel 1 for_window [class="^steam_app_default$"] floating enable, fullscreen disable, resize set width 3840 px height 2132 px, move position center, border pixel 1
''; '';
@ -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 = {
@ -13,61 +13,61 @@
}; };
}; };
}; };
blocks = [ blocks = [
{ {
block = "cpu"; block = "cpu";
interval = 1; interval = 1;
} }
{ {
block = "load"; block = "load";
interval = 1; interval = 1;
format = " $icon $1m "; format = " $icon $1m ";
} }
{ {
block = "memory"; block = "memory";
format = " $icon $mem_used_percents.eng(w:2) $zram_comp_ratio "; format = " $icon $mem_used_percents.eng(w:2) $zram_comp_ratio ";
} }
{ {
block = "memory"; block = "memory";
format = " $icon_swap $swap_used_percents.eng(w:2) "; format = " $icon_swap $swap_used_percents.eng(w:2) ";
} }
{ {
block = "nvidia_gpu"; block = "nvidia_gpu";
format = " $icon $utilization $memory $temperature "; format = " $icon $utilization $memory $temperature ";
} }
{ {
block = "hueshift"; block = "hueshift";
} }
{ {
block = "music"; block = "music";
format = " $icon {$combo.str(max_w:60) $play |}"; format = " $icon {$combo.str(max_w:60) $play |}";
} }
{ {
block = "sound"; block = "sound";
format = " $icon {$volume.eng(w:2) |}"; format = " $icon {$volume.eng(w:2) |}";
} }
{ {
block = "notify"; block = "notify";
format = " $icon {($notification_count.eng(w:1)) |}"; format = " $icon {($notification_count.eng(w:1)) |}";
} }
{ {
block = "toggle"; block = "toggle";
command_on = "${pkgs.xorg.xset}/bin/xset -dpms"; command_on = "${pkgs.xorg.xset}/bin/xset -dpms";
command_off = "${pkgs.xorg.xset}/bin/xset +dpms"; command_off = "${pkgs.xorg.xset}/bin/xset +dpms";
format = " $icon DPMS "; format = " $icon DPMS ";
command_state = ''${pkgs.xorg.xset}/bin/xset q | ${pkgs.gnugrep}/bin/grep -F "DPMS is Disabled"''; command_state = ''${pkgs.xorg.xset}/bin/xset q | ${pkgs.gnugrep}/bin/grep -F "DPMS is Disabled"'';
icon_on = "caffeine_on"; icon_on = "caffeine_on";
icon_off = "caffeine_off"; icon_off = "caffeine_off";
state_on = "info"; state_on = "info";
} }
{ {
block = "time"; block = "time";
interval = 1; interval = 1;
format = " $icon $timestamp.datetime(f:'%F %T %Z') "; format = " $icon $timestamp.datetime(f:'%F %T %Z') ";
} }
]; ];
theme = "ctp-latte"; theme = "ctp-latte";
};
}; };
}; };
} };
}

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

@ -48,7 +48,7 @@
libksysguard libksysguard
systemsettings systemsettings
kcmutils kcmutils
pkgs.plasma-applet-commandoutput pkgs.plasma-applet-commandoutput
]; ];
programs.plasma = { programs.plasma = {
configFile = { configFile = {

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,145 +1,155 @@
{ 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 {
programs.niri.settings.binds = let programs.niri.settings.binds = let
bindWorkspace = key: workspace: { bindWorkspace = key: workspace: {
"Mod+${key}".action.focus-workspace = workspace; "Mod+${key}".action.focus-workspace = workspace;
"Mod+Ctrl+${key}".action.move-column-to-workspace = workspace; "Mod+Ctrl+${key}".action.move-column-to-workspace = workspace;
}; };
workspaceBindings = workspaceBindings =
list.map (v: bindWorkspace (builtins.toString v) v) (list.range 1 9) list.map (v: bindWorkspace (builtins.toString v) v) (list.range 1 9)
++ [ ++ [
( (
bindWorkspace "0" 10 bindWorkspace "0" 10
) )
]; ];
in mkMerge (workspaceBindings ++ [{ in
# Transcribed: https://github.com/sodiboo/niri-flake/issues/483 mkMerge (workspaceBindings
# thank you Pacman99 you chad :3 ++ [
"Mod+Q".action.close-window = {}; {
"Mod+O".action.toggle-overview = {}; # Transcribed: https://github.com/sodiboo/niri-flake/issues/483
# thank you Pacman99 you chad :3
"Mod+Q".action.close-window = {};
"Mod+O".action.toggle-overview = {};
"Mod+Left".action.focus-column-left = {}; "Mod+Left".action.focus-column-left = {};
"Mod+Down".action.focus-window-down = {}; "Mod+Down".action.focus-window-down = {};
"Mod+Up".action.focus-window-up = {}; "Mod+Up".action.focus-window-up = {};
"Mod+Right".action.focus-column-right = {}; "Mod+Right".action.focus-column-right = {};
"Mod+H".action.focus-column-left = {}; "Mod+H".action.focus-column-left = {};
"Mod+J".action.focus-window-down = {}; "Mod+J".action.focus-window-down = {};
"Mod+K".action.focus-window-up = {}; "Mod+K".action.focus-window-up = {};
"Mod+L".action.focus-column-right = {}; "Mod+L".action.focus-column-right = {};
"Mod+Ctrl+Left".action.move-column-left = {}; "Mod+Ctrl+Left".action.move-column-left = {};
"Mod+Ctrl+Down".action.move-window-down = {}; "Mod+Ctrl+Down".action.move-window-down = {};
"Mod+Ctrl+Up".action.move-window-up = {}; "Mod+Ctrl+Up".action.move-window-up = {};
"Mod+Ctrl+Right".action.move-column-right = {}; "Mod+Ctrl+Right".action.move-column-right = {};
"Mod+Ctrl+H".action.move-column-left = {}; "Mod+Ctrl+H".action.move-column-left = {};
"Mod+Ctrl+J".action.move-window-down = {}; "Mod+Ctrl+J".action.move-window-down = {};
"Mod+Ctrl+K".action.move-window-up = {}; "Mod+Ctrl+K".action.move-window-up = {};
"Mod+Ctrl+L".action.move-column-right = {}; "Mod+Ctrl+L".action.move-column-right = {};
"Mod+Home".action.focus-column-first = {}; "Mod+Home".action.focus-column-first = {};
"Mod+End".action.focus-column-last = {}; "Mod+End".action.focus-column-last = {};
"Mod+Ctrl+Home".action.move-column-to-first = {}; "Mod+Ctrl+Home".action.move-column-to-first = {};
"Mod+Ctrl+End".action.move-column-to-last = {}; "Mod+Ctrl+End".action.move-column-to-last = {};
"Mod+Shift+Left".action.focus-monitor-left = {}; "Mod+Shift+Left".action.focus-monitor-left = {};
"Mod+Shift+Down".action.focus-monitor-down = {}; "Mod+Shift+Down".action.focus-monitor-down = {};
"Mod+Shift+Up".action.focus-monitor-up = {}; "Mod+Shift+Up".action.focus-monitor-up = {};
"Mod+Shift+Right".action.focus-monitor-right = {}; "Mod+Shift+Right".action.focus-monitor-right = {};
"Mod+Shift+H".action.focus-monitor-left = {}; "Mod+Shift+H".action.focus-monitor-left = {};
"Mod+Shift+J".action.focus-monitor-down = {}; "Mod+Shift+J".action.focus-monitor-down = {};
"Mod+Shift+K".action.focus-monitor-up = {}; "Mod+Shift+K".action.focus-monitor-up = {};
"Mod+Shift+L".action.focus-monitor-right = {}; "Mod+Shift+L".action.focus-monitor-right = {};
"Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = {}; "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = {};
"Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = {}; "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = {};
"Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = {}; "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = {};
"Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = {}; "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = {};
"Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = {}; "Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = {};
"Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = {}; "Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = {};
"Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = {}; "Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = {};
"Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = {}; "Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = {};
"Mod+Page_Down".action.focus-workspace-down = {}; "Mod+Page_Down".action.focus-workspace-down = {};
"Mod+Page_Up".action.focus-workspace-up = {}; "Mod+Page_Up".action.focus-workspace-up = {};
"Mod+U".action.focus-workspace-down = {}; "Mod+U".action.focus-workspace-down = {};
"Mod+I".action.focus-workspace-up = {}; "Mod+I".action.focus-workspace-up = {};
"Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = {}; "Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = {};
"Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = {}; "Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = {};
"Mod+Ctrl+U".action.move-column-to-workspace-down = {}; "Mod+Ctrl+U".action.move-column-to-workspace-down = {};
"Mod+Ctrl+I".action.move-column-to-workspace-up = {}; "Mod+Ctrl+I".action.move-column-to-workspace-up = {};
"Mod+Shift+Page_Down".action.move-workspace-down = {}; "Mod+Shift+Page_Down".action.move-workspace-down = {};
"Mod+Shift+Page_Up".action.move-workspace-up = {}; "Mod+Shift+Page_Up".action.move-workspace-up = {};
"Mod+Shift+U".action.move-workspace-down = {}; "Mod+Shift+U".action.move-workspace-down = {};
"Mod+Shift+I".action.move-workspace-up = {}; "Mod+Shift+I".action.move-workspace-up = {};
"Mod+WheelScrollDown" = { "Mod+WheelScrollDown" = {
cooldown-ms = 150; cooldown-ms = 150;
action.focus-workspace-down = {}; action.focus-workspace-down = {};
}; };
"Mod+WheelScrollUp" = { "Mod+WheelScrollUp" = {
cooldown-ms = 150; cooldown-ms = 150;
action.focus-workspace-up = {}; action.focus-workspace-up = {};
}; };
"Mod+Ctrl+WheelScrollDown" = { "Mod+Ctrl+WheelScrollDown" = {
cooldown-ms = 150; cooldown-ms = 150;
action.move-column-to-workspace-down = {}; action.move-column-to-workspace-down = {};
}; };
"Mod+Ctrl+WheelScrollUp" = { "Mod+Ctrl+WheelScrollUp" = {
cooldown-ms = 150; cooldown-ms = 150;
action.move-column-to-workspace-up = {}; action.move-column-to-workspace-up = {};
}; };
"Mod+WheelScrollRight".action.focus-column-right = {}; "Mod+WheelScrollRight".action.focus-column-right = {};
"Mod+WheelScrollLeft".action.focus-column-left = {}; "Mod+WheelScrollLeft".action.focus-column-left = {};
"Mod+Ctrl+WheelScrollRight".action.move-column-right = {}; "Mod+Ctrl+WheelScrollRight".action.move-column-right = {};
"Mod+Ctrl+WheelScrollLeft".action.move-column-left = {}; "Mod+Ctrl+WheelScrollLeft".action.move-column-left = {};
"Mod+Shift+WheelScrollDown".action.focus-column-right = {}; "Mod+Shift+WheelScrollDown".action.focus-column-right = {};
"Mod+Shift+WheelScrollUp".action.focus-column-left = {}; "Mod+Shift+WheelScrollUp".action.focus-column-left = {};
"Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = {}; "Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = {};
"Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = {}; "Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = {};
"Mod+Comma".action.consume-window-into-column = {}; "Mod+Comma".action.consume-window-into-column = {};
"Mod+Period".action.expel-window-from-column = {}; "Mod+Period".action.expel-window-from-column = {};
"Mod+R".action.switch-preset-column-width = {}; "Mod+R".action.switch-preset-column-width = {};
"Mod+Shift+R".action.reset-window-height = {}; "Mod+Shift+R".action.reset-window-height = {};
"Mod+F".action.maximize-column = {}; "Mod+F".action.maximize-column = {};
"Mod+Shift+F".action.fullscreen-window = {}; "Mod+Shift+F".action.fullscreen-window = {};
"Mod+C".action.center-column = {}; "Mod+C".action.center-column = {};
"Mod+Minus".action.set-column-width = "-10%"; "Mod+Minus".action.set-column-width = "-10%";
"Mod+Equal".action.set-column-width = "+10%"; "Mod+Equal".action.set-column-width = "+10%";
"Mod+Shift+Minus".action.set-window-height = "-10%"; "Mod+Shift+Minus".action.set-window-height = "-10%";
"Mod+Shift+Equal".action.set-window-height = "+10%"; "Mod+Shift+Equal".action.set-window-height = "+10%";
"Print".action.screenshot = {}; "Print".action.screenshot = {};
"Ctrl+Print".action.screenshot-screen = {}; "Ctrl+Print".action.screenshot-screen = {};
"Alt+Print".action.screenshot-window = {}; "Alt+Print".action.screenshot-window = {};
# The quit action will show a confirmation dialog to avoid accidental exits. # The quit action will show a confirmation dialog to avoid accidental exits.
"Mod+Shift+E".action.quit = {}; "Mod+Shift+E".action.quit = {};
# Powers off the monitors. To turn them back on, do any input like # Powers off the monitors. To turn them back on, do any input like
# moving the mouse or pressing any other key. # moving the mouse or pressing any other key.
"Mod+Shift+P".action.power-off-monitors = {}; "Mod+Shift+P".action.power-off-monitors = {};
# Kat # Kat
"XF86AudioRaiseVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"]; "XF86AudioRaiseVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"];
"XF86AudioLowerVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"]; "XF86AudioLowerVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"];
"XF86AudioMute".action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"]; "XF86AudioMute".action.spawn = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"];
"XF86AudioPlay".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "play-pause"]; "XF86AudioPlay".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "play-pause"];
"XF86AudioNext".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "next"]; "XF86AudioNext".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "next"];
"XF86AudioPrev".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "prev"]; "XF86AudioPrev".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "prev"];
"Mod+T".action.spawn = ["${config.programs.wezterm.package}/bin/wezterm"]; "Mod+T".action.spawn = ["${config.programs.wezterm.package}/bin/wezterm"];
"Mod+D".action.spawn = ["${config.programs.wofi.package}/bin/wofi" "-t" "wezterm" "-IS" "drun"]; "Mod+D".action.spawn = ["${config.programs.wofi.package}/bin/wofi" "-t" "wezterm" "-IS" "drun"];
"Mod+Shift+D".action.spawn = ["${config.programs.wofi.package}/bin/wofi" "-t" "wezterm" "-IS" "run"]; "Mod+Shift+D".action.spawn = ["${config.programs.wofi.package}/bin/wofi" "-t" "wezterm" "-IS" "run"];
"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; [
@ -35,15 +40,15 @@ in {
}; };
focus-follows-mouse.enable = true; focus-follows-mouse.enable = true;
}; };
layout = { layout = {
background-color = config.palette.base.hex; background-color = config.palette.base.hex;
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,136 +3,136 @@ _: {
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;
animation-duration: 0.5s; animation-duration: 0.5s;
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,36 +3,34 @@ _: {
{ {
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-right = r;
bottom-left = r; top-left = r;
bottom-right = r; top-right = r;
top-left = r; };
top-right = r;
};
} }
{ {
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,5 +1,5 @@
_: { _: {
disabledModules = [ disabledModules = [
"services/window-managers/i3-sway/i3.nix" "services/window-managers/i3-sway/i3.nix"
]; ];
} }

View file

@ -1,5 +1,5 @@
{ 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; [
@ -27,18 +27,18 @@
}; };
}; };
userChrome = '' userChrome = ''
/* Hide horizontal tabs at the top of the window */ /* Hide horizontal tabs at the top of the window */
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar { #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar {
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
} }
#main-window #TabsToolbar { #main-window #TabsToolbar {
visibility: collapse !important; visibility: collapse !important;
} }
/* Hide the "Tree Style Tab" header at the top of the sidebar */ /* Hide the "Tree Style Tab" header at the top of the sidebar */
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
display: none; display: none;
} }
''; '';
}; };
} }

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,12 +15,14 @@ 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,28 +7,28 @@
enable = true; enable = true;
package = inputs.wezterm.outputs.packages.${pkgs.system}.default; package = inputs.wezterm.outputs.packages.${pkgs.system}.default;
extraConfig = '' extraConfig = ''
local wezterm = require 'wezterm'; local wezterm = require 'wezterm';
local config = {} local config = {}
config.font = wezterm.font_with_fallback({ config.font = wezterm.font_with_fallback({
"Monaspace Krypton", "Monaspace Krypton",
"JetBrains Mono", "JetBrains Mono",
"Noto Color Emoji", "Noto Color Emoji",
"Symbols Nerd Font Mono", "Symbols Nerd Font Mono",
}) })
config.window_padding = { config.window_padding = {
left = 8, left = 8,
right = 8, right = 8,
top = 8, top = 8,
bottom = 8, bottom = 8,
} }
config.use_fancy_tab_bar = true config.use_fancy_tab_bar = true
config.tab_bar_at_bottom = true config.tab_bar_at_bottom = true
config.hide_mouse_cursor_when_typing = false config.hide_mouse_cursor_when_typing = false
config.window_decorations = "TITLE | RESIZE" config.window_decorations = "TITLE | RESIZE"
config.warn_about_missing_glyphs = false config.warn_about_missing_glyphs = false
config.font_size = 12.0 config.font_size = 12.0
config.check_for_updates = false config.check_for_updates = false
return config return config
''; '';
}; };
} }

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,24 +98,24 @@ 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
packages' mkMerge [
{ packages'
nixdirfmt = "nixpkgs-fmt $(fd -e nix)"; {
dmesg = "dmesg -HP"; nixdirfmt = "nixpkgs-fmt $(fd -e nix)";
hg = "history 0 | rg"; dmesg = "dmesg -HP";
} hg = "history 0 | rg";
(mkIf pkgs.hostPlatform.isLinux { }
sys = "systemctl"; (mkIf pkgs.hostPlatform.isLinux {
sysu = "systemctl --user"; sys = "systemctl";
logu = "journalctl --user"; sysu = "systemctl --user";
log = "journalctl"; logu = "journalctl --user";
lg = "log --no-pager | rg"; log = "journalctl";
}) lg = "log --no-pager | rg";
]; })
];
localVariables = { localVariables = {
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold"; ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold";
ZSH_AUTOSUGGEST_USE_ASYNC = 1; ZSH_AUTOSUGGEST_USE_ASYNC = 1;

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,82 +84,118 @@ 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
(fontConfigStr fonts) with cfg.config; ([cfg.extraConfigEarly]
"floating_modifier ${floating.modifier}" ++ [
(windowBorderString window floating) (fontConfigStr fonts)
"hide_edge_borders ${window.hideEdgeBorders}" "floating_modifier ${floating.modifier}"
"focus_wrapping ${focus.wrapping}" (windowBorderString window floating)
"focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" "hide_edge_borders ${window.hideEdgeBorders}"
"focus_on_window_activation ${focus.newWindow}" "focus_wrapping ${focus.wrapping}"
"mouse_warping ${if focus.mouseWarping then "output" else "none"}" "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}"
"workspace_layout ${workspaceLayout}" "focus_on_window_activation ${focus.newWindow}"
"workspace_auto_back_and_forth ${ "mouse_warping ${
lib.hm.booleans.yesNo workspaceAutoBackAndForth if focus.mouseWarping
}" then "output"
"client.focused ${colorSetStr colors.focused}" else "none"
"client.focused_inactive ${colorSetStr colors.focusedInactive}" }"
"client.unfocused ${colorSetStr colors.unfocused}" "workspace_layout ${workspaceLayout}"
"client.urgent ${colorSetStr colors.urgent}" "workspace_auto_back_and_forth ${
"client.placeholder ${colorSetStr colors.placeholder}" lib.hm.booleans.yesNo workspaceAutoBackAndForth
"client.background ${colors.background}" }"
(keybindingsStr { keybindings = keybindingDefaultWorkspace; }) "client.focused ${colorSetStr colors.focused}"
(keybindingsStr { keybindings = keybindingsRest; }) "client.focused_inactive ${colorSetStr colors.focusedInactive}"
(keycodebindingsStr keycodebindings) "client.unfocused ${colorSetStr colors.unfocused}"
] ++ mapAttrsToList (modeStr false) modes "client.urgent ${colorSetStr colors.urgent}"
++ mapAttrsToList assignStr assigns ++ map barStr bars "client.placeholder ${colorSetStr colors.placeholder}"
++ optional (gaps != null) gapsStr "client.background ${colors.background}"
++ map floatingCriteriaStr floating.criteria (keybindingsStr {keybindings = keybindingDefaultWorkspace;})
++ map windowCommandsStr window.commands ++ map startupEntryStr startup (keybindingsStr {keybindings = keybindingsRest;})
++ map workspaceOutputStr workspaceOutputAssign) (keycodebindingsStr keycodebindings)
else ]
[ ]) ++ [ cfg.extraConfig ])); ++ mapAttrsToList (modeStr false) modes
++ mapAttrsToList assignStr assigns
++ map barStr bars
++ optional (gaps != null) gapsStr
++ map floatingCriteriaStr floating.criteria
++ map windowCommandsStr window.commands
++ map startupEntryStr startup
++ map workspaceOutputStr workspaceOutputAssign)
else []
)
++ [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
# A zero exit code means i3 successfully validated the configuration
i3 -c ${configFile} -C -d all || {
echo "i3 configuration validation failed"
echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'"
exit 1
};
cp ${configFile} $out
'';
# A zero exit code means i3 successfully validated the configuration
i3 -c ${configFile} -C -d all || {
echo "i3 configuration validation failed"
echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'"
exit 1
};
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,43 +207,45 @@ 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 = [ {
(hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs assertions = [
platforms.linux) (hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs
]; platforms.linux)
];
home.packages = [ cfg.package ]; home.packages = [cfg.package];
xsession.windowManager.command = "${cfg.package}/bin/i3"; xsession.windowManager.command = "${cfg.package}/bin/i3";
xdg.configFile."i3/config" = { xdg.configFile."i3/config" = {
source = checkI3Config; source = checkI3Config;
onChange = '' onChange = ''
# There may be several sockets after log out/log in, but the old ones # There may be several sockets after log out/log in, but the old ones
# will fail with "Connection refused". # will fail with "Connection refused".
for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do
if [[ -S $i3Socket ]]; then if [[ -S $i3Socket ]]; then
${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true
fi fi
done done
''; '';
}; };
} }
(mkIf (cfg.config != null) { (mkIf (cfg.config != null) {
warnings = (optional (isList cfg.config.fonts) warnings =
"Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") (optional (isList cfg.config.fonts)
++ flatten (map (b: "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.")
optional (isList b.fonts) ++ flatten (map (b:
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") optional (isList b.fonts)
cfg.config.bars) ++ [ "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.")
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."
@ -200,46 +254,46 @@ in {
("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, " ("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, "
+ "use 'xsession.windowManager.i3.config.focus.wrapping' instead.")) + "use 'xsession.windowManager.i3.config.focus.wrapping' instead."))
]; ];
}) })
])) ]))
{xsession.windowManager.i3.config.keybindings = mapAttrs (n: mkOptionDefault) { {
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; xsession.windowManager.i3.config.keybindings = mapAttrs (_n: mkOptionDefault) {
"${cfg.config.modifier}+Shift+q" = "kill"; "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; "${cfg.config.modifier}+Shift+q" = "kill";
"${cfg.config.modifier}+d" = "exec ${cfg.config.menu}";
"${cfg.config.modifier}+Left" = "focus left"; "${cfg.config.modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down"; "${cfg.config.modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up"; "${cfg.config.modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right"; "${cfg.config.modifier}+Right" = "focus right";
"${cfg.config.modifier}+Shift+Left" = "move left"; "${cfg.config.modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down"; "${cfg.config.modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up"; "${cfg.config.modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right"; "${cfg.config.modifier}+Shift+Right" = "move right";
"${cfg.config.modifier}+h" = "split h"; "${cfg.config.modifier}+h" = "split h";
"${cfg.config.modifier}+v" = "split v"; "${cfg.config.modifier}+v" = "split v";
"${cfg.config.modifier}+f" = "fullscreen toggle"; "${cfg.config.modifier}+f" = "fullscreen toggle";
"${cfg.config.modifier}+s" = "layout stacking"; "${cfg.config.modifier}+s" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed"; "${cfg.config.modifier}+w" = "layout tabbed";
"${cfg.config.modifier}+e" = "layout toggle split"; "${cfg.config.modifier}+e" = "layout toggle split";
"${cfg.config.modifier}+Shift+space" = "floating toggle"; "${cfg.config.modifier}+Shift+space" = "floating toggle";
"${cfg.config.modifier}+space" = "focus mode_toggle"; "${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+a" = "focus parent"; "${cfg.config.modifier}+a" = "focus parent";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad"; "${cfg.config.modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show"; "${cfg.config.modifier}+minus" = "scratchpad show";
"${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,36 +1,45 @@
{
cfg,
config,
lib,
moduleName,
}:
with lib; rec {
criteriaStr = criteria: let
toCriteria = k: v:
if builtins.isBool v
then
(
if v
then "${k}"
else ""
)
else ''${k}="${v}"'';
in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]";
{ cfg, config, lib, moduleName }: keybindingDefaultWorkspace = filterAttrs (_n: v:
with lib;
rec {
criteriaStr = criteria:
let
toCriteria = k: v:
if builtins.isBool v then
(if v then "${k}" else "")
else
''${k}="${v}"'';
in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]";
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:
optionalString (action != null) "bindcode ${keycomb} ${action}") optionalString (action != null) "bindcode ${keycomb} ${action}")
keycodebindings); keycodebindings);
colorSetStr = c: colorSetStr = c:
concatStringsSep " " [ concatStringsSep " " [
@ -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 " "
else (remove "" ["font" "pango:${concatStringsSep ", " names}" style size]);
toFontStr { in
inherit (fontCfg) names style; fontCfg:
size = toString fontCfg.size; if isList fontCfg
}; then toFontStr {names = fontCfg;}
else
toFontStr {
inherit (fontCfg) names style;
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}")
@ -87,12 +115,12 @@ rec {
(optionalString (workspaceButtons != null) (optionalString (workspaceButtons != null)
"workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}")
(optionalString (workspaceNumbers != null) "strip_workspace_numbers ${ (optionalString (workspaceNumbers != null) "strip_workspace_numbers ${
lib.hm.booleans.yesNo (!workspaceNumbers) lib.hm.booleans.yesNo (!workspaceNumbers)
}") }")
(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}";
in ''workspace "${item.workspace}" output ${outputs}''; workspaceOutputStr = item: let
outputs = concatMapStringsSep " " strings.escapeNixString item.output;
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,56 +46,65 @@ let
}; };
startupModule = types.submodule { startupModule = types.submodule {
options = { options =
command = mkOption { {
type = types.str; command = mkOption {
description = "Command that will be executed on startup."; type = types.str;
}; description = "Command that will be executed on startup.";
};
always = mkOption { always = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Whether to run command on each ${moduleName} restart."; description = "Whether to run command on each ${moduleName} restart.";
}; };
} // optionalAttrs isI3 { }
notification = mkOption { // optionalAttrs isI3 {
type = types.bool; notification = mkOption {
default = true; type = types.bool;
description = '' default = true;
Whether to enable startup-notification support for the command. description = ''
See {option}`--no-startup-id` option description in the i3 user guide. Whether to enable startup-notification support for the command.
''; See {option}`--no-startup-id` option description in the i3 user guide.
}; '';
};
workspace = mkOption { workspace = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Launch application on a particular workspace. DEPRECATED: Launch application on a particular workspace. DEPRECATED:
Use [](#opt-xsession.windowManager.i3.config.assigns) Use [](#opt-xsession.windowManager.i3.config.assigns)
instead. See <https://github.com/nix-community/home-manager/issues/265>. instead. See <https://github.com/nix-community/home-manager/issues/265>.
''; '';
};
}; };
};
}; };
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,
type = types.nullOr type; default,
default = if versionAtLeast2009 then null else default; ...
defaultText = literalExpression '' } @ args:
null for state version 20.09, as example otherwise mkOption (args
''; // {
example = default; type = types.nullOr type;
}); default =
if versionAtLeast2009
then null
else default;
defaultText = literalExpression ''
null for state version 20.09, as example otherwise
'';
example = default;
});
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,17 +414,20 @@ 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 =
true for state version 23.05 if isI3
config.gaps == null for state version < 23.05 then ''
'' else '' true for state version 23.05
true for state version 23.05 config.gaps == null for state version < 23.05
false for state version < 23.05 ''
''; else ''
true for state version 23.05
false for state version < 23.05
'';
description = "Whether to show window titlebars."; description = "Whether to show window titlebars.";
}; };
@ -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"; {
criteria = { class = "XTerm"; }; command = "border pixel 1";
}]; criteria = {class = "XTerm";};
}
];
}; };
}; };
}; };
default = { }; default = {};
description = "Window titlebar and border settings."; description = "Window titlebar and border settings.";
}; };
@ -455,17 +474,20 @@ 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 =
true for state version 23.05 if isI3
config.gaps == null for state version < 23.05 then ''
'' else '' true for state version 23.05
true for state version 23.05 config.gaps == null for state version < 23.05
false for state version < 23.05 ''
''; else ''
true for state version 23.05
false for state version < 23.05
'';
description = "Whether to show floating window titlebars."; description = "Whether to show floating window titlebars.";
}; };
@ -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"; {
# the sway module's logic was inverted and incorrect, i3 =
# so preserve it for backwards compatibility purposes if cfg.config.focus.forceWrapping
sway = if cfg.config.focus.forceWrapping then "yes" else "no"; then "force"
}.${moduleName}; else "yes";
# the sway module's logic was inverted and incorrect,
# so preserve it for backwards compatibility purposes
sway =
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,50 +747,54 @@ in {
bars = mkOption { bars = mkOption {
type = types.listOf barModule; type = types.listOf barModule;
default = if versionAtLeast stateVersion "20.09" then [{ default =
mode = "dock"; if versionAtLeast stateVersion "20.09"
hiddenState = "hide"; then [
position = "bottom"; {
workspaceButtons = true; mode = "dock";
workspaceNumbers = true; hiddenState = "hide";
statusCommand = "${pkgs.i3status}/bin/i3status"; position = "bottom";
fonts = { workspaceButtons = true;
names = [ "monospace" ]; workspaceNumbers = true;
size = 8.0; statusCommand = "${pkgs.i3status}/bin/i3status";
}; fonts = {
trayOutput = "primary"; names = ["monospace"];
colors = { size = 8.0;
background = "#000000"; };
statusline = "#ffffff"; trayOutput = "primary";
separator = "#666666"; colors = {
focusedWorkspace = { background = "#000000";
border = "#4c7899"; statusline = "#ffffff";
background = "#285577"; separator = "#666666";
text = "#ffffff"; focusedWorkspace = {
}; border = "#4c7899";
activeWorkspace = { background = "#285577";
border = "#333333"; text = "#ffffff";
background = "#5f676a"; };
text = "#ffffff"; activeWorkspace = {
}; border = "#333333";
inactiveWorkspace = { background = "#5f676a";
border = "#333333"; text = "#ffffff";
background = "#222222"; };
text = "#888888"; inactiveWorkspace = {
}; border = "#333333";
urgentWorkspace = { background = "#222222";
border = "#2f343a"; text = "#888888";
background = "#900000"; };
text = "#ffffff"; urgentWorkspace = {
}; border = "#2f343a";
bindingMode = { background = "#900000";
border = "#2f343a"; text = "#ffffff";
background = "#900000"; };
text = "#ffffff"; bindingMode = {
}; border = "#2f343a";
}; background = "#900000";
}] else text = "#ffffff";
[ { } ]; };
};
}
]
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,28 +803,30 @@ 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 =
literalExpression '' if isI3
[ then
{ command = "systemctl --user restart polybar"; always = true; notification = false; } literalExpression ''
{ command = "dropbox start"; notification = false; } [
{ command = "firefox"; } { command = "systemctl --user restart polybar"; always = true; notification = false; }
]; { command = "dropbox start"; notification = false; }
'' { command = "firefox"; }
else ];
literalExpression '' ''
[ else
{ command = "systemctl --user restart waybar"; always = true; } literalExpression ''
{ command = "dropbox start"; } [
{ command = "firefox"; } { command = "systemctl --user restart waybar"; always = true; }
] { command = "dropbox start"; }
''; { command = "firefox"; }
]
'';
}; };
gaps = mkOption { gaps = mkOption {
@ -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,35 +949,38 @@ in {
}; };
workspaceOutputAssign = mkOption { workspaceOutputAssign = mkOption {
type = with types; type = with types; let
let workspaceOutputOpts = submodule {
workspaceOutputOpts = submodule { options = {
options = { workspace = mkOption {
workspace = mkOption { type = str;
type = str; default = "";
default = ""; example = "Web";
example = "Web"; description = ''
description = '' Name of the workspace to assign.
Name of the workspace to assign. '';
''; };
};
output = mkOption { output = mkOption {
type = with types; either str (listOf str); type = with types; either str (listOf str);
default = ""; default = "";
apply = lists.toList; apply = lists.toList;
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; };
default = [ ]; in
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,5 +1,5 @@
{ 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,7 +1,11 @@
{ pkgs, inputs, ... }: { {
pkgs,
inputs,
...
}: {
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
withUWSM = true; withUWSM = true;
package = inputs.hyprland.packages."${pkgs.system}".hyprland; package = inputs.hyprland.packages."${pkgs.system}".hyprland;
portalPackage = inputs.hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland; portalPackage = inputs.hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland;
}; };
@ -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,38 +1,44 @@
{ config, lib, ... }: let {
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault; inherit (lib.modules) mkIf mkDefault;
in { in {
gensokyo-zone = { gensokyo-zone = {
access = { access = {
tail.enable = mkDefault true; tail.enable = mkDefault true;
local.enable = mkDefault (config.networking.hostName == "goliath"); local.enable = mkDefault (config.networking.hostName == "goliath");
}; };
nix = { nix = {
# enable = true; # enable = true;
#cache.infrastructure.enable = true; #cache.infrastructure.enable = true;
# builder.enable = true; # builder.enable = true;
}; };
kyuuto = { kyuuto = {
enable = mkDefault true;
shared.enable = mkDefault true;
#domain = mkIf config.gensokyo-zone.access.local.enable "local.${domain}";
};
/*
krb5 = {
enable = mkDefault true;
sssd = {
enable = mkDefault true; enable = mkDefault true;
shared.enable = mkDefault true; # TODO: sssd ldap backend config is currently broken for unknown reasons
#domain = mkIf config.gensokyo-zone.access.local.enable "local.${domain}"; # EDIT: wait ifp was disabled maybe it's actually just fine and I'm dumb?
}; backend = "ipa";
/*krb5 = {
enable = mkDefault true;
sssd = {
enable = mkDefault true;
# TODO: sssd ldap backend config is currently broken for unknown reasons
# EDIT: wait ifp was disabled maybe it's actually just fine and I'm dumb?
backend = "ipa";
};
nfs.enable = mkDefault true;
#nfs.debug.enable = true;
ipa.enable = mkDefault true;
};*/
dns = {
enable = mkDefault true;
};
monitoring = {
enable = mkIf config.gensokyo-zone.access.local.enable (mkDefault true);
}; };
nfs.enable = mkDefault true;
#nfs.debug.enable = true;
ipa.enable = mkDefault true;
};
*/
dns = {
enable = mkDefault true;
};
monitoring = {
enable = mkIf config.gensokyo-zone.access.local.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

@ -1,3 +1,3 @@
_: { _: {
services.mullvad-vpn.enable = true; services.mullvad-vpn.enable = true;
} }

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,11 +33,11 @@
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,2 +1,2 @@
_: { _: {
} }

View file

@ -5,10 +5,10 @@ _: {
}; };
consoleLogLevel = 0; consoleLogLevel = 0;
kernelParams = ["quiet"]; kernelParams = ["quiet"];
initrd = { initrd = {
verbose = false; verbose = false;
systemd.enable = true; systemd.enable = true;
}; };
}; };
catppuccin.plymouth.enable = true; catppuccin.plymouth.enable = true;
} }

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,165 +28,163 @@ 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: {
pname = "dorion";
version = "6.7.1";
rustPlatform.buildRustPackage (finalAttrs: { src = fetchFromGitHub {
pname = "dorion"; owner = "SpikeHD";
version = "6.7.1"; repo = "Dorion";
tag = "v${finalAttrs.version}";
hash = "sha256-d4G3royqhz+te5wPWVLNqqG/w0qOvTd7dKcWSzxUMUo=";
};
src = fetchFromGitHub { cargoPatches = [
owner = "SpikeHD"; ./no-cargo-patch.patch
repo = "Dorion"; ];
tag = "v${finalAttrs.version}";
hash = "sha256-d4G3royqhz+te5wPWVLNqqG/w0qOvTd7dKcWSzxUMUo=";
};
cargoPatches = [ cargoRoot = "src-tauri";
./no-cargo-patch.patch buildAndTestSubdir = finalAttrs.cargoRoot;
];
cargoRoot = "src-tauri"; useFetchCargoVendor = true;
buildAndTestSubdir = finalAttrs.cargoRoot; cargoHash = "sha256-1xpAJkS31DjrZCY5WJ4/Z1t1ALED5gz7xYLhVR1Qzww=";
useFetchCargoVendor = true; pnpmDeps = pnpm_9.fetchDeps {
cargoHash = "sha256-1xpAJkS31DjrZCY5WJ4/Z1t1ALED5gz7xYLhVR1Qzww="; inherit (finalAttrs) pname version src;
hash = "sha256-xBonUzA4+1zbViEsKap6CaG6ZRldW1LjNYIB+FmVRFs=";
};
pnpmDeps = pnpm_9.fetchDeps { # CMake (webkit extension)
inherit (finalAttrs) pname version src; cmakeDir = ".";
hash = "sha256-xBonUzA4+1zbViEsKap6CaG6ZRldW1LjNYIB+FmVRFs="; cmakeBuildDir = "src-tauri/extension_webkit";
}; dontUseCmakeConfigure = true;
dontUseNinjaBuild = true;
dontUseNinjaCheck = true;
dontUseNinjaInstall = true;
# cmake's supposed to set this automatically
# ... but the detection is based on the presence of ninja build hook
cmakeFlags = [
"-GNinja"
];
# CMake (webkit extension) nativeBuildInputs = [
cmakeDir = "."; pnpm_9.configHook
cmakeBuildDir = "src-tauri/extension_webkit"; cargo-tauri.hook
dontUseCmakeConfigure = true; nodejs
dontUseNinjaBuild = true; pkg-config
dontUseNinjaCheck = true; wrapGAppsHook4
dontUseNinjaInstall = true; yq-go
# cmake's supposed to set this automatically desktop-file-utils
# ... but the detection is based on the presence of ninja build hook cmake
cmakeFlags = [ ninja
"-GNinja" ];
];
nativeBuildInputs = [ buildInputs = [
pnpm_9.configHook openssl
cargo-tauri.hook webkitgtk_4_1'
nodejs gst_all_1.gst-plugins-base
pkg-config gst_all_1.gst-plugins-bad
wrapGAppsHook4 gst_all_1.gst-plugins-good
yq-go gst_all_1.gst-plugins-rs
desktop-file-utils glib-networking
cmake libsysprof-capture
ninja libayatana-appindicator
]; ];
buildInputs = [ postPatch = ''
openssl # remove updater
webkitgtk_4_1' rm -rf updater
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-rs
glib-networking
libsysprof-capture
libayatana-appindicator
];
postPatch = '' # patch cargo-deps
# remove updater pushd $cargoDepsCopy/tauri-plugin-shell-*
rm -rf updater patch -p1 < /build/source/src-tauri/patches/tauri-plugin-shell+*.patch
popd
# patch cargo-deps substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
pushd $cargoDepsCopy/tauri-plugin-shell-* --replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
patch -p1 < /build/source/src-tauri/patches/tauri-plugin-shell+*.patch
popd
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \ # disable pre-build script and disable auto-updater
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" yq -iPo=json '
.bundle.resources = (.bundle.resources | map(select(. != "updater*")))
' src-tauri/tauri.conf.json
# disable pre-build script and disable auto-updater # link shelter injection
yq -iPo=json ' ln -s ${shelter} src-tauri/injection/shelter.js
.bundle.resources = (.bundle.resources | map(select(. != "updater*")))
' src-tauri/tauri.conf.json
# link shelter injection # link html/frontend data
ln -s ${shelter} src-tauri/injection/shelter.js ln -s /build/source/src /build/source/src-tauri/html
# link html/frontend data
ln -s /build/source/src /build/source/src-tauri/html
'';
configurePhase = ''
cmakeConfigurePhase
pnpmConfigHook
'';
buildPhase = ''
ninjaBuildPhase
cd /build/source
tauriBuildHook
'';
postInstall = ''
# Set up the resource directories
mkdir -p $out/lib/Dorion
ln -s $out/lib/Dorion $out/lib/dorion
rm -rf $out/lib/Dorion/injection
cp -r src-tauri/injection $out/lib/Dorion
cp -r src $out/lib/Dorion
# Modify the desktop file
desktop-file-edit \
--set-comment "Tiny alternative Discord client" \
--set-key="Exec" --set-value="Dorion %U" \
--set-key="TryExec" --set-value="Dorion" \
--set-key="StartupWMClass" --set-value="Dorion" \
--set-key="StartupNotify" --set-value="true" \
--set-key="Categories" --set-value="Network;InstantMessaging;Chat;" \
--set-key="Keywords" --set-value="dorion;discord;vencord;chat;im;vc;ds;dc;dsc;tauri;" \
--set-key="Terminal" --set-value="false" \
--set-key="MimeType" --set-value="x-scheme-handler/discord" \
$out/share/applications/Dorion.desktop
'';
# error: failed to run custom build command for `Dorion v6.5.3 (/build/source/src-tauri)`
# Permission denied (os error 13)
doCheck = false;
env = {
TAURI_RESOURCE_DIR = "${placeholder "out"}/lib";
};
meta = {
homepage = "https://spikehd.github.io/projects/dorion/";
description = "Tiny alternative Discord client";
longDescription = ''
Dorion is an alternative Discord client aimed towards lower-spec or
storage-sensitive PCs that supports themes, plugins, and more!
''; '';
changelog = "https://github.com/SpikeHD/Dorion/releases/tag/v${finalAttrs.version}";
downloadPage = "https://github.com/SpikeHD/Dorion/releases/tag/v${finalAttrs.version}";
license = with lib.licenses; [
gpl3Only
cc0 # Shelter
];
mainProgram = "Dorion";
maintainers = with lib.maintainers; [
nyabinary
aleksana
griffi-gh
getchoo
];
platforms = lib.platforms.linux;
sourceProvenance = [
lib.sourceTypes.binaryBytecode # actually, minified JS
lib.sourceTypes.fromSource
];
};
})
configurePhase = ''
cmakeConfigurePhase
pnpmConfigHook
'';
buildPhase = ''
ninjaBuildPhase
cd /build/source
tauriBuildHook
'';
postInstall = ''
# Set up the resource directories
mkdir -p $out/lib/Dorion
ln -s $out/lib/Dorion $out/lib/dorion
rm -rf $out/lib/Dorion/injection
cp -r src-tauri/injection $out/lib/Dorion
cp -r src $out/lib/Dorion
# Modify the desktop file
desktop-file-edit \
--set-comment "Tiny alternative Discord client" \
--set-key="Exec" --set-value="Dorion %U" \
--set-key="TryExec" --set-value="Dorion" \
--set-key="StartupWMClass" --set-value="Dorion" \
--set-key="StartupNotify" --set-value="true" \
--set-key="Categories" --set-value="Network;InstantMessaging;Chat;" \
--set-key="Keywords" --set-value="dorion;discord;vencord;chat;im;vc;ds;dc;dsc;tauri;" \
--set-key="Terminal" --set-value="false" \
--set-key="MimeType" --set-value="x-scheme-handler/discord" \
$out/share/applications/Dorion.desktop
'';
# error: failed to run custom build command for `Dorion v6.5.3 (/build/source/src-tauri)`
# Permission denied (os error 13)
doCheck = false;
env = {
TAURI_RESOURCE_DIR = "${placeholder "out"}/lib";
};
meta = {
homepage = "https://spikehd.github.io/projects/dorion/";
description = "Tiny alternative Discord client";
longDescription = ''
Dorion is an alternative Discord client aimed towards lower-spec or
storage-sensitive PCs that supports themes, plugins, and more!
'';
changelog = "https://github.com/SpikeHD/Dorion/releases/tag/v${finalAttrs.version}";
downloadPage = "https://github.com/SpikeHD/Dorion/releases/tag/v${finalAttrs.version}";
license = with lib.licenses; [
gpl3Only
cc0 # Shelter
];
mainProgram = "Dorion";
maintainers = with lib.maintainers; [
nyabinary
aleksana
griffi-gh
getchoo
];
platforms = lib.platforms.linux;
sourceProvenance = [
lib.sourceTypes.binaryBytecode # actually, minified JS
lib.sourceTypes.fromSource
];
};
})

View file

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

View file

@ -8,73 +8,73 @@ SYSTEM_TYPE=${3:-""}
# Helper functions # Helper functions
send_discord_message() { send_discord_message() {
local message="$1" local message="$1"
if [[ -n "$DISCORD_WEBHOOK_LINK" ]]; then if [[ -n "$DISCORD_WEBHOOK_LINK" ]]; then
local escaped_message=$(printf '%s' "$message" | jq -R -s '.') local escaped_message=$(printf '%s' "$message" | jq -R -s '.')
curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ curl -s -H "Accept: application/json" -H "Content-Type: application/json" \
-X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK"
else else
echo "Discord message (not sent): $message" echo "Discord message (not sent): $message"
fi fi
} }
init_nfargs() { init_nfargs() {
local nflinksuffix="-L" local nflinksuffix="-L"
nfargs=( nfargs=(
"${NIX_BUILD_ARGS[@]}" "${NIX_BUILD_ARGS[@]}"
)
if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then
nfargs+=(
-o "${NF_ACTIONS_TEST_OUTLINK-result}" "$nflinksuffix"
) )
else
if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then nfargs+=(
nfargs+=( --no-link
-o "${NF_ACTIONS_TEST_OUTLINK-result}" "$nflinksuffix" )
) fi
else
nfargs+=(
--no-link
)
fi
} }
perform_cachix_push() { perform_cachix_push() {
local nflinksuffix="-L" local nflinksuffix="-L"
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
send_discord_message "Cachix pushing ${SYSTEM_TYPE} system build for ${ALIAS}" send_discord_message "Cachix pushing ${SYSTEM_TYPE} system build for ${ALIAS}"
cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/ cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/
fi fi
} }
perform_garbage_collection() { perform_garbage_collection() {
if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then
nix-collect-garbage -d nix-collect-garbage -d
fi fi
} }
# Main script # Main script
if [[ -z "$SYSTEM_LINK" || -z "$ALIAS" || -z "$SYSTEM_TYPE" ]]; then if [[ -z "$SYSTEM_LINK" || -z "$ALIAS" || -z "$SYSTEM_TYPE" ]]; then
echo "Usage: $0 <SYSTEM_LINK> <ALIAS> <SYSTEM_TYPE>" >&2 echo "Usage: $0 <SYSTEM_LINK> <ALIAS> <SYSTEM_TYPE>" >&2
exit 1 exit 1
fi fi
send_discord_message "Starting ${SYSTEM_TYPE} system build for ${ALIAS}" send_discord_message "Starting ${SYSTEM_TYPE} system build for ${ALIAS}"
if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then
export NF_UPDATE_CACHIX_PUSH=1 export NF_UPDATE_CACHIX_PUSH=1
fi fi
cd "$NF_CONFIG_ROOT" cd "$NF_CONFIG_ROOT"
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result} export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result}
fi fi
if [[ ${GITHUB_ACTIONS-} = true && ${RUNNER_NAME-} = "Github Actions"* ]]; then if [[ ${GITHUB_ACTIONS-} = true && ${RUNNER_NAME-} = "Github Actions"* ]]; then
echo "Enabled GC between builds due to restricted disk space..." >&2 echo "Enabled GC between builds due to restricted disk space..." >&2
export NF_ACTIONS_TEST_GC=1 export NF_ACTIONS_TEST_GC=1
fi fi
NIX_BUILD_ARGS=( NIX_BUILD_ARGS=(
--show-trace --show-trace
) )
NIX_BUILD_ARGS_ASYNC=() NIX_BUILD_ARGS_ASYNC=()
@ -84,37 +84,37 @@ init_nfargs
nfwarn= nfwarn=
if [[ -n "${NF_NIX_SYSTEMS_WARN-}" && " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then if [[ -n "${NF_NIX_SYSTEMS_WARN-}" && " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then
nfwarn=1 nfwarn=1
fi fi
if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then
NIX_BUILD_ARGS_ASYNC+=("$nfinstallable") NIX_BUILD_ARGS_ASYNC+=("$nfinstallable")
else else
echo "Building ${nfsystem}..." >&2 echo "Building ${nfsystem}..." >&2
echo >&2 echo >&2
if ! nix build "$nfinstallable" "${nfargs[@]}"; then if ! nix build "$nfinstallable" "${nfargs[@]}"; then
if [[ -n $nfwarn ]]; then if [[ -n $nfwarn ]]; then
send_discord_message "Build failure allowed for ${nfsystem}, ignoring..." send_discord_message "Build failure allowed for ${nfsystem}, ignoring..."
echo "Build failure allowed for ${nfsystem}, ignoring..." >&2 echo "Build failure allowed for ${nfsystem}, ignoring..." >&2
else
send_discord_message "Build failure for ${nfsystem}, problem!"
exit 1
fi
else else
send_discord_message "${SYSTEM_TYPE} system build of ${ALIAS} succeeded!" send_discord_message "Build failure for ${nfsystem}, problem!"
perform_cachix_push exit 1
perform_garbage_collection
fi fi
else
send_discord_message "${SYSTEM_TYPE} system build of ${ALIAS} succeeded!"
perform_cachix_push
perform_garbage_collection
fi
fi fi
if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then
init_nfargs init_nfargs
if nix build "${nfargs[@]}" "${NIX_BUILD_ARGS_ASYNC[@]}"; then if nix build "${nfargs[@]}" "${NIX_BUILD_ARGS_ASYNC[@]}"; then
perform_cachix_push perform_cachix_push
perform_garbage_collection perform_garbage_collection
else else
send_discord_message "Async build failure for ${nfsystem}, problem!" send_discord_message "Async build failure for ${nfsystem}, problem!"
exit 1 exit 1
fi fi
fi fi

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

@ -5,14 +5,14 @@ DISCORD_WEBHOOK_LINK=${DISCORD_WEBHOOK_LINK:-""}
# Helper functions # Helper functions
send_discord_message() { send_discord_message() {
local message="$1" local message="$1"
local escaped_message=$(printf '%s' "$message" | jq -R -s '.') local escaped_message=$(printf '%s' "$message" | jq -R -s '.')
curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ curl -s -H "Accept: application/json" -H "Content-Type: application/json" \
-X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK"
} }
if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then
export NF_UPDATE_CACHIX_PUSH=1 export NF_UPDATE_CACHIX_PUSH=1
fi fi
cd "$NF_CONFIG_ROOT" cd "$NF_CONFIG_ROOT"
@ -22,48 +22,48 @@ send_discord_message "Beginning flake update cron job"
nix flake update "$@" nix flake update "$@"
if [[ -n $(git status --porcelain ./flake.lock) ]]; then if [[ -n $(git status --porcelain ./flake.lock) ]]; then
git -P diff ./flake.lock git -P diff ./flake.lock
else else
echo "no source changes" >&2 echo "no source changes" >&2
exit exit
fi fi
echo "checking that nodes still build..." >&2 echo "checking that nodes still build..." >&2
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result} export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result}
fi fi
if [[ -z ${NF_UPDATE_SKIP-} ]]; then if [[ -z ${NF_UPDATE_SKIP-} ]]; then
send_discord_message "checking that nodes still build..." send_discord_message "checking that nodes still build..."
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result} export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result}
fi fi
nix run .#nf-actions-test -- -L nix run .#nf-actions-test -- -L
fi fi
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} && -v NF_ACTIONS_TEST_OUTLINK ]]; then if [[ -n ${NF_UPDATE_CACHIX_PUSH-} && -v NF_ACTIONS_TEST_OUTLINK ]]; then
send_discord_message "Cachix pushing" send_discord_message "Cachix pushing"
cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK}"*/ & cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK}"*/ &
CACHIX_PUSH=$! CACHIX_PUSH=$!
fi fi
if [[ -z ${NF_UPDATE_GIT_COMMIT-} ]]; then if [[ -z ${NF_UPDATE_GIT_COMMIT-} ]]; then
wait ${CACHIX_PUSH-} wait ${CACHIX_PUSH-}
exit exit
fi fi
if [[ -n $(git diff --staged) ]]; then if [[ -n $(git diff --staged) ]]; then
echo "git working tree dirty, refusing to commit..." >&2 echo "git working tree dirty, refusing to commit..." >&2
exit 1 exit 1
fi 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}
send_discord_message "Pushed a new commit!" send_discord_message "Pushed a new commit!"
fi fi

View file

@ -10,89 +10,89 @@ MONTHS_TO_KEEP=1
# Helper functions # Helper functions
send_discord_message() { send_discord_message() {
local message="$1" local message="$1"
echo "$message" echo "$message"
local escaped_message=$(printf '%s' "$message" | jq -R -s '.') local escaped_message=$(printf '%s' "$message" | jq -R -s '.')
curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ curl -s -H "Accept: application/json" -H "Content-Type: application/json" \
-X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK"
} }
get_db_size() { get_db_size() {
sudo -u postgres psql matrix-synapse -t -c \ sudo -u postgres psql matrix-synapse -t -c \
"SELECT pg_size_pretty(pg_database_size('matrix-synapse'));" | tr -d ' ' "SELECT pg_size_pretty(pg_database_size('matrix-synapse'));" | tr -d ' '
} }
get_media_store_size() { get_media_store_size() {
sudo du /var/lib/matrix-synapse/media_store -hd 0 | awk '{print $1}' sudo du /var/lib/matrix-synapse/media_store -hd 0 | awk '{print $1}'
} }
get_filesystem_usage() { get_filesystem_usage() {
df -h / | awk 'NR==2 {print $5 " (" $3 ")"}' | tr -d '\n' df -h / | awk 'NR==2 {print $5 " (" $3 ")"}' | tr -d '\n'
} }
calculate_ratio() { calculate_ratio() {
local before="$1" local before="$1"
local after="$2" local after="$2"
awk "BEGIN {printf \"%.2f\", ($after / $before) * 100}" awk "BEGIN {printf \"%.2f\", ($after / $before) * 100}"
} }
# Main script # Main script
main() { main() {
# Check for required variables # Check for required variables
if [[ -z "$HOMESERVER" || -z "$API_ID" || -z "$DISCORD_WEBHOOK_LINK" ]]; then if [[ -z "$HOMESERVER" || -z "$API_ID" || -z "$DISCORD_WEBHOOK_LINK" ]]; then
send_discord_message "Error: HOMESERVER, API_ID, and DISCORD_WEBHOOK_LINK must be set." send_discord_message "Error: HOMESERVER, API_ID, and DISCORD_WEBHOOK_LINK must be set."
exit 1 exit 1
fi
# Initial sizes and usage
local db_before_size=$(get_db_size)
local media_before_size=$(get_media_store_size)
local fs_before_usage=$(get_filesystem_usage)
send_discord_message "Beginning matrix-synapse optimization process - Database before size: ${db_before_size}, Media store before size: ${media_before_size}, Filesystem usage before: ${fs_before_usage}"
send_discord_message "Starting synapse"
systemctl start matrix-synapse
sleep 5
send_discord_message "Collecting required room data"
curl --header "Authorization: Bearer ${API_ID}" \
"https://${HOMESERVER}/_synapse/admin/v1/rooms?limit=500" > "${TEMPDIR}/roomlist.json"
jq '.rooms[] | select(.joined_local_members == 0) | .room_id' < "${TEMPDIR}/roomlist.json" > "${TEMPDIR}/to_purge.txt"
jq -c '.rooms[] | select(.joined_local_members != 0) | .room_id' < "${TEMPDIR}/roomlist.json" > "${TEMPDIR}/history_purge.txt"
local ts=$(( $(date --date="${MONTHS_TO_KEEP} month ago" +%s)*1000 ))
send_discord_message "Cleaning up media store"
curl --header "Authorization: Bearer ${API_ID}" -X POST \
"https://${HOMESERVER}/_synapse/admin/v1/media/delete?before_ts=${ts}&include_local=true"
send_discord_message "Deleting empty rooms"
while read -r room_id; do
if [ -n "${room_id}" ]; then
curl --header "Authorization: Bearer ${API_ID}" -X DELETE \
-H "Content-Type: application/json" -d "{}" \
"https://${HOMESERVER}/_synapse/admin/v2/rooms/${room_id}"
fi fi
done < "${TEMPDIR}/to_purge.txt"
# Initial sizes and usage send_discord_message "Deleting unnecessary room history"
local db_before_size=$(get_db_size) while read -r room_id; do
local media_before_size=$(get_media_store_size) room_id=$(echo "$room_id" | tr -d '"') # Remove quotes if present
local fs_before_usage=$(get_filesystem_usage) if [ -n "${room_id}" ]; then
curl --header "Authorization: Bearer ${API_ID}" -X POST \
-H "Content-Type: application/json" \
-d "{ \"delete_local_events\": true, \"purge_up_to_ts\": ${ts} }" \
"https://${HOMESERVER}/_synapse/admin/v1/purge_history/${room_id}"
fi
done < "${TEMPDIR}/history_purge.txt"
send_discord_message "Beginning matrix-synapse optimization process - Database before size: ${db_before_size}, Media store before size: ${media_before_size}, Filesystem usage before: ${fs_before_usage}" send_discord_message "Performing database optimization"
systemctl stop matrix-synapse
send_discord_message "Starting synapse" export PGHOST=/var/run/postgresql/
systemctl start matrix-synapse export PGDATABASE=matrix-synapse
sleep 5 export PGUSER=matrix-synapse
send_discord_message "Collecting required room data"
curl --header "Authorization: Bearer ${API_ID}" \
"https://${HOMESERVER}/_synapse/admin/v1/rooms?limit=500" > "${TEMPDIR}/roomlist.json"
jq '.rooms[] | select(.joined_local_members == 0) | .room_id' < "${TEMPDIR}/roomlist.json" > "${TEMPDIR}/to_purge.txt"
jq -c '.rooms[] | select(.joined_local_members != 0) | .room_id' < "${TEMPDIR}/roomlist.json" > "${TEMPDIR}/history_purge.txt"
local ts=$(( $(date --date="${MONTHS_TO_KEEP} month ago" +%s)*1000 ))
send_discord_message "Cleaning up media store"
curl --header "Authorization: Bearer ${API_ID}" -X POST \
"https://${HOMESERVER}/_synapse/admin/v1/media/delete?before_ts=${ts}&include_local=true"
send_discord_message "Deleting empty rooms"
while read -r room_id; do
if [ -n "${room_id}" ]; then
curl --header "Authorization: Bearer ${API_ID}" -X DELETE \
-H "Content-Type: application/json" -d "{}" \
"https://${HOMESERVER}/_synapse/admin/v2/rooms/${room_id}"
fi
done < "${TEMPDIR}/to_purge.txt"
send_discord_message "Deleting unnecessary room history"
while read -r room_id; do
room_id=$(echo "$room_id" | tr -d '"') # Remove quotes if present
if [ -n "${room_id}" ]; then
curl --header "Authorization: Bearer ${API_ID}" -X POST \
-H "Content-Type: application/json" \
-d "{ \"delete_local_events\": true, \"purge_up_to_ts\": ${ts} }" \
"https://${HOMESERVER}/_synapse/admin/v1/purge_history/${room_id}"
fi
done < "${TEMPDIR}/history_purge.txt"
send_discord_message "Performing database optimization"
systemctl stop matrix-synapse
export PGHOST=/var/run/postgresql/
export PGDATABASE=matrix-synapse
export PGUSER=matrix-synapse
sudo -u postgres psql matrix-synapse <<_EOF sudo -u postgres psql matrix-synapse <<_EOF
BEGIN; BEGIN;
@ -125,33 +125,33 @@ WHERE NOT EXISTS
COMMIT; COMMIT;
_EOF _EOF
send_discord_message "Running synapse_auto_compressor" send_discord_message "Running synapse_auto_compressor"
sudo -u matrix-synapse synapse_auto_compressor \ sudo -u matrix-synapse synapse_auto_compressor \
-p "postgresql://matrix-synapse?user=matrix-synapse&host=/var/run/postgresql/" \ -p "postgresql://matrix-synapse?user=matrix-synapse&host=/var/run/postgresql/" \
-c 500 -n 100 -c 500 -n 100
send_discord_message "Reindexing database" send_discord_message "Reindexing database"
sudo -u postgres psql matrix-synapse -c "REINDEX (VERBOSE) DATABASE \"matrix-synapse\";" sudo -u postgres psql matrix-synapse -c "REINDEX (VERBOSE) DATABASE \"matrix-synapse\";"
send_discord_message "Vacuuming database" send_discord_message "Vacuuming database"
sudo -u postgres psql matrix-synapse -c "VACUUM FULL VERBOSE;" sudo -u postgres psql matrix-synapse -c "VACUUM FULL VERBOSE;"
rm -rf "${TEMPDIR}" rm -rf "${TEMPDIR}"
send_discord_message "Synapse cleanup performed, booting up" send_discord_message "Synapse cleanup performed, booting up"
systemctl start matrix-synapse systemctl start matrix-synapse
# Final sizes, usage, and ratios # Final sizes, usage, and ratios
local db_after_size=$(get_db_size) local db_after_size=$(get_db_size)
local media_after_size=$(get_media_store_size) local media_after_size=$(get_media_store_size)
local fs_after_usage=$(get_filesystem_usage) local fs_after_usage=$(get_filesystem_usage)
local db_ratio=$(calculate_ratio "${db_before_size//[A-Za-z]/}" "${db_after_size//[A-Za-z]/}") local db_ratio=$(calculate_ratio "${db_before_size//[A-Za-z]/}" "${db_after_size//[A-Za-z]/}")
local media_ratio=$(calculate_ratio "${media_before_size//[A-Za-z]/}" "${media_after_size//[A-Za-z]/}") local media_ratio=$(calculate_ratio "${media_before_size//[A-Za-z]/}" "${media_after_size//[A-Za-z]/}")
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,20 +7,24 @@ _: let
inputs, inputs,
... ...
}: let }: let
inherit (lib.lists) singleton;
inherit (lib.attrsets) nameValuePair listToAttrs; inherit (lib.attrsets) nameValuePair listToAttrs;
datasets = [ datasets = [
"root" "root"
"nix" "nix"
"games" "games"
"home" "home"
"var" "var"
]; ];
datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { datasetEntry = dataset:
device = "zpool/${dataset}"; nameValuePair (
fsType = "zfs"; if dataset == "root"
options = [ "zfsutil" ]; then "/"
}; else "/${dataset}"
) {
device = "zpool/${dataset}";
fsType = "zfs";
options = ["zfsutil"];
};
datasetEntries = listToAttrs (map datasetEntry datasets); datasetEntries = listToAttrs (map datasetEntry datasets);
drives = { drives = {
@ -40,15 +44,17 @@ _: let
}; };
}; };
in { in {
imports = (with tree.nixos.profiles; [ imports =
(with tree.nixos.profiles; [
graphical graphical
wireless wireless
gaming gaming
]) ])
++ (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
@ -62,17 +68,17 @@ _: let
graphical graphical
]) ])
++ (with tree.home.environments; [ ++ (with tree.home.environments; [
#hyprland #hyprland
niri niri
]); ]);
networking.hostId = "c3b94e85"; networking.hostId = "c3b94e85";
home-manager.users.kat.programs.niri.settings = { home-manager.users.kat.programs.niri.settings = {
outputs = { outputs = {
"LG Electronics LG Ultra HD 0x0001AC91" = { "LG Electronics LG Ultra HD 0x0001AC91" = {
scale = 1.25; scale = 1.25;
}; };
}; };
environment = { environment = {
NVD_BACKEND = "direct"; NVD_BACKEND = "direct";
@ -83,29 +89,29 @@ _: let
}; };
}; };
programs.ssh.extraConfig = '' programs.ssh.extraConfig = ''
Host daiyousei-build Host daiyousei-build
HostName 140.238.156.121 HostName 140.238.156.121
User root User root
IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh
'';
nix = {
buildMachines = [
{
hostName = "daiyousei-build";
system = "aarch64-linux";
protocol = "ssh-ng";
maxJobs = 100;
speedFactor = 1;
supportedFeatures = ["benchmark" "big-parallel" "kvm"];
mandatoryFeatures = [];
}
];
distributedBuilds = true;
extraOptions = ''
builders-use-substitutes = true
''; '';
nix = { };
buildMachines = [
{
hostName = "daiyousei-build";
system = "aarch64-linux";
protocol = "ssh-ng";
maxJobs = 100;
speedFactor = 1;
supportedFeatures = ["benchmark" "big-parallel" "kvm"];
mandatoryFeatures = [];
}
];
distributedBuilds = true;
extraOptions = ''
builders-use-substitutes = true
'';
};
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = { hardware.nvidia = {
@ -134,16 +140,18 @@ _: let
availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
}; };
kernelModules = ["nct6775" "kvm-amd"]; kernelModules = ["nct6775" "kvm-amd"];
extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out];
supportedFilesystems = ["ntfs" "zfs"]; supportedFilesystems = ["ntfs" "zfs"];
}; };
fileSystems = datasetEntries // { fileSystems =
"/boot" = drives.boot.result; datasetEntries
}; // {
"/boot" = drives.boot.result;
};
swapDevices = [ swapDevices = [
drives.swap.result drives.swap.result
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -6,20 +6,24 @@ _: let
config, config,
... ...
}: let }: let
inherit (lib.lists) singleton;
inherit (lib.attrsets) nameValuePair listToAttrs; inherit (lib.attrsets) nameValuePair listToAttrs;
datasets = [ datasets = [
"root" "root"
"nix" "nix"
"games" "games"
"home" "home"
"var" "var"
]; ];
datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { datasetEntry = dataset:
device = "zpool/${dataset}"; nameValuePair (
fsType = "zfs"; if dataset == "root"
options = [ "zfsutil" ]; then "/"
}; else "/${dataset}"
) {
device = "zpool/${dataset}";
fsType = "zfs";
options = ["zfsutil"];
};
datasetEntries = listToAttrs (map datasetEntry datasets); datasetEntries = listToAttrs (map datasetEntry datasets);
drives = { drives = {
@ -48,30 +52,32 @@ _: let
quiet-boot quiet-boot
wireless wireless
laptop laptop
gaming gaming
sdr sdr
#virtualisation #virtualisation
#secureboot #secureboot
]) ])
++ (with tree.nixos.environments; [ ++ (with tree.nixos.environments; [
niri niri
]); ]);
config = { config = {
home-manager.users.kat.imports = home-manager.users.kat.imports =
(with tree.home.profiles; [ (with tree.home.profiles; [
graphical graphical
]) ])
++ (with tree.home.environments; [ ++ (with tree.home.environments; [
niri niri
]); ]);
fileSystems = datasetEntries // { fileSystems =
"/boot" = drives.boot.result; datasetEntries
}; // {
"/boot" = drives.boot.result;
};
swapDevices = [ swapDevices = [
drives.swap.result drives.swap.result
]; ];
home-manager.users.kat = { home-manager.users.kat = {
wayland.windowManager.hyprland.settings.monitor = [ wayland.windowManager.hyprland.settings.monitor = [
@ -87,20 +93,20 @@ _: let
extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out];
}; };
services.scx = { services.scx = {
enable = true; enable = true;
package = pkgs.scx_git.full; package = pkgs.scx_git.full;
scheduler = "scx_lavd"; scheduler = "scx_lavd";
}; };
virtualisation.virtualbox.host = { virtualisation.virtualbox.host = {
enable = true; enable = true;
enableExtensionPack = true; enableExtensionPack = true;
enableKvm = true; enableKvm = true;
addNetworkInterface = false; addNetworkInterface = false;
}; };
zramSwap.enable = true; zramSwap.enable = true;
programs.ssh.extraConfig = '' programs.ssh.extraConfig = ''
Host daiyousei-build Host daiyousei-build

View file

@ -1,13 +1,13 @@
locals { locals {
account_id = "0467b993b65d8fd4a53fe24ed2fbb2a1" account_id = "0467b993b65d8fd4a53fe24ed2fbb2a1"
zones = { zones = {
dork = "dork.dev" dork = "dork.dev"
inskip = "inskip.me" inskip = "inskip.me"
kittywitch = "kittywit.ch" kittywitch = "kittywit.ch"
} }
zone_ids = { zone_ids = {
dork = cloudflare_zone.dork_zone.id dork = cloudflare_zone.dork_zone.id
inskip = cloudflare_zone.inskip_zone.id inskip = cloudflare_zone.inskip_zone.id
kittywitch = cloudflare_zone.kittywitch_zone.id kittywitch = cloudflare_zone.kittywitch_zone.id
} }
} }

View file

@ -1,8 +1,8 @@
variable "cloudflare_api_key" { variable "cloudflare_api_key" {
sensitive = true sensitive = true
} }
provider "cloudflare" { provider "cloudflare" {
email = "kat@inskip.me" email = "kat@inskip.me"
api_key = var.cloudflare_api_key api_key = var.cloudflare_api_key
} }

View file

@ -1,22 +1,22 @@
resource "cloudflare_pages_project" "dorkdev" { resource "cloudflare_pages_project" "dorkdev" {
account_id = local.account_id account_id = local.account_id
name = "dorkdev" name = "dorkdev"
production_branch = "main" production_branch = "main"
source { source {
type = "github" type = "github"
config { config {
owner = "kittywitch" owner = "kittywitch"
repo_name = "dork.dev" repo_name = "dork.dev"
production_branch = "main" production_branch = "main"
deployments_enabled = true deployments_enabled = true
pr_comments_enabled = false pr_comments_enabled = false
production_deployment_enabled = true production_deployment_enabled = true
} }
} }
build_config { build_config {
build_command = "zola build" build_command = "zola build"
destination_dir = "public" destination_dir = "public"
#root_dir = "/" #root_dir = "/"
} }
@ -26,7 +26,7 @@ resource "cloudflare_pages_project" "dorkdev" {
production { production {
environment_variables = { environment_variables = {
UNSTABLE_PRE_BUILD = "asdf plugin add zola https://github.com/salasrod/asdf-zola && asdf install zola 0.20.0 && asdf global zola 0.20.0" UNSTABLE_PRE_BUILD = "asdf plugin add zola https://github.com/salasrod/asdf-zola && asdf install zola 0.20.0 && asdf global zola 0.20.0"
ZOLA_VERSION = "0.20.0" ZOLA_VERSION = "0.20.0"
} }
} }
} }
@ -39,9 +39,9 @@ resource "cloudflare_pages_project" "dorkdev" {
} }
resource "cloudflare_pages_domain" "dorkdev_root" { resource "cloudflare_pages_domain" "dorkdev_root" {
account_id = local.account_id account_id = local.account_id
project_name = "dorkdev" project_name = "dorkdev"
domain = local.zones.dork domain = local.zones.dork
} }

View file

@ -1,29 +1,29 @@
locals { locals {
dkims = { dkims = {
inskip = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkxag/EmXQ89XQmLrBDPpPtZ7EtEJT0hgvWf/+AFiOfBOm902tq9NbTTvRJ2dLeBLPaV+hNvq2Alc7UfkKUDlLTWQjeuiC6aOnRKQQg3LZ2W25U3AlIj0jd2IPiUhg9JGV4c66XiqQ5ylTBniShfUUyeAXxbPhYFBCkBg62LZcO/tFpFsdKWtZzLjgac5vTJID+M4F8duHpkA/ZCNNUEmtt7RNQB/LLI1Gr5yR4GdQl9z7NmwtOTo9pghbZuvljr8phYjdDrwZeFTMKQnvR1l2Eh/dZ8I0C4nP5Bk4QEfmLq666P1HzOxwT6iCU6Tc+P/pkWbrx0HJh39E1aKGyLJMQIDAQAB" inskip = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkxag/EmXQ89XQmLrBDPpPtZ7EtEJT0hgvWf/+AFiOfBOm902tq9NbTTvRJ2dLeBLPaV+hNvq2Alc7UfkKUDlLTWQjeuiC6aOnRKQQg3LZ2W25U3AlIj0jd2IPiUhg9JGV4c66XiqQ5ylTBniShfUUyeAXxbPhYFBCkBg62LZcO/tFpFsdKWtZzLjgac5vTJID+M4F8duHpkA/ZCNNUEmtt7RNQB/LLI1Gr5yR4GdQl9z7NmwtOTo9pghbZuvljr8phYjdDrwZeFTMKQnvR1l2Eh/dZ8I0C4nP5Bk4QEfmLq666P1HzOxwT6iCU6Tc+P/pkWbrx0HJh39E1aKGyLJMQIDAQAB"
dork = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAziwoHJbM1rmeUiIXOgg0cujTL5BFW9PQOksUhKza1XpDP2rpzTlQr21NFYMJMc08xiE3AbvScMTX0jX3gc7+XoIYLD1VigRRvkyTubVfRmatqj+Pk41Fle1jWXHv5vNIYjjcsUTrpnrXYKoYrz34TtsmYHnu0G9MgmmcQGmbRU+WY+1R/ukhavlgXasfEW6r4tjLgVxQnser1Zjr80AUcu23od/+o+m6C9rDGMMnv6NIc2DOT7Ei6o60458f2Iwcpg38te22dy46A8AeGynbpB9+jF33Se0m22eKk5qZN5mfju/wxWMsl7ifCY/eqLZXRxJaEd5bMI8px5KvZp1TWwIDAQAB" dork = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAziwoHJbM1rmeUiIXOgg0cujTL5BFW9PQOksUhKza1XpDP2rpzTlQr21NFYMJMc08xiE3AbvScMTX0jX3gc7+XoIYLD1VigRRvkyTubVfRmatqj+Pk41Fle1jWXHv5vNIYjjcsUTrpnrXYKoYrz34TtsmYHnu0G9MgmmcQGmbRU+WY+1R/ukhavlgXasfEW6r4tjLgVxQnser1Zjr80AUcu23od/+o+m6C9rDGMMnv6NIc2DOT7Ei6o60458f2Iwcpg38te22dy46A8AeGynbpB9+jF33Se0m22eKk5qZN5mfju/wxWMsl7ifCY/eqLZXRxJaEd5bMI8px5KvZp1TWwIDAQAB"
kittywitch = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdmyA2+/si8UV3bodFZhtv5y68QnYr/kk9wnDHnk3JfJKusbrctXfETVu/9GXQ/U8tRquesF7aXKYHM/K3O6H58gAgIFm8JVnr9EUFh5PWBTKJxHgDo/6pprhpdAJg8k4f4p5yvqE0nUI6TC0UpN+ZmQMimgxvGGwQ6mpl7qmc7JxmTOiJbO1yz6eokU27S0NHfpdiE3TGG93i2r/LwAnHuhT/4weGO+vcXwKRTFGFFjvMo0XgjL2JnP01nk6dpDFwkkt5I26J4DkuNMkLefgDiGOoxDmG5EgPu0YwAm7Vk2/kX0W6rLe16lHGDkB0/atQ/IB9uch31GQrLP9etmdwIDAQAB" kittywitch = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdmyA2+/si8UV3bodFZhtv5y68QnYr/kk9wnDHnk3JfJKusbrctXfETVu/9GXQ/U8tRquesF7aXKYHM/K3O6H58gAgIFm8JVnr9EUFh5PWBTKJxHgDo/6pprhpdAJg8k4f4p5yvqE0nUI6TC0UpN+ZmQMimgxvGGwQ6mpl7qmc7JxmTOiJbO1yz6eokU27S0NHfpdiE3TGG93i2r/LwAnHuhT/4weGO+vcXwKRTFGFFjvMo0XgjL2JnP01nk6dpDFwkkt5I26J4DkuNMkLefgDiGOoxDmG5EgPu0YwAm7Vk2/kX0W6rLe16lHGDkB0/atQ/IB9uch31GQrLP9etmdwIDAQAB"
} }
} }
module "inskip-gmail" { module "inskip-gmail" {
source = "./gmail_dns" source = "./gmail_dns"
cloudflare_api_key = var.cloudflare_api_key cloudflare_api_key = var.cloudflare_api_key
zone_id = local.zone_ids.inskip zone_id = local.zone_ids.inskip
zone_name = local.zones.inskip zone_name = local.zones.inskip
dkim = local.dkims.inskip dkim = local.dkims.inskip
} }
module "dork-gmail" { module "dork-gmail" {
source = "./gmail_dns" source = "./gmail_dns"
cloudflare_api_key = var.cloudflare_api_key cloudflare_api_key = var.cloudflare_api_key
zone_id = local.zone_ids.dork zone_id = local.zone_ids.dork
zone_name = local.zones.dork zone_name = local.zones.dork
dkim = local.dkims.dork dkim = local.dkims.dork
} }
module "kittywitch-gmail" { module "kittywitch-gmail" {
source = "./gmail_dns" source = "./gmail_dns"
cloudflare_api_key = var.cloudflare_api_key cloudflare_api_key = var.cloudflare_api_key
zone_id = local.zone_ids.kittywitch zone_id = local.zone_ids.kittywitch
zone_name = local.zones.kittywitch zone_name = local.zones.kittywitch
dkim = local.dkims.kittywitch dkim = local.dkims.kittywitch
} }

View file

@ -1,13 +1,13 @@
terraform { terraform {
required_providers { required_providers {
cloudflare = { cloudflare = {
source = "cloudflare/cloudflare" source = "cloudflare/cloudflare"
version = "4.4.0" version = "4.4.0"
}
} }
}
} }
provider "cloudflare" { provider "cloudflare" {
email = "kat@inskip.me" email = "kat@inskip.me"
api_key = var.cloudflare_api_key api_key = var.cloudflare_api_key
} }

View file

@ -1,5 +1,5 @@
resource "cloudflare_record" "gmail_mx_1_aspmx" { resource "cloudflare_record" "gmail_mx_1_aspmx" {
name = var.zone_name name = var.zone_name
priority = 1 priority = 1
proxied = false proxied = false
ttl = 3600 ttl = 3600
@ -9,7 +9,7 @@ resource "cloudflare_record" "gmail_mx_1_aspmx" {
} }
resource "cloudflare_record" "gmail_mx_5_alt1" { resource "cloudflare_record" "gmail_mx_5_alt1" {
name = var.zone_name name = var.zone_name
priority = 5 priority = 5
proxied = false proxied = false
ttl = 3600 ttl = 3600
@ -19,7 +19,7 @@ resource "cloudflare_record" "gmail_mx_5_alt1" {
} }
resource "cloudflare_record" "gmail_mx_5_alt2" { resource "cloudflare_record" "gmail_mx_5_alt2" {
name = var.zone_name name = var.zone_name
priority = 5 priority = 5
proxied = false proxied = false
ttl = 3600 ttl = 3600
@ -29,7 +29,7 @@ resource "cloudflare_record" "gmail_mx_5_alt2" {
} }
resource "cloudflare_record" "gmail_mx_10_alt3" { resource "cloudflare_record" "gmail_mx_10_alt3" {
name = var.zone_name name = var.zone_name
priority = 10 priority = 10
proxied = false proxied = false
ttl = 3600 ttl = 3600
@ -38,7 +38,7 @@ resource "cloudflare_record" "gmail_mx_10_alt3" {
zone_id = var.zone_id zone_id = var.zone_id
} }
resource "cloudflare_record" "gmail_mx_10_alt4" { resource "cloudflare_record" "gmail_mx_10_alt4" {
name = var.zone_name name = var.zone_name
priority = 10 priority = 10
proxied = false proxied = false
ttl = 3600 ttl = 3600
@ -53,7 +53,7 @@ resource "cloudflare_record" "gmail_dkim" {
ttl = 3600 ttl = 3600
type = "TXT" type = "TXT"
value = var.dkim value = var.dkim
zone_id = var.zone_id zone_id = var.zone_id
} }
resource "cloudflare_record" "gmail_spf" { resource "cloudflare_record" "gmail_spf" {
@ -62,5 +62,5 @@ resource "cloudflare_record" "gmail_spf" {
ttl = 3600 ttl = 3600
type = "TXT" type = "TXT"
value = "v=spf1 include:_spf.google.com -all" value = "v=spf1 include:_spf.google.com -all"
zone_id = var.zone_id zone_id = var.zone_id
} }

View file

@ -1,14 +1,14 @@
variable "cloudflare_api_key" { variable "cloudflare_api_key" {
sensitive = true sensitive = true
} }
variable "zone_id" { variable "zone_id" {
type = string type = string
} }
variable "dkim" { variable "dkim" {
type = string type = string
} }
variable "zone_name" { variable "zone_name" {
type = string type = string
} }

View file

@ -1,23 +1,23 @@
resource "cloudflare_pages_project" "inskip_root" { resource "cloudflare_pages_project" "inskip_root" {
account_id = local.account_id account_id = local.account_id
name = "inskip-root" name = "inskip-root"
production_branch = "main" production_branch = "main"
source { source {
type = "github" type = "github"
config { config {
owner = "kittywitch" owner = "kittywitch"
repo_name = "inskip.me" repo_name = "inskip.me"
production_branch = "main" production_branch = "main"
deployments_enabled = true deployments_enabled = true
pr_comments_enabled = false pr_comments_enabled = false
production_deployment_enabled = true production_deployment_enabled = true
} }
} }
build_config { build_config {
build_command = "hugo" build_command = "hugo"
destination_dir = "public" destination_dir = "public"
root_dir = "/" root_dir = "/"
} }
lifecycle { lifecycle {
ignore_changes = [ ignore_changes = [
@ -28,9 +28,9 @@ resource "cloudflare_pages_project" "inskip_root" {
} }
resource "cloudflare_pages_domain" "inskip_root" { resource "cloudflare_pages_domain" "inskip_root" {
account_id = local.account_id account_id = local.account_id
project_name = "inskip-root" project_name = "inskip-root"
domain = local.zones.inskip domain = local.zones.inskip
} }
resource "cloudflare_record" "inskip_root_pages" { resource "cloudflare_record" "inskip_root_pages" {

View file

@ -1,17 +1,17 @@
resource "cloudflare_pages_project" "kittywitch" { resource "cloudflare_pages_project" "kittywitch" {
account_id = local.account_id account_id = local.account_id
name = "kittywitch" name = "kittywitch"
production_branch = "main" production_branch = "main"
source { source {
type = "github" type = "github"
config { config {
owner = "kittywitch" owner = "kittywitch"
repo_name = "kittywit.ch" repo_name = "kittywit.ch"
production_branch = "main" production_branch = "main"
deployments_enabled = true deployments_enabled = true
pr_comments_enabled = false pr_comments_enabled = false
production_deployment_enabled = true production_deployment_enabled = true
} }
} }
@ -24,9 +24,9 @@ resource "cloudflare_pages_project" "kittywitch" {
} }
resource "cloudflare_pages_domain" "kittywitch_root" { resource "cloudflare_pages_domain" "kittywitch_root" {
account_id = local.account_id account_id = local.account_id
project_name = "kittywitch" project_name = "kittywitch"
domain = local.zones.kittywitch domain = local.zones.kittywitch
} }
resource "cloudflare_record" "kittywitch_root_pages" { resource "cloudflare_record" "kittywitch_root_pages" {

View file

@ -1,13 +1,13 @@
module "oci_common_private_network" { module "oci_common_private_network" {
source = "./oci_common_private_network" source = "./oci_common_private_network"
cidr_blocks = [ cidr_blocks = [
"10.25.0.0/16" "10.25.0.0/16"
] ]
display_name = "CoreNetwork" display_name = "CoreNetwork"
dns_label = "core" dns_label = "core"
tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id
providers = { providers = {
oci = oci.oci_compartment oci = oci.oci_compartment

View file

@ -4,12 +4,12 @@ resource "oci_core_default_security_list" "this" {
dynamic "ingress_security_rules" { dynamic "ingress_security_rules" {
for_each = [ for_each = [
{ from = 60000 { from = 60000
to = 61000 } to = 61000 }
] ]
iterator = port iterator = port
content { content {
protocol = local.protocol_number.udp protocol = local.protocol_number.udp
source = "0.0.0.0/0" source = "0.0.0.0/0"
description = "Mosh traffic from any origin" description = "Mosh traffic from any origin"

View file

@ -1,7 +1,7 @@
resource "oci_core_internet_gateway" "this" { resource "oci_core_internet_gateway" "this" {
display_name = "internet" display_name = "internet"
compartment_id = var.tenancy_ocid compartment_id = var.tenancy_ocid
vcn_id = local.vcn.id vcn_id = local.vcn.id
} }
locals { locals {

View file

@ -2,12 +2,12 @@ terraform {
required_providers { required_providers {
# Vendor: Hashicorp # Vendor: Hashicorp
tls = { tls = {
source = "hashicorp/tls" source = "hashicorp/tls"
version = "4.0.5" version = "4.0.5"
} }
# Vendor: Oracle # Vendor: Oracle
oci = { oci = {
source = "oracle/oci" source = "oracle/oci"
version = "5.45.0" version = "5.45.0"
} }
} }

View file

@ -17,9 +17,9 @@ variable "dns_label" {
resource "oci_core_vcn" "this" { resource "oci_core_vcn" "this" {
compartment_id = var.tenancy_ocid compartment_id = var.tenancy_ocid
cidr_blocks = var.cidr_blocks cidr_blocks = var.cidr_blocks
display_name = var.display_name display_name = var.display_name
dns_label = var.dns_label dns_label = var.dns_label
is_ipv6enabled = true is_ipv6enabled = true
} }

View file

@ -27,20 +27,20 @@ variable "oci_compartment_bootstrap_user_email" {
# https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformgettingstarted.htm # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformgettingstarted.htm
# https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
provider "oci" { provider "oci" {
alias = "oci_root" alias = "oci_root"
private_key = var.oci_compartment_bootstrap_private_key private_key = var.oci_compartment_bootstrap_private_key
region = var.oci_compartment_bootstrap_region region = var.oci_compartment_bootstrap_region
tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid
user_ocid = var.oci_compartment_bootstrap_user_ocid user_ocid = var.oci_compartment_bootstrap_user_ocid
fingerprint = var.oci_compartment_bootstrap_fingerprint fingerprint = var.oci_compartment_bootstrap_fingerprint
} }
# OCI Compartment Bootstrap # OCI Compartment Bootstrap
module "oci_compartment_bootstrap" { module "oci_compartment_bootstrap" {
source = "./oci_compartment_bootstrap" source = "./oci_compartment_bootstrap"
tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid
user_email = var.oci_compartment_bootstrap_user_email user_email = var.oci_compartment_bootstrap_user_email
providers = { providers = {
oci = oci.oci_root oci = oci.oci_root
@ -48,42 +48,42 @@ module "oci_compartment_bootstrap" {
} }
output "oci_compartment_bootstrap_child_user_id" { output "oci_compartment_bootstrap_child_user_id" {
value = module.oci_compartment_bootstrap.child_user_id value = module.oci_compartment_bootstrap.child_user_id
sensitive = true sensitive = true
} }
output "oci_compartment_bootstrap_child_compartment_id" { output "oci_compartment_bootstrap_child_compartment_id" {
value = module.oci_compartment_bootstrap.child_compartment_id value = module.oci_compartment_bootstrap.child_compartment_id
sensitive = true sensitive = true
} }
output "oci_compartment_bootstrap_child_compartment_key_id" { output "oci_compartment_bootstrap_child_compartment_key_id" {
value = module.oci_compartment_bootstrap.child_compartment_key_id value = module.oci_compartment_bootstrap.child_compartment_key_id
sensitive = true sensitive = true
} }
output "oci_compartment_bootstrap_child_compartment_key_fingerprint" { output "oci_compartment_bootstrap_child_compartment_key_fingerprint" {
value = module.oci_compartment_bootstrap.child_compartment_key_fingerprint value = module.oci_compartment_bootstrap.child_compartment_key_fingerprint
sensitive = true sensitive = true
} }
output "oci_compartment_bootstrap_child_compartment_key_value" { output "oci_compartment_bootstrap_child_compartment_key_value" {
value = module.oci_compartment_bootstrap.child_compartment_key_value value = module.oci_compartment_bootstrap.child_compartment_key_value
sensitive = true sensitive = true
} }
output "oci_compartment_bootstrap_child_compartment_key_state" { output "oci_compartment_bootstrap_child_compartment_key_state" {
value = module.oci_compartment_bootstrap.child_compartment_key_state value = module.oci_compartment_bootstrap.child_compartment_key_state
sensitive = true sensitive = true
} }
# https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformgettingstarted.htm # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformgettingstarted.htm
# https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
provider "oci" { provider "oci" {
alias = "oci_compartment" alias = "oci_compartment"
private_key = module.oci_compartment_bootstrap.child_compartment_private_key private_key = module.oci_compartment_bootstrap.child_compartment_private_key
region = var.oci_compartment_bootstrap_region region = var.oci_compartment_bootstrap_region
tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id
user_ocid = module.oci_compartment_bootstrap.child_user_id user_ocid = module.oci_compartment_bootstrap.child_user_id
fingerprint = module.oci_compartment_bootstrap.child_compartment_key_fingerprint fingerprint = module.oci_compartment_bootstrap.child_compartment_key_fingerprint
} }

View file

@ -1,6 +1,6 @@
resource "oci_identity_api_key" "this" { resource "oci_identity_api_key" "this" {
key_value = local.child_compartment_public_key key_value = local.child_compartment_public_key
user_id = local.child_compartment_user user_id = local.child_compartment_user
} }
locals { locals {

View file

@ -5,8 +5,8 @@ variable "tenancy_ocid" {
resource "oci_identity_compartment" "this" { resource "oci_identity_compartment" "this" {
# Compartment ID is Tenancy ID for this case # Compartment ID is Tenancy ID for this case
compartment_id = var.tenancy_ocid compartment_id = var.tenancy_ocid
description = "Compartment for Terraform usage" description = "Compartment for Terraform usage"
name = "kittywitch-tf" name = "kittywitch-tf"
} }

View file

@ -1,6 +1,6 @@
resource "oci_identity_group" "this" { resource "oci_identity_group" "this" {
compartment_id = var.tenancy_ocid compartment_id = var.tenancy_ocid
name = "terraform" name = "terraform"
description = "terraform" description = "terraform"
} }

View file

@ -1,4 +1,4 @@
resource "oci_identity_user_group_membership" "this" { resource "oci_identity_user_group_membership" "this" {
user_id = oci_identity_user.this.id user_id = oci_identity_user.this.id
group_id = oci_identity_group.this.id group_id = oci_identity_group.this.id
} }

View file

@ -10,7 +10,7 @@ ANY { request.operation = 'CreateNetworkSecurityGroup', request.operation = 'Del
resource "oci_identity_policy" "terraform-admin" { resource "oci_identity_policy" "terraform-admin" {
compartment_id = var.tenancy_ocid compartment_id = var.tenancy_ocid
name = "terraform-admin" name = "terraform-admin"
description = "terraform-admin" description = "terraform-admin"
statements = [ statements = [

View file

@ -2,12 +2,12 @@ terraform {
required_providers { required_providers {
# Vendor: Hashicorp # Vendor: Hashicorp
tls = { tls = {
source = "hashicorp/tls" source = "hashicorp/tls"
version = "4.0.5" version = "4.0.5"
} }
# Vendor: Oracle # Vendor: Oracle
oci = { oci = {
source = "oracle/oci" source = "oracle/oci"
version = "5.45.0" version = "5.45.0"
} }
} }

View file

@ -2,12 +2,12 @@ resource "tls_private_key" "this" {
# https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/identity_api_key#key_value # https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/identity_api_key#key_value
# "The public key. Must be an RSA key in PEM format." # "The public key. Must be an RSA key in PEM format."
algorithm = "RSA" algorithm = "RSA"
rsa_bits = 4096 rsa_bits = 4096
} }
locals { locals {
child_compartment_private_key = tls_private_key.this.private_key_pem child_compartment_private_key = tls_private_key.this.private_key_pem
child_compartment_public_key = tls_private_key.this.public_key_pem child_compartment_public_key = tls_private_key.this.public_key_pem
} }
output "child_compartment_private_key" { output "child_compartment_private_key" {

View file

@ -4,9 +4,9 @@ variable "user_email" {
resource "oci_identity_user" "this" { resource "oci_identity_user" "this" {
compartment_id = local.child_compartment_id compartment_id = local.child_compartment_id
description = "The user for Terraform to use" description = "The user for Terraform to use"
name = "terraform" name = "terraform"
email = var.user_email email = var.user_email
} }
locals { locals {

Some files were not shown because too many files have changed in this diff Show more