155 lines
3.6 KiB
Nix
155 lines
3.6 KiB
Nix
# vim: et:ts=2:sw=2:
|
|
{
|
|
niri,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
# Use niri.
|
|
nixpkgs.overlays = [ niri.overlays.niri ];
|
|
imports = [
|
|
|
|
# Imports that add additional functionality
|
|
./waybar
|
|
./niri.nix
|
|
./mako.nix
|
|
./nirilock-fancy.nix
|
|
|
|
# Core niri import.
|
|
niri.nixosModules.niri
|
|
(
|
|
{ ... }:
|
|
{
|
|
|
|
# Enable Niri system-wide.
|
|
programs.niri = {
|
|
enable = true;
|
|
package = pkgs.niri-unstable;
|
|
};
|
|
|
|
# We configure a cache ourselves; skip the upstream autoconf.
|
|
niri-flake.cache.enable = false;
|
|
}
|
|
)
|
|
];
|
|
|
|
# Also provide an xserver and plasma, for when we need accessibility.
|
|
services.xserver.enable = true;
|
|
services.desktopManager.plasma6.enable = true;
|
|
|
|
# Don't let Plasma override TLP with PPD.
|
|
services.power-profiles-daemon.enable = lib.mkForce false;
|
|
|
|
|
|
# Enable espanso, when possible.
|
|
services.espanso.enable = true;
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
wtype
|
|
wl-clipboard
|
|
brightnessctl
|
|
sddm-chili-theme
|
|
nirilock-fancy
|
|
|
|
xdg-desktop-portal-gtk
|
|
xdg-desktop-portal-gnome
|
|
|
|
# Terrible hack to type things in Wayland.
|
|
(pkgs.writeScriptBin "haxtype" ''
|
|
#!/usr/bin/env bash
|
|
|
|
declare -A direct_windows=(
|
|
[\"org.gajim.Gajim\"]=1
|
|
[\"nheko\"]=1
|
|
)
|
|
|
|
# Get the current application ID; we'll use it to
|
|
appid=$(niri msg -j focused-window | ${pkgs.jq}/bin/jq .app_id)
|
|
|
|
# If this is a Direct window, inject data from wtype directly.
|
|
if [[ -n "''${direct_windows[$appid]}" ]]; then
|
|
${wtype}/bin/wtype "$1 "
|
|
echo "Using direct input!"
|
|
exit 0
|
|
fi
|
|
|
|
# If this is a Wezterm window, use its special text input.
|
|
if [[ $appid == \""org.wezfurlong.wezterm\"" ]]; then
|
|
wezterm cli send-text "$1 "
|
|
exit 0
|
|
fi
|
|
|
|
#
|
|
# Otherwise, use the clipboard (ugh).
|
|
#
|
|
TEMPFILE=$(${coreutils-full}/bin/coreutils --coreutils-prog=mktemp)
|
|
|
|
# Save the clipboard.
|
|
${wl-clipboard}/bin/wl-paste -n > $TEMPFILE
|
|
MIMETYPE=$(${wl-clipboard}/bin/wl-paste -l | head -n 1)
|
|
|
|
# Type our our message.
|
|
echo -n "$1" | ${wl-clipboard}/bin/wl-copy
|
|
${wtype}/bin/wtype -M Ctrl v -m Ctrl
|
|
${wtype}/bin/wtype ' '
|
|
|
|
# Resetore the clipboard and clear our buffer.
|
|
cat $TEMPFILE | ${wl-clipboard}/bin/wl-copy -t $MIMETYPE
|
|
rm $TEMPFILE
|
|
'')
|
|
];
|
|
|
|
xdg.portal = {
|
|
enable = true;
|
|
|
|
# These enable common operations and screencasting.
|
|
extraPortals = with pkgs; [
|
|
xdg-desktop-portal-gtk
|
|
xdg-desktop-portal-gnome
|
|
];
|
|
};
|
|
|
|
# Set up everything per-user but niri; which is in its own module.
|
|
home-manager.users.deprekated =
|
|
{ pkgs, config, ... }:
|
|
{
|
|
|
|
# Use mako as a notification daemon.
|
|
services.mako = {
|
|
enable = true;
|
|
defaultTimeout = 10000;
|
|
};
|
|
|
|
# Use fuzzel as a launcher.
|
|
programs.fuzzel = {
|
|
enable = true;
|
|
settings.main.terminal = "wezterm";
|
|
};
|
|
};
|
|
|
|
# Use a graphical greeter.
|
|
services.displayManager = {
|
|
defaultSession = "niri";
|
|
|
|
sddm = {
|
|
enable = true;
|
|
autoNumlock = true;
|
|
#wayland.enable = true;
|
|
theme = "chili";
|
|
};
|
|
};
|
|
|
|
# Use KDE connect.
|
|
programs.kdeconnect.enable = true;
|
|
|
|
# Enable sound with pipewire.
|
|
hardware.pulseaudio.enable = false;
|
|
security.rtkit.enable = true;
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
alsa.support32Bit = true;
|
|
pulse.enable = true;
|
|
};
|
|
}
|