nixos-config/modules/gnome.nix
2022-11-16 13:20:46 -05:00

74 lines
3.6 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.sconfig.gnome;
in
{
options.sconfig.gnome = lib.mkEnableOption "Enable Gnome Desktop";
config = lib.mkIf cfg {
services.xserver = {
enable = true;
libinput.enable = true;
displayManager.gdm.enable = true;
displayManager.gdm.autoSuspend = false;
desktopManager.gnome.enable = true;
displayManager.defaultSession = "gnome-xorg";
};
services.colord.enable = false;
systemd.services.packagekit.enable = false;
environment.systemPackages = with pkgs; [
gnome3.gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.dash-to-dock
gnomeExtensions.dash-to-panel
gnomeExtensions.ddterm
(runCommand "x-terminal-emulator" { } ''
mkdir -p $out/bin
ln -s /run/current-system/sw/bin/kgx $out/bin/x-terminal-emulator
'')
(writeShellScriptBin "red" ''
x="$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled)"
[ "$x" = "true" ] && x=false || x=true
echo "Nightlight: $x"
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled $x
'')
];
sconfig.user-settings = ''
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.desktop.interface enable-hot-corners false
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace 12'
gsettings set org.gnome.desktop.interface show-battery-percentage true
gsettings set org.gnome.desktop.media-handling automount false
gsettings set org.gnome.desktop.media-handling autorun-never true
gsettings set org.gnome.desktop.notifications show-in-lock-screen false
gsettings set org.gnome.desktop.privacy remove-old-temp-files true
gsettings set org.gnome.desktop.privacy remove-old-trash-files true
gsettings set org.gnome.desktop.search-providers disabled "['org.gnome.Epiphany.desktop']"
gsettings set org.gnome.desktop.wm.keybindings maximize-vertically "['<Super>w']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "['<Shift><Super>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward "['<Shift><Alt>Tab']"
gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "['<Super>f']"
gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true
gsettings set org.gnome.settings-daemon.plugins.media-keys logout '[]'
gsettings set org.gnome.settings-daemon.plugins.media-keys www "['<Super>b']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Super>Return'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command 'x-terminal-emulator'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'Terminal'
gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'interactive'
'';
# Moving from Terminal to Console removes "Open in Remote Terminal" feature from nautilus
programs.gnome-terminal.enable = true;
};
}