244 lines
7.2 KiB
Nix
244 lines
7.2 KiB
Nix
{lib, config, pkgs, modulesPath, inputs, ... }:
|
||
|
||
let
|
||
cfg = config.cspark-desktop-ewm;
|
||
in
|
||
{
|
||
imports =
|
||
[
|
||
inputs.ewm.nixosModules.default
|
||
];
|
||
|
||
options.cspark-desktop-ewm = {
|
||
enable
|
||
= lib.mkEnableOption "Enable Custom EWM Desktop Setup";
|
||
};
|
||
|
||
config = lib.mkIf cfg.enable {
|
||
services.libinput.enable = true;
|
||
|
||
# For xwayland
|
||
services.xserver = {
|
||
enable = true;
|
||
displayManager.lightdm.enable = false;
|
||
|
||
# Remove/disable xterm, we are using eshell.
|
||
desktopManager.xterm.enable = false;
|
||
excludePackages = with pkgs; [ xterm ];
|
||
};
|
||
programs.xwayland.enable = true;
|
||
|
||
# EWM setup
|
||
programs.ewm = {
|
||
enable = true;
|
||
emacsPackage = let
|
||
patchSource = pkgs.fetchFromGitHub {
|
||
owner = "minad";
|
||
repo = "emacs-canvas-patch";
|
||
rev = "57a28b5cca57de8cce00d1595eb4b66f1d335401"; # Can be a tag, branch, or specific commit hash
|
||
hash = "sha256-fMdiYPf/7IgvrNovajy565bn5dgh7OCP6KOdZaHTDUQ=";
|
||
};
|
||
targetPackage = inputs.emacs-overlay.packages.x86_64-linux.emacs-git-pgtk;
|
||
in
|
||
(pkgs.emacsPackagesFor ((targetPackage.overrideAttrs (oldAttrs: {
|
||
patches =
|
||
(oldAttrs.patches or []) ++ [
|
||
# Path to your local patch file or a fetchurl call
|
||
"${patchSource}/canvas.diff"
|
||
];
|
||
})).override {
|
||
withNativeCompilation = true;
|
||
withTreeSitter = true;
|
||
})).withPackages (epkgs: [
|
||
epkgs.mu4e
|
||
inputs.ewm.packages.x86_64-linux.default
|
||
]);
|
||
};
|
||
# We will disable this as not needed with EWM
|
||
services.emacs = {
|
||
enable = lib.mkForce false;
|
||
};
|
||
# The minimal login manager I'm using for EWM
|
||
services.greetd = {
|
||
enable = true;
|
||
settings = {
|
||
default_session = {
|
||
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time";
|
||
user = "greeter";
|
||
};
|
||
};
|
||
};
|
||
|
||
programs.gnupg = {
|
||
agent.enable = true;
|
||
agent.pinentryPackage = pkgs.pinentry-qt;
|
||
};
|
||
|
||
environment.systemPackages = with pkgs; [
|
||
emacs-pgtk
|
||
|
||
xorg.libxcb
|
||
gcr # For GNOME gpg pinentry
|
||
pinentry-qt
|
||
|
||
gtk3 # Includes gtk-launch which is used by counsel-linux-app inside emacs
|
||
|
||
wdisplays # Manage wayland displays
|
||
wlr-randr # Manage wayland displays - xrandr clone
|
||
wlsunset # Day/night gamma adjustment/filter for wayland
|
||
brightnessctl # GNU/Linux application to control backlights
|
||
grim
|
||
slurp
|
||
wl-clipboard
|
||
haskellPackages.gtk-sni-tray # System Tray
|
||
haskellPackages.status-notifier-item # System Tray
|
||
|
||
udiskie # Automounting drives
|
||
xwayland-satellite # Xwayland support outside your Wayland compositor
|
||
|
||
#lxqt.pcmanfm-qt # File Manager
|
||
nautilus # File Manager
|
||
lxqt.lxqt-archiver # Archiver
|
||
qt6Packages.qt6ct # Manage QT6 Themes
|
||
libsForQt5.qt5ct # Manage QT5 Themes
|
||
lxappearance # Manage GTK Themes
|
||
kdePackages.polkit-kde-agent-1 # Polkit Prompt for password prompts etc
|
||
lxqt.lxqt-openssh-askpass # GUI to query passwords on behalf of SSH agents
|
||
pavucontrol # Audio control
|
||
|
||
(pkgs.writeShellScriptBin "wl-kbptr-ewm" ''
|
||
DATA=$(wl-kbptr --only-print)
|
||
|
||
if [ -n "$DATA" ]; then
|
||
X=$(echo "$DATA" | awk -F'[x+]' '{print int($1 / 2) + $3}')
|
||
Y=$(echo "$DATA" | awk -F'[x+]' '{print int($2 / 2) + $4}')
|
||
|
||
ydotool mousemove --absolute "$X" "$Y"
|
||
ydotool click 0xC0
|
||
fi
|
||
'')
|
||
];
|
||
|
||
# XDG Portal Integration (For file chooser/screensharing etc)
|
||
xdg.portal = {
|
||
enable = true;
|
||
wlr.enable = true;
|
||
extraPortals = [
|
||
pkgs.xdg-desktop-portal-gnome
|
||
pkgs.xdg-desktop-portal-gtk
|
||
];
|
||
config = {
|
||
ewm = {
|
||
default = [ "gnome" "gtk" ];
|
||
# Use GNOME specifically for screencasting
|
||
"org.freedesktop.impl.portal.Screencast" = [ "gnome" ];
|
||
"org.freedesktop.impl.portal.Screenshot" = [ "gnome" ];
|
||
};
|
||
};
|
||
};
|
||
|
||
# Whether to enable Qt configuration, including theming.
|
||
qt.enable = true;
|
||
# Enable polkit
|
||
security.polkit.enable = true;
|
||
# For udiskie
|
||
services.udisks2.enable = true;
|
||
|
||
# KDE Connect
|
||
programs.kdeconnect.enable = true;
|
||
|
||
# Whether to enable GNOME Keyring daemon, a service designed to take care of the user’s security credentials, such as user names and passwords.
|
||
services.gnome.gnome-keyring.enable = true;
|
||
|
||
# GTK themes are not applied in Wayland applications / Window Decorations missing / Cursor looks different
|
||
programs.dconf.enable = true;
|
||
|
||
# Enable CUPS to print documents.
|
||
services.printing.enable = true;
|
||
|
||
# Enable sound with pipewire.
|
||
# sound.enable = true; Deprecated option
|
||
hardware.pulseaudio.enable = false;
|
||
security.rtkit.enable = true;
|
||
services.pipewire = {
|
||
enable = true;
|
||
systemWide = true;
|
||
|
||
alsa.enable = true;
|
||
alsa.support32Bit = true;
|
||
pulse.enable = true;
|
||
# # If you want to use JACK applications, uncomment this
|
||
jack.enable = true;
|
||
|
||
# use the example session manager (no others are packaged yet so this is enabled by default,
|
||
# no need to redefine it in your config for now)
|
||
#media-session.enable = true;
|
||
|
||
# Virtual mic to route processed microphone or other devices simultaneously into
|
||
extraConfig =
|
||
{
|
||
pipewire."91-processed-mic" = {
|
||
"context.objects" = [
|
||
{
|
||
factory = "adapter";
|
||
args = {
|
||
"factory.name" = "support.null-audio-sink";
|
||
"node.name" = "Processed-Mic";
|
||
"node.description" = "Virtual Processed Microphone";
|
||
"media.class" = "Audio/Source/Virtual";
|
||
"audio.position" = "FL,FR";
|
||
};
|
||
}
|
||
];
|
||
};
|
||
# For Mopidy
|
||
pipewire-pulse."10-mopidy.conf" = {
|
||
"pulse.properties" = {
|
||
"server.address" = [
|
||
"unix:native"
|
||
"tcp:4713"
|
||
];
|
||
};
|
||
};
|
||
};
|
||
};
|
||
|
||
security.sudo = {
|
||
extraRules = [
|
||
{
|
||
commands = [
|
||
{
|
||
command = "/run/current-system/sw/bin/brightnessctl";
|
||
options = [ "NOPASSWD" ];
|
||
}
|
||
];
|
||
groups = [ "wheel" ];
|
||
}
|
||
];
|
||
};
|
||
|
||
programs.ssh = {
|
||
enableAskPassword = true;
|
||
askPassword = "/run/current-system/sw/bin/lxqt-openssh-askpass";
|
||
};
|
||
|
||
environment.sessionVariables = {
|
||
EDITOR="emacsclient -r";
|
||
QT_QPA_PLATFORMTHEME = "qt6ct";
|
||
SDL_VIDEODRIVER = "wayland,x11,windows";
|
||
_JAVA_AWT_WM_NONREPARENTING = "1";
|
||
SSH_ASKPASS_REQUIRE = "force";
|
||
SSH_ASKPASS = "/run/current-system/sw/bin/lxqt-openssh-askpass";
|
||
};
|
||
environment.variables = {
|
||
EDITOR="emacsclient -r";
|
||
QT_QPA_PLATFORMTHEME = "qt6ct";
|
||
SDL_VIDEODRIVER = "wayland,x11,windows";
|
||
_JAVA_AWT_WM_NONREPARENTING = "1";
|
||
SSH_ASKPASS_REQUIRE = "force";
|
||
SSH_ASKPASS = lib.mkForce "/run/current-system/sw/bin/lxqt-openssh-askpass";
|
||
};
|
||
|
||
};
|
||
}
|