fix: Fix polkit and qt configuration

This commit is contained in:
ulic-youthlic 2025-11-10 19:28:58 +08:00
parent b4c3dfec42
commit 8019bc7003
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
5 changed files with 705 additions and 751 deletions

View file

@ -1,10 +1,4 @@
{ {config, ...}: {
config,
inputs,
...
}: let
inherit (inputs.niri-flake.lib.kdl) node leaf flag;
in {
david.programs.niri = { david.programs.niri = {
waybar.settings = let waybar.settings = let
cfg = config.david.programs.niri.waybar; cfg = config.david.programs.niri.waybar;
@ -20,25 +14,5 @@ in {
]; ];
}; };
}; };
extraConfig = let
output = node "output";
in [
(
output
["eDP-1"]
[
(leaf "mode" ["1920x1200@60.018"])
(leaf "scale" [1.0])
(flag "focus-at-startup")
(leaf "position" [
{
x = 0;
y = 0;
}
])
(leaf "transform" ["normal"])
]
)
];
}; };
} }

View file

@ -34,6 +34,5 @@ in {
} }
]; ];
}; };
extraConfig = [];
}; };
} }

View file

@ -3,9 +3,10 @@
pkgs, pkgs,
lib, lib,
inputs, inputs,
osConfig ? null, osConfig ? (throw "Trying to access osConfig, the home-manager module is not being used in the nixos module"),
... ...
}: let }: {
config.david.programs.niri.config = let
inherit (lib) getExe getExe'; inherit (lib) getExe getExe';
inherit inherit
(inputs.niri-flake.lib.kdl) (inputs.niri-flake.lib.kdl)
@ -40,7 +41,7 @@
cliphist = getExe' pkgs.cliphist "cliphist"; cliphist = getExe' pkgs.cliphist "cliphist";
cliphist-fuzzel-img = getExe' pkgs.cliphist "cliphist-fuzzel-img"; cliphist-fuzzel-img = getExe' pkgs.cliphist "cliphist-fuzzel-img";
wl-clip-persist = getExe pkgs.wl-clip-persist; wl-clip-persist = getExe pkgs.wl-clip-persist;
in in
( (
let let
spawn = leaf "spawn"; spawn = leaf "spawn";
@ -494,7 +495,6 @@ in
waypaper waypaper
"--restore" "--restore"
]) ])
(spawn-at-startup [polkit-kde-agent])
(spawn-at-startup [ (spawn-at-startup [
wl-paste wl-paste
"--watch" "--watch"
@ -705,4 +705,5 @@ in
(leaf "place-within-backdrop" [true]) (leaf "place-within-backdrop" [true])
]) ])
] # layer-rule ] # layer-rule
) );
}

View file

@ -3,13 +3,15 @@
lib, lib,
inputs, inputs,
pkgs, pkgs,
osConfig ? null, osConfig ? (throw "Trying to access osConfig, the home-manager module is not being used in the nixos module"),
options, options,
... ...
} @ args: let }: let
cfg = config.david.programs.niri; cfg = config.david.programs.niri;
niri = osConfig.programs.niri.package;
in { in {
imports = [
./config.nix
];
options = { options = {
david.programs.niri = { david.programs.niri = {
enable = enable =
@ -17,7 +19,7 @@ in {
// { // {
default = osConfig.youthlic.gui.enabled == "niri"; default = osConfig.youthlic.gui.enabled == "niri";
}; };
extraConfig = lib.mkOption { config = lib.mkOption {
type = inputs.niri-flake.lib.kdl.types.kdl-document; type = inputs.niri-flake.lib.kdl.types.kdl-document;
}; };
wluma.extraSettings = lib.mkOption { wluma.extraSettings = lib.mkOption {
@ -42,40 +44,23 @@ in {
}; };
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
home.packages = home.packages = with pkgs; [
(with pkgs; [
swaynotificationcenter swaynotificationcenter
kdePackages.polkit-kde-agent-1
wl-clipboard wl-clipboard
cliphist cliphist
swayimg swayimg
seahorse seahorse
]) ];
++ [niri];
qt = {
enable = true;
};
xdg.portal = {
configPackages = [niri];
enable = true;
extraPortals = lib.mkIf (
!niri.cargoBuildNoDefaultFeatures || builtins.elem "xdp-gnome-screencast" niri.cargoBuildFeatures
) [pkgs.xdg-desktop-portal-gnome];
};
xdg.configFile = let xdg.configFile = let
qtctConf = qtctConf = ''
''
[Appearance] [Appearance]
standard_dialogs=xdgdesktopportal standard_dialogs=xdgdesktopportal
''
+ lib.optionalString (config.qt.style ? name) ''
style=${config.qt.style.name}
''; '';
in { in {
"qt5ct/qt5ct.conf" = lib.mkForce { "qt5ct/qt5ct.conf" = {
text = qtctConf; text = qtctConf;
}; };
"qt6ct/qt6ct.conf" = lib.mkForce { "qt6ct/qt6ct.conf" = {
text = qtctConf; text = qtctConf;
}; };
}; };
@ -95,9 +80,7 @@ in {
kanshi.enable = true; kanshi.enable = true;
}; };
programs.niri = { programs.niri = {
config = inherit (cfg) config;
(lib.toList (import ./config.nix (args // {inherit pkgs;}))) ++ (lib.toList cfg.extraConfig);
package = niri;
}; };
}) })
(lib.mkIf (!cfg.enable) { (lib.mkIf (!cfg.enable) {

View file

@ -11,12 +11,11 @@ in {
}; };
}; };
config = lib.mkIf (cfg.enabled == "niri") { config = lib.mkIf (cfg.enabled == "niri") {
qt = {
enable = true;
platformTheme = "qt5ct";
};
# Enabled to support trash of nautilus # Enabled to support trash of nautilus
services.gvfs.enable = true; services.gvfs.enable = true;
systemd.user.services.niri-flake-polkit.serviceConfig.ExecStart = lib.mkForce "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";
environment = { environment = {
pathsToLink = ["share/thumbnailers"]; pathsToLink = ["share/thumbnailers"];
systemPackages = with pkgs; [ systemPackages = with pkgs; [
@ -26,8 +25,6 @@ in {
libheif.out libheif.out
bluez bluez
kdePackages.qt6ct
libsForQt5.qt5ct
xwayland-satellite-unstable xwayland-satellite-unstable
evince evince
]; ];