Files
dotfiles/homes/julian/features/hyprland/default.nix
T
2026-06-04 09:15:21 +02:00

150 lines
3.5 KiB
Nix

{
pkgs,
inputs,
config,
lib,
...
}: let
# Apply lib.mkDefault to a whole attrset recursively, used for the noctalia config
mkDefaultsRec = value:
if builtins.isAttrs value
then lib.mapAttrs (_: mkDefaultsRec) value
else if builtins.isList value
then map mkDefaultsRec value
else lib.mkDefault value;
in {
imports = [
# inputs.hyprland.homeManagerModules.default
# ./waybar
# ./wofi
# ./mako
# ./hyprlock
./wlogout
# ../gammastep
# ./swayidle.nix
./swaylock.nix
./waypipe.nix
# ./hyprbars.nix
inputs.noctalia.homeModules.default
];
xdg.portal = {
extraPortals = [pkgs.xdg-desktop-portal-wlr];
config.hyprland = {
default = [
"wlr"
"gtk"
];
};
};
home.pointerCursor = {
hyprcursor.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
programs.imv.enable = true; # TODO: what is that
programs.noctalia-shell = {
enable = true;
# noctalia-shell ipc call state all | jq .settings | xclip
# mkDefaultsRec used so that stylix can overwrite style options
settings = mkDefaultsRec (builtins.fromJSON (builtins.readFile ./noctalia.json));
};
home.packages = with pkgs; [
hyprpicker
hyprcursor
brightnessctl
playerctl
frajul.hyprshot-gui
frajul.wl-ocr
wf-recorder
wl-clipboard
(pkgs.writeShellScriptBin "toggle-screen-mirroring" (
builtins.readFile ./toggle-screen-mirroring.sh
))
(pkgs.writeShellScriptBin "correct-workspace-locations" (
lib.concatStringsSep "\n" (
builtins.concatLists (
map (
monitor:
map (ws: "hyprctl dispatch 'hl.dsp.workspace.move({workspace=\"${ws}\", monitor=\"${monitor.name}\"})'") monitor.workspaces
)
config.monitors
)
)
))
];
services.cliphist = {
enable = true;
};
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1;
QT_QPA_PLATFORM = "wayland";
LIBSEAT_BACKEND = "logind";
};
services.network-manager-applet.enable = true;
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
extraConfig =
# Variables controllable by nix
''
-- Nix controlled variables
local terminal = "${config.terminal}"
local fileManager = "pcmanfm"
-- local menu = "wofi --show drun,run"
local menu = "noctalia-shell ipc call launcher toggle"
local calculator = "qalculate-gtk"
local browser = "firefox"
local editor = "emacs"
''
+ "-- Main config from `hyprland.lua`\n"
+ builtins.readFile ./hyprland.lua
+ "-- Assign workspaces to monitors\n"
+ lib.concatStringsSep "\n" (
builtins.concatLists (
map (
monitor:
map (ws: "hl.workspace_rule({ workspace = \"${ws}\", monitor = \"${monitor.name}\"})") monitor.workspaces
)
config.monitors
)
);
systemd = {
enable = true;
# Same as default, but stop graphical-session too
extraCommands = lib.mkBefore [
"systemctl --user stop graphical-session.target"
"systemctl --user start hyprland-session.target"
];
variables = [
"DISPLAY"
"HYPRLAND_INSTANCE_SIGNATURE"
"WAYLAND_DISPLAY"
"XDG_CURRENT_DESKTOP"
];
};
xwayland.enable = true;
plugins = [
# hyprlandPlugins.hyprbars
];
};
}