2022-05-21 13:07:55 +03:00
|
|
|
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/sway.nix
|
2022-12-04 22:29:12 +03:00
|
|
|
inputs: {
|
2022-05-21 13:07:55 +03:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
2022-12-09 17:25:57 +03:00
|
|
|
|
2023-01-18 11:37:56 +03:00
|
|
|
defaultHyprlandPackage = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
|
2022-12-09 17:25:57 +03:00
|
|
|
enableXWayland = cfg.xwayland.enable;
|
|
|
|
hidpiXWayland = cfg.xwayland.hidpi;
|
2022-12-15 21:53:20 +03:00
|
|
|
nvidiaPatches = cfg.nvidiaPatches;
|
2022-12-09 17:25:57 +03:00
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
in {
|
2022-09-03 02:20:20 +03:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule ["programs" "hyprland" "extraPackages"] "extraPackages has been removed. Use environment.systemPackages instead.")
|
|
|
|
];
|
|
|
|
|
2022-05-21 13:07:55 +03:00
|
|
|
options.programs.hyprland = {
|
|
|
|
enable = mkEnableOption ''
|
|
|
|
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
|
|
|
You can manually launch Hyprland by executing "exec Hyprland" on a TTY.
|
|
|
|
A configuration file will be generated in ~/.config/hypr/hyprland.conf.
|
|
|
|
See <link xlink:href="https://github.com/vaxerski/Hyprland/wiki" /> for
|
|
|
|
more information.
|
|
|
|
'';
|
|
|
|
|
|
|
|
package = mkOption {
|
2022-07-30 18:11:46 +03:00
|
|
|
type = types.nullOr types.package;
|
2022-12-09 17:25:57 +03:00
|
|
|
default = defaultHyprlandPackage;
|
2022-05-21 13:07:55 +03:00
|
|
|
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
|
|
|
|
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
|
|
|
|
description = ''
|
|
|
|
Hyprland package to use.
|
|
|
|
'';
|
|
|
|
};
|
2022-09-09 15:40:30 +03:00
|
|
|
|
2022-12-09 17:25:57 +03:00
|
|
|
xwayland = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enable XWayland.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
hidpi = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enable HiDPI XWayland.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-12-15 21:53:20 +03:00
|
|
|
nvidiaPatches = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2023-01-24 20:20:50 +03:00
|
|
|
example = literalExpression "true";
|
2022-12-15 21:53:20 +03:00
|
|
|
description = ''
|
|
|
|
Patch wlroots for better Nvidia support.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-09-09 15:40:30 +03:00
|
|
|
recommendedEnvironment = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
defaultText = literalExpression "true";
|
|
|
|
example = literalExpression "false";
|
|
|
|
description = ''
|
|
|
|
Whether to set the recommended environment variables.
|
|
|
|
'';
|
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-09-07 00:45:24 +03:00
|
|
|
environment = {
|
2022-12-15 21:53:20 +03:00
|
|
|
systemPackages = lib.optional (cfg.package != null) cfg.package;
|
2022-09-09 15:40:30 +03:00
|
|
|
|
|
|
|
sessionVariables = mkIf cfg.recommendedEnvironment {
|
|
|
|
NIXOS_OZONE_WL = "1";
|
2022-09-07 00:45:24 +03:00
|
|
|
};
|
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
fonts.enableDefaultFonts = mkDefault true;
|
2022-09-07 00:45:24 +03:00
|
|
|
hardware.opengl.enable = mkDefault true;
|
|
|
|
programs = {
|
|
|
|
dconf.enable = mkDefault true;
|
|
|
|
xwayland.enable = mkDefault true;
|
|
|
|
};
|
|
|
|
security.polkit.enable = true;
|
2022-12-15 21:53:20 +03:00
|
|
|
services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
|
2022-09-07 00:45:24 +03:00
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2022-12-04 22:29:12 +03:00
|
|
|
# xdg-desktop-portal-hyprland
|
2022-12-09 17:25:57 +03:00
|
|
|
extraPortals = lib.mkIf (cfg.package != null) [
|
2023-01-18 11:37:56 +03:00
|
|
|
(inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland.override {
|
|
|
|
hyprland-share-picker = inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.hyprland-share-picker.override {
|
2022-12-15 21:53:20 +03:00
|
|
|
hyprland = cfg.package;
|
2022-12-09 17:25:57 +03:00
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2022-09-07 00:45:24 +03:00
|
|
|
};
|
2022-05-21 13:07:55 +03:00
|
|
|
};
|
|
|
|
}
|