panacea/modules/gui.nix

169 lines
3.7 KiB
Nix

{ config, lib, pkgs, ... }:
let tmux_config = builtins.readFile /home/coolneng/.tmux.conf;
in {
# Display manager
services.xserver.enable = true;
services.xserver.displayManager = {
defaultSession = "sway";
autoLogin = {
enable = true;
user = "coolneng";
};
lightdm = {
enable = true;
greeter.package = pkgs.lightdm_gtk_greeter;
};
};
# Window manager
programs.sway = {
enable = true;
extraPackages = with pkgs; [
xwayland
swaylock
swayidle
swaybg
rofi
waybar
clipman
wl-clipboard
grim
slurp
light
imv
kanshi
kitty
];
extraSessionCommands = ''
export MOZ_ENABLE_WAYLAND=1
export MOZ_DBUS_REMOTE=1
export GRIM_DEFAULT_DIR=/home/coolneng/Photos/Screenshots
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export SDL_VIDEODRIVER=wayland
export GTK_THEME=Adapta-Eta
'';
};
# Backlight
programs.light.enable = true;
# Blue light filter
location = {
latitude = 35.89;
longitude = -5.32;
provider = "manual";
};
services.redshift = {
package = pkgs.redshift-wlr;
enable = true;
temperature = {
day = 6500;
night = 5300;
};
};
# Bar
programs.waybar.enable = true;
# GPG agent
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gtk2";
};
# Tmux
programs.tmux = {
enable = true;
historyLimit = 5000;
keyMode = "vi";
shortcut = "x";
terminal = "screen-256";
baseIndex = 1;
extraConfig = tmux_config;
};
# Automount external storage
services.autofs = {
enable = true;
timeout = 5;
autoMaster = let
mapConf = pkgs.writeText "auto" ''
usb -fstype=auto :/dev/sdb1
sdcard -fstype=auto :/dev/mmcblk0p1
'';
in ''
/media file:${mapConf} --timeout=5
'';
};
# Integrate pass with the browser
programs.browserpass.enable = true;
# Upgrade Doom Emacs daily
systemd.user.services.doom-upgrade = {
description = "Upgrade Doom Emacs";
wantedBy = [ "default.target" ];
path = [ pkgs.emacs pkgs.git ];
serviceConfig = {
Type = "oneshot";
ExecStart =
"/bin/sh /home/coolneng/.emacs.d/bin/doom -y upgrade ; /bin/sh /home/coolneng/.emacs.d/bin/doom -y update";
};
};
systemd.user.timers.doom-upgrade = {
description = "Daily upgrade of Doom Emacs";
wantedBy = [ "default.target" ];
timerConfig = {
OnCalendar = "20:00:00";
Unit = "doom-upgrade.service";
};
};
# Clean up Doom Emacs monthly
systemd.user.services.doom-purge = {
description = "Purge Doom Emacs";
wantedBy = [ "default.target" ];
path = [ pkgs.emacs pkgs.git ];
serviceConfig = {
Type = "oneshot";
ExecStart = "/bin/sh /home/coolneng/.emacs.d/bin/doom purge";
};
};
systemd.user.timers.doom-purge = {
description = "Monthly purge of Doom Emacs";
wantedBy = [ "default.target" ];
timerConfig = {
OnCalendar = "13 22:00:00";
Unit = "doom-purge.service";
};
};
# Upgrade Neovim plugins weekly
systemd.user.services.vim-plug-upgrade = {
description = "Upgrade Vim-Plug";
wantedBy = [ "default.target" ];
path = [ pkgs.git pkgs.neovim ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.neovim}/bin/nvim +PlugUpgrade +PlugUpdate +qa";
};
};
systemd.user.timers.vim-plug-upgrade = {
description = "Weekly upgrade of Vim-Plug";
wantedBy = [ "default.target" ];
timerConfig = {
OnCalendar = "Wed 18:00:00";
Unit = "vim-plug-upgrade.service";
};
};
}