1
This commit is contained in:
2023-04-26 12:56:31 +02:00
parent 1b83c0131f
commit 9a457490d4
39 changed files with 308 additions and 316 deletions

View File

@ -10,7 +10,7 @@ with lib;
with mylib.modules; let
cfg = config.modules.hyprland;
in {
options.modules.hyprland = import ./options.nix { inherit lib mylib; };
options.modules.hyprland = import ./options.nix {inherit lib mylib;};
config = let
# Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix
@ -37,124 +37,126 @@ in {
};
waybar-hyprland = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
patches = (oldAttrs.patches or [ ]) ++ [ workspaces-patch ];
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
patches = (oldAttrs.patches or []) ++ [workspaces-patch];
});
in mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.programs.hyprland.enable;
message = "Can't enable Hyprland module with Hyprland disabled!";
}
];
in
mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.programs.hyprland.enable;
message = "Can't enable Hyprland module with Hyprland disabled!";
}
];
gtk = {
enable = true;
iconTheme.package = pkgs.papirus-icon-theme;
iconTheme.name = "Papirus";
};
gtk = {
enable = true;
iconTheme.package = pkgs.papirus-icon-theme;
iconTheme.name = "Papirus";
};
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 16;
};
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 16;
};
home.sessionVariables = {
# QT_QPA_PLATFORMTHEME = "qt5ct";
};
home.sessionVariables = {
# QT_QPA_PLATFORMTHEME = "qt5ct";
};
# Polkit
home.file.".config/hypr/polkit.conf".text = ''exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1'';
# Polkit
home.file.".config/hypr/polkit.conf".text = ''exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1'';
home.file.".config/hypr/waybar-reload.conf".text = let
waybar-reload = pkgs.writeScript "waybar-reload" ''
#! ${pkgs.bash}/bin/bash
home.file.".config/hypr/waybar-reload.conf".text = let
waybar-reload = pkgs.writeScript "waybar-reload" ''
#! ${pkgs.bash}/bin/bash
trap "${pkgs.procps}/bin/pkill waybar" EXIT
trap "${pkgs.procps}/bin/pkill waybar" EXIT
while true; do
${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config -s $HOME/NixFlake/config/waybar/style.css &
${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config $HOME/NixFlake/config/waybar/style.css
${pkgs.procps}/bin/pkill waybar
done
while true; do
${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config -s $HOME/NixFlake/config/waybar/style.css &
${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config $HOME/NixFlake/config/waybar/style.css
${pkgs.procps}/bin/pkill waybar
done
'';
in ''
exec-once = ${waybar-reload}
'';
in ''
exec-once = ${waybar-reload}
'';
home.file.".config/hypr/hyprpaper.conf".text = ''
preload = ~/NixFlake/wallpapers/${cfg.theme}.png
wallpaper = HDMI-A-1, ~/NixFlake/wallpapers/${cfg.theme}.png
wallpaper = HDMI-A-2, ~/NixFlake/wallpapers/${cfg.theme}.png
'';
home.file.".config/hypr/hyprpaper.conf".text = ''
preload = ~/NixFlake/wallpapers/${cfg.theme}.png
wallpaper = HDMI-A-1, ~/NixFlake/wallpapers/${cfg.theme}.png
wallpaper = HDMI-A-2, ~/NixFlake/wallpapers/${cfg.theme}.png
'';
home.activation = {
# NOTE: Keep the hyprland/waybar config symlinked, to allow easy changes with hotreload
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
# TODO: Use this approach for every program that supports it, makes things much easier,
# as everything can just stay in ~/NixFlake/config
linkHyprlandConfig = hm.dag.entryAfter ["writeBoundary"]
(mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
home.activation = {
# NOTE: Keep the hyprland/waybar config symlinked, to allow easy changes with hotreload
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
# TODO: Use this approach for every program that supports it, makes things much easier,
# as everything can just stay in ~/NixFlake/config
linkHyprlandConfig =
hm.dag.entryAfter ["writeBoundary"]
(mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
# linkWaybarConfig = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/config" "~/.config/waybar/config");
# linkWaybarStyle = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/style.css" "~/.config/waybar/style.css");
# linkWaybarColors = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/colors" "~/.config/waybar/colors");
};
home.packages = with pkgs; [
hyprpaper # Wallpaper setter
hyprpicker # Color picker
wl-clipboard
clipman # Clipboard manager (wl-paste)
imv # Image viewer
moc # Audio player
ncpamixer # ncurses pavucontrol
slurp # Region selector for screensharing
grim # Grab images from compositor
xfce.thunar
xfce.tumbler # Thunar thumbnails
libsForQt5.polkit-kde-agent
];
services = {
# Notification service
dunst = {
enable = true;
};
};
programs = {
rofi = {
enable = true;
package = pkgs.rofi-wayland;
plugins = [
pkgs.keepmenu # TODO: Rofi KeepassXC frontend
];
# NOTE: Don't use this, use the configfile for hot-reload
# terminal = "${pkgs.kitty}/bin/kitty";
# font = "JetBrains Mono 14";
# theme =
# extraConfig = '''';
# linkWaybarConfig = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/config" "~/.config/waybar/config");
# linkWaybarStyle = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/style.css" "~/.config/waybar/style.css");
# linkWaybarColors = hm.dag.entryAfter ["writeBoundary"]
# (mkLink "~/NixFlake/config/waybar/colors" "~/.config/waybar/colors");
};
waybar = {
enable = true;
package = waybar-hyprland;
home.packages = with pkgs; [
hyprpaper # Wallpaper setter
hyprpicker # Color picker
systemd = {
enable = false; # Gets started by hyprland
wl-clipboard
clipman # Clipboard manager (wl-paste)
imv # Image viewer
moc # Audio player
ncpamixer # ncurses pavucontrol
slurp # Region selector for screensharing
grim # Grab images from compositor
xfce.thunar
xfce.tumbler # Thunar thumbnails
libsForQt5.polkit-kde-agent
];
services = {
# Notification service
dunst = {
enable = true;
};
};
programs = {
rofi = {
enable = true;
package = pkgs.rofi-wayland;
plugins = [
pkgs.keepmenu # TODO: Rofi KeepassXC frontend
];
# NOTE: Don't use this, use the configfile for hot-reload
# terminal = "${pkgs.kitty}/bin/kitty";
# font = "JetBrains Mono 14";
# theme =
# extraConfig = '''';
};
waybar = {
enable = true;
package = waybar-hyprland;
systemd = {
enable = false; # Gets started by hyprland
};
};
};
};
};
}

View File

@ -1,14 +1,13 @@
{
lib,
mylib
mylib,
}:
with lib;
with mylib.modules;
{
with mylib.modules; {
enable = mkEnableOpt "Hyprland Window Manager + Compositor";
theme = mkOption {
type = types.str;
description = "Wallpaper and colorscheme to use";
};
}
};
}