nix: add xdph to flake and enable it in the nixos module

This commit is contained in:
Mihai Fufezan 2022-12-09 16:25:57 +02:00
parent ff12a41c40
commit 11a1a6c271
No known key found for this signature in database
GPG key ID: 5899325F2F120900
3 changed files with 39 additions and 7 deletions

View file

@ -82,11 +82,11 @@
]
},
"locked": {
"lastModified": 1670202338,
"narHash": "sha256-StTfshdAoSxO+t0wRbq1I3YESLFIQWFjGJse5ICV8rk=",
"lastModified": 1670593043,
"narHash": "sha256-tsDs6FB+7PlBOt46dMQFBMH5yPY/fduf4cYbQYhauhA=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "af840a9e0947a79a37a95a9f62062653721e43fa",
"rev": "5f7eecff553d82f21e049d79d8fb3f1f46568da0",
"type": "github"
},
"original": {

View file

@ -77,6 +77,10 @@
waybar-hyprland = prev.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
});
xdg-desktop-portal-hyprland = inputs.xdph.packages.${prev.system}.default.override {
hyprland-share-picker = inputs.xdph.packages.${prev.system}.hyprland-share-picker.override {inherit hyprland;};
};
};
packages = genSystems (system:

View file

@ -7,6 +7,11 @@ inputs: {
}:
with lib; let
cfg = config.programs.hyprland;
defaultHyprlandPackage = inputs.self.packages.${pkgs.system}.default.override {
enableXWayland = cfg.xwayland.enable;
hidpiXWayland = cfg.xwayland.hidpi;
};
in {
imports = [
(mkRemovedOptionModule ["programs" "hyprland" "extraPackages"] "extraPackages has been removed. Use environment.systemPackages instead.")
@ -23,7 +28,7 @@ in {
package = mkOption {
type = types.nullOr types.package;
default = inputs.self.packages.${pkgs.system}.default;
default = defaultHyprlandPackage;
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
description = ''
@ -31,6 +36,23 @@ in {
'';
};
xwayland = {
enable = mkOption {
type = types.bool;
default = true;
description = ''
Enable XWayland.
'';
};
hidpi = mkOption {
type = types.bool;
default = true;
description = ''
Enable HiDPI XWayland.
'';
};
};
recommendedEnvironment = mkOption {
type = types.bool;
default = true;
@ -44,7 +66,7 @@ in {
config = mkIf cfg.enable {
environment = {
systemPackages = lib.optional (cfg.package != null) cfg.package;
systemPackages = lib.optional (cfg.package != null) defaultHyprlandPackage;
sessionVariables = mkIf cfg.recommendedEnvironment {
NIXOS_OZONE_WL = "1";
@ -57,11 +79,17 @@ in {
xwayland.enable = mkDefault true;
};
security.polkit.enable = true;
services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) defaultHyprlandPackage;
xdg.portal = {
enable = mkDefault true;
# xdg-desktop-portal-hyprland
extraPortals = [inputs.xdph.packages.${pkgs.system}.default];
extraPortals = lib.mkIf (cfg.package != null) [
(inputs.xdph.packages.${pkgs.system}.xdg-desktop-portal-hyprland.override {
hyprland-share-picker = inputs.xdph.packages.${pkgs.system}.hyprland-share-picker.override {
hyprland = defaultHyprlandPackage;
};
})
];
};
};
}