From 71a517debe25c7be96f1933aa8d543efa0524141 Mon Sep 17 00:00:00 2001 From: Linnnus Date: Sun, 10 Sep 2023 01:35:14 +0200 Subject: Add graphics module --- hosts/ahmed/configuration.nix | 3 +++ modules/default.nix | 1 + modules/graphics/default.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 modules/graphics/default.nix diff --git a/hosts/ahmed/configuration.nix b/hosts/ahmed/configuration.nix index c117456..8a93021 100644 --- a/hosts/ahmed/configuration.nix +++ b/hosts/ahmed/configuration.nix @@ -76,6 +76,9 @@ # We are running behind CF proxy. my.modules.cloudflare-proxy.enable = true; + # Use as main driver temporarily. + # my.modules.graphics.enable = true; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave diff --git a/modules/default.nix b/modules/default.nix index ae6789f..61ef9cc 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,5 +5,6 @@ [ ./linus.onl ./cloudflare-proxy + ./graphics ]; } diff --git a/modules/graphics/default.nix b/modules/graphics/default.nix new file mode 100644 index 0000000..e2b7a86 --- /dev/null +++ b/modules/graphics/default.nix @@ -0,0 +1,36 @@ +# This module configures a basic graphical environment. I use this sometimes for +# ahmed when muhammed is being repaired. + +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkEnableOption mkIf; + + cfg = config.my.modules.graphics; +in +{ + options.my.modules.graphics.enable = mkEnableOption "basic graphical environment"; + + config = mkIf cfg.enable { + services.xserver.enable = true; + + # Match console keyboard layout but swap capslock and escape. + # TODO: Create a custom keymap with esc/capslock swap so console can use it. + services.xserver.layout = config.console.keyMap; + services.xserver.xkbOptions = "caps:swapescape"; + + # Enable touchpad support. + services.xserver.libinput.enable = true; + + services.xserver.windowManager.dwm.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + environment.systemPackages = with pkgs; [ + st # suckless terminal - dwm is pretty sucky without this + dmenu # application launcher + ]; + }; +} -- cgit v1.2.3