{ config, lib, pkgs, ... }: { imports = [ ./applications.nix ./fonts.nix ./games.nix ./nautilus.nix ]; options.bchmnn = { gui = { enable = lib.mkEnableOption "gui"; greeter = { enable = lib.mkEnableOption "greeter"; }; flavour = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "sway" ]; example = [ "sway" "i3" ]; description = '' The flavour (WM) for your system to use ''; }; }; }; config = lib.mkIf (config.bchmnn.gui.enable && config.bchmnn.gui.flavour != [ ]) { environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw programs.sway.enable = builtins.elem "sway" config.bchmnn.gui.flavour; services.xserver.windowManager.i3.enable = builtins.elem "i3" config.bchmnn.gui.flavour; services.libinput.enable = true; services.xserver = { enable = ( builtins.elem "i3" config.bchmnn.gui.flavour || builtins.elem "gnome" config.bchmnn.gui.flavour ); desktopManager.gnome.enable = builtins.elem "gnome" config.bchmnn.gui.flavour; displayManager = { gdm.enable = builtins.elem "gnome" config.bchmnn.gui.flavour; startx.enable = builtins.elem "i3" config.bchmnn.gui.flavour; }; }; environment.systemPackages = [ (pkgs.writeShellScriptBin "sway-run" '' export WLR_NO_HARDWARE_CURSORS=1 exec ${pkgs.sway}/bin/sway "$@" '') ]; environment = { etc = { "greetd/environments".text = (lib.strings.concatLines config.bchmnn.gui.flavour); "greetd/kanshi-config".text = '' profile nomad { output "LVDS-1" enable } profile iroh { output "DP-3" enable mode 2560x1440 position 0,0 output "DP-2" enable mode 2560x1440 position 2560,0 output "DP-1" enable mode 2560x1440 position 5120,0 } profile station { output "LVDS-1" disable output "Dell Inc. DELL U2515H 9X2VY5490XUL" enable mode 1920x1080 position 0,0 output "Dell Inc. DELL U2515H 9X2VY5C7138L" enable mode 1920x1080 position 1920,0 output "HJW VGA TO HDMI 0x00000100" enable mode 1920x1080 position 3840,0 } ''; "greetd/sway-config".text = '' exec "${pkgs.kanshi}/bin/kanshi --config /etc/greetd/kanshi-config" exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit" bindsym Mod4+shift+e exec swaynag \ -t warning \ -m 'What do you want to do?' \ -b 'Poweroff' 'systemctl poweroff' \ -b 'Reboot' 'systemctl reboot' include /etc/sway/config.d/* ''; }; }; services.greetd = { enable = config.bchmnn.gui.greeter.enable; settings = { default_session = { command = "sway-run --config /etc/greetd/sway-config" + lib.optionalString config.bchmnn.nvidia.enable " --unsupported-gpu"; }; }; }; # TODO workaround to get swaylock accepting pw # https://github.com/NixOS/nixpkgs/issues/158025 security.pam.services = lib.mkIf (lib.elem "sway" config.bchmnn.gui.flavour) { swaylock = { }; }; xdg.portal = { enable = true; wlr.enable = true; config.common.default = "*"; extraPortals = lib.optionals (lib.elem "sway" config.bchmnn.gui.flavour) [ pkgs.xdg-desktop-portal-wlr ]; }; environment.sessionVariables.GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" ( with pkgs.gst_all_1; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly ] ); hardware.opengl = { enable = true; driSupport = true; driSupport32Bit = true; }; environment.variables = lib.mkIf (builtins.elem pkgs.intel-media-driver config.hardware.opengl.extraPackages) { LIBVA_DRIVER_NAME = "iHD"; }; }; }