265 lines
8.5 KiB
Nix
265 lines
8.5 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/`.
|
|
# waypaper calls `swww`/`swww-daemon`, but the maintained successor ships as
|
|
# `awww`. Same compatibility symlinks the Arch package creates.
|
|
swww-compat = pkgs.runCommand "swww-compat" { } ''
|
|
mkdir -p "$out/bin"
|
|
ln -s ${pkgs.awww}/bin/awww "$out/bin/swww"
|
|
ln -s ${pkgs.awww}/bin/awww-daemon "$out/bin/swww-daemon"
|
|
'';
|
|
|
|
wallpaper = "${moonarchSrc}/defaults/backgrounds/wallpaper.jpg";
|
|
|
|
# waypaper's config points at /usr/share/moonarch/wallpaper.jpg, which does
|
|
# not exist here. Generated with the store path instead of copied verbatim.
|
|
waypaperConfig = pkgs.runCommand "waypaper-config.ini" { } ''
|
|
substitute ${xdg}/waypaper/config.ini "$out" \
|
|
--replace-fail /usr/share/moonarch/wallpaper.jpg ${wallpaper}
|
|
'';
|
|
|
|
moonarch-scripts = pkgs.stdenv.mkDerivation {
|
|
pname = "moonarch-scripts";
|
|
version = "0-unstable";
|
|
src = moonarchSrc;
|
|
|
|
dontBuild = true;
|
|
installPhase = ''
|
|
runHook preInstall
|
|
# moonarch-waybar* are excluded: waybar is not part of this setup, the
|
|
# Quickshell bar replaced it.
|
|
for f in defaults/bin/moonarch-*; do
|
|
case "$(basename "$f")" in
|
|
moonarch-waybar*) continue ;;
|
|
esac
|
|
install -Dm755 "$f" -t "$out/bin/"
|
|
done
|
|
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 = {
|
|
# niri reads /etc/niri, not /etc/xdg/niri. Both are provided: the former
|
|
# is what niri actually loads, the latter keeps the layout consistent with
|
|
# the Arch package and with any user config that includes it.
|
|
"niri/config.kdl".source = "${xdg}/niri/config.kdl";
|
|
"xdg/niri/config.kdl".source = "${xdg}/niri/config.kdl";
|
|
"xdg/quickshell/moonarch".source = "${xdg}/quickshell/moonarch";
|
|
"xdg/foot/foot.ini".source = "${xdg}/foot/foot.ini";
|
|
"xdg/fastfetch/config.jsonc".source = "${xdg}/fastfetch/config.jsonc";
|
|
# defaults/xdg/kanshi/config is an empty placeholder — on Arch too. kanshi
|
|
# rejects it ("failed to parse config file") and restarts in a loop, so it
|
|
# is not deployed. Monitor profiles are machine specific and belong in
|
|
# ~/.config/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";
|
|
# Kept for layout parity with the Arch package; waypaper itself only reads
|
|
# the copy in the home directory, seeded below.
|
|
"xdg/waypaper/config.ini".source = waypaperConfig;
|
|
|
|
# stasis reads /etc/stasis/ as its system-wide fallback, never /etc/xdg/.
|
|
"stasis/stasis.rune".source = "${xdg}/stasis/stasis.rune";
|
|
|
|
# moonlock and moonset fall back to /usr/share/moonarch/wallpaper.jpg,
|
|
# which does not exist here, so the wallpaper is pointed at the store path
|
|
# explicitly. Both read these files as their system-wide config.
|
|
"moonlock/moonlock.toml".text = ''
|
|
background_path = "${wallpaper}"
|
|
'';
|
|
# blur matches the value set in ~/.config/moonset/moonset.toml on Arch.
|
|
"moonset/moonset.toml".text = ''
|
|
background_path = "${wallpaper}"
|
|
background_blur = 20.0
|
|
'';
|
|
|
|
# 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.
|
|
# localConf is written to /etc/fonts/local.conf verbatim, so it has to be a
|
|
# complete XML document — not just the inner elements.
|
|
fonts.fontconfig.localConf = ''
|
|
<?xml version="1.0"?>
|
|
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
|
<fontconfig>
|
|
<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>
|
|
</fontconfig>
|
|
'';
|
|
|
|
# --- Compositor ---
|
|
programs.niri.enable = true;
|
|
|
|
# niri searches $XDG_CONFIG_HOME/niri/config.kdl, then /etc/niri/config.kdl —
|
|
# not /etc/xdg. On Arch a one-line ~/.config/niri/config.kdl bridges there
|
|
# via `include`; here the system path is used directly, so nothing has to be
|
|
# placed in the home directory.
|
|
|
|
# config.kdl spawns the polkit agent by its FHS path
|
|
# (/usr/lib/polkit-gnome/...). Provide that path rather than diverging the
|
|
# config, which is shared with Arch.
|
|
systemd.tmpfiles.rules = [
|
|
"d /usr/lib 0755 root root -"
|
|
"L+ /usr/lib/polkit-gnome - - - - ${pkgs.polkit_gnome}/libexec"
|
|
];
|
|
|
|
# --- 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
|
|
moonarchPkgs.stasis
|
|
moonarch-scripts
|
|
|
|
# Compositor extras
|
|
xwayland-satellite
|
|
kanshi
|
|
|
|
# Bar, notifications, clipboard.
|
|
# Neither waybar nor swaync are installed: the Quickshell bar owns both
|
|
# roles. The "kept as a reserve" notes in the Arch config date from the
|
|
# migration and do not apply to a fresh setup.
|
|
quickshell
|
|
libnotify
|
|
cliphist
|
|
wl-clipboard
|
|
|
|
# Display and wallpaper
|
|
wlsunset
|
|
nwg-look
|
|
brightnessctl
|
|
awww
|
|
swww-compat
|
|
waypaper
|
|
|
|
# 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.override {
|
|
schemeVariants = [ "catppuccin" ];
|
|
colorVariants = [ "grey" ];
|
|
})
|
|
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;
|
|
|
|
# Seed configs for programs that read only from the home directory and have
|
|
# no system-wide fallback. 'C' copies once and never overwrites, so user
|
|
# edits survive. This is what post-install.sh does imperatively on Arch.
|
|
systemd.user.tmpfiles.rules = [
|
|
"C %h/.config/waypaper/config.ini 0644 - - - ${waypaperConfig}"
|
|
];
|
|
}
|