Files
moonix/flake.nix
T
nevaforget a419a17e08 feat(desktop): gtklock replaces swaylock, GTK theme moves to Mocha
Looking at whether gtklock was worth it turned up two things.

The GTK layer was never on Mocha. colloid-gtk-theme with the catppuccin
tweak produces Frappé with a grey accent — base #292c3c, selection #ccd0da
— and #1e1e2e, #b4befe and #cba6f7 appear nowhere in its gtk.css. Kvantum,
the swaylock ring and Zed were all Mocha, so GTK was the one layer out of
step, unnoticed because the two dark bases sit close together.
catppuccin-gtk carries Colloid as a git submodule and only recolors it, so
the switch is a recolor with identical widget shapes.

The old objection to gtklock is gone: 4.0.0 links libgtk-session-lock.so.0,
so it speaks ext-session-lock-v1 like swaylock and the compositor still
holds the lock if it crashes. Only the ≤2.x layer-shell versions unlocked
on a crash. What it adds over swaylock is the modules — avatar, clock and
power buttons — which swaylock cannot do at all.

The blur stays baked into the wallpaper. gtklock cannot blur either: GTK3
has no filter CSS property at all, and it takes no screenshot of the
session, so there is nothing to blur at lock time.

Two rewrites of moonarch config were needed and both take the command from
one lockCommand binding: stasis names the locker in four places, and the
Quickshell power popout spawns it itself. Routing the popout through
`stasis trigger lock-screen` would have named it once, but the Lock button
would then fail silently whenever stasis is down. The reason to want it
turned out not to exist — the plan continues after a manual lock anyway,
because stasis takes the state from logind's LockedHint rather than from
having started the locker. Verified by locking by hand and watching DPMS
fire on schedule.

gtkSettings rewrites the Colloid name out of moonarch's settings.ini files.
Without it every GTK3 application would have fallen back to Adwaita: GTK3
reads those files directly and the dconf entry does not reach it on
Wayland.

Verified after rebuild: both hosts build, /etc/pam.d/gtklock carries the
same `auth sufficient pam_unix.so` swaylock had, the seeded stasis.rune
names gtklock at all four call sites, and the popout spawns it.
2026-09-12 02:26:40 +02:00

151 lines
5.0 KiB
Nix

# ABOUTME: Flake for running the Moonarch desktop on NixOS.
# ABOUTME: Pulls the Moonarch project repos as sources and builds them with Nix.
{
description = "NixOS configuration for a niri and Quickshell Wayland desktop";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
# Declarative partitioning. Consumed by modules/disk.nix.
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
# Project sources. These repos are not flakes themselves, they are
# consumed as plain source trees following their default branch.
moonarch = {
url = "git+https://gitea.moonarch.de/nevaforget/moonarch.git";
flake = false;
};
sweet-cursors = {
url = "git+https://gitea.moonarch.de/nevaforget/Sweet-cursors.git";
flake = false;
};
};
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
moonarchPackages = {
sweet-cursors = pkgs.callPackage ./pkgs/sweet-cursors.nix {
src = inputs.sweet-cursors;
version = "0-unstable";
};
moonarch-scripts = pkgs.callPackage ./pkgs/moonarch-scripts.nix {
src = inputs.moonarch;
};
};
# disko kills the whole format script when the two passphrase entries
# differ: `exit 1` sits inside a function called from the `until` loop
# that was meant to repeat the prompt
# (share/disko/lib/types/luks.nix:151). A typo therefore means starting
# the install over. One word changes that.
diskoRetryingPassphrase = inputs.disko.packages.${system}.disko.overrideAttrs (old: {
postFixup = (old.postFixup or "") + ''
substituteInPlace $out/share/disko/lib/types/luks.nix \
--replace-fail 'exit 1' 'return 1'
'';
});
# Theme overrides, used by the desktop session and by the greeter.
# Defined once so the two cannot drift apart.
themePackages = {
# catppuccin/gtk is Colloid: it pulls vinceliuice's theme in as a git
# submodule and only recolors it, so the widget shapes are the same
# either way. Colloid's own `catppuccin` tweak produces Frappe with a
# grey accent (base #292c3c, selection #ccd0da) — which left GTK as the
# one layer not on Mocha, while Kvantum and Zed both are. This build is
# Mocha with the lavender accent, so #b4befe, #f38ba8 and #f9e2af match
# catppuccin-mocha-lavender in Kvantum exactly — and gtklock, being
# GTK3, takes its whole palette from here.
gtk = pkgs.catppuccin-gtk.override {
variant = "mocha";
accents = [ "lavender" ];
};
icons = pkgs.colloid-icon-theme.override {
schemeVariants = [ "catppuccin" ];
colorVariants = [ "grey" ];
};
};
in
{
packages.${system} = moonarchPackages // {
# Installer image: `nix build .#installer-iso`.
installer-iso = self.nixosConfigurations.installer.config.system.build.isoImage;
};
# Makes the packages and the moonarch source tree available to every
# module without threading arguments through by hand.
nixosModules.moonarch = { ... }: {
imports = [
inputs.disko.nixosModules.disko
./modules/user.nix
./modules/disk.nix
./modules/desktop.nix
./modules/greetd.nix
./modules/services.nix
./modules/zed.nix
];
_module.args = {
moonarchSrc = inputs.moonarch;
moonarchPkgs = moonarchPackages;
moonarchThemes = themePackages;
};
};
nixosConfigurations = {
# Installer image. Carries this flake and disko, so installing needs
# neither a clone nor the Gitea reference.
installer = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./hosts/installer ];
specialArgs = {
moonixSrc = self;
disko = diskoRetryingPassphrase;
};
};
# QEMU/KVM test VM.
testvm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/testvm
self.nixosModules.moonarch
];
};
# Desktop: 512G system disk, 1T disk for /home.
desktop = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/desktop
self.nixosModules.moonarch
];
};
# ThinkPad T14 Gen 3 (AMD Ryzen 7 PRO 6850U).
thinkpad = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen3
./hosts/thinkpad
self.nixosModules.moonarch
];
};
};
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ nixpkgs-fmt ];
};
};
}