dotfiles/common/desktop_environment/i3/default.nix
RingOfStorms (Joshua Bell) e77dec2d94 i3 draft
2025-09-19 17:11:15 -05:00

64 lines
1.8 KiB
Nix

{ config, lib, pkgs, ... }:
let
ccfg = import ../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"i3"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
with lib;
{
options = {
enable = lib.mkEnableOption "i3 (X11) desktop environment";
terminalCommand = mkOption {
type = lib.types.str;
default = "foot";
description = "The terminal command to use.";
};
extraOptions = mkOption {
type = lib.types.attrs;
default = { };
description = "Extra options for i3 configuration.";
};
};
config = lib.mkIf cfg.enable {
home-manager = {
sharedModules = [ ./home_manager ];
};
services.greetd = {
enable = true;
vt = 2;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${pkgs.xorg.xinit}/bin/xinit ${pkgs.i3}/bin/i3'}";
user = "greeter";
};
};
};
# X server
services.xserver.enable = true;
services.xserver.displayManager = {
# kept undefined to allow user selection; greetd is enabled above
};
# Environment variables for X11
environment.sessionVariables = {
XDG_SESSION_TYPE = "x11";
XDG_CURRENT_DESKTOP = "i3";
XDG_SESSION_DESKTOP = "i3";
};
environment.systemPackages = with pkgs; [ i3 i3status i3lock i3-gaps polybar maim xclip xterm ];
# Enable backlight/brightness control, audio, etc., similar to sway defaults
environment.systemPackages = lib.mkForce (with pkgs; [ polybar maim xclip i3 i3status i3lock i3-gaps pavucontrol btop nemo feh rofi ]);
# Allow users to add extra options into the generated i3 config
# extraOptions can be appended by home-manager fragment
};
}