1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

First phase to swayfy the setup

This commit is contained in:
Stefan Ellmauthaler 2022-08-10 14:40:01 +02:00
parent 2ae6ff01e1
commit c7ff0f5092
Failed to extract signature
6 changed files with 120 additions and 8 deletions

View File

@ -20,6 +20,8 @@
# enable X11 with lightdm and i3
graphical = {
enable = true;
sway.enable = true;
i3.enable = false;
# set dpi if used in mobile applications
# dpi = 180;
};

View File

@ -7,7 +7,7 @@ with lib; {
cfg = config.elss.programs.communication;
in
mkIf cfg.enable {
elss.graphical.enable = true;
# elss.graphical.enable = true;
environment.systemPackages = with pkgs; [
element-desktop
jitsi-meet-electron

View File

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib; {
options.elss.graphical = {
enable = mkEnableOption "configure i3-based graphical layer";
enable = mkEnableOption "configure graphical layer";
greeterCursorsize = mkOption {
type = types.int;
default = 16;
@ -16,6 +16,7 @@ with lib; {
DPI setting for the xserver
'';
};
i3.enable = mkEnableOption "enable i3";
};
config =
let
@ -24,11 +25,11 @@ with lib; {
#xserverDPI = if config.variables.hostName == "stel-xps" then 180 else null;
in
mkIf cfg.enable {
elss.users.x11.enable = true;
elss.users.x11.enable = if cfg.i3.enable then true else false;
elss.networking.useNetworkManager = true;
services = {
xserver = {
xserver = mkIf cfg.i3.enable {
enable = true;
dpi = cfg.dpi;
displayManager.lightdm = {
@ -59,7 +60,7 @@ with lib; {
sound.enable = true;
hardware = {
pulseaudio.enable = true;
#pulseaudio.enable = true;
bluetooth.enable = true;
};

51
modules/sway.nix Normal file
View File

@ -0,0 +1,51 @@
{ config, pkgs, lib, ... }:
with lib; {
options.elss.graphical.sway.enable = mkEnableOption "Use sway";
config =
let
cfg = config.elss.graphical.sway;
in
mkIf cfg.enable {
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# xdg-desktop-portal works by exposing a series of D-Bus interfaces
# known as portals under a well-known name
# (org.freedesktop.portal.Desktop) and object path
# (/org/freedesktop/portal/desktop).
# The portal interfaces include APIs for file access, opening URIs,
# printing and others.
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
gtkUsePortal = true;
};
# enable sway window manager
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
# greetd login manager
services.greetd = {
enable = true;
package = pkgs.greetd.tuigreet;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
};
};
};
environment.systemPackages = with pkgs; [
rofi
];
};
}

View File

@ -1,14 +1,16 @@
{ config, lib, pkgs, ... }:
{
imports = [
./autorandr.nix
# ./autorandr.nix
./dunst.nix
./git.nix
./gpg.nix
./i3.nix
# ./i3.nix
./nextcloud.nix
./polybar.nix
# ./polybar.nix
./zsh.nix
./sway.nix
];
services = {
gnome-keyring = {

56
users/ellmau/sway.nix Normal file
View File

@ -0,0 +1,56 @@
{ config, pkgs, lib, ... }:
{
wayland.windowManager.sway = {
enable = true;
config = {
down = "k";
up = "l";
left = "j";
right = "semicolon";
modifier = "Mod4";
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun";
"${modifier}+Tab" = "exec ${pkgs.rofi}/bin/rofi -show window";
"${modifier}+BackSpace" = "mode $mode_system";
};
keycodebindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
{ };
startup = [
{
command = "--no-startup-id nm-applet";
always = true;
}
];
terminal = "alacritty";
window = {
titlebar = true;
};
};
extraConfig = ''
mode "$mode_system" {
bindsym l exec --no-startup-id $i3lockwall, mode "default"
bindsym Ctrl+e exec --no-startup-id swaymsg exit, mode "default"
#bindsym s exec --no-startup-id $i3lockwall && systemctl suspend, mode "default"
#bindsym h exec --no-startup-id $i3lockwall && systemctl hibernate, mode "default"
bindsym Ctrl+r exec --no-startup-id systemctl reboot, mode "default"
bindsym Ctrl+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
'';
};
}