{ pkgs , lib , config , ... }: with lib; let cfg = config.home.sway; gui = with config.faucet.gui; ( enable && session ); in { options.home = { sway = {}; }; config = { users.homeModules = [ # this module passes gui configuration to home-manager { passthrough.gui = gui; } # this module passes sway-specific config values { passthrough.sway = cfg; } ]; users.home.persist = mkIf gui { directories = [ ".config/google-chrome" ]; }; users.adminGroups = mkIf gui [ "video" ]; # themes and icons environment.systemPackages = with pkgs; [ whitesur-gtk-theme whitesur-icon-theme bibata-cursors ]; services.xserver.displayManager.sessionPackages = mkIf gui [ (pkgs.writeTextFile { name = "sway-session"; destination = "/share/wayland-sessions/sway.desktop"; text = '' [Desktop Entry] Name=Sway Comment=An i3-compatible Wayland compositor Exec=sway --unsupported-gpu Type=Application ''; } // { providedSessions = [ pkgs.sway.meta.mainProgram ]; }) ]; security = mkIf gui { polkit.enable = true; chromiumSuidSandbox.enable = true; pam.services.swaylock = { }; }; fonts.enableDefaultPackages = mkIf gui true; programs = mkIf gui { dconf.enable = true; light.enable = true; }; }; }