Files
moonix/modules/desktop.nix
T
2026-08-07 12:58:15 +02:00

188 lines
5.0 KiB
Nix

# ABOUTME: Deploys the Moonarch XDG configs and desktop package set.
# ABOUTME: Counterpart to the package() function in moonarch-git/PKGBUILD.
{ pkgs, lib, moonarchSrc, moonarchPkgs, ... }:
let
xdg = "${moonarchSrc}/defaults/xdg";
etc = "${moonarchSrc}/defaults/etc";
# The moonarch-* helper scripts from defaults/bin, installed as a single
# package. Counterpart to `install -Dm755 defaults/bin/moonarch-* -t /usr/bin/`.
moonarch-scripts = pkgs.stdenv.mkDerivation {
pname = "moonarch-scripts";
version = "0-unstable";
src = moonarchSrc;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm755 defaults/bin/moonarch-* -t "$out/bin/"
runHook postInstall
'';
meta.description = "Moonarch helper scripts for Waybar, power and devices";
};
in
{
# --- XDG configs -> /etc/xdg/ ---
#
# Deployed verbatim from the moonarch repo; defaults/ stays the single
# source of truth for both distros.
#
# Deliberately excluded: defaults/xdg/walker/ — walker is not part of this
# setup, the Quickshell launcher replaced it.
environment.etc = {
"xdg/niri/config.kdl".source = "${xdg}/niri/config.kdl";
"xdg/quickshell/moonarch".source = "${xdg}/quickshell/moonarch";
"xdg/waybar".source = "${xdg}/waybar";
"xdg/swaync".source = "${xdg}/swaync";
"xdg/foot/foot.ini".source = "${xdg}/foot/foot.ini";
"xdg/fastfetch/config.jsonc".source = "${xdg}/fastfetch/config.jsonc";
"xdg/kanshi/config".source = "${xdg}/kanshi/config";
"xdg/Kvantum/kvantum.kvconfig".source = "${xdg}/Kvantum/kvantum.kvconfig";
"xdg/qt6ct/qt6ct.conf".source = "${xdg}/qt6ct/qt6ct.conf";
"xdg/gtk-3.0/settings.ini".source = "${xdg}/gtk-3.0/settings.ini";
"xdg/gtk-4.0/settings.ini".source = "${xdg}/gtk-4.0/settings.ini";
"xdg/pipewire/pipewire.conf.d/99-input-denoising.conf".source =
"${xdg}/pipewire/pipewire.conf.d/99-input-denoising.conf";
# stasis reads /etc/stasis/ as its system-wide fallback, never /etc/xdg/.
"stasis/stasis.rune".source = "${xdg}/stasis/stasis.rune";
# Configs outside /etc/xdg/ in the Arch package as well.
"mpv/mpv.conf".source = "${etc}/mpv/mpv.conf";
"xdg-desktop-portal/niri-portals.conf".source =
"${etc}/xdg-desktop-portal/niri-portals.conf";
};
# Generic-family defaults. Same content as
# defaults/etc/fonts/conf.d/65-moonarch-fonts.conf, but routed through the
# fontconfig module: /etc/fonts/conf.d/ is owned by NixOS and rejects
# environment.etc entries.
fonts.fontconfig.localConf = ''
<description>Moonarch generic-family defaults</description>
<!-- binding="strong" required: the default weak <prefer> ranks behind
stock generic fallbacks, so it would not take effect. -->
<alias binding="strong">
<family>sans-serif</family>
<prefer>
<family>UbuntuSans Nerd Font</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace</family>
<prefer>
<family>UbuntuSansMono Nerd Font</family>
</prefer>
</alias>
'';
# --- Compositor ---
programs.niri.enable = true;
# --- Shell ---
programs.zsh.enable = true;
# --- Theme, systemwide instead of the gsettings calls in post-install.sh ---
programs.dconf = {
enable = true;
profiles.user.databases = [{
settings."org/gnome/desktop/interface" = {
gtk-theme = "Colloid-Grey-Dark-Catppuccin";
icon-theme = "Colloid-Grey-Catppuccin-Dark";
color-scheme = "prefer-dark";
font-name = "UbuntuSans Nerd Font 11";
};
}];
};
# --- Portals ---
xdg.portal = {
enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gnome xdg-desktop-portal-gtk ];
};
fonts.packages = with pkgs; [
nerd-fonts.ubuntu-sans
openmoji-color
];
environment.systemPackages = with pkgs; [
# Moonarch's own programs
moonarchPkgs.moonlock
moonarchPkgs.moonset
moonarchPkgs.sweet-cursors
moonarch-scripts
# Compositor extras
xwayland-satellite
kanshi
# Bar, notifications, clipboard
waybar
quickshell
swaynotificationcenter
libnotify
cliphist
wl-clipboard
# Display and wallpaper
wlsunset
nwg-look
brightnessctl
awww
# Terminal
foot
# Audio
pavucontrol
alsa-utils
# Network and bluetooth
networkmanagerapplet
blueman
# File manager stack
gvfs
udisks2
ntfs3g
# Theming
(colloid-gtk-theme.override {
themeVariants = [ "grey" ];
colorVariants = [ "dark" ];
tweaks = [ "catppuccin" ];
})
colloid-icon-theme
libsForQt5.qtstyleplugin-kvantum
qt6Packages.qtstyleplugin-kvantum
qt6Packages.qt6ct
qt6.qt5compat
# CLI tools referenced by zshrc and the helper scripts
bat
btop
eza
fastfetch
fd
fzf
jq
lazygit
ripgrep
neovim
git
# System
fwupd
upower
polkit_gnome
wdisplays
wl-color-picker
];
# Polkit agent for privilege prompts inside the session.
security.polkit.enable = true;
}