This commit is contained in:
2025-02-16 19:40:39 +01:00
parent 2e5dcfe151
commit fa0407fbd6
31 changed files with 919 additions and 3047 deletions

View File

@@ -50,6 +50,8 @@ in {
vulkan-tools
wayland
wayland-protocols
scx.rustscheds
libGL
# rocmPackages.rocm-smi
];
})

View File

@@ -0,0 +1,63 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.programs.hyprland;
in {
options = {
nixos.programs.hyprland.appearance.enable = mkEnableOption "Enables appearance settings in Hyprland";
};
config = mkIf cfg.appearance.enable {
programs.hyprland.settings = {
general = {
gaps_in = 2;
gaps_out = "4, 4, 4, 4";
border_size = 3;
#col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
#col.inactive_border = rgba(595959aa)
"col.active_border" = "rgb(4c7a5d)"; # rgba(b16286ee) 45deg
"col.inactive_border" = "rgb(504945)";
layout = "dwindle";
resize_on_border = true;
};
decoration = {
rounding = 0;
blur = {
enabled = true;
brightness = 1.0;
contrast = 1.0;
noise = 0.01;
vibrancy = 0.15;
vibrancy_darkness = 0.5;
passes = 1;
size = 3;
popups = true;
popups_ignorealpha = 0.2;
};
shadow = {
enabled = false;
color = "rgba(00000025)";
ignore_window = true;
offset = "0 5";
range = 45;
render_power = 2;
scale = 0.95;
};
};
animations.enabled = true;
animation = [
"border, 1, 2, default"
"fade, 1, 4, default"
"windows, 1, 3, default, popin 80%"
"workspaces, 1, 2, default, slide"
];
dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # you probably want this
};
};
};
}

View File

@@ -1,32 +1,39 @@
{
pkgs,
inputs,
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib) mkIf mkEnableOption mkDefault;
cfg = config.nixos.programs.hyprland;
# hyprsysteminfoFlake = inputs.hyprsysteminfo.packages.${pkgs.system}.default;
in {
imports = [
inputs.hyprland.nixosModules.default
./appearance.nix
./inputs.nix
./keybinds.nix
./rules.nix
./startup.nix
];
options = {
nixos.programs.hyprland = {
enable = mkEnableOption "Enables hyprland";
enable = mkEnableOption "Enable Hyprland";
};
};
config = mkIf cfg.enable {
security.pam.services.hyprlock.text = "auth include login";
nixos.programs.hyprland = {
appearance.enable = mkDefault true;
inputs.enable = mkDefault true;
keybinds.enable = mkDefault true;
rules.enable = mkDefault true;
startup.enable = mkDefault true;
};
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
environment = {
variables.NIXOS_OZONE_WL = "1";
systemPackages = [
# pkgs.hyprwayland-scanner
# hyprsysteminfoFlake
];
};
environment.variables.NIXOS_OZONE_WL = "1";
};
}

View File

@@ -0,0 +1,116 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.nixos.programs.hyprland;
host = config.networking.hostName;
in {
options = {
nixos.programs.hyprland.inputs.enable = mkEnableOption "Enables input settings in Hyprland";
};
config = mkIf cfg.inputs.enable (mkMerge [
{
programs.hyprland.settings = {
env = [
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
];
input = {
kb_layout = "se";
kb_variant = "nodeadkeys";
follow_mouse = 1;
accel_profile = "flat";
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = true;
disable_while_typing = true;
clickfinger_behavior = true;
scroll_factor = 0.5;
};
};
gestures = {
workspace_swipe = true;
workspace_swipe_distance = 400;
workspace_swipe_fingers = 3;
workspace_swipe_cancel_ratio = 0.2;
workspace_swipe_min_speed_to_force = 5;
workspace_swipe_direction_lock = true;
workspace_swipe_direction_lock_threshold = 10;
workspace_swipe_create_new = true;
};
misc = {
mouse_move_enables_dpms = 1;
key_press_enables_dpms = 0;
force_default_wallpaper = 0;
disable_hyprland_logo = true;
disable_splash_rendering = true;
disable_autoreload = true;
disable_xdg_env_checks = true;
layers_hog_keyboard_focus = false;
};
xwayland = {
force_zero_scaling = false;
};
};
}
(mkIf (host == "cnix") {
programs.hyprland.settings = {
render = {
explicit_sync = 2;
explicit_sync_kms = 2;
direct_scanout = false;
};
cursor = {
no_hardware_cursors = 2;
};
general = {
allow_tearing = false;
};
misc = {
vrr = 0;
};
};
})
(mkIf (host == "cnixpad") {
programs.hyprland.settings = {
input = {
kb_options = "ctrl:swapcaps";
};
general = {
allow_tearing = false;
};
misc = {
vrr = 0;
vfr = 1;
};
};
})
(mkIf (host == "toothpc") {
programs.hyprland.settings = {
render = {
explicit_sync = 0;
explicit_sync_kms = 0;
direct_scanout = false;
};
cursor = {
no_hardware_cursors = true;
};
general = {
allow_tearing = false;
};
misc = {
vrr = 0;
};
};
})
]);
}

