summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Fufezan <fufexan@protonmail.com>2022-12-09 16:25:57 +0200
committerMihai Fufezan <fufexan@protonmail.com>2022-12-09 16:25:57 +0200
commit11a1a6c27106bbb6b68ab6c3cf04dc1c3340bbfe (patch)
tree3ba3d5db2746420a9ab53c5d9723a854b1b0f326
parentff12a41c40b8529330c06f37120787cf40bde980 (diff)
nix: add xdph to flake and enable it in the nixos module
-rw-r--r--flake.lock6
-rw-r--r--flake.nix4
-rw-r--r--nix/module.nix36
3 files changed, 39 insertions, 7 deletions
diff --git a/flake.lock b/flake.lock
index 213725aa..2e759a79 100644
--- a/flake.lock
+++ b/flake.lock
@@ -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": {
diff --git a/flake.nix b/flake.nix
index 666edf3f..4fbe5610 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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:
diff --git a/nix/module.nix b/nix/module.nix
index 55c667a9..69c69c93 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -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;
+ };
+ })
+ ];
};
};
}