nixos-config/modules/gui.nix

63 lines
1.8 KiB
Nix

# SPDX-FileCopyrightText: 2020-2023 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, pkgs, ... }:
lib.mkIf config.sbruder.gui.enable {
# used to set up system wide configuration, actual configuration happens in
# home-manager
programs.sway = {
enable = true;
extraPackages = [ ];
};
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
};
};
# can have side effects (https://github.com/NixOS/nixpkgs/pull/179204)
environment.sessionVariables.GTK_USE_PORTAL = "1";
services.upower.enable = true;
services.udisks2.enable = true;
# steam (and other high quality software) still ships 32 bit binaries
hardware.opengl.driSupport32Bit = lib.mkDefault pkgs.stdenv.isx86_64;
environment.systemPackages = with pkgs; [
pkgs.gnome3.adwaita-icon-theme # lutris requires system-wide installation
];
services.input-remapper = lib.mkIf config.sbruder.full {
enable = true;
serviceWantedBy = [ "multi-user.target" ];
};
security.polkit.extraConfig = lib.optionalString config.sbruder.full ''
// Potential security problem, but required because there is no graphical polkit authentication agent
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec" && action.lookup("program") == "${config.services.input-remapper.package}/bin/input-remapper-control" && subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
'';
sops.secrets = lib.mkIf config.sbruder.trusted {
listenbrainz-token = {
group = "users";
mode = "440";
};
};
# required for pinentry-gnome3
services.dbus.packages = [ pkgs.gcr ];
}