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": { "locked": {
"lastModified": 1670202338, "lastModified": 1670593043,
"narHash": "sha256-StTfshdAoSxO+t0wRbq1I3YESLFIQWFjGJse5ICV8rk=", "narHash": "sha256-tsDs6FB+7PlBOt46dMQFBMH5yPY/fduf4cYbQYhauhA=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "af840a9e0947a79a37a95a9f62062653721e43fa", "rev": "5f7eecff553d82f21e049d79d8fb3f1f46568da0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -77,6 +77,10 @@
waybar-hyprland = prev.waybar.overrideAttrs (oldAttrs: { waybar-hyprland = prev.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; 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: packages = genSystems (system:

View file

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