From 4b099404d4f3dcc611f9de20755913a954495ec6 Mon Sep 17 00:00:00 2001 From: Stefan Ellmauthaler Date: Tue, 24 May 2022 15:06:21 +0200 Subject: [PATCH] Add graphical layer as module --- machines/stel-xps/default.nix | 5 +++ machines/stel-xps/software.nix | 3 ++ modules/graphical.nix | 79 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 modules/graphical.nix diff --git a/machines/stel-xps/default.nix b/machines/stel-xps/default.nix index d712e66..264181c 100644 --- a/machines/stel-xps/default.nix +++ b/machines/stel-xps/default.nix @@ -15,6 +15,11 @@ locale.enable = true; # configure zsh zsh.enable = true; + # enable X11 with lightdm and i3 + graphical = { + enable = true; + # dpi = 180; + }; # user setup users = { diff --git a/machines/stel-xps/software.nix b/machines/stel-xps/software.nix index a335b5d..9a680a4 100644 --- a/machines/stel-xps/software.nix +++ b/machines/stel-xps/software.nix @@ -19,5 +19,8 @@ obsstudio.enable = true; python.enable = true; }; + + texlive.enable = true; + steam-run.enable = true; }; } diff --git a/modules/graphical.nix b/modules/graphical.nix new file mode 100644 index 0000000..46c9ac0 --- /dev/null +++ b/modules/graphical.nix @@ -0,0 +1,79 @@ +{ config, pkgs, lib, ... }: +with lib; { + options.elss.graphical= { + enable = mkEnableOption "configure i3-based graphical layer"; + greeterCursorsize = mkOption{ + type = types.int; + default = 16; + description = '' + Size of the cursortheme in the lightdm greeter + ''; + }; + dpi = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + DPI setting for the xserver + ''; + }; + }; + config = + let + cfg = config.elss.graphical; + #cursorsize = if config.variables.hostName == "nucturne" then 14 else 16; + #xserverDPI = if config.variables.hostName == "stel-xps" then 180 else null; + in + { + config.elss.users.x11.enable = true; + networking.networkmanager.enable = true; + + services = { + xserver = { + enable = true; + dpi = cfg.dpi; + displayManager.lightdm = { + enable = true; + greeters.gtk.cursorTheme.size = cfg.greeterCursorsize; + }; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + rofi # launcher + polybarFull # bar + i3lock # lock screen + xss-lock + autorandr + ]; + extraSessionCommands = '' + ${pkgs.autorandr}/bin/autorandr -c + ''; + }; + layout = "us"; + xkbOptions = "eurosign:e"; + }; + gnome.gnome-keyring.enable = true; + + printing.enable = true; + }; + + sound.enable = true; + + hardware = { + pulseaudio.enable = true; + bluetooth.enable = true; + }; + + services.blueman.enable = true; + + environment.systemPackages = with pkgs; [ + firefox + thunderbird + okular + texlive.combined.scheme-full + usbutils + keepassxc + gnome.libsecret + arandr + ]; + }; +}