1{ 2 pkgs, 3 config, 4 lib, 5 ... 6}@inputs: 7 8let 9 i3-workspace-history = 10 inputs.i3-workspace-history.packages.${pkgs.stdenv.hostPlatform.system}.default; 11 replacements = { 12 wm = "i3"; 13 wmmsg = "i3-msg"; 14 rofi = "rofi"; 15 app_id = "class"; 16 bar_extra = ""; 17 locked = ""; 18 polkit_gnome = "${pkgs.polkit_gnome}"; 19 locker = "xsecurelock"; 20 enable_output = "xrandr --output $laptop_output --auto"; 21 disable_output = "xrandr --output $laptop_output --off"; 22 drun = "rofi -i -modi drun -show drun"; 23 dmenu = "rofi -i -dmenu -p"; 24 displays = "arandr"; 25 bar = "i3bar"; 26 notification_deamon = "dunst"; 27 i3_workspace_history = "${i3-workspace-history}/bin/i3-workspace-history"; 28 i3_workspace_history_args = ""; 29 }; 30 util = import ./util.nix { inherit pkgs lib; }; 31 cfg = config.custom.gui.i3; 32in 33{ 34 options.custom.gui.i3.enable = lib.mkEnableOption "i3"; 35 36 config = lib.mkIf cfg.enable { 37 # TODO 38 # idling 39 40 home.packages = with pkgs; [ i3-workspace-history ]; 41 42 home.pointerCursor.x11.enable = true; 43 44 home.file = { 45 ".xinitrc".text = '' 46 export XDG_SESSION_TYPE=x11 47 export GDK_BACKEND=x11 48 export DESKTOP_SESSION=plasma 49 export TMUX_TMPDIR=$XDG_RUNTIME_DIR/x-tmux 50 eval `dbus-launch` 51 export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID DBUS_SESSION_BUS_WINDOWID 52 exec i3 53 ''; 54 ".zprofile".text = '' 55 # Autostart at login on TTY 2 56 if [ -z "''${DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 2 ]; then 57 source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh 58 exec startx 59 fi 60 ''; 61 }; 62 63 xdg.configFile = 64 let 65 entries = { 66 "dunst/dunstrc".source = ./dunst; 67 "i3/config".text = 68 let 69 wmFilenames = util.listFilesInDir ./wm/config.d; 70 in 71 let 72 i3Filenames = util.listFilesInDir ./wm/i3; 73 in 74 (util.concatFilesReplace ([ ./wm/config ] ++ wmFilenames ++ i3Filenames) replacements); 75 "rofi/config.rasi".source = ./rofi.rasi; 76 }; 77 in 78 (util.inDirReplace ./wm/scripts "i3/scripts" replacements) // entries; 79 80 services.redshift = { 81 enable = true; 82 provider = "geoclue2"; 83 }; 84 85 services.picom.enable = true; 86 }; 87}