diff --git a/modules/home/programs/graphical/wms/hyprland/default.nix b/modules/home/programs/graphical/wms/hyprland/default.nix index a0c5d3ae1..38d73ff1a 100644 --- a/modules/home/programs/graphical/wms/hyprland/default.nix +++ b/modules/home/programs/graphical/wms/hyprland/default.nix @@ -1,16 +1,13 @@ { config, - inputs, lib, pkgs, - system, namespace, ... }: let inherit (lib) mkIf mkEnableOption getExe; inherit (lib.${namespace}) enabled; - inherit (inputs) hyprland; cfg = config.${namespace}.programs.graphical.wms.hyprland; @@ -57,6 +54,9 @@ in # NOTE: xdph requirement grim slurp + hyprsunset + # TODO: package + pkgs.khanelinix.hyprsysteminfo ]; sessionVariables = @@ -139,11 +139,7 @@ in ${cfg.appendConfig} ''; - package = - if cfg.enableDebug then - hyprland.packages.${system}.hyprland-debug - else - hyprland.packages.${system}.hyprland; + package = if cfg.enableDebug then pkgs.hyprland.override { debug = true; } else pkgs.hyprland; settings = { exec = [ "${getExe pkgs.libnotify} --icon ~/.face -u normal \"Hello $(whoami)\"" ]; @@ -156,6 +152,7 @@ in "${systemctl} --user stop hyprland-session.target" "${systemctl} --user reset-failed" "${systemctl} --user start hyprland-session.target" + "${systemctl} --user start hyprpolkitagent" ]; variables = [ diff --git a/modules/nixos/programs/graphical/addons/uwsm/default.nix b/modules/nixos/programs/graphical/addons/uwsm/default.nix new file mode 100644 index 000000000..c5cc1f17b --- /dev/null +++ b/modules/nixos/programs/graphical/addons/uwsm/default.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + namespace, + ... +}: +let + inherit (lib) mkIf; + inherit (lib.${namespace}) mkBoolOpt; + + cfg = config.${namespace}.programs.graphical.addons.uwsm; +in +{ + options.${namespace}.programs.graphical.addons.uwsm = { + enable = mkBoolOpt false "Whether or not to enable uwsm"; + }; + + config = mkIf cfg.enable { + programs.uwsm.enable = true; + }; +} diff --git a/modules/nixos/programs/graphical/addons/xdg-portal/default.nix b/modules/nixos/programs/graphical/addons/xdg-portal/default.nix index 6a0dcfdf8..f4cec8e73 100644 --- a/modules/nixos/programs/graphical/addons/xdg-portal/default.nix +++ b/modules/nixos/programs/graphical/addons/xdg-portal/default.nix @@ -1,9 +1,7 @@ { config, - inputs, lib, pkgs, - system, namespace, ... }: diff --git a/modules/nixos/programs/graphical/wms/hyprland/default.nix b/modules/nixos/programs/graphical/wms/hyprland/default.nix index 27a74ec89..dd7731c48 100644 --- a/modules/nixos/programs/graphical/wms/hyprland/default.nix +++ b/modules/nixos/programs/graphical/wms/hyprland/default.nix @@ -1,9 +1,7 @@ { config, - inputs, lib, pkgs, - system, namespace, ... }: @@ -15,7 +13,6 @@ let types ; inherit (lib.${namespace}) mkBoolOpt mkOpt enabled; - inherit (inputs) hyprland; cfg = config.${namespace}.programs.graphical.wms.hyprland; @@ -23,7 +20,7 @@ let with pkgs; [ # TODO: make sure this references same package as home-manager - hyprland.packages.${system}.hyprland + pkgs.hyprland coreutils config.services.power-profiles-daemon.package systemd @@ -140,6 +137,6 @@ in }; }; - services.displayManager.sessionPackages = [ hyprland.packages.${system}.hyprland ]; + services.displayManager.sessionPackages = [ pkgs.hyprland ]; }; } diff --git a/modules/nixos/security/polkit/default.nix b/modules/nixos/security/polkit/default.nix index 0f534eb9d..2a40d28b2 100644 --- a/modules/nixos/security/polkit/default.nix +++ b/modules/nixos/security/polkit/default.nix @@ -16,7 +16,14 @@ in }; config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; [ libsForQt5.polkit-kde-agent ]; + environment.systemPackages = + with pkgs; + lib.optionals (!config.${namespace}.programs.graphical.wms.hyprland.enable) [ + libsForQt5.polkit-kde-agent + ] + ++ lib.optionals (config.${namespace}.programs.graphical.wms.hyprland.enable) [ + pkgs.khanelinix.hyprpolkitagent + ]; security.polkit = { enable = true; @@ -31,18 +38,22 @@ in }; systemd = { - user.services.polkit-kde-authentication-agent-1 = { - after = [ "graphical-session.target" ]; - description = "polkit-kde-authentication-agent-1"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; - }; + user.services = { + polkit-kde-authentication-agent-1 = + lib.mkIf (!config.${namespace}.programs.graphical.wms.hyprland.enable) + { + after = [ "graphical-session.target" ]; + description = "polkit-kde-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; }; }; }; diff --git a/packages/hyprland-qt-support/default.nix b/packages/hyprland-qt-support/default.nix new file mode 100644 index 000000000..861bf0062 --- /dev/null +++ b/packages/hyprland-qt-support/default.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + ninja, + qt6, + pkg-config, + hyprlang, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "hyprland-qt-support"; + version = "0.1.0"; + + src = fetchFromGitHub { + owner = "hyprwm"; + repo = "hyprland-qt-support"; + tag = "v${finalAttrs.version}"; + hash = "sha256-+uZovj+X0a28172y0o0BvgGXyZLpKPbG03sVlCiSrWc="; + }; + + nativeBuildInputs = [ + cmake + ninja + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtsvg + qt6.qtwayland + hyprlang + ]; + + cmakeFlags = [ + (lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix) + ]; + + meta = { + description = "hyprland-qt-support"; + homepage = "https://github.com/hyprwm/hyprland-qt-support"; + license = lib.licenses.bsd3; + platforms = lib.platforms.linux; + maintainers = lib.teams.hyprland.members; + }; +}) diff --git a/packages/hyprpolkitagent/default.nix b/packages/hyprpolkitagent/default.nix new file mode 100644 index 000000000..b9b2ba249 --- /dev/null +++ b/packages/hyprpolkitagent/default.nix @@ -0,0 +1,49 @@ +{ + lib, + stdenv, + cmake, + pkg-config, + fetchFromGitHub, + hyprland-qt-support, + hyprutils, + kdePackages, + polkit, + qt6, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "hyprpolkitagent"; + version = "0.1.2"; + + src = fetchFromGitHub { + owner = "hyprwm"; + repo = "hyprpolkitagent"; + tag = "v${finalAttrs.version}"; + hash = "sha256-K1nSPFlh5VBWNagcaZ/157gfifAXTH8lzeyfYt/UEX8="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + hyprland-qt-support + hyprutils + kdePackages.kirigami-addons + kdePackages.polkit-qt-1 + polkit + qt6.qtbase + qt6.qtsvg + qt6.qtwayland + ]; + + meta = { + description = "Polkit authentication agent written in QT/QML"; + homepage = "https://github.com/hyprwm/hyprpolkitagent"; + license = lib.licenses.bsd3; + maintainers = lib.teams.hyprland.members; + mainProgram = "hyprpolkitagent"; + platforms = lib.platforms.linux; + }; +}) diff --git a/packages/hyprsysteminfo/default.nix b/packages/hyprsysteminfo/default.nix new file mode 100644 index 000000000..54e1f7a6c --- /dev/null +++ b/packages/hyprsysteminfo/default.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + qt6, + pkg-config, + hyprutils, + pciutils, + hyprland-qt-support, +}: +let + inherit (lib.strings) makeBinPath; +in +stdenv.mkDerivation (finalAttrs: { + pname = "hyprsysteminfo"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "hyprwm"; + repo = "hyprsysteminfo"; + tag = "v${finalAttrs.version}"; + hash = "sha256-KDxT9B+1SATWiZdUBAQvZu17vk3xmyXcw2Zy56bdWbY="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtsvg + qt6.qtwayland + hyprutils + hyprland-qt-support + ]; + + preFixup = '' + qtWrapperArgs+=(--prefix PATH : "${makeBinPath [ pciutils ]}") + ''; + + meta = { + description = "A tiny qt6/qml application to display information about the running system"; + homepage = "https://github.com/hyprwm/hyprsysteminfo"; + license = lib.licenses.bsd3; + maintainers = lib.teams.hyprland.members; + mainProgram = "hyprsysteminfo"; + platforms = lib.platforms.linux; + }; +})