From 6e0cc170eb898b1c00fcd6fb1f255cd8614e34cb Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Sun, 13 Jul 2025 05:10:57 -0700 Subject: [PATCH] style: nix fmt --- flake.nix | 2 +- formatting.nix | 1 - home/environments/hyprland/catppuccin.nix | 9 +- home/environments/hyprland/cursor.nix | 2 +- home/environments/hyprland/hyprland.nix | 80 +-- home/environments/hyprland/hyprlock.nix | 6 +- home/environments/hyprland/waybar.nix | 211 ++++---- home/environments/i3/catppuccin.nix | 9 +- home/environments/i3/i3.nix | 98 ++-- home/environments/i3/i3status-rust.nix | 112 ++-- home/environments/i3/rofi.nix | 6 +- home/environments/kde/gtk.nix | 2 +- home/environments/kde/kde.nix | 2 +- home/environments/niri/autostart.nix | 5 +- home/environments/niri/avizo.nix | 2 +- home/environments/niri/binds.nix | 254 ++++----- home/environments/niri/cursor.nix | 5 +- home/environments/niri/mako.nix | 1 - home/environments/niri/niri.nix | 17 +- home/environments/niri/swayidle.nix | 6 +- home/environments/niri/swaylock.nix | 2 +- home/environments/niri/waybar.nix | 211 ++++---- home/environments/niri/window-rules.nix | 30 +- home/profiles/common/catppuccin.nix | 9 +- home/profiles/common/modules.nix | 6 +- home/profiles/common/packages.nix | 8 +- home/profiles/graphical/discord.nix | 4 +- home/profiles/graphical/documents.nix | 2 +- home/profiles/graphical/floorp/containers.nix | 9 +- home/profiles/graphical/floorp/main.nix | 8 +- home/profiles/graphical/floorp/mtab.nix | 12 +- home/profiles/graphical/floorp/tst.nix | 26 +- home/profiles/graphical/floorp/ublock.nix | 2 +- home/profiles/graphical/media.nix | 1 - home/profiles/graphical/spotify.nix | 20 +- home/profiles/graphical/taskwarrior.nix | 4 +- home/profiles/graphical/wezterm.nix | 44 +- home/profiles/neovim/default.nix | 4 +- home/profiles/shell/zsh.nix | 32 +- modules/home/i3.nix | 316 ++++++----- modules/home/i3/functions.nix | 169 +++--- modules/home/i3/options.nix | 502 ++++++++++-------- modules/home/palette.nix | 10 +- modules/home/zsh.nix | 2 +- modules/system/host.nix | 14 +- nixos/common/nh.nix | 6 +- nixos/common/nix.nix | 2 +- nixos/common/packages.nix | 10 +- nixos/common/tailscale.nix | 7 +- nixos/environments/hyprland/hyprland.nix | 14 +- nixos/environments/i3/xdg.nix | 1 - nixos/environments/niri/niri.nix | 2 +- nixos/profiles/bcachefs.nix | 1 - nixos/profiles/gaming/lutris.nix | 3 +- nixos/profiles/gaming/steam.nix | 2 +- nixos/profiles/gaming/vr.nix | 12 +- nixos/profiles/graphical/infra.nix | 62 ++- nixos/profiles/graphical/kernel.nix | 2 +- nixos/profiles/graphical/mullvad.nix | 4 +- nixos/profiles/graphical/sound.nix | 10 +- nixos/profiles/laptop/cpufreq.nix | 2 +- nixos/profiles/quiet-boot.nix | 8 +- nixos/servers/rustdesk.nix | 2 +- outputs.nix | 2 +- overlays.nix | 4 +- packages/arcmenu/default.nix | 20 +- packages/commonalitysol.nix | 1 - packages/cppyy/default.nix | 7 +- packages/dorion.nix | 286 +++++----- packages/kwin-blishhud-shader.nix | 1 - packages/nf-build-system/build-system.sh | 118 ++-- packages/nf-build-system/default.nix | 7 +- packages/nf-update/default.nix | 7 +- packages/nf-update/update.sh | 46 +- packages/synapse-cleanup/cleanup.sh | 166 +++--- systems/goliath.nix | 94 ++-- systems/koishi.nix | 68 +-- tf/cloudflare-zones.tf | 8 +- tf/cloudflare.tf | 6 +- tf/dork-pages.tf | 26 +- tf/gmail.tf | 40 +- tf/gmail_dns/cloudflare_provider.tf | 14 +- tf/gmail_dns/main.tf | 14 +- tf/gmail_dns/variables.tf | 8 +- tf/inskip-pages.tf | 26 +- tf/kw-pages.tf | 22 +- tf/oci_common_private_network.tf | 8 +- .../default_security_list.tf | 4 +- .../internet_gateway.tf | 4 +- tf/oci_common_private_network/providers.tf | 4 +- .../virtual_cloud_network.tf | 4 +- tf/oci_compartment_bootstrap.tf | 40 +- tf/oci_compartment_bootstrap/api_key.tf | 2 +- tf/oci_compartment_bootstrap/compartment.tf | 4 +- tf/oci_compartment_bootstrap/group.tf | 2 +- .../group_membership.tf | 2 +- tf/oci_compartment_bootstrap/policy.tf | 2 +- tf/oci_compartment_bootstrap/providers.tf | 4 +- tf/oci_compartment_bootstrap/tls.tf | 4 +- tf/oci_compartment_bootstrap/user.tf | 6 +- tf/oci_servers.tf | 18 +- tf/oci_servers/flex.tf | 6 +- tf/oci_servers/ipv4.tf | 2 +- tf/oci_servers/micro.tf | 10 +- tf/oci_servers/providers.tf | 2 +- tf/oci_servers/vnic.tf | 6 +- tf/tailnet-dns.tf | 26 +- tf/tailscale.tf | 12 +- tf/terraform.tf | 8 +- treefmt.nix | 4 +- wrappers/actions-test.sh | 110 ++-- wrappers/generate.sh | 4 +- 112 files changed, 1977 insertions(+), 1739 deletions(-) diff --git a/flake.nix b/flake.nix index 41aa6338..5fe5b494 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,7 @@ }; systems.url = "github:nix-systems/default"; # 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"; # to allow non-nix 2.4 evaluation flake-compat = { diff --git a/formatting.nix b/formatting.nix index 27f5c261..697d2c84 100644 --- a/formatting.nix +++ b/formatting.nix @@ -1,6 +1,5 @@ { inputs, - pkgs, ... }: inputs.flake-utils.lib.eachDefaultSystem (system: let diff --git a/home/environments/hyprland/catppuccin.nix b/home/environments/hyprland/catppuccin.nix index ae7fdac3..215c13bc 100644 --- a/home/environments/hyprland/catppuccin.nix +++ b/home/environments/hyprland/catppuccin.nix @@ -1,5 +1,6 @@ -{ config, lib, pkgs, ... }: let - inherit (config.catppuccin) sources; - inherit (lib) mkBefore; -in { +{ + config, + lib, + ... +}: { } diff --git a/home/environments/hyprland/cursor.nix b/home/environments/hyprland/cursor.nix index dba5daaa..f7e4dbfd 100644 --- a/home/environments/hyprland/cursor.nix +++ b/home/environments/hyprland/cursor.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { home.pointerCursor = { enable = true; package = pkgs.graphite-cursors; diff --git a/home/environments/hyprland/hyprland.nix b/home/environments/hyprland/hyprland.nix index 516735b7..feb25159 100644 --- a/home/environments/hyprland/hyprland.nix +++ b/home/environments/hyprland/hyprland.nix @@ -27,19 +27,19 @@ in { services.swww.enable = true; wayland.windowManager.hyprland = let import-gsettings = pkgs.writeShellScriptBin "import-gsettings" '' -# usage: import-gsettings -config="''${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" -if [ ! -f "$config" ]; then exit 1; fi + # usage: import-gsettings + config="''${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" + if [ ! -f "$config" ]; then exit 1; fi -gnome_schema="org.gnome.desktop.interface" -gtk_theme="$(grep 'gtk-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*//')" -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" icon-theme "$icon_theme" -${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme" -${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" + gnome_schema="org.gnome.desktop.interface" + gtk_theme="$(grep 'gtk-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*//')" + 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" icon-theme "$icon_theme" + ${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme" + ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" ''; in { enable = true; @@ -56,12 +56,11 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" package = inputs.hyprland.packages.${pkgs.system}.hyprland; settings = { # TODO: break it up - windowrule = let - in [ + windowrule = [ "suppressevent fullscreen, class:steam_app_default" "workspace 2, class:steam_app_default" "suppressevent maximize, class:.*" - + "tile, class:battle\.net\.exe" "renderunfocused, class:discord, initialTitle:Discord" @@ -87,21 +86,23 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" ++ (list.map ( workspace: "${toString workspace},monitor:DP-1${commonOptions}" ) (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}" ) (list.range 12 20)); - /*list.concat (list.generate ( - x: let - ws = let - c = (x + 1) / 10; - in - builtins.toString (x + 1 - (c * 10)); - in [ - "${toString x},monitor:DP-1" - "${toString (x + 10)},monitor:DP-2${commonOptions}" - ] - ) - 10); + /* + list.concat (list.generate ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "${toString x},monitor:DP-1" + "${toString (x + 10)},monitor:DP-2${commonOptions}" + ] + ) + 10); */ env = [ "MOZ_ENABLE_WAYLAND,1" @@ -141,9 +142,9 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" "$mod ALT, mouse:272, resizewindow" ]; bindl = [ - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" ]; binde = [ ", 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 -- "; uwsmApp = cmd: uwsmCmd + cmd; uwsmSingleApp = cmd: "pgrep ${cmd} || ${uwsmCmd + cmd}"; - in [ + in + [ ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" ", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next" @@ -226,9 +228,17 @@ ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" in [ "$mod, ${ws}, workspace, ${toString (x + 1)}" "$mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" - "$mod, F${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, F${ + 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)}" ] ) diff --git a/home/environments/hyprland/hyprlock.nix b/home/environments/hyprland/hyprlock.nix index 6a129e4d..3c6cc421 100644 --- a/home/environments/hyprland/hyprlock.nix +++ b/home/environments/hyprland/hyprlock.nix @@ -1,4 +1,8 @@ -{ inputs, pkgs, ... }: { +{ + inputs, + pkgs, + ... +}: { programs.hyprlock = { enable = true; package = inputs.hyprlock.packages.${pkgs.system}.hyprlock; diff --git a/home/environments/hyprland/waybar.nix b/home/environments/hyprland/waybar.nix index 55e9fad2..1710cd75 100644 --- a/home/environments/hyprland/waybar.nix +++ b/home/environments/hyprland/waybar.nix @@ -3,136 +3,136 @@ _: { enable = true; systemd.enable = true; style = '' -* { - border: none; - border-radius: 0; - font-family: Monaspace Krypton, monospace; - font-size: 13px; - min-height: 0; -} + * { + border: none; + border-radius: 0; + font-family: Monaspace Krypton, monospace; + font-size: 13px; + min-height: 0; + } -window#waybar { - all:unset; -} + window#waybar { + all:unset; + } -.modules-left, .modules-right, .modules-center { - background: alpha(@base, 0.9); - box-shadow: 0px 0px 2px rgba(0,0,0,0.6); - color: @text; - padding: 5px; - margin: 2px 4px; - border: 1px solid @lavender; -} + .modules-left, .modules-right, .modules-center { + background: alpha(@base, 0.9); + box-shadow: 0px 0px 2px rgba(0,0,0,0.6); + color: @text; + padding: 5px; + margin: 2px 4px; + border: 1px solid @lavender; + } -tooltip { - background: rgba(43, 48, 59, 0.5); - border: 1px solid rgba(100, 114, 125, 0.5); -} -tooltip label { - color: white; -} + tooltip { + background: rgba(43, 48, 59, 0.5); + border: 1px solid rgba(100, 114, 125, 0.5); + } + tooltip label { + color: white; + } -#workspaces { - border-right: 1px solid @surface2; -} + #workspaces { + border-right: 1px solid @surface2; + } -#workspaces button.persistent { - background: @theme_unfocused_bg_color; - color: @subtext1; -} + #workspaces button.persistent { + background: @theme_unfocused_bg_color; + color: @subtext1; + } -#workspaces button { - padding: 2px 5px; - background: @surface0; - border-bottom: 3px solid transparent; -} + #workspaces button { + padding: 2px 5px; + background: @surface0; + border-bottom: 3px solid transparent; + } -#workspaces button.empty { - background: @crust; - color: @subtext1; -} + #workspaces button.empty { + background: @crust; + color: @subtext1; + } -#workspaces button.visible { - background: @pink; - color: @theme_selected_fg_color; - border-bottom: 3px solid @rosewater; -} + #workspaces button.visible { + background: @pink; + color: @theme_selected_fg_color; + border-bottom: 3px solid @rosewater; + } -#workspaces button.urgent { - background: @red; - color: @theme_selected_fg_color; -} + #workspaces button.urgent { + background: @red; + color: @theme_selected_fg_color; + } -#workspaces button.active, #workspaces button.focused { - background: @theme_selected_bg_color; - color: @theme_selected_fg_color; - border-bottom: 3px solid white; -} + #workspaces button.active, #workspaces button.focused { + background: @theme_selected_bg_color; + color: @theme_selected_fg_color; + border-bottom: 3px solid white; + } -#window { - padding: 0 10px; -} + #window { + padding: 0 10px; + } -window#waybar.empty #window { - padding: 0px; - margin: 0px; -} + window#waybar.empty #window { + padding: 0px; + margin: 0px; + } -#mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { - padding: 0 5px; - margin: 0 5px; -} + #mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { + padding: 0 5px; + margin: 0 5px; + } -#mpris { - color: @mantle; -} + #mpris { + color: @mantle; + } -#mpris.playing { - background-color: @lavender; -} + #mpris.playing { + background-color: @lavender; + } -#mpris.paused { - background-color: @mauve; -} + #mpris.paused { + background-color: @mauve; + } -#mpris.stopped { - background-color: @rosewater; -} + #mpris.stopped { + background-color: @rosewater; + } -#mode { - background: #64727D; - border-bottom: 3px solid white; -} + #mode { + background: #64727D; + border-bottom: 3px solid white; + } -#clock { -} + #clock { + } -#battery { -} + #battery { + } -#battery.charging { - color: white; - background-color: #26A65B; -} + #battery.charging { + color: white; + background-color: #26A65B; + } -@keyframes blink { - to { - background-color: #ffffff; - color: black; - } -} + @keyframes blink { + to { + background-color: #ffffff; + color: black; + } + } -#battery.warning:not(.charging) { - background: #f53c3c; - color: white; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: steps(12); - animation-iteration-count: infinite; - animation-direction: alternate; -} + #battery.warning:not(.charging) { + background: #f53c3c; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; + } ''; settings.main = { layer = "top"; @@ -150,7 +150,6 @@ window#waybar.empty #window { "mpris" ]; - modules-right = [ "privacy" "bluetooth" diff --git a/home/environments/i3/catppuccin.nix b/home/environments/i3/catppuccin.nix index eb16d8b9..33ff4c86 100644 --- a/home/environments/i3/catppuccin.nix +++ b/home/environments/i3/catppuccin.nix @@ -1,10 +1,13 @@ -{ config, lib, ... }: let +{ + config, + lib, + ... +}: let inherit (config.catppuccin) sources; - inherit (lib) mkBefore; cfg = config.catppuccin.sway; theme = "${sources.sway}/catppuccin-${cfg.flavor}"; in { - xsession.windowManager.i3.extraConfigEarly = '' + xsession.windowManager.i3.extraConfigEarly = '' ${builtins.readFile theme} ''; } diff --git a/home/environments/i3/i3.nix b/home/environments/i3/i3.nix index 95b50d7e..425f402f 100644 --- a/home/environments/i3/i3.nix +++ b/home/environments/i3/i3.nix @@ -1,14 +1,13 @@ { -pkgs, -lib, -std, -config, -... -}: -let + pkgs, + lib, + std, + config, + ... +}: let inherit (std) list; inherit (lib.modules) mkMerge; - inherit (lib) mkOptionDefault mkDefault mapAttrs; + inherit (lib) mkDefault mapAttrs; in { home.packages = with pkgs; [ maim @@ -18,42 +17,46 @@ in { ]; services.i3gopher.enable = true; xsession.windowManager.i3 = let - modifier = "Mod4"; - other_modifier = "Mod1"; - mod = modifier; - mod2 = other_modifier; - runCommand = "${config.programs.rofi.finalPackage}/bin/rofi -show combi -modes combi"; - workspaceNames = { - "1" = " Term"; - "2" = " GW2"; - "3" = " GW1"; - "4" = " Web"; - "11" = " IM"; - "12" = " Web"; - "13" = " Media"; - "14" = " Music"; - }; - workspaceNamer = num: let - numStr = builtins.toString num; - in if workspaceNames ? ${numStr} then "${numStr}:${workspaceNames.${numStr}}" else "${numStr}:${numStr}"; + modifier = "Mod4"; + other_modifier = "Mod1"; + mod = modifier; + mod2 = other_modifier; + runCommand = "${config.programs.rofi.finalPackage}/bin/rofi -show combi -modes combi"; + workspaceNames = { + "1" = " Term"; + "2" = " GW2"; + "3" = " GW1"; + "4" = " Web"; + "11" = " IM"; + "12" = " Web"; + "13" = " Media"; + "14" = " Music"; + }; + workspaceNamer = num: let + numStr = builtins.toString num; + 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"; - gapsMode = "Gaps: (o) outer, (i) inner"; - gapsOuterMode = "Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)"; - gapsInnerMode = "Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)"; - in { + actionMode = "(l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"; + gapsMode = "Gaps: (o) outer, (i) inner"; + gapsOuterMode = "Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)"; + gapsInnerMode = "Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)"; + in { enable = true; extraConfig = let - displayWorkspace = display: workspace: '' - workspace "${workspaceNamer (builtins.toString workspace)}" output ${display} - ''; - displayBindings = list.map (v: displayWorkspace "DP-2" v) (list.range 1 9) - ++ [ (displayWorkspace "DP-2" 10) ] - ++ list.map (v: displayWorkspace "HDMI-0" (11+v)) (list.range 1 12); - displayBindingsStr = lib.concatLines displayBindings; - in '' + displayWorkspace = display: workspace: '' + workspace "${workspaceNamer (builtins.toString workspace)}" output ${display} + ''; + displayBindings = + list.map (v: displayWorkspace "DP-2" v) (list.range 1 9) + ++ [(displayWorkspace "DP-2" 10)] + ++ list.map (v: displayWorkspace "HDMI-0" (11 + v)) (list.range 1 12); + displayBindingsStr = lib.concatLines displayBindings; + in '' ${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 ''; @@ -70,8 +73,14 @@ in { }; 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 @@ -107,7 +116,8 @@ in { "${mod}+Shift+g" = ''mode "${gapsMode}"''; "${mod}+Delete" = ''mode "${actionMode}"''; }; - in mkMerge (map mapDefaultAttrs ([ normalBindings ] ++ workspaceBindings)); + in + mkMerge (map mapDefaultAttrs ([normalBindings] ++ workspaceBindings)); assigns = { ${workspaceNamer 2} = [ @@ -255,7 +265,7 @@ in { focusedStatusline = "$text"; focusedSeparator = "$base"; focusedWorkspace = { - border ="$base"; + border = "$base"; background = "$mauve"; text = "$crust"; }; diff --git a/home/environments/i3/i3status-rust.nix b/home/environments/i3/i3status-rust.nix index 351e96ab..43bb6393 100644 --- a/home/environments/i3/i3status-rust.nix +++ b/home/environments/i3/i3status-rust.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.i3status-rust = { enable = true; bars = { @@ -13,61 +13,61 @@ }; }; }; - blocks = [ - { - block = "cpu"; - interval = 1; - } - { - block = "load"; - interval = 1; - format = " $icon $1m "; - } - { - block = "memory"; - format = " $icon $mem_used_percents.eng(w:2) $zram_comp_ratio "; - } - { - block = "memory"; - format = " $icon_swap $swap_used_percents.eng(w:2) "; - } - { - block = "nvidia_gpu"; - format = " $icon $utilization $memory $temperature "; - } - { - block = "hueshift"; - } - { - block = "music"; - format = " $icon {$combo.str(max_w:60) $play |}"; - } - { - block = "sound"; - format = " $icon {$volume.eng(w:2) |}"; - } - { - block = "notify"; - format = " $icon {($notification_count.eng(w:1)) |}"; - } - { - block = "toggle"; - command_on = "${pkgs.xorg.xset}/bin/xset -dpms"; - command_off = "${pkgs.xorg.xset}/bin/xset +dpms"; - format = " $icon DPMS "; - command_state = ''${pkgs.xorg.xset}/bin/xset q | ${pkgs.gnugrep}/bin/grep -F "DPMS is Disabled"''; - icon_on = "caffeine_on"; - icon_off = "caffeine_off"; - state_on = "info"; - } - { - block = "time"; - interval = 1; - format = " $icon $timestamp.datetime(f:'%F %T %Z') "; - } - ]; + blocks = [ + { + block = "cpu"; + interval = 1; + } + { + block = "load"; + interval = 1; + format = " $icon $1m "; + } + { + block = "memory"; + format = " $icon $mem_used_percents.eng(w:2) $zram_comp_ratio "; + } + { + block = "memory"; + format = " $icon_swap $swap_used_percents.eng(w:2) "; + } + { + block = "nvidia_gpu"; + format = " $icon $utilization $memory $temperature "; + } + { + block = "hueshift"; + } + { + block = "music"; + format = " $icon {$combo.str(max_w:60) $play |}"; + } + { + block = "sound"; + format = " $icon {$volume.eng(w:2) |}"; + } + { + block = "notify"; + format = " $icon {($notification_count.eng(w:1)) |}"; + } + { + block = "toggle"; + command_on = "${pkgs.xorg.xset}/bin/xset -dpms"; + command_off = "${pkgs.xorg.xset}/bin/xset +dpms"; + format = " $icon DPMS "; + command_state = ''${pkgs.xorg.xset}/bin/xset q | ${pkgs.gnugrep}/bin/grep -F "DPMS is Disabled"''; + icon_on = "caffeine_on"; + icon_off = "caffeine_off"; + state_on = "info"; + } + { + block = "time"; + interval = 1; + format = " $icon $timestamp.datetime(f:'%F %T %Z') "; + } + ]; theme = "ctp-latte"; - }; }; }; - } + }; +} diff --git a/home/environments/i3/rofi.nix b/home/environments/i3/rofi.nix index b0b396fd..95a7466f 100644 --- a/home/environments/i3/rofi.nix +++ b/home/environments/i3/rofi.nix @@ -1,4 +1,8 @@ -{ pkgs, config, ... }: { +{ + pkgs, + config, + ... +}: { home.packages = [ config.programs.rofi.finalPackage ]; diff --git a/home/environments/kde/gtk.nix b/home/environments/kde/gtk.nix index da0be91f..87a13d7f 100644 --- a/home/environments/kde/gtk.nix +++ b/home/environments/kde/gtk.nix @@ -1,2 +1,2 @@ -{pkgs, ...}: { +_: { } diff --git a/home/environments/kde/kde.nix b/home/environments/kde/kde.nix index a952f692..40657258 100644 --- a/home/environments/kde/kde.nix +++ b/home/environments/kde/kde.nix @@ -48,7 +48,7 @@ libksysguard systemsettings kcmutils - pkgs.plasma-applet-commandoutput + pkgs.plasma-applet-commandoutput ]; programs.plasma = { configFile = { diff --git a/home/environments/niri/autostart.nix b/home/environments/niri/autostart.nix index e89e84be..474f6816 100644 --- a/home/environments/niri/autostart.nix +++ b/home/environments/niri/autostart.nix @@ -1,4 +1,7 @@ -{ pkgs, config, ... }: { +{ + pkgs, + ... +}: { programs.niri.settings.spawn-at-startup = let import-gsettings = pkgs.writeShellScriptBin "import-gsettings" '' # usage: import-gsettings diff --git a/home/environments/niri/avizo.nix b/home/environments/niri/avizo.nix index c2ef6845..3342c05c 100644 --- a/home/environments/niri/avizo.nix +++ b/home/environments/niri/avizo.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { services.avizo = { enable = true; settings = { diff --git a/home/environments/niri/binds.nix b/home/environments/niri/binds.nix index 630c6014..67428380 100644 --- a/home/environments/niri/binds.nix +++ b/home/environments/niri/binds.nix @@ -1,145 +1,155 @@ -{ config, pkgs, lib, std, ... }: let +{ + config, + pkgs, + lib, + std, + ... +}: let inherit (std) list; inherit (lib.modules) mkMerge; in { programs.niri.settings.binds = let - bindWorkspace = key: workspace: { - "Mod+${key}".action.focus-workspace = workspace; - "Mod+Ctrl+${key}".action.move-column-to-workspace = workspace; - }; - workspaceBindings = - list.map (v: bindWorkspace (builtins.toString v) v) (list.range 1 9) - ++ [ - ( - bindWorkspace "0" 10 - ) - ]; - in mkMerge (workspaceBindings ++ [{ - # 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 = {}; + bindWorkspace = key: workspace: { + "Mod+${key}".action.focus-workspace = workspace; + "Mod+Ctrl+${key}".action.move-column-to-workspace = workspace; + }; + workspaceBindings = + list.map (v: bindWorkspace (builtins.toString v) v) (list.range 1 9) + ++ [ + ( + bindWorkspace "0" 10 + ) + ]; + in + mkMerge (workspaceBindings + ++ [ + { + # 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+Down".action.focus-window-down = {}; - "Mod+Up".action.focus-window-up = {}; - "Mod+Right".action.focus-column-right = {}; - "Mod+H".action.focus-column-left = {}; - "Mod+J".action.focus-window-down = {}; - "Mod+K".action.focus-window-up = {}; - "Mod+L".action.focus-column-right = {}; + "Mod+Left".action.focus-column-left = {}; + "Mod+Down".action.focus-window-down = {}; + "Mod+Up".action.focus-window-up = {}; + "Mod+Right".action.focus-column-right = {}; + "Mod+H".action.focus-column-left = {}; + "Mod+J".action.focus-window-down = {}; + "Mod+K".action.focus-window-up = {}; + "Mod+L".action.focus-column-right = {}; - "Mod+Ctrl+Left".action.move-column-left = {}; - "Mod+Ctrl+Down".action.move-window-down = {}; - "Mod+Ctrl+Up".action.move-window-up = {}; - "Mod+Ctrl+Right".action.move-column-right = {}; - "Mod+Ctrl+H".action.move-column-left = {}; - "Mod+Ctrl+J".action.move-window-down = {}; - "Mod+Ctrl+K".action.move-window-up = {}; - "Mod+Ctrl+L".action.move-column-right = {}; + "Mod+Ctrl+Left".action.move-column-left = {}; + "Mod+Ctrl+Down".action.move-window-down = {}; + "Mod+Ctrl+Up".action.move-window-up = {}; + "Mod+Ctrl+Right".action.move-column-right = {}; + "Mod+Ctrl+H".action.move-column-left = {}; + "Mod+Ctrl+J".action.move-window-down = {}; + "Mod+Ctrl+K".action.move-window-up = {}; + "Mod+Ctrl+L".action.move-column-right = {}; - "Mod+Home".action.focus-column-first = {}; - "Mod+End".action.focus-column-last = {}; - "Mod+Ctrl+Home".action.move-column-to-first = {}; - "Mod+Ctrl+End".action.move-column-to-last = {}; + "Mod+Home".action.focus-column-first = {}; + "Mod+End".action.focus-column-last = {}; + "Mod+Ctrl+Home".action.move-column-to-first = {}; + "Mod+Ctrl+End".action.move-column-to-last = {}; - "Mod+Shift+Left".action.focus-monitor-left = {}; - "Mod+Shift+Down".action.focus-monitor-down = {}; - "Mod+Shift+Up".action.focus-monitor-up = {}; - "Mod+Shift+Right".action.focus-monitor-right = {}; - "Mod+Shift+H".action.focus-monitor-left = {}; - "Mod+Shift+J".action.focus-monitor-down = {}; - "Mod+Shift+K".action.focus-monitor-up = {}; - "Mod+Shift+L".action.focus-monitor-right = {}; + "Mod+Shift+Left".action.focus-monitor-left = {}; + "Mod+Shift+Down".action.focus-monitor-down = {}; + "Mod+Shift+Up".action.focus-monitor-up = {}; + "Mod+Shift+Right".action.focus-monitor-right = {}; + "Mod+Shift+H".action.focus-monitor-left = {}; + "Mod+Shift+J".action.focus-monitor-down = {}; + "Mod+Shift+K".action.focus-monitor-up = {}; + "Mod+Shift+L".action.focus-monitor-right = {}; - "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = {}; - "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = {}; - "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = {}; - "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = {}; - "Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = {}; - "Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = {}; - "Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = {}; - "Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = {}; + "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = {}; + "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = {}; + "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = {}; + "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = {}; + "Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = {}; + "Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = {}; + "Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = {}; + "Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = {}; - "Mod+Page_Down".action.focus-workspace-down = {}; - "Mod+Page_Up".action.focus-workspace-up = {}; - "Mod+U".action.focus-workspace-down = {}; - "Mod+I".action.focus-workspace-up = {}; - "Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = {}; - "Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = {}; - "Mod+Ctrl+U".action.move-column-to-workspace-down = {}; - "Mod+Ctrl+I".action.move-column-to-workspace-up = {}; + "Mod+Page_Down".action.focus-workspace-down = {}; + "Mod+Page_Up".action.focus-workspace-up = {}; + "Mod+U".action.focus-workspace-down = {}; + "Mod+I".action.focus-workspace-up = {}; + "Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = {}; + "Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = {}; + "Mod+Ctrl+U".action.move-column-to-workspace-down = {}; + "Mod+Ctrl+I".action.move-column-to-workspace-up = {}; - "Mod+Shift+Page_Down".action.move-workspace-down = {}; - "Mod+Shift+Page_Up".action.move-workspace-up = {}; - "Mod+Shift+U".action.move-workspace-down = {}; - "Mod+Shift+I".action.move-workspace-up = {}; + "Mod+Shift+Page_Down".action.move-workspace-down = {}; + "Mod+Shift+Page_Up".action.move-workspace-up = {}; + "Mod+Shift+U".action.move-workspace-down = {}; + "Mod+Shift+I".action.move-workspace-up = {}; - "Mod+WheelScrollDown" = { - cooldown-ms = 150; - action.focus-workspace-down = {}; - }; - "Mod+WheelScrollUp" = { - cooldown-ms = 150; - action.focus-workspace-up = {}; - }; - "Mod+Ctrl+WheelScrollDown" = { - cooldown-ms = 150; - action.move-column-to-workspace-down = {}; - }; - "Mod+Ctrl+WheelScrollUp" = { - cooldown-ms = 150; - action.move-column-to-workspace-up = {}; - }; + "Mod+WheelScrollDown" = { + cooldown-ms = 150; + action.focus-workspace-down = {}; + }; + "Mod+WheelScrollUp" = { + cooldown-ms = 150; + action.focus-workspace-up = {}; + }; + "Mod+Ctrl+WheelScrollDown" = { + cooldown-ms = 150; + action.move-column-to-workspace-down = {}; + }; + "Mod+Ctrl+WheelScrollUp" = { + cooldown-ms = 150; + action.move-column-to-workspace-up = {}; + }; - "Mod+WheelScrollRight".action.focus-column-right = {}; - "Mod+WheelScrollLeft".action.focus-column-left = {}; - "Mod+Ctrl+WheelScrollRight".action.move-column-right = {}; - "Mod+Ctrl+WheelScrollLeft".action.move-column-left = {}; + "Mod+WheelScrollRight".action.focus-column-right = {}; + "Mod+WheelScrollLeft".action.focus-column-left = {}; + "Mod+Ctrl+WheelScrollRight".action.move-column-right = {}; + "Mod+Ctrl+WheelScrollLeft".action.move-column-left = {}; - "Mod+Shift+WheelScrollDown".action.focus-column-right = {}; - "Mod+Shift+WheelScrollUp".action.focus-column-left = {}; - "Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = {}; - "Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = {}; + "Mod+Shift+WheelScrollDown".action.focus-column-right = {}; + "Mod+Shift+WheelScrollUp".action.focus-column-left = {}; + "Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = {}; + "Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = {}; - "Mod+Comma".action.consume-window-into-column = {}; - "Mod+Period".action.expel-window-from-column = {}; + "Mod+Comma".action.consume-window-into-column = {}; + "Mod+Period".action.expel-window-from-column = {}; - "Mod+R".action.switch-preset-column-width = {}; - "Mod+Shift+R".action.reset-window-height = {}; - "Mod+F".action.maximize-column = {}; - "Mod+Shift+F".action.fullscreen-window = {}; - "Mod+C".action.center-column = {}; + "Mod+R".action.switch-preset-column-width = {}; + "Mod+Shift+R".action.reset-window-height = {}; + "Mod+F".action.maximize-column = {}; + "Mod+Shift+F".action.fullscreen-window = {}; + "Mod+C".action.center-column = {}; - "Mod+Minus".action.set-column-width = "-10%"; - "Mod+Equal".action.set-column-width = "+10%"; + "Mod+Minus".action.set-column-width = "-10%"; + "Mod+Equal".action.set-column-width = "+10%"; - "Mod+Shift+Minus".action.set-window-height = "-10%"; - "Mod+Shift+Equal".action.set-window-height = "+10%"; + "Mod+Shift+Minus".action.set-window-height = "-10%"; + "Mod+Shift+Equal".action.set-window-height = "+10%"; - "Print".action.screenshot = {}; - "Ctrl+Print".action.screenshot-screen = {}; - "Alt+Print".action.screenshot-window = {}; + "Print".action.screenshot = {}; + "Ctrl+Print".action.screenshot-screen = {}; + "Alt+Print".action.screenshot-window = {}; - # The quit action will show a confirmation dialog to avoid accidental exits. - "Mod+Shift+E".action.quit = {}; + # The quit action will show a confirmation dialog to avoid accidental exits. + "Mod+Shift+E".action.quit = {}; - # Powers off the monitors. To turn them back on, do any input like - # moving the mouse or pressing any other key. - "Mod+Shift+P".action.power-off-monitors = {}; + # Powers off the monitors. To turn them back on, do any input like + # moving the mouse or pressing any other key. + "Mod+Shift+P".action.power-off-monitors = {}; - # Kat - "XF86AudioRaiseVolume".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"]; - "XF86AudioPlay".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "play-pause"]; - "XF86AudioNext".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "next"]; - "XF86AudioPrev".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "prev"]; - "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+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+Shift+Escape".action.spawn = ["${config.programs.swaylock.package}/bin/swaylock" "-f"]; - #"Print".action.spawn = ["${pkgs.grimblast}/bin/grimblast" "copy" "area"]; - }]); + # Kat + "XF86AudioRaiseVolume".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"]; + "XF86AudioPlay".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "play-pause"]; + "XF86AudioNext".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "next"]; + "XF86AudioPrev".action.spawn = ["${pkgs.playerctl}/bin/playerctl" "prev"]; + "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+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+Shift+Escape".action.spawn = ["${config.programs.swaylock.package}/bin/swaylock" "-f"]; + #"Print".action.spawn = ["${pkgs.grimblast}/bin/grimblast" "copy" "area"]; + } + ]); } diff --git a/home/environments/niri/cursor.nix b/home/environments/niri/cursor.nix index 05f4463d..b69a7aec 100644 --- a/home/environments/niri/cursor.nix +++ b/home/environments/niri/cursor.nix @@ -1,4 +1,7 @@ -{ config, pkgs, ... }: { +{ + config, + ... +}: { catppuccin.cursors.enable = true; home.pointerCursor = { dotIcons.enable = true; diff --git a/home/environments/niri/mako.nix b/home/environments/niri/mako.nix index a560adf9..a41211b9 100644 --- a/home/environments/niri/mako.nix +++ b/home/environments/niri/mako.nix @@ -5,7 +5,6 @@ ... }: let inherit (config.base16) palette; - inherit (lib.modules) mkForce; in { systemd.user.services = { mako = { diff --git a/home/environments/niri/niri.nix b/home/environments/niri/niri.nix index 29e6bb40..f7123779 100644 --- a/home/environments/niri/niri.nix +++ b/home/environments/niri/niri.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: let +{ + config, + pkgs, + lib, + ... +}: let inherit (lib.meta) getExe; in { home.packages = with pkgs; [ @@ -35,15 +40,15 @@ in { }; focus-follows-mouse.enable = true; }; - layout = { + layout = { background-color = config.palette.base.hex; gaps = 10; always-center-single-column = true; preset-column-widths = [ - { proportion = 0.33333; } - { proportion = 0.5; } - { proportion = 0.66667; } - { proportion = 1.0; } + {proportion = 0.33333;} + {proportion = 0.5;} + {proportion = 0.66667;} + {proportion = 1.0;} ]; default-column-width = { proportion = 1.0; diff --git a/home/environments/niri/swayidle.nix b/home/environments/niri/swayidle.nix index c119d67e..6871f485 100644 --- a/home/environments/niri/swayidle.nix +++ b/home/environments/niri/swayidle.nix @@ -1,4 +1,8 @@ -{ pkgs, config, ... }: { +{ + pkgs, + config, + ... +}: { services.swayidle = { enable = true; timeouts = [ diff --git a/home/environments/niri/swaylock.nix b/home/environments/niri/swaylock.nix index 28e961d3..d8bdc53e 100644 --- a/home/environments/niri/swaylock.nix +++ b/home/environments/niri/swaylock.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.swaylock = { enable = true; package = pkgs.swaylock-effects; diff --git a/home/environments/niri/waybar.nix b/home/environments/niri/waybar.nix index 68f9909d..e2ff7666 100644 --- a/home/environments/niri/waybar.nix +++ b/home/environments/niri/waybar.nix @@ -3,136 +3,136 @@ _: { enable = true; systemd.enable = true; style = '' -* { - border: none; - border-radius: 0; - font-family: Monaspace Krypton, monospace; - font-size: 13px; - min-height: 0; -} + * { + border: none; + border-radius: 0; + font-family: Monaspace Krypton, monospace; + font-size: 13px; + min-height: 0; + } -window#waybar { - all:unset; -} + window#waybar { + all:unset; + } -.modules-left, .modules-right, .modules-center { - background: alpha(@base, 0.9); - box-shadow: 0px 0px 2px rgba(0,0,0,0.6); - color: @text; - padding: 5px; - margin: 2px 4px; - border: 1px solid @lavender; -} + .modules-left, .modules-right, .modules-center { + background: alpha(@base, 0.9); + box-shadow: 0px 0px 2px rgba(0,0,0,0.6); + color: @text; + padding: 5px; + margin: 2px 4px; + border: 1px solid @lavender; + } -tooltip { - background: rgba(43, 48, 59, 0.5); - border: 1px solid rgba(100, 114, 125, 0.5); -} -tooltip label { - color: white; -} + tooltip { + background: rgba(43, 48, 59, 0.5); + border: 1px solid rgba(100, 114, 125, 0.5); + } + tooltip label { + color: white; + } -#workspaces { - border-right: 1px solid @surface2; -} + #workspaces { + border-right: 1px solid @surface2; + } -#workspaces button.persistent { - background: @theme_unfocused_bg_color; - color: @subtext1; -} + #workspaces button.persistent { + background: @theme_unfocused_bg_color; + color: @subtext1; + } -#workspaces button { - padding: 2px 5px; - background: @surface0; - border-bottom: 3px solid transparent; -} + #workspaces button { + padding: 2px 5px; + background: @surface0; + border-bottom: 3px solid transparent; + } -#workspaces button.empty { - background: @crust; - color: @subtext1; -} + #workspaces button.empty { + background: @crust; + color: @subtext1; + } -#workspaces button.visible { - background: @pink; - color: @theme_selected_fg_color; - border-bottom: 3px solid @rosewater; -} + #workspaces button.visible { + background: @pink; + color: @theme_selected_fg_color; + border-bottom: 3px solid @rosewater; + } -#workspaces button.urgent { - background: @red; - color: @theme_selected_fg_color; -} + #workspaces button.urgent { + background: @red; + color: @theme_selected_fg_color; + } -#workspaces button.active, #workspaces button.focused { - background: @theme_selected_bg_color; - color: @theme_selected_fg_color; - border-bottom: 3px solid white; -} + #workspaces button.active, #workspaces button.focused { + background: @theme_selected_bg_color; + color: @theme_selected_fg_color; + border-bottom: 3px solid white; + } -#window { - padding: 0 10px; -} + #window { + padding: 0 10px; + } -window#waybar.empty #window { - padding: 0px; - margin: 0px; -} + window#waybar.empty #window { + padding: 0px; + margin: 0px; + } -#mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { - padding: 0 5px; - margin: 0 5px; -} + #mode, #clock, #battery, #idle_inhibitor, #tray, #wireplumber, #bluetooth, #backlight, #mpris { + padding: 0 5px; + margin: 0 5px; + } -#mpris { - color: @mantle; -} + #mpris { + color: @mantle; + } -#mpris.playing { - background-color: @lavender; -} + #mpris.playing { + background-color: @lavender; + } -#mpris.paused { - background-color: @mauve; -} + #mpris.paused { + background-color: @mauve; + } -#mpris.stopped { - background-color: @rosewater; -} + #mpris.stopped { + background-color: @rosewater; + } -#mode { - background: #64727D; - border-bottom: 3px solid white; -} + #mode { + background: #64727D; + border-bottom: 3px solid white; + } -#clock { -} + #clock { + } -#battery { -} + #battery { + } -#battery.charging { - color: white; - background-color: #26A65B; -} + #battery.charging { + color: white; + background-color: #26A65B; + } -@keyframes blink { - to { - background-color: #ffffff; - color: black; - } -} + @keyframes blink { + to { + background-color: #ffffff; + color: black; + } + } -#battery.warning:not(.charging) { - background: #f53c3c; - color: white; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: steps(12); - animation-iteration-count: infinite; - animation-direction: alternate; -} + #battery.warning:not(.charging) { + background: #f53c3c; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; + } ''; settings.main = { layer = "top"; @@ -149,7 +149,6 @@ window#waybar.empty #window { "mpris" ]; - modules-right = [ "privacy" "bluetooth" diff --git a/home/environments/niri/window-rules.nix b/home/environments/niri/window-rules.nix index 4d123b81..37ef21ae 100644 --- a/home/environments/niri/window-rules.nix +++ b/home/environments/niri/window-rules.nix @@ -3,36 +3,34 @@ _: { { draw-border-with-background = false; clip-to-geometry = true; - geometry-corner-radius = - let - r = 5.0; - in - { - bottom-left = r; - bottom-right = r; - top-left = r; - top-right = r; - }; + geometry-corner-radius = let + r = 5.0; + in { + bottom-left = r; + bottom-right = r; + top-left = r; + top-right = r; + }; } { - matches = [ { app-id = "^firefox$"; } ]; + matches = [{app-id = "^firefox$";}]; open-on-workspace = "browser"; } { matches = [ - { app-id = "^vesktop$"; } - { app-id = "^discord$"; } - { app-id = "^org.telegram.desktop$"; } + {app-id = "^vesktop$";} + {app-id = "^discord$";} + {app-id = "^org.telegram.desktop$";} ]; open-on-workspace = "chat"; } { - matches = [ { app-id = "^steam_app_default$"; } ]; + matches = [{app-id = "^steam_app_default$";}]; open-on-workspace = "vidya"; } { - matches = [ { app-id = "^spotify$"; } ]; + matches = [{app-id = "^spotify$";}]; open-on-workspace = "media"; } ]; diff --git a/home/profiles/common/catppuccin.nix b/home/profiles/common/catppuccin.nix index 876978e9..f10deffa 100644 --- a/home/profiles/common/catppuccin.nix +++ b/home/profiles/common/catppuccin.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, inputs, ... }: let +{ + lib, + pkgs, + inputs, + ... +}: let inherit (lib) mkForce; qtct = '' [Appearance] @@ -176,7 +181,7 @@ in { gnomeShellTheme = mkForce false; }; }; - dconf.settings = mkForce { }; + dconf.settings = mkForce {}; gtk.enable = true; # https://git.gay/olivia/fur/src/branch/main/modules/home/theming/qt/default.nix qt = { diff --git a/home/profiles/common/modules.nix b/home/profiles/common/modules.nix index ec22edfd..a134f71d 100644 --- a/home/profiles/common/modules.nix +++ b/home/profiles/common/modules.nix @@ -1,5 +1,5 @@ _: { - disabledModules = [ - "services/window-managers/i3-sway/i3.nix" - ]; + disabledModules = [ + "services/window-managers/i3-sway/i3.nix" + ]; } diff --git a/home/profiles/common/packages.nix b/home/profiles/common/packages.nix index 190b5dbc..3fcf3e0c 100644 --- a/home/profiles/common/packages.nix +++ b/home/profiles/common/packages.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: { - home.packages = [ - pkgs.magic-wormhole - ]; +{pkgs, ...}: { + home.packages = [ + pkgs.magic-wormhole + ]; } diff --git a/home/profiles/graphical/discord.nix b/home/profiles/graphical/discord.nix index aa441e66..c691334e 100644 --- a/home/profiles/graphical/discord.nix +++ b/home/profiles/graphical/discord.nix @@ -2,9 +2,7 @@ pkgs, lib, ... -}: let - inherit (lib.generators) toJSON; -in { +}: { home.packages = with pkgs; [ (discord-krisp.override { withOpenASAR = true; diff --git a/home/profiles/graphical/documents.nix b/home/profiles/graphical/documents.nix index bf8114e7..bc842008 100644 --- a/home/profiles/graphical/documents.nix +++ b/home/profiles/graphical/documents.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { home.packages = with pkgs; [ calibre pkgs.kdePackages.okular diff --git a/home/profiles/graphical/floorp/containers.nix b/home/profiles/graphical/floorp/containers.nix index 52be7a3e..73bef399 100644 --- a/home/profiles/graphical/floorp/containers.nix +++ b/home/profiles/graphical/floorp/containers.nix @@ -1,7 +1,7 @@ -{ config, lib, ... }: let - inherit (lib.attrsets) listToAttrs nameValuePair; - inherit (lib.modules) mkMerge; -in { +{ + lib, + ... +}: { programs.firefox.profiles.main = { containersForce = true; containers = { @@ -31,4 +31,3 @@ in { }; }; } - diff --git a/home/profiles/graphical/floorp/main.nix b/home/profiles/graphical/floorp/main.nix index d94d1dfc..b76c5b2f 100644 --- a/home/profiles/graphical/floorp/main.nix +++ b/home/profiles/graphical/floorp/main.nix @@ -1,11 +1,15 @@ -{pkgs, nur, ...}: let +{ + pkgs, + nur, + ... +}: let defaultFont = "Monaspace Krypton"; in { home.sessionVariables = { BROWSER = "firefox"; }; - home.packages = [ pkgs.ff2mpv-rust ]; + home.packages = [pkgs.ff2mpv-rust]; programs.firefox = { nativeMessagingHosts = [ pkgs.ff2mpv-rust diff --git a/home/profiles/graphical/floorp/mtab.nix b/home/profiles/graphical/floorp/mtab.nix index 737e7050..5caee9fc 100644 --- a/home/profiles/graphical/floorp/mtab.nix +++ b/home/profiles/graphical/floorp/mtab.nix @@ -1,4 +1,4 @@ -{ nur, ... }: { +{nur, ...}: { programs.firefox.profiles.main.extensions = { packages = with nur.repos.rycee.firefox-addons; [ mtab @@ -28,7 +28,7 @@ userDefinedCols = null; }; extras = { - snow = { enabled = "off"; }; + snow = {enabled = "off";}; }; hotkeys = { activationKey = " "; @@ -46,9 +46,9 @@ textColor = "#ffffff"; textSize = 3.75; type = "afternoon-morning"; - weather = { unitsType = "f"; }; + weather = {unitsType = "f";}; }; - options = { showOptionsButton = true; }; + options = {showOptionsButton = true;}; search = { assist = { conversions = true; @@ -75,7 +75,7 @@ }; title = { defaultTitle = "Mew Tab"; - dynamic = { enabled = true; }; + dynamic = {enabled = true;}; faviconType = "default"; }; ui = { @@ -92,7 +92,7 @@ highlightColor = "#ffffff20"; style = "glass"; }; - user = { name = "kat"; }; + user = {name = "kat";}; wallpaper = { enabled = false; filters = { diff --git a/home/profiles/graphical/floorp/tst.nix b/home/profiles/graphical/floorp/tst.nix index dfb5211d..512e37d0 100644 --- a/home/profiles/graphical/floorp/tst.nix +++ b/home/profiles/graphical/floorp/tst.nix @@ -1,4 +1,4 @@ -{ nur, ... }: { +{nur, ...}: { programs.firefox.profiles.main = { extensions = { packages = with nur.repos.rycee.firefox-addons; [ @@ -27,18 +27,18 @@ }; }; userChrome = '' - /* Hide horizontal tabs at the top of the window */ - #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar { - opacity: 0; - pointer-events: none; - } - #main-window #TabsToolbar { - visibility: collapse !important; - } - /* Hide the "Tree Style Tab" header at the top of the sidebar */ - #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { - display: none; - } + /* Hide horizontal tabs at the top of the window */ + #main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar { + opacity: 0; + pointer-events: none; + } + #main-window #TabsToolbar { + visibility: collapse !important; + } + /* Hide the "Tree Style Tab" header at the top of the sidebar */ + #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { + display: none; + } ''; }; } diff --git a/home/profiles/graphical/floorp/ublock.nix b/home/profiles/graphical/floorp/ublock.nix index 80fe8665..8ed0df2c 100644 --- a/home/profiles/graphical/floorp/ublock.nix +++ b/home/profiles/graphical/floorp/ublock.nix @@ -1,4 +1,4 @@ -{ nur, ... }: { +{nur, ...}: { programs.firefox.profiles.main.extensions = { packages = with nur.repos.rycee.firefox-addons; [ ublock-origin diff --git a/home/profiles/graphical/media.nix b/home/profiles/graphical/media.nix index f2dadf3a..34b9d4d8 100644 --- a/home/profiles/graphical/media.nix +++ b/home/profiles/graphical/media.nix @@ -1,7 +1,6 @@ { pkgs, lib, - inputs, ... }: let inherit (lib.attrsets) mapAttrsToList; diff --git a/home/profiles/graphical/spotify.nix b/home/profiles/graphical/spotify.nix index b216750e..5a631007 100644 --- a/home/profiles/graphical/spotify.nix +++ b/home/profiles/graphical/spotify.nix @@ -1,4 +1,8 @@ -{pkgs, inputs, ... }: let +{ + pkgs, + inputs, + ... +}: let spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; in { programs.spicetify = { @@ -11,12 +15,14 @@ in { experimentalFeatures = true; windowManagerPatch = true; colorScheme = "CatppuccinMocha"; - theme = spicePkgs.themes.text // { + theme = + spicePkgs.themes.text + // { additionalCss = '' - :root { - --font-family: 'Monaspace Krypton', monospace; - } - ''; - }; + :root { + --font-family: 'Monaspace Krypton', monospace; + } + ''; + }; }; } diff --git a/home/profiles/graphical/taskwarrior.nix b/home/profiles/graphical/taskwarrior.nix index c4cbc4a5..14f657a4 100644 --- a/home/profiles/graphical/taskwarrior.nix +++ b/home/profiles/graphical/taskwarrior.nix @@ -1,7 +1,7 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.taskwarrior = { enable = true; package = pkgs.taskwarrior3; }; - home.packages = [ pkgs.taskwarrior-tui ]; + home.packages = [pkgs.taskwarrior-tui]; } diff --git a/home/profiles/graphical/wezterm.nix b/home/profiles/graphical/wezterm.nix index 9f4126c6..95c267df 100644 --- a/home/profiles/graphical/wezterm.nix +++ b/home/profiles/graphical/wezterm.nix @@ -7,28 +7,28 @@ enable = true; package = inputs.wezterm.outputs.packages.${pkgs.system}.default; extraConfig = '' - local wezterm = require 'wezterm'; - local config = {} - config.font = wezterm.font_with_fallback({ - "Monaspace Krypton", - "JetBrains Mono", - "Noto Color Emoji", - "Symbols Nerd Font Mono", - }) - config.window_padding = { - left = 8, - right = 8, - top = 8, - bottom = 8, - } - config.use_fancy_tab_bar = true - config.tab_bar_at_bottom = true - config.hide_mouse_cursor_when_typing = false - config.window_decorations = "TITLE | RESIZE" - config.warn_about_missing_glyphs = false - config.font_size = 12.0 - config.check_for_updates = false - return config + local wezterm = require 'wezterm'; + local config = {} + config.font = wezterm.font_with_fallback({ + "Monaspace Krypton", + "JetBrains Mono", + "Noto Color Emoji", + "Symbols Nerd Font Mono", + }) + config.window_padding = { + left = 8, + right = 8, + top = 8, + bottom = 8, + } + config.use_fancy_tab_bar = true + config.tab_bar_at_bottom = true + config.hide_mouse_cursor_when_typing = false + config.window_decorations = "TITLE | RESIZE" + config.warn_about_missing_glyphs = false + config.font_size = 12.0 + config.check_for_updates = false + return config ''; }; } diff --git a/home/profiles/neovim/default.nix b/home/profiles/neovim/default.nix index caadb119..755cbb06 100644 --- a/home/profiles/neovim/default.nix +++ b/home/profiles/neovim/default.nix @@ -7,14 +7,14 @@ }: let inherit (lib.modules) mkIf; inherit (std) string set; - initLua = (pkgs.replaceVars ./init.lua ({ + initLua = pkgs.replaceVars ./init.lua ({ base16ShellPath = config.base16.shell.package; catppuccin_flavour = config.catppuccin.flavor; inherit (config.base16) defaultSchemeName; defaultSchemeSlug = config.base16.defaultScheme.slug; } // 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 { home.sessionVariables = mkIf config.programs.neovim.enable {EDITOR = "nvim";}; programs.neovim = { diff --git a/home/profiles/shell/zsh.nix b/home/profiles/shell/zsh.nix index d485dd12..d0095715 100644 --- a/home/profiles/shell/zsh.nix +++ b/home/profiles/shell/zsh.nix @@ -98,24 +98,24 @@ in { "sidequest" "ungoogled-chromium" ]; - flake = self; makeAliasForBin = package: nameValuePair package "nix run kat#${package}"; packages' = builtins.listToAttrs (map makeAliasForBin packages); - in mkMerge [ - packages' - { - nixdirfmt = "nixpkgs-fmt $(fd -e nix)"; - dmesg = "dmesg -HP"; - hg = "history 0 | rg"; - } - (mkIf pkgs.hostPlatform.isLinux { - sys = "systemctl"; - sysu = "systemctl --user"; - logu = "journalctl --user"; - log = "journalctl"; - lg = "log --no-pager | rg"; - }) - ]; + in + mkMerge [ + packages' + { + nixdirfmt = "nixpkgs-fmt $(fd -e nix)"; + dmesg = "dmesg -HP"; + hg = "history 0 | rg"; + } + (mkIf pkgs.hostPlatform.isLinux { + sys = "systemctl"; + sysu = "systemctl --user"; + logu = "journalctl --user"; + log = "journalctl"; + lg = "log --no-pager | rg"; + }) + ]; localVariables = { ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold"; ZSH_AUTOSUGGEST_USE_ASYNC = 1; diff --git a/modules/home/i3.nix b/modules/home/i3.nix index c3f9b72f..f9bcf80f 100644 --- a/modules/home/i3.nix +++ b/modules/home/i3.nix @@ -1,10 +1,10 @@ - -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cfg = config.xsession.windowManager.i3; commonOptions = import ./i3/options.nix { @@ -14,10 +14,26 @@ let configModule = types.submodule { options = { - inherit (commonOptions) - fonts window floating focus assigns modifier workspaceLayout - workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu - terminal defaultWorkspace workspaceOutputAssign; + inherit + (commonOptions) + fonts + window + floating + focus + assigns + modifier + workspaceLayout + workspaceAutoBackAndForth + keycodebindings + colors + bars + startup + gaps + menu + terminal + defaultWorkspace + workspaceOutputAssign + ; keybindings = mkOption { type = types.attrsOf (types.nullOr types.str); @@ -68,82 +84,118 @@ let moduleName = "i3"; }; - inherit (commonFunctions) - keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr - floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString - fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr; + inherit + (commonFunctions) + keybindingsStr + keycodebindingsStr + modeStr + assignStr + barStr + gapsStr + floatingCriteriaStr + windowCommandsStr + colorSetStr + windowBorderString + fontConfigStr + keybindingDefaultWorkspace + keybindingsRest + workspaceOutputStr + ; - startupEntryStr = { command, always, notification, workspace, ... }: + startupEntryStr = { + command, + always, + notification, + workspace, + ... + }: concatStringsSep " " [ - (if always then "exec_always" else "exec") - (if (notification && workspace == null) then "" else "--no-startup-id") - (if (workspace == null) then - command - else - "i3-msg 'workspace ${workspace}; exec ${command}'") + ( + if always + then "exec_always" + else "exec" + ) + ( + 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" - ((if cfg.config != null then - with cfg.config; - ([ cfg.extraConfigEarly] ++ [ - (fontConfigStr fonts) - "floating_modifier ${floating.modifier}" - (windowBorderString window floating) - "hide_edge_borders ${window.hideEdgeBorders}" - "focus_wrapping ${focus.wrapping}" - "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" - "focus_on_window_activation ${focus.newWindow}" - "mouse_warping ${if focus.mouseWarping then "output" else "none"}" - "workspace_layout ${workspaceLayout}" - "workspace_auto_back_and_forth ${ - lib.hm.booleans.yesNo workspaceAutoBackAndForth - }" - "client.focused ${colorSetStr colors.focused}" - "client.focused_inactive ${colorSetStr colors.focusedInactive}" - "client.unfocused ${colorSetStr colors.unfocused}" - "client.urgent ${colorSetStr colors.urgent}" - "client.placeholder ${colorSetStr colors.placeholder}" - "client.background ${colors.background}" - (keybindingsStr { keybindings = keybindingDefaultWorkspace; }) - (keybindingsStr { keybindings = keybindingsRest; }) - (keycodebindingsStr keycodebindings) - ] ++ 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 ])); + (( + if cfg.config != null + then + with cfg.config; ([cfg.extraConfigEarly] + ++ [ + (fontConfigStr fonts) + "floating_modifier ${floating.modifier}" + (windowBorderString window floating) + "hide_edge_borders ${window.hideEdgeBorders}" + "focus_wrapping ${focus.wrapping}" + "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" + "focus_on_window_activation ${focus.newWindow}" + "mouse_warping ${ + if focus.mouseWarping + then "output" + else "none" + }" + "workspace_layout ${workspaceLayout}" + "workspace_auto_back_and_forth ${ + lib.hm.booleans.yesNo workspaceAutoBackAndForth + }" + "client.focused ${colorSetStr colors.focused}" + "client.focused_inactive ${colorSetStr colors.focusedInactive}" + "client.unfocused ${colorSetStr colors.unfocused}" + "client.urgent ${colorSetStr colors.urgent}" + "client.placeholder ${colorSetStr colors.placeholder}" + "client.background ${colors.background}" + (keybindingsStr {keybindings = keybindingDefaultWorkspace;}) + (keybindingsStr {keybindings = keybindingsRest;}) + (keycodebindingsStr keycodebindings) + ] + ++ 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 - checkI3Config = - pkgs.runCommandLocal "i3-config" { buildInputs = [ cfg.package ]; } '' - # We have to make sure the wrapper does not start a dbus session - 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 - ''; + checkI3Config = pkgs.runCommandLocal "i3-config" {buildInputs = [cfg.package];} '' + # We have to make sure the wrapper does not start a dbus session + 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 + ''; in { - meta.maintainers = with maintainers; [ sumnerevans ]; + meta.maintainers = with maintainers; [sumnerevans]; options = { xsession.windowManager.i3 = { enable = mkEnableOption "i3 window manager"; - package = mkPackageOption pkgs "i3" { }; + package = mkPackageOption pkgs "i3" {}; config = mkOption { type = types.nullOr configModule; - default = { }; + default = {}; description = "i3 configuration options."; }; @@ -155,43 +207,45 @@ in { extraConfig = mkOption { type = types.lines; default = ""; - description = - "Extra configuration lines to add to ~/.config/i3/config."; + description = "Extra configuration lines to add to ~/.config/i3/config."; }; }; }; - config = mkMerge [ (mkIf cfg.enable (mkMerge [ - { - assertions = [ - (hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs - platforms.linux) - ]; + config = mkMerge [ + (mkIf cfg.enable (mkMerge [ + { + assertions = [ + (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" = { - source = checkI3Config; - onChange = '' - # There may be several sockets after log out/log in, but the old ones - # will fail with "Connection refused". - for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do - if [[ -S $i3Socket ]]; then - ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true - fi - done - ''; - }; - } - (mkIf (cfg.config != null) { - warnings = (optional (isList cfg.config.fonts) - "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") - ++ flatten (map (b: - optional (isList b.fonts) - "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") - cfg.config.bars) ++ [ + xdg.configFile."i3/config" = { + source = checkI3Config; + onChange = '' + # There may be several sockets after log out/log in, but the old ones + # will fail with "Connection refused". + for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do + if [[ -S $i3Socket ]]; then + ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true + fi + done + ''; + }; + } + (mkIf (cfg.config != null) { + warnings = + (optional (isList cfg.config.fonts) + "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") + ++ flatten (map (b: + optional (isList b.fonts) + "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) ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " + "use 'xsession.windowManager.i3.config.assigns' instead." @@ -200,46 +254,46 @@ in { ("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, " + "use 'xsession.windowManager.i3.config.focus.wrapping' instead.")) ]; - }) - ])) - {xsession.windowManager.i3.config.keybindings = mapAttrs (n: mkOptionDefault) { - "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; - "${cfg.config.modifier}+Shift+q" = "kill"; - "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; + }) + ])) + { + xsession.windowManager.i3.config.keybindings = mapAttrs (_n: mkOptionDefault) { + "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; + "${cfg.config.modifier}+Shift+q" = "kill"; + "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; - "${cfg.config.modifier}+Left" = "focus left"; - "${cfg.config.modifier}+Down" = "focus down"; - "${cfg.config.modifier}+Up" = "focus up"; - "${cfg.config.modifier}+Right" = "focus right"; + "${cfg.config.modifier}+Left" = "focus left"; + "${cfg.config.modifier}+Down" = "focus down"; + "${cfg.config.modifier}+Up" = "focus up"; + "${cfg.config.modifier}+Right" = "focus right"; - "${cfg.config.modifier}+Shift+Left" = "move left"; - "${cfg.config.modifier}+Shift+Down" = "move down"; - "${cfg.config.modifier}+Shift+Up" = "move up"; - "${cfg.config.modifier}+Shift+Right" = "move right"; + "${cfg.config.modifier}+Shift+Left" = "move left"; + "${cfg.config.modifier}+Shift+Down" = "move down"; + "${cfg.config.modifier}+Shift+Up" = "move up"; + "${cfg.config.modifier}+Shift+Right" = "move right"; - "${cfg.config.modifier}+h" = "split h"; - "${cfg.config.modifier}+v" = "split v"; - "${cfg.config.modifier}+f" = "fullscreen toggle"; + "${cfg.config.modifier}+h" = "split h"; + "${cfg.config.modifier}+v" = "split v"; + "${cfg.config.modifier}+f" = "fullscreen toggle"; - "${cfg.config.modifier}+s" = "layout stacking"; - "${cfg.config.modifier}+w" = "layout tabbed"; - "${cfg.config.modifier}+e" = "layout toggle split"; + "${cfg.config.modifier}+s" = "layout stacking"; + "${cfg.config.modifier}+w" = "layout tabbed"; + "${cfg.config.modifier}+e" = "layout toggle split"; - "${cfg.config.modifier}+Shift+space" = "floating toggle"; - "${cfg.config.modifier}+space" = "focus mode_toggle"; + "${cfg.config.modifier}+Shift+space" = "floating 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}+minus" = "scratchpad show"; + "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.config.modifier}+minus" = "scratchpad show"; - "${cfg.config.modifier}+Shift+c" = "reload"; - "${cfg.config.modifier}+Shift+r" = "restart"; - "${cfg.config.modifier}+Shift+e" = - "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + "${cfg.config.modifier}+Shift+c" = "reload"; + "${cfg.config.modifier}+Shift+r" = "restart"; + "${cfg.config.modifier}+Shift+e" = "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"; + }; } ]; } diff --git a/modules/home/i3/functions.nix b/modules/home/i3/functions.nix index a5e0a662..5b122b4e 100644 --- a/modules/home/i3/functions.nix +++ b/modules/home/i3/functions.nix @@ -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 }: - -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: + keybindingDefaultWorkspace = filterAttrs (_n: v: 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.keybindings; + cfg.config.keybindings; - keybindingsStr = { keybindings, bindsymArgs ? "", indent ? "" }: + keybindingsStr = { + keybindings, + bindsymArgs ? "", + indent ? "", + }: concatStringsSep "\n" (mapAttrsToList (keycomb: action: optionalString (action != null) "${indent}bindsym ${ lib.optionalString (bindsymArgs != "") "${bindsymArgs} " - }${keycomb} ${action}") keybindings); + }${keycomb} ${action}") + keybindings); keycodebindingsStr = keycodebindings: concatStringsSep "\n" (mapAttrsToList (keycomb: action: optionalString (action != null) "bindcode ${keycomb} ${action}") - keycodebindings); + keycodebindings); colorSetStr = c: concatStringsSep " " [ @@ -40,7 +49,7 @@ rec { c.indicator c.childBorder ]; - barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ]; + barColorSetStr = c: concatStringsSep " " [c.border c.background c.text]; modeStr = bindkeysToCode: name: keybindings: '' mode "${name}" { @@ -57,23 +66,42 @@ rec { (map (c: "assign ${criteriaStr c} ${workspace}") criteria); fontConfigStr = let - toFontStr = { names, style ? "", size ? "" }: - optionalString (names != [ ]) concatStringsSep " " - (remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]); - in fontCfg: - if isList fontCfg then - toFontStr { names = fontCfg; } - else - toFontStr { - inherit (fontCfg) names style; - size = toString fontCfg.size; - }; + toFontStr = { + names, + style ? "", + size ? "", + }: + optionalString (names != []) concatStringsSep " " + (remove "" ["font" "pango:${concatStringsSep ", " names}" style size]); + in + fontCfg: + if isList fontCfg + then toFontStr {names = fontCfg;} + else + toFontStr { + inherit (fontCfg) names style; + size = toString fontCfg.size; + }; - barStr = { id, fonts, mode, 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 ] + barStr = { + id, + fonts, + mode, + 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 [ "bar {" (optionalString (id != null) "id ${id}") @@ -87,12 +115,12 @@ rec { (optionalString (workspaceButtons != null) "workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}") (optionalString (workspaceNumbers != null) "strip_workspace_numbers ${ - lib.hm.booleans.yesNo (!workspaceNumbers) - }") + lib.hm.booleans.yesNo (!workspaceNumbers) + }") (optionalString (trayOutput != null) "tray_output ${trayOutput}") (optionalString (trayPadding != null) "tray_padding ${toString trayPadding}") - (optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [ + (optionals colorsNotNull (indent (lists.subtractLists ["" null] [ "colors {" (optionalString (colors.background != null) "background ${colors.background}") @@ -117,13 +145,13 @@ rec { (optionalString (colors.bindingMode != null) "binding_mode ${barColorSetStr colors.bindingMode}") "}" - ]) { })) + ]) {})) extraConfig "}" - ])) { }); + ])) {}); gapsStr = with cfg.config.gaps; - concatStringsSep "\n" (lists.subtractLists [ "" null ] [ + concatStringsSep "\n" (lists.subtractLists ["" null] [ (optionalString (inner != null) "gaps inner ${toString inner}") (optionalString (outer != null) "gaps outer ${toString outer}") (optionalString (horizontal != null) @@ -137,30 +165,41 @@ rec { (optionalString (smartBorders != "off") "smart_borders ${smartBorders}") ]); - windowBorderString = window: floating: - let - titlebarString = { titlebar, border, ... }: - "${if titlebar then "normal" else "pixel"} ${toString border}"; - in concatStringsSep "\n" [ + windowBorderString = window: floating: let + titlebarString = { + titlebar, + border, + ... + }: "${ + if titlebar + then "normal" + else "pixel" + } ${toString border}"; + in + concatStringsSep "\n" [ "default_border ${titlebarString window}" "default_floating_border ${titlebarString floating}" ]; - floatingCriteriaStr = criteria: - "for_window ${criteriaStr criteria} floating enable"; - windowCommandsStr = { command, criteria, ... }: - "for_window ${criteriaStr criteria} ${command}"; - workspaceOutputStr = item: - let outputs = concatMapStringsSep " " strings.escapeNixString item.output; - in ''workspace "${item.workspace}" output ${outputs}''; + floatingCriteriaStr = criteria: "for_window ${criteriaStr criteria} floating enable"; + windowCommandsStr = { + command, + criteria, + ... + }: "for_window ${criteriaStr criteria} ${command}"; + workspaceOutputStr = item: let + outputs = concatMapStringsSep " " strings.escapeNixString item.output; + in ''workspace "${item.workspace}" output ${outputs}''; - indent = list: - { includesWrapper ? true, level ? 1 }: - let prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2)); - - in (lib.imap1 (i: v: - "${if includesWrapper && (i == 1 || i == (lib.length list)) then - v - else - "${prefix}${v}"}") list); + indent = list: { + includesWrapper ? true, + level ? 1, + }: let + prefix = concatStringsSep "" (lib.genList (_x: " ") (level * 2)); + in lib.imap1 (i: v: "${ + if includesWrapper && (i == 1 || i == (lib.length list)) + then v + else "${prefix}${v}" + }") + list; } diff --git a/modules/home/i3/options.nix b/modules/home/i3/options.nix index 38edaae8..ed160e19 100644 --- a/modules/home/i3/options.nix +++ b/modules/home/i3/options.nix @@ -1,8 +1,12 @@ -{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }: - -with lib; - -let +{ + config, + lib, + moduleName, + cfg, + pkgs, + capitalModuleName ? moduleName, +}: +with lib; let isI3 = moduleName == "i3"; isSway = !isI3; @@ -12,7 +16,7 @@ let options = { names = mkOption { type = types.listOf types.str; - default = [ "monospace" ]; + default = ["monospace"]; defaultText = literalExpression ''[ "monospace" ]''; description = '' List of font names list used for window titles. Only FreeType fonts are supported. @@ -42,56 +46,65 @@ let }; startupModule = types.submodule { - options = { - command = mkOption { - type = types.str; - description = "Command that will be executed on startup."; - }; + options = + { + command = mkOption { + type = types.str; + description = "Command that will be executed on startup."; + }; - always = mkOption { - type = types.bool; - default = false; - description = "Whether to run command on each ${moduleName} restart."; - }; - } // optionalAttrs isI3 { - notification = mkOption { - type = types.bool; - default = true; - description = '' - Whether to enable startup-notification support for the command. - See {option}`--no-startup-id` option description in the i3 user guide. - ''; - }; + always = mkOption { + type = types.bool; + default = false; + description = "Whether to run command on each ${moduleName} restart."; + }; + } + // optionalAttrs isI3 { + notification = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable startup-notification support for the command. + See {option}`--no-startup-id` option description in the i3 user guide. + ''; + }; - workspace = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - Launch application on a particular workspace. DEPRECATED: - Use [](#opt-xsession.windowManager.i3.config.assigns) - instead. See . - ''; + workspace = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Launch application on a particular workspace. DEPRECATED: + Use [](#opt-xsession.windowManager.i3.config.assigns) + instead. See . + ''; + }; }; - }; - }; barModule = types.submodule { options = let versionAtLeast2009 = versionAtLeast stateVersion "20.09"; - mkNullableOption = { type, default, ... }@args: - mkOption (args // { - type = types.nullOr type; - default = if versionAtLeast2009 then null else default; - defaultText = literalExpression '' - null for state version ≥ 20.09, as example otherwise - ''; - example = default; - }); + mkNullableOption = { + type, + default, + ... + } @ args: + mkOption (args + // { + 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 { fonts = mkOption { type = with types; either (listOf str) fontOptions; - default = { }; + default = {}; example = literalExpression '' { names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; @@ -119,19 +132,19 @@ let }; mode = mkNullableOption { - type = types.enum [ "dock" "hide" "invisible" ]; + type = types.enum ["dock" "hide" "invisible"]; default = "dock"; description = "Bar visibility mode."; }; hiddenState = mkNullableOption { - type = types.enum [ "hide" "show" ]; + type = types.enum ["hide" "show"]; default = "hide"; description = "The default bar mode when 'bar.mode' == 'hide'."; }; position = mkNullableOption { - type = types.enum [ "top" "bottom" ]; + type = types.enum ["top" "bottom"]; default = "bottom"; description = "The edge of the screen ${moduleName}bar should show up."; }; @@ -145,8 +158,7 @@ let workspaceNumbers = mkNullableOption { type = types.bool; default = true; - description = - "Whether workspace numbers should be displayed within the workspace buttons."; + description = "Whether workspace numbers should be displayed within the workspace buttons."; }; command = mkOption { @@ -154,14 +166,17 @@ let default = let # If the user uses the "system" Sway (i.e. cfg.package == null) then the bar has # 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"; defaultText = "i3bar"; description = "Command that will be used to start a bar."; - example = if isI3 then - "\${pkgs.i3}/bin/i3bar -t" - else - "\${pkgs.waybar}/bin/waybar"; + example = + if isI3 + then "\${pkgs.i3}/bin/i3bar -t" + else "\${pkgs.waybar}/bin/waybar"; }; statusCommand = mkNullableOption { @@ -194,24 +209,21 @@ let focusedBackground = mkOption { type = types.nullOr types.str; default = null; - description = - "Background color of the bar on the currently focused monitor output."; + description = "Background color of the bar on the currently focused monitor output."; example = "#000000"; }; focusedStatusline = mkOption { type = types.nullOr types.str; default = null; - description = - "Text color to be used for the statusline on the currently focused monitor output."; + description = "Text color to be used for the statusline on the currently focused monitor output."; example = "#ffffff"; }; focusedSeparator = mkOption { type = types.nullOr types.str; default = null; - description = - "Text color to be used for the separator on the currently focused monitor output."; + description = "Text color to be used for the separator on the currently focused monitor output."; example = "#666666"; }; @@ -272,12 +284,11 @@ let background = "#900000"; text = "#ffffff"; }; - description = - "Border, background and text color for the binding mode indicator"; + description = "Border, background and text color for the binding mode indicator"; }; }; }; - default = { }; + default = {}; description = '' Bar color settings. All color classes can be specified using submodules with 'border', 'background', 'text', fields and RGB color hex-codes as values. @@ -291,7 +302,10 @@ let trayOutput = mkNullableOption { 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 - default = if isI3 then "primary" else "*"; + default = + if isI3 + then "primary" + else "*"; description = "Where to output tray."; }; @@ -384,7 +398,7 @@ let in { fonts = mkOption { type = with types; either (listOf str) fontOptions; - default = { }; + default = {}; example = literalExpression '' { names = [ "DejaVu Sans Mono" "FontAwesome5Free" ]; @@ -400,17 +414,20 @@ in { options = { titlebar = mkOption { type = types.bool; - default = if versionOlder stateVersion "23.05" then - (isI3 && (cfg.config.gaps == null)) - else - true; - defaultText = if isI3 then '' - true for state version ≥ 23.05 - config.gaps == null for state version < 23.05 - '' else '' - true for state version ≥ 23.05 - false for state version < 23.05 - ''; + default = + if versionOlder stateVersion "23.05" + then (isI3 && (cfg.config.gaps == null)) + else true; + defaultText = + if isI3 + then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' + else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; description = "Whether to show window titlebars."; }; @@ -422,31 +439,33 @@ in { hideEdgeBorders = mkOption { type = let - i3Options = [ "none" "vertical" "horizontal" "both" "smart" ]; - swayOptions = i3Options ++ [ "smart_no_gaps" ]; - in if isI3 then - types.enum i3Options - else - types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions)); + i3Options = ["none" "vertical" "horizontal" "both" "smart"]; + swayOptions = i3Options ++ ["smart_no_gaps"]; + in + if isI3 + then types.enum i3Options + else types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions)); default = "none"; description = "Hide window borders adjacent to the screen edges."; }; commands = mkOption { type = types.listOf windowCommandModule; - default = [ ]; + default = []; description = '' List of commands that should be executed on specific windows. See {option}`for_window` ${moduleName}wm option documentation. ''; - example = [{ - command = "border pixel 1"; - criteria = { class = "XTerm"; }; - }]; + example = [ + { + command = "border pixel 1"; + criteria = {class = "XTerm";}; + } + ]; }; }; }; - default = { }; + default = {}; description = "Window titlebar and border settings."; }; @@ -455,17 +474,20 @@ in { options = { titlebar = mkOption { type = types.bool; - default = if versionOlder stateVersion "23.05" then - (isI3 && (cfg.config.gaps == null)) - else - true; - defaultText = if isI3 then '' - true for state version ≥ 23.05 - config.gaps == null for state version < 23.05 - '' else '' - true for state version ≥ 23.05 - false for state version < 23.05 - ''; + default = + if versionOlder stateVersion "23.05" + then (isI3 && (cfg.config.gaps == null)) + else true; + defaultText = + if isI3 + then '' + true for state version ≥ 23.05 + config.gaps == null 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."; }; @@ -479,24 +501,22 @@ in { type = types.str; default = cfg.config.modifier; defaultText = "${moduleName}.config.modifier"; - description = - "Modifier key or keys that can be used to drag floating windows."; + description = "Modifier key or keys that can be used to drag floating windows."; example = "Mod4"; }; criteria = mkOption { type = types.listOf criteriaModule; - default = [ ]; - description = - "List of criteria for windows that should be opened in a floating mode."; + default = []; + description = "List of criteria for windows that should be opened in a floating mode."; example = [ - { "title" = "Steam - Update News"; } - { "class" = "Pavucontrol"; } + {"title" = "Steam - Update News";} + {"class" = "Pavucontrol";} ]; }; }; }; - default = { }; + default = {}; description = "Floating window settings."; }; @@ -504,7 +524,7 @@ in { type = types.submodule { options = { newWindow = mkOption { - type = types.enum [ "smart" "urgent" "focus" "none" ]; + type = types.enum ["smart" "urgent" "focus" "none"]; default = "smart"; description = '' This option modifies focus behavior on new window activation. @@ -515,24 +535,38 @@ in { }; followMouse = mkOption { - type = if isSway then - types.either (types.enum [ "yes" "no" "always" ]) types.bool - else - types.bool; - default = if isSway then "yes" else true; + type = + if isSway + then types.either (types.enum ["yes" "no" "always"]) types.bool + else types.bool; + default = + if isSway + then "yes" + else true; description = "Whether focus should follow the mouse."; 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 { - type = types.enum [ "yes" "no" "force" "workspace" ]; - default = { - i3 = if cfg.config.focus.forceWrapping then "force" 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}; + type = types.enum ["yes" "no" "force" "workspace"]; + default = + { + i3 = + if cfg.config.focus.forceWrapping + then "force" + 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 = '' Whether the window focus commands automatically wrap around the edge of containers. @@ -551,10 +585,10 @@ in { }; mouseWarping = mkOption { - type = if isSway then - types.oneOf [ types.bool (types.enum [ "container" "output" ]) ] - else - types.bool; + type = + if isSway + then types.oneOf [types.bool (types.enum ["container" "output"])] + else types.bool; default = true; description = '' 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."; }; assigns = mkOption { type = types.attrsOf (types.listOf criteriaModule); - default = { }; + default = {}; description = '' An attribute set that assigns applications to workspaces based on criteria. @@ -583,14 +617,14 @@ in { }; modifier = mkOption { - type = types.enum [ "Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5" ]; + type = types.enum ["Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5"]; default = "Mod1"; description = "Modifier key that is used for all default keybindings."; example = "Mod4"; }; workspaceLayout = mkOption { - type = types.enum [ "default" "stacking" "tabbed" ]; + type = types.enum ["default" "stacking" "tabbed"]; default = "default"; example = "tabbed"; description = '' @@ -613,12 +647,12 @@ in { keycodebindings = mkOption { type = types.attrsOf (types.nullOr types.str); - default = { }; + default = {}; description = '' An attribute set that assigns keypress to an action using key code. See . ''; - example = { "214" = "exec /bin/script.sh"; }; + example = {"214" = "exec /bin/script.sh";}; }; colors = mkOption { @@ -700,7 +734,7 @@ in { }; }; }; - default = { }; + default = {}; description = '' Color settings. All color classes can be specified using submodules with 'border', 'background', 'text', 'indicator' and 'childBorder' fields @@ -713,50 +747,54 @@ in { bars = mkOption { type = types.listOf barModule; - default = if versionAtLeast stateVersion "20.09" then [{ - mode = "dock"; - hiddenState = "hide"; - position = "bottom"; - workspaceButtons = true; - workspaceNumbers = true; - statusCommand = "${pkgs.i3status}/bin/i3status"; - fonts = { - names = [ "monospace" ]; - size = 8.0; - }; - trayOutput = "primary"; - colors = { - background = "#000000"; - statusline = "#ffffff"; - separator = "#666666"; - focusedWorkspace = { - border = "#4c7899"; - background = "#285577"; - text = "#ffffff"; - }; - activeWorkspace = { - border = "#333333"; - background = "#5f676a"; - text = "#ffffff"; - }; - inactiveWorkspace = { - border = "#333333"; - background = "#222222"; - text = "#888888"; - }; - urgentWorkspace = { - border = "#2f343a"; - background = "#900000"; - text = "#ffffff"; - }; - bindingMode = { - border = "#2f343a"; - background = "#900000"; - text = "#ffffff"; - }; - }; - }] else - [ { } ]; + default = + if versionAtLeast stateVersion "20.09" + then [ + { + mode = "dock"; + hiddenState = "hide"; + position = "bottom"; + workspaceButtons = true; + workspaceNumbers = true; + statusCommand = "${pkgs.i3status}/bin/i3status"; + fonts = { + names = ["monospace"]; + size = 8.0; + }; + trayOutput = "primary"; + colors = { + background = "#000000"; + statusline = "#ffffff"; + separator = "#666666"; + focusedWorkspace = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + }; + activeWorkspace = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + }; + inactiveWorkspace = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + urgentWorkspace = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + bindingMode = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + }; + } + ] + else [{}]; defaultText = literalExpression "see code"; description = '' ${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely. @@ -765,28 +803,30 @@ in { startup = mkOption { type = types.listOf startupModule; - default = [ ]; + default = []; description = '' Commands that should be executed at startup. See . ''; - example = if isI3 then - literalExpression '' - [ - { command = "systemctl --user restart polybar"; always = true; notification = false; } - { command = "dropbox start"; notification = false; } - { command = "firefox"; } - ]; - '' - else - literalExpression '' - [ - { command = "systemctl --user restart waybar"; always = true; } - { command = "dropbox start"; } - { command = "firefox"; } - ] - ''; + example = + if isI3 + then + literalExpression '' + [ + { command = "systemctl --user restart polybar"; always = true; notification = false; } + { command = "dropbox start"; notification = false; } + { command = "firefox"; } + ]; + '' + else + literalExpression '' + [ + { command = "systemctl --user restart waybar"; always = true; } + { command = "dropbox start"; } + { command = "firefox"; } + ] + ''; }; gaps = mkOption { @@ -859,7 +899,7 @@ in { }; smartBorders = mkOption { - type = types.enum [ "on" "off" "no_gaps" ]; + type = types.enum ["on" "off" "no_gaps"]; default = "off"; description = '' This option controls whether to disable container borders on @@ -876,17 +916,20 @@ in { terminal = mkOption { 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."; example = "alacritty"; }; menu = mkOption { type = types.str; - default = if isSway then - "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --" - else - "${pkgs.dmenu}/bin/dmenu_run"; + default = + if isSway + then "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --" + else "${pkgs.dmenu}/bin/dmenu_run"; description = "Default launcher to use."; example = "bemenu-run"; }; @@ -896,7 +939,9 @@ in { default = null; description = '' The default workspace to show when ${ - if isSway then "sway" else "i3" + if isSway + then "sway" + else "i3" } is launched. This must to correspond to the value of the keybinding of the default workspace. ''; @@ -904,35 +949,38 @@ in { }; workspaceOutputAssign = mkOption { - type = with types; - let - workspaceOutputOpts = submodule { - options = { - workspace = mkOption { - type = str; - default = ""; - example = "Web"; - description = '' - Name of the workspace to assign. - ''; - }; + type = with types; let + workspaceOutputOpts = submodule { + options = { + workspace = mkOption { + type = str; + default = ""; + example = "Web"; + description = '' + Name of the workspace to assign. + ''; + }; - output = mkOption { - type = with types; either str (listOf str); - default = ""; - apply = lists.toList; - example = "eDP"; - description = '' - Name(s) of the output(s) from {command}` - ${if isSway then "swaymsg" else "i3-msg"} -t get_outputs - `. - ''; - }; + output = mkOption { + type = with types; either str (listOf str); + default = ""; + apply = lists.toList; + example = "eDP"; + description = '' + Name(s) of the output(s) from {command}` + ${ + if isSway + then "swaymsg" + else "i3-msg" + } -t get_outputs + `. + ''; }; }; - in listOf workspaceOutputOpts; - default = [ ]; + }; + in + listOf workspaceOutputOpts; + default = []; description = "Assign workspaces to outputs."; }; } - diff --git a/modules/home/palette.nix b/modules/home/palette.nix index c8ddeff2..7837ef5c 100644 --- a/modules/home/palette.nix +++ b/modules/home/palette.nix @@ -4,18 +4,14 @@ pkgs, lib, ... -}: -let +}: let inherit (lib) mkOption types; palette = (pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json")) .${config.catppuccin.flavor}.colors; -in -{ - options.palette = mkOption { type = types.attrsOf types.raw; }; +in { + options.palette = mkOption {type = types.attrsOf types.raw;}; config = { inherit palette; }; } - - diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 2584c815..7f81ede3 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{lib, ...}: { programs.zsh.initContent = lib.mkBefore '' source /etc/static/zshrc ''; diff --git a/modules/system/host.nix b/modules/system/host.nix index e9a21310..f812ecde 100644 --- a/modules/system/host.nix +++ b/modules/system/host.nix @@ -66,7 +66,9 @@ in { linux = "linux"; home = "linux"; } - .${string.toLower config.type}; + .${ + string.toLower config.type + }; in "${config.arch}-${kernel}"; folder = { @@ -77,7 +79,9 @@ in { windows = "windows"; home = "home"; } - .${string.toLower config.type}; + .${ + string.toLower config.type + }; modules = mkMerge [ (mkIf (config.folder != "linux") [ # per-OS modules @@ -107,7 +111,7 @@ in { } // args); in - args: sys args; + sys; home = args: let renamedArgs = set.rename "specialArgs" "extraSpecialArgs" args; renamedArgsWithPkgs = @@ -123,7 +127,9 @@ in { darwin = inputs.darwin.lib.darwinSystem; macos = inputs.darwin.lib.darwinSystem; } - .${string.toLower config.type} + .${ + string.toLower config.type + } or null; built = mkOptionDefault (mapNullable (builder: builder { diff --git a/nixos/common/nh.nix b/nixos/common/nh.nix index 71c16558..c1174692 100644 --- a/nixos/common/nh.nix +++ b/nixos/common/nh.nix @@ -1,4 +1,8 @@ -{ pkgs, inputs, ... }: { +{ + pkgs, + inputs, + ... +}: { programs.nh = { enable = true; package = inputs.nh.packages.${pkgs.system}.nh; diff --git a/nixos/common/nix.nix b/nixos/common/nix.nix index a43ebe6f..32e9ad09 100644 --- a/nixos/common/nix.nix +++ b/nixos/common/nix.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: { +{pkgs, ...}: { nix = { gc = { automatic = true; diff --git a/nixos/common/packages.nix b/nixos/common/packages.nix index 43c3eca0..bb2a02cb 100644 --- a/nixos/common/packages.nix +++ b/nixos/common/packages.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: { - environment.systemPackages = [ - pkgs.magic-wormhole - ]; -} \ No newline at end of file +{pkgs, ...}: { + environment.systemPackages = [ + pkgs.magic-wormhole + ]; +} diff --git a/nixos/common/tailscale.nix b/nixos/common/tailscale.nix index 5117938a..ee590a86 100644 --- a/nixos/common/tailscale.nix +++ b/nixos/common/tailscale.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: with lib; let @@ -30,7 +29,8 @@ in { sops.secrets.tailscale-key = mkIf cfg.enable { sopsFile = ./secrets.yaml; }; -/* systemd.services.tailscale-autoconnect = mkIf cfg.enable rec { + /* + systemd.services.tailscale-autoconnect = mkIf cfg.enable rec { description = "Automatic connection to Tailscale"; # make sure tailscale is running before trying to connect to tailscale @@ -72,6 +72,7 @@ in { # otherwise authenticate with tailscale ${getExe tailscale} up ${advertiseExitNode} -authkey $(cat ${config.sops.secrets.tailscale-key.path}) ''; - };*/ + }; + */ }; } diff --git a/nixos/environments/hyprland/hyprland.nix b/nixos/environments/hyprland/hyprland.nix index 9330af55..f5d190fd 100644 --- a/nixos/environments/hyprland/hyprland.nix +++ b/nixos/environments/hyprland/hyprland.nix @@ -1,7 +1,11 @@ -{ pkgs, inputs, ... }: { +{ + pkgs, + inputs, + ... +}: { programs.hyprland = { enable = true; - withUWSM = true; + withUWSM = true; package = inputs.hyprland.packages."${pkgs.system}".hyprland; portalPackage = inputs.hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland; }; @@ -14,9 +18,11 @@ ''; services.clipboard-sync.enable = true; - /*services.displayManager.sddm = { + /* + services.displayManager.sddm = { enable = true; package = pkgs.kdePackages.sddm; wayland.enable = true; - };*/ + }; + */ } diff --git a/nixos/environments/i3/xdg.nix b/nixos/environments/i3/xdg.nix index 47af71da..cbe85423 100644 --- a/nixos/environments/i3/xdg.nix +++ b/nixos/environments/i3/xdg.nix @@ -9,4 +9,3 @@ }; }; } - diff --git a/nixos/environments/niri/niri.nix b/nixos/environments/niri/niri.nix index 161ae5b9..beedda4a 100644 --- a/nixos/environments/niri/niri.nix +++ b/nixos/environments/niri/niri.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.niri = { enable = true; package = pkgs.niri-unstable; diff --git a/nixos/profiles/bcachefs.nix b/nixos/profiles/bcachefs.nix index edd03e07..0c3ea3b7 100644 --- a/nixos/profiles/bcachefs.nix +++ b/nixos/profiles/bcachefs.nix @@ -1,6 +1,5 @@ { lib, - pkgs, ... }: let inherit (lib.types) submodule loaOf; diff --git a/nixos/profiles/gaming/lutris.nix b/nixos/profiles/gaming/lutris.nix index 7cbb7046..0cc37e0a 100644 --- a/nixos/profiles/gaming/lutris.nix +++ b/nixos/profiles/gaming/lutris.nix @@ -1,6 +1,5 @@ { pkgs, - inputs, ... }: { hardware.graphics = { @@ -9,7 +8,7 @@ driversi686Linux.mesa ]; }; -programs.gamescope = { + programs.gamescope = { enable = true; package = pkgs.gamescope; }; diff --git a/nixos/profiles/gaming/steam.nix b/nixos/profiles/gaming/steam.nix index 50710486..6419a90c 100644 --- a/nixos/profiles/gaming/steam.nix +++ b/nixos/profiles/gaming/steam.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: { +_: { programs.steam = { enable = true; remotePlay.openFirewall = true; diff --git a/nixos/profiles/gaming/vr.nix b/nixos/profiles/gaming/vr.nix index 285f9dec..bbae4e7d 100644 --- a/nixos/profiles/gaming/vr.nix +++ b/nixos/profiles/gaming/vr.nix @@ -1,10 +1,11 @@ -{pkgs, ... }: { +{pkgs, ...}: { programs.envision = { enable = true; openFirewall = true; # This is set true by default }; - /*services.wivrn = { + /* + services.wivrn = { enable = true; openFirewall = true; package = pkgs.wivrn.override { cudaSupport = true; }; @@ -30,7 +31,8 @@ #]; }; }; - };*/ + }; + */ environment.systemPackages = with pkgs; [ wlx-overlay-s @@ -39,7 +41,7 @@ ]; networking.firewall = { - allowedTCPPorts = [ 9757 ]; - allowedUDPPorts = [ 9757 ]; + allowedTCPPorts = [9757]; + allowedUDPPorts = [9757]; }; } diff --git a/nixos/profiles/graphical/infra.nix b/nixos/profiles/graphical/infra.nix index 2c678bb2..4e1cc4b7 100644 --- a/nixos/profiles/graphical/infra.nix +++ b/nixos/profiles/graphical/infra.nix @@ -1,38 +1,44 @@ -{ config, lib, ... }: let +{ + config, + lib, + ... +}: let inherit (lib.modules) mkIf mkDefault; in { gensokyo-zone = { - access = { - tail.enable = mkDefault true; - local.enable = mkDefault (config.networking.hostName == "goliath"); - }; - nix = { + access = { + tail.enable = mkDefault true; + local.enable = mkDefault (config.networking.hostName == "goliath"); + }; + nix = { # enable = true; #cache.infrastructure.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; - shared.enable = mkDefault true; - #domain = mkIf config.gensokyo-zone.access.local.enable "local.${domain}"; - }; - /*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); + # 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); + }; }; } diff --git a/nixos/profiles/graphical/kernel.nix b/nixos/profiles/graphical/kernel.nix index 59abb1d5..1d07b03e 100644 --- a/nixos/profiles/graphical/kernel.nix +++ b/nixos/profiles/graphical/kernel.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { boot.zfs.package = pkgs.zfs_cachyos; boot.kernelPackages = pkgs.linuxPackages_cachyos; } diff --git a/nixos/profiles/graphical/mullvad.nix b/nixos/profiles/graphical/mullvad.nix index e50ef2b6..ab5c27a1 100644 --- a/nixos/profiles/graphical/mullvad.nix +++ b/nixos/profiles/graphical/mullvad.nix @@ -1,3 +1,3 @@ _: { - services.mullvad-vpn.enable = true; -} \ No newline at end of file + services.mullvad-vpn.enable = true; +} diff --git a/nixos/profiles/graphical/sound.nix b/nixos/profiles/graphical/sound.nix index d0ae7ad3..69f219f3 100644 --- a/nixos/profiles/graphical/sound.nix +++ b/nixos/profiles/graphical/sound.nix @@ -14,7 +14,7 @@ "context.properties" = [ { name = "libpipewire-module-protocol-pulse"; - args = { }; + args = {}; } ]; "pulse.properties" = { @@ -33,11 +33,11 @@ services.pipewire.extraConfig.pipewire-pulse."91-discord-latency" = { pulse.rules = [ { - matches = [ { "application.process.binary" = "Discord"; } ]; + matches = [{"application.process.binary" = "Discord";}]; actions = { - update-props = { - "pulse.min.quantum" = "1024/48000"; - }; + update-props = { + "pulse.min.quantum" = "1024/48000"; + }; }; } ]; diff --git a/nixos/profiles/laptop/cpufreq.nix b/nixos/profiles/laptop/cpufreq.nix index c2e7520c..87a13d7f 100644 --- a/nixos/profiles/laptop/cpufreq.nix +++ b/nixos/profiles/laptop/cpufreq.nix @@ -1,2 +1,2 @@ _: { -} \ No newline at end of file +} diff --git a/nixos/profiles/quiet-boot.nix b/nixos/profiles/quiet-boot.nix index f77244c8..eb791a49 100644 --- a/nixos/profiles/quiet-boot.nix +++ b/nixos/profiles/quiet-boot.nix @@ -5,10 +5,10 @@ _: { }; consoleLogLevel = 0; kernelParams = ["quiet"]; - initrd = { - verbose = false; - systemd.enable = true; - }; + initrd = { + verbose = false; + systemd.enable = true; + }; }; catppuccin.plymouth.enable = true; } diff --git a/nixos/servers/rustdesk.nix b/nixos/servers/rustdesk.nix index b3d24c5a..c52a258f 100644 --- a/nixos/servers/rustdesk.nix +++ b/nixos/servers/rustdesk.nix @@ -1,6 +1,6 @@ _: { services.rustdesk-server = { enable = true; - relayHosts = [ "100.89.32.57" ]; + relayHosts = ["100.89.32.57"]; }; } diff --git a/outputs.nix b/outputs.nix index a217e9b8..4c7e3330 100644 --- a/outputs.nix +++ b/outputs.nix @@ -16,7 +16,7 @@ in legacyPackages = pkgs; packages = set.merge [pkgs wrappers.packages]; checks = checks // formatting.checks; - formatter = formatting.formatter; + inherit (formatting) formatter; } // systems // shells diff --git a/overlays.nix b/overlays.nix index e87676f1..b7c08da4 100644 --- a/overlays.nix +++ b/overlays.nix @@ -10,7 +10,7 @@ inputs.neorg-overlay.overlays.default inputs.niri.overlays.niri (import tree.packages.default {inherit inputs tree;}) - (final: prev: { - wivrn = prev.wivrn.override { cudaSupport = true; }; + (_final: prev: { + wivrn = prev.wivrn.override {cudaSupport = true;}; }) ] diff --git a/packages/arcmenu/default.nix b/packages/arcmenu/default.nix index 255f448c..231b36fb 100644 --- a/packages/arcmenu/default.nix +++ b/packages/arcmenu/default.nix @@ -1,5 +1,12 @@ -{ lib, stdenv, fetchFromGitLab, glib, gettext, substituteAll, gnome-menus }: - +{ + lib, + stdenv, + fetchFromGitLab, + glib, + gettext, + substituteAll, + gnome-menus, +}: stdenv.mkDerivation rec { pname = "gnome-shell-extension-arcmenu"; version = "63"; @@ -19,10 +26,11 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - glib gettext + glib + gettext ]; - makeFlags = [ "INSTALLBASE=${placeholder "out"}/share/gnome-shell/extensions" ]; + makeFlags = ["INSTALLBASE=${placeholder "out"}/share/gnome-shell/extensions"]; passthru = { extensionUuid = "arcmenu@arcmenu.com"; @@ -32,7 +40,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "Application menu for GNOME Shell, designed to provide a more traditional user experience and workflow"; license = licenses.gpl2Plus; - maintainers = with maintainers; [ dkabot ]; + maintainers = with maintainers; [dkabot]; homepage = "https://gitlab.com/arcmenu/ArcMenu"; }; -} \ No newline at end of file +} diff --git a/packages/commonalitysol.nix b/packages/commonalitysol.nix index f6afedd7..566e953b 100644 --- a/packages/commonalitysol.nix +++ b/packages/commonalitysol.nix @@ -3,7 +3,6 @@ stdenvNoCC, fetchgit, openssh, - findutils, ... }: stdenvNoCC.mkDerivation rec { diff --git a/packages/cppyy/default.nix b/packages/cppyy/default.nix index aab708d3..cf0823ce 100644 --- a/packages/cppyy/default.nix +++ b/packages/cppyy/default.nix @@ -1,10 +1,6 @@ { - stdenv, lib, fetchFromGitHub, - pkg-config, - cmake, - setuptools, python, }: let cppyy = python.buildPythonPackage rec { @@ -26,4 +22,5 @@ license = licenses.bsd3Lbnl; }; }; -in cppyy \ No newline at end of file +in + cppyy diff --git a/packages/dorion.nix b/packages/dorion.nix index 488eda2e..7ba142e3 100644 --- a/packages/dorion.nix +++ b/packages/dorion.nix @@ -18,9 +18,7 @@ webkitgtk_4_1, cargo-tauri, desktop-file-utils, -}: - -let +}: let webkitgtk_4_1' = webkitgtk_4_1.override { enableExperimental = true; }; @@ -30,165 +28,163 @@ let hash = "sha256-d9vaKLrl8RYNcHnE1iGN49ov6U/Y+9XpEsio+c1Sguc="; meta = { homepage = "https://github.com/uwu/shelter"; - sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; # actually, minified JS + sourceProvenance = [lib.sourceTypes.binaryBytecode]; # actually, minified JS license = lib.licenses.cc0; }; }; in + rustPlatform.buildRustPackage (finalAttrs: { + pname = "dorion"; + version = "6.7.1"; -rustPlatform.buildRustPackage (finalAttrs: { - pname = "dorion"; - version = "6.7.1"; + src = fetchFromGitHub { + owner = "SpikeHD"; + repo = "Dorion"; + tag = "v${finalAttrs.version}"; + hash = "sha256-d4G3royqhz+te5wPWVLNqqG/w0qOvTd7dKcWSzxUMUo="; + }; - src = fetchFromGitHub { - owner = "SpikeHD"; - repo = "Dorion"; - tag = "v${finalAttrs.version}"; - hash = "sha256-d4G3royqhz+te5wPWVLNqqG/w0qOvTd7dKcWSzxUMUo="; - }; + cargoPatches = [ + ./no-cargo-patch.patch + ]; - cargoPatches = [ - ./no-cargo-patch.patch - ]; + cargoRoot = "src-tauri"; + buildAndTestSubdir = finalAttrs.cargoRoot; - cargoRoot = "src-tauri"; - buildAndTestSubdir = finalAttrs.cargoRoot; + useFetchCargoVendor = true; + cargoHash = "sha256-1xpAJkS31DjrZCY5WJ4/Z1t1ALED5gz7xYLhVR1Qzww="; - useFetchCargoVendor = true; - cargoHash = "sha256-1xpAJkS31DjrZCY5WJ4/Z1t1ALED5gz7xYLhVR1Qzww="; + pnpmDeps = pnpm_9.fetchDeps { + inherit (finalAttrs) pname version src; + hash = "sha256-xBonUzA4+1zbViEsKap6CaG6ZRldW1LjNYIB+FmVRFs="; + }; - pnpmDeps = pnpm_9.fetchDeps { - inherit (finalAttrs) pname version src; - hash = "sha256-xBonUzA4+1zbViEsKap6CaG6ZRldW1LjNYIB+FmVRFs="; - }; + # CMake (webkit extension) + cmakeDir = "."; + 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) - cmakeDir = "."; - 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" - ]; + nativeBuildInputs = [ + pnpm_9.configHook + cargo-tauri.hook + nodejs + pkg-config + wrapGAppsHook4 + yq-go + desktop-file-utils + cmake + ninja + ]; - nativeBuildInputs = [ - pnpm_9.configHook - cargo-tauri.hook - nodejs - pkg-config - wrapGAppsHook4 - yq-go - desktop-file-utils - cmake - ninja - ]; + buildInputs = [ + openssl + webkitgtk_4_1' + 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 + ]; - buildInputs = [ - openssl - webkitgtk_4_1' - 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 = '' + # remove updater + rm -rf updater - postPatch = '' - # remove updater - rm -rf updater + # patch cargo-deps + pushd $cargoDepsCopy/tauri-plugin-shell-* + patch -p1 < /build/source/src-tauri/patches/tauri-plugin-shell+*.patch + popd - # patch cargo-deps - pushd $cargoDepsCopy/tauri-plugin-shell-* - patch -p1 < /build/source/src-tauri/patches/tauri-plugin-shell+*.patch - popd + substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \ + --replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" - substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \ - --replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" + # disable pre-build script and disable auto-updater + yq -iPo=json ' + .bundle.resources = (.bundle.resources | map(select(. != "updater*"))) + ' src-tauri/tauri.conf.json - # disable pre-build script and disable auto-updater - yq -iPo=json ' - .bundle.resources = (.bundle.resources | map(select(. != "updater*"))) - ' src-tauri/tauri.conf.json + # link shelter injection + ln -s ${shelter} src-tauri/injection/shelter.js - # link shelter injection - ln -s ${shelter} src-tauri/injection/shelter.js - - # 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! + # link html/frontend data + ln -s /build/source/src /build/source/src-tauri/html ''; - 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 + ]; + }; + }) diff --git a/packages/kwin-blishhud-shader.nix b/packages/kwin-blishhud-shader.nix index 465a7193..d8b4cdd8 100644 --- a/packages/kwin-blishhud-shader.nix +++ b/packages/kwin-blishhud-shader.nix @@ -1,5 +1,4 @@ { - lib, stdenv, fetchFromGitHub, extra-cmake-modules, diff --git a/packages/nf-build-system/build-system.sh b/packages/nf-build-system/build-system.sh index 28315050..7ba7a141 100644 --- a/packages/nf-build-system/build-system.sh +++ b/packages/nf-build-system/build-system.sh @@ -8,73 +8,73 @@ SYSTEM_TYPE=${3:-""} # Helper functions send_discord_message() { - local message="$1" - if [[ -n "$DISCORD_WEBHOOK_LINK" ]]; then - local escaped_message=$(printf '%s' "$message" | jq -R -s '.') - curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ - -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" - else - echo "Discord message (not sent): $message" - fi + local message="$1" + if [[ -n "$DISCORD_WEBHOOK_LINK" ]]; then + local escaped_message=$(printf '%s' "$message" | jq -R -s '.') + curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ + -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" + else + echo "Discord message (not sent): $message" + fi } init_nfargs() { - local nflinksuffix="-L" + local nflinksuffix="-L" - nfargs=( - "${NIX_BUILD_ARGS[@]}" + nfargs=( + "${NIX_BUILD_ARGS[@]}" + ) + + if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then + nfargs+=( + -o "${NF_ACTIONS_TEST_OUTLINK-result}" "$nflinksuffix" ) - - if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then - nfargs+=( - -o "${NF_ACTIONS_TEST_OUTLINK-result}" "$nflinksuffix" - ) - else - nfargs+=( - --no-link - ) - fi + else + nfargs+=( + --no-link + ) + fi } perform_cachix_push() { - local nflinksuffix="-L" - if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then - send_discord_message "Cachix pushing ${SYSTEM_TYPE} system build for ${ALIAS}" - cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/ - fi + local nflinksuffix="-L" + if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then + send_discord_message "Cachix pushing ${SYSTEM_TYPE} system build for ${ALIAS}" + cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/ + fi } perform_garbage_collection() { - if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then - nix-collect-garbage -d - fi + if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then + nix-collect-garbage -d + fi } # Main script if [[ -z "$SYSTEM_LINK" || -z "$ALIAS" || -z "$SYSTEM_TYPE" ]]; then - echo "Usage: $0 " >&2 - exit 1 + echo "Usage: $0 " >&2 + exit 1 fi send_discord_message "Starting ${SYSTEM_TYPE} system build for ${ALIAS}" if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then - export NF_UPDATE_CACHIX_PUSH=1 + export NF_UPDATE_CACHIX_PUSH=1 fi cd "$NF_CONFIG_ROOT" 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 if [[ ${GITHUB_ACTIONS-} = true && ${RUNNER_NAME-} = "Github Actions"* ]]; then - echo "Enabled GC between builds due to restricted disk space..." >&2 - export NF_ACTIONS_TEST_GC=1 + echo "Enabled GC between builds due to restricted disk space..." >&2 + export NF_ACTIONS_TEST_GC=1 fi NIX_BUILD_ARGS=( - --show-trace + --show-trace ) NIX_BUILD_ARGS_ASYNC=() @@ -84,37 +84,37 @@ init_nfargs nfwarn= if [[ -n "${NF_NIX_SYSTEMS_WARN-}" && " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then - nfwarn=1 + nfwarn=1 fi if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then - NIX_BUILD_ARGS_ASYNC+=("$nfinstallable") + NIX_BUILD_ARGS_ASYNC+=("$nfinstallable") else - echo "Building ${nfsystem}..." >&2 - echo >&2 + echo "Building ${nfsystem}..." >&2 + echo >&2 - if ! nix build "$nfinstallable" "${nfargs[@]}"; then - if [[ -n $nfwarn ]]; then - send_discord_message "Build failure allowed for ${nfsystem}, ignoring..." - echo "Build failure allowed for ${nfsystem}, ignoring..." >&2 - else - send_discord_message "Build failure for ${nfsystem}, problem!" - exit 1 - fi + if ! nix build "$nfinstallable" "${nfargs[@]}"; then + if [[ -n $nfwarn ]]; then + send_discord_message "Build failure allowed for ${nfsystem}, ignoring..." + echo "Build failure allowed for ${nfsystem}, ignoring..." >&2 else - send_discord_message "${SYSTEM_TYPE} system build of ${ALIAS} succeeded!" - perform_cachix_push - perform_garbage_collection + send_discord_message "Build failure for ${nfsystem}, problem!" + exit 1 fi + else + send_discord_message "${SYSTEM_TYPE} system build of ${ALIAS} succeeded!" + perform_cachix_push + perform_garbage_collection + fi fi if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then - init_nfargs - if nix build "${nfargs[@]}" "${NIX_BUILD_ARGS_ASYNC[@]}"; then - perform_cachix_push - perform_garbage_collection - else - send_discord_message "Async build failure for ${nfsystem}, problem!" - exit 1 - fi + init_nfargs + if nix build "${nfargs[@]}" "${NIX_BUILD_ARGS_ASYNC[@]}"; then + perform_cachix_push + perform_garbage_collection + else + send_discord_message "Async build failure for ${nfsystem}, problem!" + exit 1 + fi fi diff --git a/packages/nf-build-system/default.nix b/packages/nf-build-system/default.nix index 5d1e52dd..8143ffb2 100644 --- a/packages/nf-build-system/default.nix +++ b/packages/nf-build-system/default.nix @@ -5,10 +5,11 @@ cachix, jq, nix, - curl + curl, }: let inherit (lib) makeBinPath; -in writeShellScriptBin "nf-build-system" '' +in + writeShellScriptBin "nf-build-system" '' export PATH="$PATH:${lib.makeBinPath [ git cachix @@ -17,4 +18,4 @@ in writeShellScriptBin "nf-build-system" '' curl ]}" exec ${./build-system.sh} "$@" -'' + '' diff --git a/packages/nf-update/default.nix b/packages/nf-update/default.nix index 5284ae62..ae54f6d4 100644 --- a/packages/nf-update/default.nix +++ b/packages/nf-update/default.nix @@ -5,10 +5,11 @@ cachix, jq, nix, - curl + curl, }: let inherit (lib) makeBinPath; -in writeShellScriptBin "nf-update" '' +in + writeShellScriptBin "nf-update" '' export PATH="$PATH:${lib.makeBinPath [ git cachix @@ -17,4 +18,4 @@ in writeShellScriptBin "nf-update" '' curl ]}" exec ${./update.sh} "$@" -'' + '' diff --git a/packages/nf-update/update.sh b/packages/nf-update/update.sh index f75329f7..a21f1571 100644 --- a/packages/nf-update/update.sh +++ b/packages/nf-update/update.sh @@ -5,14 +5,14 @@ DISCORD_WEBHOOK_LINK=${DISCORD_WEBHOOK_LINK:-""} # Helper functions send_discord_message() { - local message="$1" - local escaped_message=$(printf '%s' "$message" | jq -R -s '.') - curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ - -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" + local message="$1" + local escaped_message=$(printf '%s' "$message" | jq -R -s '.') + curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ + -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" } if [[ -n ${CACHIX_AUTH_TOKEN-} ]]; then - export NF_UPDATE_CACHIX_PUSH=1 + export NF_UPDATE_CACHIX_PUSH=1 fi cd "$NF_CONFIG_ROOT" @@ -22,48 +22,48 @@ send_discord_message "Beginning flake update cron job" nix flake update "$@" if [[ -n $(git status --porcelain ./flake.lock) ]]; then - git -P diff ./flake.lock + git -P diff ./flake.lock else - echo "no source changes" >&2 - exit + echo "no source changes" >&2 + exit fi echo "checking that nodes still build..." >&2 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 if [[ -z ${NF_UPDATE_SKIP-} ]]; then - send_discord_message "checking that nodes still build..." - if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then - export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result} - fi + send_discord_message "checking that nodes still build..." + if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then + export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result} + fi nix run .#nf-actions-test -- -L fi if [[ -n ${NF_UPDATE_CACHIX_PUSH-} && -v NF_ACTIONS_TEST_OUTLINK ]]; then send_discord_message "Cachix pushing" - cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK}"*/ & - CACHIX_PUSH=$! + cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK}"*/ & + CACHIX_PUSH=$! fi if [[ -z ${NF_UPDATE_GIT_COMMIT-} ]]; then - wait ${CACHIX_PUSH-} - exit + wait ${CACHIX_PUSH-} + exit fi if [[ -n $(git diff --staged) ]]; then - echo "git working tree dirty, refusing to commit..." >&2 - exit 1 + echo "git working tree dirty, refusing to commit..." >&2 + exit 1 fi git add flake.lock env \ -GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch \ - GIT_{COMMITTER,AUTHOR}_NAME="flake cron job" \ -git commit --message="chore(ci): flake update" + GIT_{COMMITTER,AUTHOR}_EMAIL=github@kittywit.ch \ + GIT_{COMMITTER,AUTHOR}_NAME="flake cron job" \ + git commit --message="chore(ci): flake update" 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!" fi diff --git a/packages/synapse-cleanup/cleanup.sh b/packages/synapse-cleanup/cleanup.sh index 20e4a869..bff1ea17 100644 --- a/packages/synapse-cleanup/cleanup.sh +++ b/packages/synapse-cleanup/cleanup.sh @@ -10,89 +10,89 @@ MONTHS_TO_KEEP=1 # Helper functions send_discord_message() { - local message="$1" - echo "$message" - local escaped_message=$(printf '%s' "$message" | jq -R -s '.') - curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ - -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" + local message="$1" + echo "$message" + local escaped_message=$(printf '%s' "$message" | jq -R -s '.') + curl -s -H "Accept: application/json" -H "Content-Type: application/json" \ + -X POST --data "{\"content\": $escaped_message}" "$DISCORD_WEBHOOK_LINK" } get_db_size() { - sudo -u postgres psql matrix-synapse -t -c \ - "SELECT pg_size_pretty(pg_database_size('matrix-synapse'));" | tr -d ' ' + sudo -u postgres psql matrix-synapse -t -c \ + "SELECT pg_size_pretty(pg_database_size('matrix-synapse'));" | tr -d ' ' } 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() { - df -h / | awk 'NR==2 {print $5 " (" $3 ")"}' | tr -d '\n' + df -h / | awk 'NR==2 {print $5 " (" $3 ")"}' | tr -d '\n' } calculate_ratio() { - local before="$1" - local after="$2" - awk "BEGIN {printf \"%.2f\", ($after / $before) * 100}" + local before="$1" + local after="$2" + awk "BEGIN {printf \"%.2f\", ($after / $before) * 100}" } # Main script main() { - # Check for required variables - 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." - exit 1 + # Check for required variables + 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." + 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 + done < "${TEMPDIR}/to_purge.txt" - # 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 "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 "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 - 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 + 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 BEGIN; @@ -125,33 +125,33 @@ WHERE NOT EXISTS COMMIT; _EOF - send_discord_message "Running synapse_auto_compressor" - sudo -u matrix-synapse synapse_auto_compressor \ - -p "postgresql://matrix-synapse?user=matrix-synapse&host=/var/run/postgresql/" \ - -c 500 -n 100 + send_discord_message "Running synapse_auto_compressor" + sudo -u matrix-synapse synapse_auto_compressor \ + -p "postgresql://matrix-synapse?user=matrix-synapse&host=/var/run/postgresql/" \ + -c 500 -n 100 - send_discord_message "Reindexing database" - sudo -u postgres psql matrix-synapse -c "REINDEX (VERBOSE) DATABASE \"matrix-synapse\";" + send_discord_message "Reindexing database" + sudo -u postgres psql matrix-synapse -c "REINDEX (VERBOSE) DATABASE \"matrix-synapse\";" - send_discord_message "Vacuuming database" - sudo -u postgres psql matrix-synapse -c "VACUUM FULL VERBOSE;" + send_discord_message "Vacuuming database" + sudo -u postgres psql matrix-synapse -c "VACUUM FULL VERBOSE;" - rm -rf "${TEMPDIR}" + rm -rf "${TEMPDIR}" - send_discord_message "Synapse cleanup performed, booting up" - systemctl start matrix-synapse + send_discord_message "Synapse cleanup performed, booting up" + systemctl start matrix-synapse - # Final sizes, usage, and ratios - local db_after_size=$(get_db_size) - local media_after_size=$(get_media_store_size) - 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 media_ratio=$(calculate_ratio "${media_before_size//[A-Za-z]/}" "${media_after_size//[A-Za-z]/}") + # Final sizes, usage, and ratios + local db_after_size=$(get_db_size) + local media_after_size=$(get_media_store_size) + 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 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}%), 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 diff --git a/systems/goliath.nix b/systems/goliath.nix index 5e554809..74bbc0da 100644 --- a/systems/goliath.nix +++ b/systems/goliath.nix @@ -7,20 +7,24 @@ _: let inputs, ... }: let - inherit (lib.lists) singleton; inherit (lib.attrsets) nameValuePair listToAttrs; - datasets = [ + datasets = [ "root" "nix" "games" "home" "var" ]; - datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { - device = "zpool/${dataset}"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; + datasetEntry = dataset: + nameValuePair ( + if dataset == "root" + then "/" + else "/${dataset}" + ) { + device = "zpool/${dataset}"; + fsType = "zfs"; + options = ["zfsutil"]; + }; datasetEntries = listToAttrs (map datasetEntry datasets); drives = { @@ -40,15 +44,17 @@ _: let }; }; in { - imports = (with tree.nixos.profiles; [ + imports = + (with tree.nixos.profiles; [ graphical wireless gaming ]) ++ (with tree.nixos.environments; [ - #hyprland - niri - ]) ++ (with inputs.nixos-hardware.outputs.nixosModules; [ + #hyprland + niri + ]) + ++ (with inputs.nixos-hardware.outputs.nixosModules; [ common-pc common-pc-ssd common-cpu-amd @@ -62,17 +68,17 @@ _: let graphical ]) ++ (with tree.home.environments; [ - #hyprland - niri + #hyprland + niri ]); networking.hostId = "c3b94e85"; home-manager.users.kat.programs.niri.settings = { outputs = { - "LG Electronics LG Ultra HD 0x0001AC91" = { - scale = 1.25; - }; + "LG Electronics LG Ultra HD 0x0001AC91" = { + scale = 1.25; + }; }; environment = { NVD_BACKEND = "direct"; @@ -83,29 +89,29 @@ _: let }; }; - programs.ssh.extraConfig = '' - Host daiyousei-build - HostName 140.238.156.121 - User root - IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh + programs.ssh.extraConfig = '' + Host daiyousei-build + HostName 140.238.156.121 + User root + 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"]; hardware.nvidia = { @@ -134,16 +140,18 @@ _: let availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; }; kernelModules = ["nct6775" "kvm-amd"]; - extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; + extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; supportedFilesystems = ["ntfs" "zfs"]; }; - fileSystems = datasetEntries // { - "/boot" = drives.boot.result; - }; + fileSystems = + datasetEntries + // { + "/boot" = drives.boot.result; + }; swapDevices = [ - drives.swap.result + drives.swap.result ]; environment.systemPackages = with pkgs; [ diff --git a/systems/koishi.nix b/systems/koishi.nix index 96565bf5..1aae4fbf 100644 --- a/systems/koishi.nix +++ b/systems/koishi.nix @@ -6,20 +6,24 @@ _: let config, ... }: let - inherit (lib.lists) singleton; inherit (lib.attrsets) nameValuePair listToAttrs; - datasets = [ + datasets = [ "root" "nix" "games" "home" "var" ]; - datasetEntry = dataset: nameValuePair (if dataset == "root" then "/" else "/${dataset}") { - device = "zpool/${dataset}"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; + datasetEntry = dataset: + nameValuePair ( + if dataset == "root" + then "/" + else "/${dataset}" + ) { + device = "zpool/${dataset}"; + fsType = "zfs"; + options = ["zfsutil"]; + }; datasetEntries = listToAttrs (map datasetEntry datasets); drives = { @@ -48,30 +52,32 @@ _: let quiet-boot wireless laptop - gaming - sdr - #virtualisation - #secureboot + gaming + sdr + #virtualisation + #secureboot ]) ++ (with tree.nixos.environments; [ - niri + niri ]); config = { home-manager.users.kat.imports = (with tree.home.profiles; [ - graphical + graphical ]) ++ (with tree.home.environments; [ - niri + niri ]); - fileSystems = datasetEntries // { - "/boot" = drives.boot.result; - }; + fileSystems = + datasetEntries + // { + "/boot" = drives.boot.result; + }; - swapDevices = [ + swapDevices = [ drives.swap.result - ]; + ]; home-manager.users.kat = { wayland.windowManager.hyprland.settings.monitor = [ @@ -87,20 +93,20 @@ _: let extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; }; - services.scx = { - enable = true; - package = pkgs.scx_git.full; - scheduler = "scx_lavd"; - }; + services.scx = { + enable = true; + package = pkgs.scx_git.full; + scheduler = "scx_lavd"; + }; - virtualisation.virtualbox.host = { - enable = true; - enableExtensionPack = true; - enableKvm = true; - addNetworkInterface = false; - }; + virtualisation.virtualbox.host = { + enable = true; + enableExtensionPack = true; + enableKvm = true; + addNetworkInterface = false; + }; - zramSwap.enable = true; + zramSwap.enable = true; programs.ssh.extraConfig = '' Host daiyousei-build diff --git a/tf/cloudflare-zones.tf b/tf/cloudflare-zones.tf index 1b469820..ee2f2fc2 100644 --- a/tf/cloudflare-zones.tf +++ b/tf/cloudflare-zones.tf @@ -1,13 +1,13 @@ locals { account_id = "0467b993b65d8fd4a53fe24ed2fbb2a1" zones = { - dork = "dork.dev" - inskip = "inskip.me" + dork = "dork.dev" + inskip = "inskip.me" kittywitch = "kittywit.ch" } zone_ids = { - dork = cloudflare_zone.dork_zone.id - inskip = cloudflare_zone.inskip_zone.id + dork = cloudflare_zone.dork_zone.id + inskip = cloudflare_zone.inskip_zone.id kittywitch = cloudflare_zone.kittywitch_zone.id } } diff --git a/tf/cloudflare.tf b/tf/cloudflare.tf index 34ec496f..09e00dee 100644 --- a/tf/cloudflare.tf +++ b/tf/cloudflare.tf @@ -1,8 +1,8 @@ variable "cloudflare_api_key" { - sensitive = true + sensitive = true } provider "cloudflare" { - email = "kat@inskip.me" - api_key = var.cloudflare_api_key + email = "kat@inskip.me" + api_key = var.cloudflare_api_key } \ No newline at end of file diff --git a/tf/dork-pages.tf b/tf/dork-pages.tf index f66455af..e718816d 100644 --- a/tf/dork-pages.tf +++ b/tf/dork-pages.tf @@ -1,22 +1,22 @@ resource "cloudflare_pages_project" "dorkdev" { - account_id = local.account_id - name = "dorkdev" + account_id = local.account_id + name = "dorkdev" production_branch = "main" source { type = "github" config { - owner = "kittywitch" - repo_name = "dork.dev" - production_branch = "main" - deployments_enabled = true - pr_comments_enabled = false - production_deployment_enabled = true + owner = "kittywitch" + repo_name = "dork.dev" + production_branch = "main" + deployments_enabled = true + pr_comments_enabled = false + production_deployment_enabled = true } } build_config { - build_command = "zola build" + build_command = "zola build" destination_dir = "public" #root_dir = "/" } @@ -26,7 +26,7 @@ resource "cloudflare_pages_project" "dorkdev" { production { 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" - 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" { - account_id = local.account_id - project_name = "dorkdev" - domain = local.zones.dork + account_id = local.account_id + project_name = "dorkdev" + domain = local.zones.dork } diff --git a/tf/gmail.tf b/tf/gmail.tf index 4f1e9110..b75bb04c 100644 --- a/tf/gmail.tf +++ b/tf/gmail.tf @@ -1,29 +1,29 @@ locals { - dkims = { - 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" - kittywitch = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdmyA2+/si8UV3bodFZhtv5y68QnYr/kk9wnDHnk3JfJKusbrctXfETVu/9GXQ/U8tRquesF7aXKYHM/K3O6H58gAgIFm8JVnr9EUFh5PWBTKJxHgDo/6pprhpdAJg8k4f4p5yvqE0nUI6TC0UpN+ZmQMimgxvGGwQ6mpl7qmc7JxmTOiJbO1yz6eokU27S0NHfpdiE3TGG93i2r/LwAnHuhT/4weGO+vcXwKRTFGFFjvMo0XgjL2JnP01nk6dpDFwkkt5I26J4DkuNMkLefgDiGOoxDmG5EgPu0YwAm7Vk2/kX0W6rLe16lHGDkB0/atQ/IB9uch31GQrLP9etmdwIDAQAB" - } + dkims = { + 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" + kittywitch = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdmyA2+/si8UV3bodFZhtv5y68QnYr/kk9wnDHnk3JfJKusbrctXfETVu/9GXQ/U8tRquesF7aXKYHM/K3O6H58gAgIFm8JVnr9EUFh5PWBTKJxHgDo/6pprhpdAJg8k4f4p5yvqE0nUI6TC0UpN+ZmQMimgxvGGwQ6mpl7qmc7JxmTOiJbO1yz6eokU27S0NHfpdiE3TGG93i2r/LwAnHuhT/4weGO+vcXwKRTFGFFjvMo0XgjL2JnP01nk6dpDFwkkt5I26J4DkuNMkLefgDiGOoxDmG5EgPu0YwAm7Vk2/kX0W6rLe16lHGDkB0/atQ/IB9uch31GQrLP9etmdwIDAQAB" + } } module "inskip-gmail" { - source = "./gmail_dns" - cloudflare_api_key = var.cloudflare_api_key - zone_id = local.zone_ids.inskip - zone_name = local.zones.inskip - dkim = local.dkims.inskip + source = "./gmail_dns" + cloudflare_api_key = var.cloudflare_api_key + zone_id = local.zone_ids.inskip + zone_name = local.zones.inskip + dkim = local.dkims.inskip } module "dork-gmail" { - source = "./gmail_dns" - cloudflare_api_key = var.cloudflare_api_key - zone_id = local.zone_ids.dork - zone_name = local.zones.dork - dkim = local.dkims.dork + source = "./gmail_dns" + cloudflare_api_key = var.cloudflare_api_key + zone_id = local.zone_ids.dork + zone_name = local.zones.dork + dkim = local.dkims.dork } module "kittywitch-gmail" { - source = "./gmail_dns" - cloudflare_api_key = var.cloudflare_api_key - zone_id = local.zone_ids.kittywitch - zone_name = local.zones.kittywitch - dkim = local.dkims.kittywitch + source = "./gmail_dns" + cloudflare_api_key = var.cloudflare_api_key + zone_id = local.zone_ids.kittywitch + zone_name = local.zones.kittywitch + dkim = local.dkims.kittywitch } diff --git a/tf/gmail_dns/cloudflare_provider.tf b/tf/gmail_dns/cloudflare_provider.tf index c40565eb..f0c6fe69 100644 --- a/tf/gmail_dns/cloudflare_provider.tf +++ b/tf/gmail_dns/cloudflare_provider.tf @@ -1,13 +1,13 @@ terraform { - required_providers { - cloudflare = { - source = "cloudflare/cloudflare" - version = "4.4.0" - } + required_providers { + cloudflare = { + source = "cloudflare/cloudflare" + version = "4.4.0" } + } } provider "cloudflare" { - email = "kat@inskip.me" - api_key = var.cloudflare_api_key + email = "kat@inskip.me" + api_key = var.cloudflare_api_key } diff --git a/tf/gmail_dns/main.tf b/tf/gmail_dns/main.tf index 8a2f2156..177e90d4 100644 --- a/tf/gmail_dns/main.tf +++ b/tf/gmail_dns/main.tf @@ -1,5 +1,5 @@ resource "cloudflare_record" "gmail_mx_1_aspmx" { - name = var.zone_name + name = var.zone_name priority = 1 proxied = false ttl = 3600 @@ -9,7 +9,7 @@ resource "cloudflare_record" "gmail_mx_1_aspmx" { } resource "cloudflare_record" "gmail_mx_5_alt1" { - name = var.zone_name + name = var.zone_name priority = 5 proxied = false ttl = 3600 @@ -19,7 +19,7 @@ resource "cloudflare_record" "gmail_mx_5_alt1" { } resource "cloudflare_record" "gmail_mx_5_alt2" { - name = var.zone_name + name = var.zone_name priority = 5 proxied = false ttl = 3600 @@ -29,7 +29,7 @@ resource "cloudflare_record" "gmail_mx_5_alt2" { } resource "cloudflare_record" "gmail_mx_10_alt3" { - name = var.zone_name + name = var.zone_name priority = 10 proxied = false ttl = 3600 @@ -38,7 +38,7 @@ resource "cloudflare_record" "gmail_mx_10_alt3" { zone_id = var.zone_id } resource "cloudflare_record" "gmail_mx_10_alt4" { - name = var.zone_name + name = var.zone_name priority = 10 proxied = false ttl = 3600 @@ -53,7 +53,7 @@ resource "cloudflare_record" "gmail_dkim" { ttl = 3600 type = "TXT" value = var.dkim - zone_id = var.zone_id + zone_id = var.zone_id } resource "cloudflare_record" "gmail_spf" { @@ -62,5 +62,5 @@ resource "cloudflare_record" "gmail_spf" { ttl = 3600 type = "TXT" value = "v=spf1 include:_spf.google.com -all" - zone_id = var.zone_id + zone_id = var.zone_id } \ No newline at end of file diff --git a/tf/gmail_dns/variables.tf b/tf/gmail_dns/variables.tf index a8c7b7b8..5b69f6ed 100644 --- a/tf/gmail_dns/variables.tf +++ b/tf/gmail_dns/variables.tf @@ -1,14 +1,14 @@ variable "cloudflare_api_key" { - sensitive = true + sensitive = true } variable "zone_id" { - type = string + type = string } variable "dkim" { - type = string + type = string } variable "zone_name" { - type = string + type = string } \ No newline at end of file diff --git a/tf/inskip-pages.tf b/tf/inskip-pages.tf index 200d07c2..2cfd5068 100644 --- a/tf/inskip-pages.tf +++ b/tf/inskip-pages.tf @@ -1,23 +1,23 @@ resource "cloudflare_pages_project" "inskip_root" { - account_id = local.account_id - name = "inskip-root" + account_id = local.account_id + name = "inskip-root" production_branch = "main" source { type = "github" config { - owner = "kittywitch" - repo_name = "inskip.me" - production_branch = "main" - deployments_enabled = true - pr_comments_enabled = false - production_deployment_enabled = true + owner = "kittywitch" + repo_name = "inskip.me" + production_branch = "main" + deployments_enabled = true + pr_comments_enabled = false + production_deployment_enabled = true } } build_config { - build_command = "hugo" + build_command = "hugo" destination_dir = "public" - root_dir = "/" + root_dir = "/" } lifecycle { ignore_changes = [ @@ -28,9 +28,9 @@ resource "cloudflare_pages_project" "inskip_root" { } resource "cloudflare_pages_domain" "inskip_root" { - account_id = local.account_id - project_name = "inskip-root" - domain = local.zones.inskip + account_id = local.account_id + project_name = "inskip-root" + domain = local.zones.inskip } resource "cloudflare_record" "inskip_root_pages" { diff --git a/tf/kw-pages.tf b/tf/kw-pages.tf index 58c78916..3cc472aa 100644 --- a/tf/kw-pages.tf +++ b/tf/kw-pages.tf @@ -1,17 +1,17 @@ resource "cloudflare_pages_project" "kittywitch" { - account_id = local.account_id - name = "kittywitch" + account_id = local.account_id + name = "kittywitch" production_branch = "main" source { type = "github" config { - owner = "kittywitch" - repo_name = "kittywit.ch" - production_branch = "main" - deployments_enabled = true - pr_comments_enabled = false - production_deployment_enabled = true + owner = "kittywitch" + repo_name = "kittywit.ch" + production_branch = "main" + deployments_enabled = true + pr_comments_enabled = false + production_deployment_enabled = true } } @@ -24,9 +24,9 @@ resource "cloudflare_pages_project" "kittywitch" { } resource "cloudflare_pages_domain" "kittywitch_root" { - account_id = local.account_id - project_name = "kittywitch" - domain = local.zones.kittywitch + account_id = local.account_id + project_name = "kittywitch" + domain = local.zones.kittywitch } resource "cloudflare_record" "kittywitch_root_pages" { diff --git a/tf/oci_common_private_network.tf b/tf/oci_common_private_network.tf index 5cda782d..612c5faf 100644 --- a/tf/oci_common_private_network.tf +++ b/tf/oci_common_private_network.tf @@ -1,13 +1,13 @@ module "oci_common_private_network" { source = "./oci_common_private_network" - cidr_blocks = [ + cidr_blocks = [ "10.25.0.0/16" ] - display_name = "CoreNetwork" - dns_label = "core" - tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id + display_name = "CoreNetwork" + dns_label = "core" + tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id providers = { oci = oci.oci_compartment diff --git a/tf/oci_common_private_network/default_security_list.tf b/tf/oci_common_private_network/default_security_list.tf index 79f4350b..15654552 100644 --- a/tf/oci_common_private_network/default_security_list.tf +++ b/tf/oci_common_private_network/default_security_list.tf @@ -4,12 +4,12 @@ resource "oci_core_default_security_list" "this" { dynamic "ingress_security_rules" { for_each = [ { from = 60000 - to = 61000 } + to = 61000 } ] iterator = port content { protocol = local.protocol_number.udp - source = "0.0.0.0/0" + source = "0.0.0.0/0" description = "Mosh traffic from any origin" diff --git a/tf/oci_common_private_network/internet_gateway.tf b/tf/oci_common_private_network/internet_gateway.tf index a7886498..29b7e596 100644 --- a/tf/oci_common_private_network/internet_gateway.tf +++ b/tf/oci_common_private_network/internet_gateway.tf @@ -1,7 +1,7 @@ resource "oci_core_internet_gateway" "this" { - display_name = "internet" + display_name = "internet" compartment_id = var.tenancy_ocid - vcn_id = local.vcn.id + vcn_id = local.vcn.id } locals { diff --git a/tf/oci_common_private_network/providers.tf b/tf/oci_common_private_network/providers.tf index 6c35c789..d09296a5 100644 --- a/tf/oci_common_private_network/providers.tf +++ b/tf/oci_common_private_network/providers.tf @@ -2,12 +2,12 @@ terraform { required_providers { # Vendor: Hashicorp tls = { - source = "hashicorp/tls" + source = "hashicorp/tls" version = "4.0.5" } # Vendor: Oracle oci = { - source = "oracle/oci" + source = "oracle/oci" version = "5.45.0" } } diff --git a/tf/oci_common_private_network/virtual_cloud_network.tf b/tf/oci_common_private_network/virtual_cloud_network.tf index 328d1e97..8798294b 100644 --- a/tf/oci_common_private_network/virtual_cloud_network.tf +++ b/tf/oci_common_private_network/virtual_cloud_network.tf @@ -17,9 +17,9 @@ variable "dns_label" { resource "oci_core_vcn" "this" { compartment_id = var.tenancy_ocid - cidr_blocks = var.cidr_blocks + cidr_blocks = var.cidr_blocks display_name = var.display_name - dns_label = var.dns_label + dns_label = var.dns_label is_ipv6enabled = true } diff --git a/tf/oci_compartment_bootstrap.tf b/tf/oci_compartment_bootstrap.tf index bbbb2e46..d543ea4d 100644 --- a/tf/oci_compartment_bootstrap.tf +++ b/tf/oci_compartment_bootstrap.tf @@ -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/terraformproviderconfiguration.htm provider "oci" { - alias = "oci_root" - private_key = var.oci_compartment_bootstrap_private_key - region = var.oci_compartment_bootstrap_region - tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid - user_ocid = var.oci_compartment_bootstrap_user_ocid - fingerprint = var.oci_compartment_bootstrap_fingerprint + alias = "oci_root" + private_key = var.oci_compartment_bootstrap_private_key + region = var.oci_compartment_bootstrap_region + tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid + user_ocid = var.oci_compartment_bootstrap_user_ocid + fingerprint = var.oci_compartment_bootstrap_fingerprint } # OCI Compartment Bootstrap module "oci_compartment_bootstrap" { source = "./oci_compartment_bootstrap" - tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid - user_email = var.oci_compartment_bootstrap_user_email + tenancy_ocid = var.oci_compartment_bootstrap_tenancy_ocid + user_email = var.oci_compartment_bootstrap_user_email providers = { oci = oci.oci_root @@ -48,42 +48,42 @@ module "oci_compartment_bootstrap" { } 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 } 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 } 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 } 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 } 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 } 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 } # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformgettingstarted.htm # https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm provider "oci" { - alias = "oci_compartment" - private_key = module.oci_compartment_bootstrap.child_compartment_private_key - region = var.oci_compartment_bootstrap_region - tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id - user_ocid = module.oci_compartment_bootstrap.child_user_id - fingerprint = module.oci_compartment_bootstrap.child_compartment_key_fingerprint + alias = "oci_compartment" + private_key = module.oci_compartment_bootstrap.child_compartment_private_key + region = var.oci_compartment_bootstrap_region + tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id + user_ocid = module.oci_compartment_bootstrap.child_user_id + fingerprint = module.oci_compartment_bootstrap.child_compartment_key_fingerprint } diff --git a/tf/oci_compartment_bootstrap/api_key.tf b/tf/oci_compartment_bootstrap/api_key.tf index c6152da8..131b5803 100644 --- a/tf/oci_compartment_bootstrap/api_key.tf +++ b/tf/oci_compartment_bootstrap/api_key.tf @@ -1,6 +1,6 @@ resource "oci_identity_api_key" "this" { key_value = local.child_compartment_public_key - user_id = local.child_compartment_user + user_id = local.child_compartment_user } locals { diff --git a/tf/oci_compartment_bootstrap/compartment.tf b/tf/oci_compartment_bootstrap/compartment.tf index d5a3fa92..f35089d1 100644 --- a/tf/oci_compartment_bootstrap/compartment.tf +++ b/tf/oci_compartment_bootstrap/compartment.tf @@ -5,8 +5,8 @@ variable "tenancy_ocid" { resource "oci_identity_compartment" "this" { # Compartment ID is Tenancy ID for this case compartment_id = var.tenancy_ocid - description = "Compartment for Terraform usage" - name = "kittywitch-tf" + description = "Compartment for Terraform usage" + name = "kittywitch-tf" } diff --git a/tf/oci_compartment_bootstrap/group.tf b/tf/oci_compartment_bootstrap/group.tf index d5ecc765..e92729e5 100644 --- a/tf/oci_compartment_bootstrap/group.tf +++ b/tf/oci_compartment_bootstrap/group.tf @@ -1,6 +1,6 @@ resource "oci_identity_group" "this" { compartment_id = var.tenancy_ocid - name = "terraform" + name = "terraform" description = "terraform" } \ No newline at end of file diff --git a/tf/oci_compartment_bootstrap/group_membership.tf b/tf/oci_compartment_bootstrap/group_membership.tf index 1e1d6a65..b9da079e 100644 --- a/tf/oci_compartment_bootstrap/group_membership.tf +++ b/tf/oci_compartment_bootstrap/group_membership.tf @@ -1,4 +1,4 @@ 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 } \ No newline at end of file diff --git a/tf/oci_compartment_bootstrap/policy.tf b/tf/oci_compartment_bootstrap/policy.tf index 549d1620..4a38fa7a 100644 --- a/tf/oci_compartment_bootstrap/policy.tf +++ b/tf/oci_compartment_bootstrap/policy.tf @@ -10,7 +10,7 @@ ANY { request.operation = 'CreateNetworkSecurityGroup', request.operation = 'Del resource "oci_identity_policy" "terraform-admin" { compartment_id = var.tenancy_ocid - name = "terraform-admin" + name = "terraform-admin" description = "terraform-admin" statements = [ diff --git a/tf/oci_compartment_bootstrap/providers.tf b/tf/oci_compartment_bootstrap/providers.tf index 6c35c789..d09296a5 100644 --- a/tf/oci_compartment_bootstrap/providers.tf +++ b/tf/oci_compartment_bootstrap/providers.tf @@ -2,12 +2,12 @@ terraform { required_providers { # Vendor: Hashicorp tls = { - source = "hashicorp/tls" + source = "hashicorp/tls" version = "4.0.5" } # Vendor: Oracle oci = { - source = "oracle/oci" + source = "oracle/oci" version = "5.45.0" } } diff --git a/tf/oci_compartment_bootstrap/tls.tf b/tf/oci_compartment_bootstrap/tls.tf index 21eafe26..d5312804 100644 --- a/tf/oci_compartment_bootstrap/tls.tf +++ b/tf/oci_compartment_bootstrap/tls.tf @@ -2,12 +2,12 @@ resource "tls_private_key" "this" { # 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." algorithm = "RSA" - rsa_bits = 4096 + rsa_bits = 4096 } locals { 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" { diff --git a/tf/oci_compartment_bootstrap/user.tf b/tf/oci_compartment_bootstrap/user.tf index fbec4635..6eae4f86 100644 --- a/tf/oci_compartment_bootstrap/user.tf +++ b/tf/oci_compartment_bootstrap/user.tf @@ -4,9 +4,9 @@ variable "user_email" { resource "oci_identity_user" "this" { compartment_id = local.child_compartment_id - description = "The user for Terraform to use" - name = "terraform" - email = var.user_email + description = "The user for Terraform to use" + name = "terraform" + email = var.user_email } locals { diff --git a/tf/oci_servers.tf b/tf/oci_servers.tf index 1888bede..943a87dc 100644 --- a/tf/oci_servers.tf +++ b/tf/oci_servers.tf @@ -6,7 +6,7 @@ module "oci_servers" { source = "./oci_servers" micro_display_names = ["Mei", "Mai"] - flex_display_name = "Daiyousei" + flex_display_name = "Daiyousei" tenancy_ocid = module.oci_compartment_bootstrap.child_compartment_id nsg_id = module.oci_common_private_network.nsg_id @@ -37,17 +37,17 @@ output "mai_public_ipv4" { locals { server_ips = { daiyousei = module.oci_servers.flex_public_ipv4 - mei = module.oci_servers.micro_public_ipv4s[0] - mai = module.oci_servers.micro_public_ipv4s[1] + mei = module.oci_servers.micro_public_ipv4s[0] + mai = module.oci_servers.micro_public_ipv4s[1] } } resource "cloudflare_record" "oci" { for_each = local.server_ips - name = each.key - proxied = false - ttl = 3600 - type = "A" - value = each.value - zone_id = local.zone_ids.inskip + name = each.key + proxied = false + ttl = 3600 + type = "A" + value = each.value + zone_id = local.zone_ids.inskip } diff --git a/tf/oci_servers/flex.tf b/tf/oci_servers/flex.tf index 85630706..3c9fe99d 100644 --- a/tf/oci_servers/flex.tf +++ b/tf/oci_servers/flex.tf @@ -24,7 +24,7 @@ locals { resource "oci_core_instance" "that" { availability_domain = data.oci_identity_availability_domains.this.availability_domains.0.name - compartment_id = var.tenancy_ocid + compartment_id = var.tenancy_ocid shape = local.shapes.flex display_name = var.flex_display_name @@ -49,8 +49,8 @@ resource "oci_core_instance" "that" { assign_public_ip = true display_name = var.flex_display_name hostname_label = local.flex_hostname - nsg_ids = [var.nsg_id] - subnet_id = var.subnet_id + nsg_ids = [var.nsg_id] + subnet_id = var.subnet_id } shape_config { diff --git a/tf/oci_servers/ipv4.tf b/tf/oci_servers/ipv4.tf index c4d3550e..ed1c0e34 100644 --- a/tf/oci_servers/ipv4.tf +++ b/tf/oci_servers/ipv4.tf @@ -1,5 +1,5 @@ locals { - flex_public_ipv4 = oci_core_instance.that.public_ip + flex_public_ipv4 = oci_core_instance.that.public_ip micro_public_ipv4s = oci_core_instance.this[*].public_ip } diff --git a/tf/oci_servers/micro.tf b/tf/oci_servers/micro.tf index ac8c23e1..e68a16e0 100644 --- a/tf/oci_servers/micro.tf +++ b/tf/oci_servers/micro.tf @@ -28,7 +28,7 @@ resource "oci_core_instance" "this" { count = 2 availability_domain = local.availability_domain_micro - compartment_id = var.tenancy_ocid + compartment_id = var.tenancy_ocid shape = local.shapes.micro display_name = var.micro_display_names[count.index] @@ -51,10 +51,10 @@ resource "oci_core_instance" "this" { create_vnic_details { assign_public_ip = true - display_name = var.micro_display_names[count.index] - hostname_label = lower(var.micro_display_names[count.index]) - nsg_ids = [var.nsg_id] - subnet_id = var.subnet_id + display_name = var.micro_display_names[count.index] + hostname_label = lower(var.micro_display_names[count.index]) + nsg_ids = [var.nsg_id] + subnet_id = var.subnet_id } source_details { diff --git a/tf/oci_servers/providers.tf b/tf/oci_servers/providers.tf index 3f20158b..5f8af255 100644 --- a/tf/oci_servers/providers.tf +++ b/tf/oci_servers/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { # Vendor: Oracle oci = { - source = "oracle/oci" + source = "oracle/oci" version = "5.45.0" } } diff --git a/tf/oci_servers/vnic.tf b/tf/oci_servers/vnic.tf index ec07f2d1..8ad6800a 100644 --- a/tf/oci_servers/vnic.tf +++ b/tf/oci_servers/vnic.tf @@ -1,10 +1,10 @@ data "oci_core_vnic_attachments" "flex" { compartment_id = var.tenancy_ocid - instance_id = local.flex.id + instance_id = local.flex.id } data "oci_core_vnic_attachments" "micros" { - count = 2 + count = 2 compartment_id = var.tenancy_ocid - instance_id = local.micros[count.index].id + instance_id = local.micros[count.index].id } \ No newline at end of file diff --git a/tf/tailnet-dns.tf b/tf/tailnet-dns.tf index 3eaa08fa..f0a2c668 100644 --- a/tf/tailnet-dns.tf +++ b/tf/tailnet-dns.tf @@ -2,25 +2,25 @@ data "tailscale_devices" "tailnet" { } locals { - tailscale_devices = data.tailscale_devices.tailnet.devices + tailscale_devices = data.tailscale_devices.tailnet.devices } resource "cloudflare_record" "tailscale_device_v4_record" { for_each = { for device_name, device in local.tailscale_devices : split(".", device.name)[0] => device.addresses[0] if device.user == "kat@gensokyo.zone" } - name = "${each.key}.devices" - proxied = false - ttl = 3600 - type = "A" - value = each.value - zone_id = local.zone_ids.inskip + name = "${each.key}.devices" + proxied = false + ttl = 3600 + type = "A" + value = each.value + zone_id = local.zone_ids.inskip } resource "cloudflare_record" "tailscale_device_v6_record" { for_each = { for device_name, device in local.tailscale_devices : split(".", device.name)[0] => device.addresses[1] if device.user == "kat@gensokyo.zone" } - name = "${each.key}.devices" - proxied = false - ttl = 3600 - type = "AAAA" - value = each.value - zone_id = local.zone_ids.inskip + name = "${each.key}.devices" + proxied = false + ttl = 3600 + type = "AAAA" + value = each.value + zone_id = local.zone_ids.inskip } \ No newline at end of file diff --git a/tf/tailscale.tf b/tf/tailscale.tf index facd9622..9efca2a8 100644 --- a/tf/tailscale.tf +++ b/tf/tailscale.tf @@ -1,17 +1,17 @@ variable "tailscale_oauth_client_id" { - sensitive = true + sensitive = true } variable "tailscale_oauth_client_secret" { - sensitive = true + sensitive = true } variable "tailnet" { - sensitive = false + sensitive = false } provider "tailscale" { - oauth_client_id = var.tailscale_oauth_client_id - oauth_client_secret = var.tailscale_oauth_client_secret - tailnet = var.tailnet + oauth_client_id = var.tailscale_oauth_client_id + oauth_client_secret = var.tailscale_oauth_client_secret + tailnet = var.tailnet } \ No newline at end of file diff --git a/tf/terraform.tf b/tf/terraform.tf index edad75b4..99f5fcfe 100644 --- a/tf/terraform.tf +++ b/tf/terraform.tf @@ -2,12 +2,12 @@ terraform { required_providers { # Vendor: Hashicorp tls = { - source = "hashicorp/tls" + source = "hashicorp/tls" version = "4.0.5" } # Vendor: Oracle oci = { - source = "oracle/oci" + source = "oracle/oci" version = "5.45.0" } /*hcloud = { @@ -15,11 +15,11 @@ terraform { version = "1.38.2" }*/ tailscale = { - source = "tailscale/tailscale" + source = "tailscale/tailscale" version = "0.13.7" } cloudflare = { - source = "cloudflare/cloudflare" + source = "cloudflare/cloudflare" version = "4.4.0" } } diff --git a/treefmt.nix b/treefmt.nix index 2072958d..4e8ba967 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,7 +1,9 @@ -{ pkgs, ... }: { +_: { projectRootFile = "flake.nix"; programs = { alejandra.enable = true; + deadnix.enable = true; + statix.enable = true; terraform.enable = true; beautysh.enable = true; }; diff --git a/wrappers/actions-test.sh b/wrappers/actions-test.sh index 5a04e26d..8eff5781 100644 --- a/wrappers/actions-test.sh +++ b/wrappers/actions-test.sh @@ -2,84 +2,84 @@ set -eu if [[ ${GITHUB_ACTIONS-} = true && ${RUNNER_NAME-} = "Github Actions"* ]]; then - # low disk space available on public runners... - echo "enabled GC between builds due to restricted disk space..." >&2 - export NF_ACTIONS_TEST_GC=1 + # low disk space available on public runners... + echo "enabled GC between builds due to restricted disk space..." >&2 + export NF_ACTIONS_TEST_GC=1 fi NIX_BUILD_ARGS=( - --show-trace + --show-trace ) NIX_BUILD_ARGS_ASYNC=() init_nfargs() { - nflinksuffix="$1" - shift + nflinksuffix="$1" + shift - nfargs=( - "${NIX_BUILD_ARGS[@]}" - ) + nfargs=( + "${NIX_BUILD_ARGS[@]}" + ) - if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then - nfargs+=( - -o "${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix" - ) - else - nfargs+=( - --no-link - ) - fi + if [[ -n "${NF_ACTIONS_TEST_OUTLINK-}" || -n "${NF_UPDATE_CACHIX_PUSH-}" ]]; then + nfargs+=( + -o "${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix" + ) + else + nfargs+=( + --no-link + ) + fi } nfgc() { - if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then - if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then - cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/ - rm -f "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"* - fi - nix-collect-garbage -d - fi + if [[ -n ${NF_ACTIONS_TEST_GC-} ]]; then + if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then + cachix push kittywitch "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"*/ + rm -f "./${NF_ACTIONS_TEST_OUTLINK-result}$nflinksuffix"* + fi + nix-collect-garbage -d + fi } for nfsystem in "${NF_NIX_SYSTEMS[@]}"; do - nfinstallable="${NF_CONFIG_ROOT}#nixosConfigurations.${nfsystem}.config.system.build.toplevel" - init_nfargs "-$nfsystem" + nfinstallable="${NF_CONFIG_ROOT}#nixosConfigurations.${nfsystem}.config.system.build.toplevel" + init_nfargs "-$nfsystem" - nfwarn= - if [[ " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then - nfwarn=1 - fi + nfwarn= + if [[ " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then + nfwarn=1 + fi - if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then - NIX_BUILD_ARGS_ASYNC+=("$nfinstallable") - continue - fi + if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then + NIX_BUILD_ARGS_ASYNC+=("$nfinstallable") + continue + fi - echo "building ${nfsystem}..." >&2 - echo >&2 + echo "building ${nfsystem}..." >&2 + echo >&2 - nfbuildexit=0 - nix build "$nfinstallable" \ - "${nfargs[@]}" \ - "$@" || nfbuildexit=$? + nfbuildexit=0 + nix build "$nfinstallable" \ + "${nfargs[@]}" \ + "$@" || nfbuildexit=$? - if [[ $nfbuildexit -ne 0 ]]; then - if [[ -n $nfwarn ]]; then - echo "build failure allowed for ${nfsystem}, ignoring..." >&2 - continue - fi - exit $nfbuildexit - fi + if [[ $nfbuildexit -ne 0 ]]; then + if [[ -n $nfwarn ]]; then + echo "build failure allowed for ${nfsystem}, ignoring..." >&2 + continue + fi + exit $nfbuildexit + fi - nfgc + nfgc done if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then - init_nfargs "" - nix build \ - "${nfargs[@]}" \ - "${NIX_BUILD_ARGS_ASYNC[@]}" \ - "$@" + init_nfargs "" + nix build \ + "${nfargs[@]}" \ + "${NIX_BUILD_ARGS_ASYNC[@]}" \ + "$@" - nfgc + nfgc fi diff --git a/wrappers/generate.sh b/wrappers/generate.sh index 4ac31d7b..203e6fac 100644 --- a/wrappers/generate.sh +++ b/wrappers/generate.sh @@ -2,6 +2,6 @@ set -eu for ciconfig in "${NF_CONFIG_FILES[@]}"; do - echo "processing ${ciconfig}..." >&2 - nix run --argstr config "$NF_CONFIG_ROOT/ci/$ciconfig" -f "$NF_INPUT_CI" run.gh-actions-generate + echo "processing ${ciconfig}..." >&2 + nix run --argstr config "$NF_CONFIG_ROOT/ci/$ciconfig" -f "$NF_INPUT_CI" run.gh-actions-generate done