nixnew/modules/hyprland/default.nix
2024-01-01 21:15:39 -08:00

94 lines
2.2 KiB
Nix

{ system, inputs, impurity, lib, config, pkgs, ... }: let
inherit (inputs) hyprland hyprpaper hyprland-hy3;
# I blame home manager
wrapper = pkgs.callPackage ({ ... }: pkgs.writeShellScriptBin "hyprland" ''
${builtins.readFile ./session.sh}
${config.hyprland-session.prerun}
${hyprland.packages.${system}.default}/bin/Hyprland $@
'') {};
in {
imports = [ hyprland.nixosModules.default ];
options.hyprland-session = with lib; {
prerun = mkOption {
type = types.separatedString "\n";
default = "";
};
extraConfig = mkOption {
type = types.separatedString "\n";
default = "";
};
};
config = {
programs.hyprland.enable = true;
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-kde
];
config.common.default = [
"hyprland"
"kde"
];
};
security.pam.services.swaylock = {};
home-manager.users.${config.main-user} = {
imports = [ hyprland.homeManagerModules.default ];
home.packages = with pkgs; [
wrapper
hyprpaper
# environment programs
wl-clipboard
grim
slurp
playerctl
wf-recorder
];
programs.swaylock = {
enable = true;
settings = {
color = "000000";
font-size = 14;
ignore-empty-password = true;
show-failed-attempts = true;
image = "${./wallpaper.png}";
};
};
wayland.windowManager.hyprland = {
enable = true;
package = wrapper;
plugins = [ hyprland-hy3.packages.${system}.default inputs.hyprfocus.packages.${system}.default ];
extraConfig = ''
exec-once = ${hyprpaper.packages.${system}.default}/bin/hyprpaper
source = ${impurity.link ./hyprland.conf}
${config.hyprland-session.extraConfig}
'';
};
xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ${./wallpaper.png}
wallpaper = ,${./wallpaper.png}
'';
};
};
}