nixnew/modules/hyprland/default.nix

94 lines
2.2 KiB
Nix
Raw Normal View History

2023-06-22 08:04:50 +00:00
{ system, inputs, impurity, lib, config, pkgs, ... }: let
inherit (inputs) hyprland hyprpaper hyprland-hy3;
2024-01-02 05:15:39 +00:00
# I blame home manager
wrapper = pkgs.callPackage ({ ... }: pkgs.writeShellScriptBin "hyprland" ''
${builtins.readFile ./session.sh}
2023-06-22 08:04:50 +00:00
${config.hyprland-session.prerun}
${hyprland.packages.${system}.default}/bin/Hyprland $@
2024-01-02 05:15:39 +00:00
'') {};
2023-06-22 08:04:50 +00:00
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=" ];
};
2023-06-27 05:09:25 +00:00
xdg.portal = {
enable = true;
2024-01-02 05:15:39 +00:00
2023-06-27 05:09:25 +00:00
extraPortals = with pkgs; [
xdg-desktop-portal-kde
];
2024-01-02 05:15:39 +00:00
config.common.default = [
"hyprland"
"kde"
];
2023-06-27 05:09:25 +00:00
};
2023-06-28 08:54:58 +00:00
security.pam.services.swaylock = {};
2023-06-22 08:04:50 +00:00
home-manager.users.${config.main-user} = {
imports = [ hyprland.homeManagerModules.default ];
2023-06-26 01:15:34 +00:00
home.packages = with pkgs; [
wrapper
2024-01-02 05:15:39 +00:00
hyprpaper
2023-06-26 01:15:34 +00:00
# environment programs
wl-clipboard
grim
slurp
playerctl
wf-recorder
];
2023-06-22 08:04:50 +00:00
2023-06-28 08:54:58 +00:00
programs.swaylock = {
enable = true;
settings = {
color = "000000";
font-size = 14;
ignore-empty-password = true;
show-failed-attempts = true;
image = "${./wallpaper.png}";
};
};
2023-06-22 08:04:50 +00:00
wayland.windowManager.hyprland = {
enable = true;
package = wrapper;
2024-01-02 05:15:39 +00:00
plugins = [ hyprland-hy3.packages.${system}.default inputs.hyprfocus.packages.${system}.default ];
2023-06-22 08:04:50 +00:00
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}
'';
};
};
}