Add NixOS modules for desktop, greetd and services
This commit is contained in:
1 parent
4f0f4ccbbf
commit
d485783cf7
6 files changed
+432
-3
No files matched your search
@@ -0,0 +1,166 @@
|
||||
# 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";
|
||||
"fonts/conf.d/65-moonarch-fonts.conf".source =
|
||||
"${etc}/fonts/conf.d/65-moonarch-fonts.conf";
|
||||
"xdg-desktop-portal/niri-portals.conf".source =
|
||||
"${etc}/xdg-desktop-portal/niri-portals.conf";
|
||||
};
|
||||
|
||||
# --- 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
|
||||
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
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
# ABOUTME: Sets up greetd with moongreet as the login greeter.
|
||||
# ABOUTME: Counterpart to defaults/etc/greetd/ in the moonarch repo.
|
||||
|
||||
{ pkgs, lib, moonarchSrc, moonarchPkgs, ... }:
|
||||
|
||||
let
|
||||
wallpaper = "${moonarchSrc}/defaults/backgrounds/wallpaper.jpg";
|
||||
|
||||
# moongreet.toml cannot be copied verbatim: the upstream file points at
|
||||
# /usr/share/moonarch/wallpaper.jpg, which does not exist under Nix.
|
||||
# Everything else matches defaults/etc/moongreet/moongreet.toml.
|
||||
moongreetConfig = pkgs.writeText "moongreet.toml" ''
|
||||
[appearance]
|
||||
background = "${wallpaper}"
|
||||
cursor-size = 24
|
||||
'';
|
||||
|
||||
greeterNiriConfig = "${moonarchSrc}/defaults/etc/greetd/niri-greeter.kdl";
|
||||
in
|
||||
{
|
||||
environment.etc = {
|
||||
"greetd/niri-greeter.kdl".source = greeterNiriConfig;
|
||||
"moongreet/moongreet.toml".source = moongreetConfig;
|
||||
};
|
||||
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
terminal.vt = 1;
|
||||
default_session = {
|
||||
# moongreet needs a Wayland compositor; niri provides it.
|
||||
command = "${lib.getExe pkgs.niri} -c /etc/greetd/niri-greeter.kdl";
|
||||
user = "greeter";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# The greeter session spawns `moongreet` by name from niri-greeter.kdl,
|
||||
# so it has to resolve in PATH.
|
||||
environment.systemPackages = [ moonarchPkgs.moongreet ];
|
||||
|
||||
# PAM stack for moonlock, shipped by the package but owned by the system.
|
||||
security.pam.services.moonlock.text =
|
||||
builtins.readFile "${moonarchPkgs.moonlock}/share/moonlock/moonlock-pam";
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
# ABOUTME: systemd user and system services for the Moonarch session.
|
||||
# ABOUTME: Rebuilt from defaults/etc/systemd/ because the units use FHS paths.
|
||||
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# --- Audio ---
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
# --- Hardware ---
|
||||
hardware.bluetooth.enable = true;
|
||||
services.blueman.enable = true;
|
||||
services.udisks2.enable = true;
|
||||
services.upower.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
services.fwupd.enable = true;
|
||||
|
||||
# --- Firewall, replaces the ufw calls in post-install.sh ---
|
||||
networking.firewall.enable = true;
|
||||
|
||||
# --- Session services ---
|
||||
#
|
||||
# Rebuilt rather than copied: the upstream units reference /usr/bin/,
|
||||
# which does not exist under Nix.
|
||||
|
||||
systemd.user.services.kanshi = {
|
||||
description = "Dynamic display configuration";
|
||||
partOf = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = lib.getExe pkgs.kanshi;
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.cliphist-text = {
|
||||
description = "Clipboard history manager (text)";
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStartPre = "${pkgs.runtimeShell} -c 'mkdir -p $XDG_RUNTIME_DIR/cliphist && ${pkgs.cliphist}/bin/cliphist wipe'";
|
||||
ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist -db-path %t/cliphist/db store";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.cliphist-image = {
|
||||
description = "Clipboard history manager (image)";
|
||||
partOf = [ "graphical-session.target" ];
|
||||
after = [ "cliphist-text.service" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste --type image --watch ${pkgs.cliphist}/bin/cliphist -db-path %t/cliphist/db store";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
};
|
||||
|
||||
# Night light stays disabled by default: it is a user toggle. Enabling it
|
||||
# here would create a system-scope symlink that overrides any
|
||||
# `systemctl --user disable` — same reasoning as in moonarch-git/PKGBUILD.
|
||||
systemd.user.services.wlsunset = {
|
||||
description = "Wlsunset night light (blue light filter)";
|
||||
partOf = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" "kanshi.service" ];
|
||||
wantedBy = [ ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 2";
|
||||
ExecStart = "${lib.getExe pkgs.wlsunset} -T 6500 -t 5000 -S 00:00 -s 00:01";
|
||||
# Leading '-' keeps a missing waybar non-fatal, otherwise pkill's exit 1
|
||||
# fails the unit and Restart=on-failure spins it in a flicker loop.
|
||||
ExecStartPost = "-${pkgs.procps}/bin/pkill -RTMIN+11 waybar";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
};
|
||||
|
||||
# Polkit authentication agent for the graphical session.
|
||||
systemd.user.services.polkit-gnome-authentication-agent-1 = {
|
||||
description = "polkit-gnome authentication agent";
|
||||
partOf = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user