View File

@@ -0,0 +1,129 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.nixos.programs.hyprland;
host = config.networking.hostName;
toggle = program: let
prog = builtins.substring 0 14 program;
in "pkill ${prog} || uwsm app -- ${program}";
runOnce = program: "pgrep ${program} || uwsm app -- ${program}";
in {
options = {
nixos.programs.hyprland.keybinds.enable = mkEnableOption "Enables keybind settings in Hyprland";
};
config = mkIf cfg.keybinds.enable (mkMerge [
{
programs.hyprland.settings = {
# Common Keybind Variables
"$fileManager" = "thunar";
"$yazi" = "foot -e yazi";
"$launcher" = "fuzzel";
bind = [
"$mod, SPACE, exec, $launcher"
"$mod, R, exec, $launcher"
"$mod, L, exec, ${toggle "nwg-bar"}"
"$mod SHIFT, B, exec, pkill -SIGUSR2 waybar"
"$mod, A, exec, pkill -SIGUSR1 waybar"
"$mod, T, exec, $terminal"
"$mod, W, exec, $browser"
"$mod, K, exec, keepassxc"
"$mod SHIFT, W, exec, $browserinc"
"$mod, Q, killactive,"
"$mod, E, exec, $fileManager"
"$mod SHIFT, E, exec, $yazi"
"$mod, F, fullscreen,"
"$mod SHIFT, F, togglefloating,"
"$mod, P, pseudo,"
"$mod, J, togglesplit,"
"$mod, C, exec, hyprctl dispatch exec copyq toggle"
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
",XF86AudioLowerVolume, exec, volume-control.sh --dec"
",XF86AudioRaiseVolume, exec, volume-control.sh --inc"
",XF86AudioMute, exec, volume-control.sh --toggle"
",XF86AudioMicMute, exec, volume-control.sh --toggle-mic"
",XF86MonBrightnessDown, exec, brightnessctl s 5%-"
",XF86MonBrightnessUp, exec, brightnessctl s +5%"
"$mod, XF86MonBrightnessUp, exec, hyprctl dispatch dpms on"
"$mod, XF86MonBrightnessDown, exec, hyprctl dispatch dpms off"
",Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave area"
"SHIFT, Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave output"
"ALT, Insert, exec, ${runOnce "grimblast"} --freeze save area - | ${runOnce "tesseract"} - - | wl-copy && ${runOnce "notify-send"} -t 3000 'OCR result copied to buffer'"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
};
}
(mkIf (host == "cnix") {
programs.hyprland.settings = {
"$terminal" = "ghostty";
"$browser" = "zen";
"$browserinc" = "zen --private-window";
"$mod" = "SUPER";
bind = [
# Add more host-specific binds as needed
];
};
})
(mkIf (host == "cnixpad") {
programs.hyprland.settings = {
"$terminal" = "foot";
"$browser" = "zen";
"$browserinc" = "zen --private-window";
"$mod" = "ALT_L";
bind = [
# Add more host-specific binds as needed
];
};
})
(mkIf (host == "toothpc") {
programs.hyprland.settings = {
"$terminal" = "alacritty";
"$browser" = "firefox";
"$browserinc" = "firefox --private-window";
"$mod" = "ALT_L";
bind = [
# Add more host-specific binds as needed
];
};
})
]);
}

View File

@@ -0,0 +1,94 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.programs.hyprland.rules;
in {
options = {
nixos.programs.hyprland.rules.enable = mkEnableOption "Enables window rule settings in Hyprland";
};
config = mkIf cfg.enable {
programs.hyprland.settings = {
windowrulev2 = [
# === CALCURSE SETTINGS ===
"size 843 650, initialTitle:^(floatcal)$"
"move 100%-w-20 40, initialTitle:^(floatcal)$"
"float, initialTitle:^(floatcal)$"
# === TUIRUN SETTINGS ===
"size 600 300, title:^(tuirun)$"
"center, title:^(tuirun)$"
# "workspace special:tuirun, initialTitle:^(tuirun)$"
"noborder, title:^(tuirun)$"
"float, title:^(tuirun)$"
# === KEEPASSXC SETTINGS ===
"size 843 530, class:^(org.keepassxc.KeePassXC)$"
"move 100%-w-20 40, class:^(org.keepassxc.KeePassXC)$"
"float, class:^(org.keepassxc.KeePassXC)$"
# === SUPPRESS MAXIMIZE EVENT ===
"suppressevent maximize, class:.*" # Suppress maximize events for all windows
# === NWG-LOOK SETTINGS ===
"center, class:^(nwg-look)$"
"float, class:^(nwg-look)$"
# === OCULANTE SETTINGS ===
"center, class:^(oculante)$"
"float, class:^(oculante)$"
# === PAVUCONTROL SETTINGS ===
"move 100%-w-20 40, class:^(pavucontrol)$"
"size 741 585, class:^(pavucontrol)$"
"float, class:^(pavucontrol)$"
# === XARCHIVER SETTINGS ===
"center, class:^(xarchiver)$"
"float, class:^(xarchiver)$"
# === FLOATING APPLICATIONS ===
"float, class:^(org.gnome.FileRoller)$"
"float, class:^(org.freedesktop.impl.portal.desktop.kde)$"
"float, class:^(org.corectrl.CoreCtrl)$"
"float, class:^(feh)$"
"float, class:^(polkit-gnome-authentication-agent-1)$"
"float, class:^(org.gnome.Calculator)$"
"float, class:^(com.github.hluk.copyq)$"
"float, class:^(blueman-manager)$"
# === WORKSPACE RULES ===
"workspace 5 silent, class:^(discord)$"
];
windowrule = [];
workspace = [
"name:1,monitor:DP-3"
"name:2,monitor:DP-3"
"name:3,monitor:DP-3"
"name:4,monitor:DP-3"
"name:5,monitor:DP-4"
"name:6,monitor:DP-3"
"name:7,monitor:DP-3"
"name:8,monitor:DP-3"
"name:9,monitor:DP-3"
"name:10,monitor:DP-3"
];
layerrule = [
"animation fade,hyprpicker"
"animation fade,selection"
"noanim,waybar"
"ignorezero,waybar"
"ignorealpha 0.0,waybar"
"blur,notifications"
"ignorezero,notifications"
"noanim,wallpaper"
];
};
};
}

View File

@@ -0,0 +1,53 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.nixos.programs.hyprland;
host = config.networking.hostName;
in {
options = {
nixos.programs.hyprland.startup.enable = mkEnableOption "Enables startup settings in Hyprland";
};
config = mkIf cfg.startup.enable (mkMerge [
{
programs.hyprland.settings = {
exec-once = [
"sleep 2 && uwsm finalize"
"hyprlock"
];
};
}
(mkIf (host == "cnix") {
programs.hyprland.settings.exec-once = [
"uwsm app -- mullvad-vpn"
"uwsm app -- blueman-applet"
"uwsm app -- keepassxc"
"uwsm app -- pamixer --set-volume 50"
"uwsm app -- solaar -w hide -b regular"
"uwsm app -- nm-applet --indicator"
];
})
(mkIf (host == "cnixpad") {
programs.hyprland.settings.exec-once = [
"uwsm app -- blueman-applet"
"uwsm app -- keepassxc"
"uwsm app -- pamixer --set-volume 50"
"uwsm app -- nm-applet --indicator"
];
})
(mkIf (host == "toothpc") {
programs.hyprland.settings.exec-once = [
"uwsm app -- mullvad-vpn"
"uwsm app -- keepassxc"
"uwsm app -- solaar -w hide -b regular"
"uwsm app -- nm-applet --indicator"
];
})
]);
}

View File

@@ -0,0 +1,32 @@
{
pkgs,
inputs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.programs.hyprland;
# hyprsysteminfoFlake = inputs.hyprsysteminfo.packages.${pkgs.system}.default;
in {
options = {
nixos.programs.hyprland = {
enable = mkEnableOption "Enables hyprland";
};
};
config = mkIf cfg.enable {
security.pam.services.hyprlock.text = "auth include login";
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
environment = {
variables.NIXOS_OZONE_WL = "1";
systemPackages = [
# pkgs.hyprwayland-scanner
# hyprsysteminfoFlake
];
};
};
}

View File

@@ -62,7 +62,7 @@ in {
])
(mkIf cfg.dev.enable [
lldb_19
# lldb_20 # some biuld error atm
nfs-utils
gcc
rust-analyzer

View File

@@ -0,0 +1,28 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.flatpak;
in {
options = {
nixos.services.flatpak.enable = mkEnableOption "Enables flatpaks and gnome software";
};
config = mkIf cfg.enable {
services.flatpak.enable = true;
environment.systemPackages = with pkgs; [
gnome-software
];
systemd.services.flatpak-repo = {
wantedBy = ["multi-user.target"];
requires = ["network-online.target"];
after = ["network-online.target"];
path = [pkgs.flatpak];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
};
}