Files
moonix/flake.nix
T
nevaforget dddf236ace feat(theme): a splash theme of our own, images in viewnior, a stop timeout for stasis
The Catppuccin splash showed the NixOS logo and the loading animation and
nothing else. The NixOS plymouth module links boot.plymouth.logo into every
theme directory named catppuccin-<flavour>, and the two-step module has no
alignment key for that header image, so its distance from the animation is not
the theme's to set. A theme under a name of its own is outside that loop.
moonarch-plymouth joins as a flake input; pkgs/moonarch-plymouth.nix rewrites
the descriptor's FHS ImageDir to the store path.

Images opened in Chromium although viewnior has been installed since 3e40a70:
no mimeapps.list named image/* at all, so xdg-open took the first candidate
from mimeinfo.cache. xdg.mime points gif, jpeg, png and webp at
viewnior.desktop. webp needs addedAssociations besides, which viewnior.desktop
does not declare, and webp-pixbuf-loader, without which gdk-pixbuf cannot
decode it.

stasis does not answer SIGTERM as part of the session teardown, and the default
90 seconds left the whole user manager waiting on it: niri received its own
SIGTERM only once stasis had been killed, 88 seconds in the journal.
TimeoutStopSec = 5. What it holds is an idle timer, so nothing is lost when it
goes down hard.

glab on the ThinkPad.
2026-09-28 14:52:05 +02:00

181 lines
5.9 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";
};
# Firefox preference set, consumed by pkgs/betterfox.nix. Not in nixpkgs;
# carried as an input so `nix flake update` moves it and neither version
# nor hash have to be kept by hand.
betterfox = {
url = "github:yokoffing/Betterfox";
flake = false;
};
# 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;
};
moonarch-plymouth = {
url = "git+https://gitea.moonarch.de/nevaforget/moonarch-plymouth-theme.git";
flake = false;
};
};
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
moonarchPackages = {
betterfox = pkgs.callPackage ./pkgs/betterfox.nix {
src = inputs.betterfox;
version = "154.0-unstable";
};
sweet-cursors = pkgs.callPackage ./pkgs/sweet-cursors.nix {
src = inputs.sweet-cursors;
version = "0-unstable";
};
moonarch-plymouth = pkgs.callPackage ./pkgs/moonarch-plymouth.nix {
src = inputs.moonarch-plymouth;
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/browsers.nix
./modules/printing.nix
./modules/lock.nix
./modules/shell.nix
./modules/theme.nix
./modules/audio.nix
./modules/files.nix
./modules/network.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 ];
};
};
}