2022-05-21 12:07:55 +02:00
|
|
|
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/sway.nix
|
2022-12-04 20:29:12 +01:00
|
|
|
inputs: {
|
2022-05-21 12:07:55 +02:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.programs.hyprland;
|
|
|
|
in {
|
2022-09-03 01:20:20 +02:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule ["programs" "hyprland" "extraPackages"] "extraPackages has been removed. Use environment.systemPackages instead.")
|
|
|
|
];
|
|
|
|
|
2022-05-21 12:07:55 +02: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 17:11:46 +02:00
|
|
|
type = types.nullOr types.package;
|
2022-12-04 20:29:12 +01:00
|
|
|
default = inputs.self.packages.${pkgs.system}.default;
|
2022-05-21 12:07:55 +02:00
|
|
|
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
|
|
|
|
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
|
|
|
|
description = ''
|
|
|
|
Hyprland package to use.
|
|
|
|
'';
|
|
|
|
};
|
2022-09-09 14:40:30 +02: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 12:07:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-09-06 23:45:24 +02:00
|
|
|
environment = {
|
|
|
|
systemPackages = lib.optional (cfg.package != null) cfg.package;
|
2022-09-09 14:40:30 +02:00
|
|
|
|
|
|
|
sessionVariables = mkIf cfg.recommendedEnvironment {
|
|
|
|
NIXOS_OZONE_WL = "1";
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
|
|
|
};
|
2022-12-07 18:18:15 +01:00
|
|
|
|
2022-05-21 12:07:55 +02:00
|
|
|
fonts.enableDefaultFonts = mkDefault true;
|
2022-09-06 23:45:24 +02:00
|
|
|
hardware.opengl.enable = mkDefault true;
|
2022-12-07 18:18:15 +01:00
|
|
|
|
|
|
|
# enable cachix
|
|
|
|
nix.settings = {
|
|
|
|
substituters = ["https://hyprland.cachix.org"];
|
|
|
|
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
|
|
|
|
};
|
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
programs = {
|
|
|
|
dconf.enable = mkDefault true;
|
|
|
|
xwayland.enable = mkDefault true;
|
|
|
|
};
|
2022-12-07 18:18:15 +01:00
|
|
|
|
2022-09-06 23:45:24 +02:00
|
|
|
security.polkit.enable = true;
|
2022-07-30 17:19:27 +02:00
|
|
|
services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
|
2022-09-06 23:45:24 +02:00
|
|
|
xdg.portal = {
|
|
|
|
enable = mkDefault true;
|
2022-12-04 20:29:12 +01:00
|
|
|
# xdg-desktop-portal-hyprland
|
|
|
|
extraPortals = [inputs.xdph.packages.${pkgs.system}.default];
|
2022-09-06 23:45:24 +02:00
|
|
|
};
|
2022-05-21 12:07:55 +02:00
|
|
|
};
|
|
|
|
}
|