The option surface (`enable`, `paths`) lived in core/home/overrides.nix
since 2026-05-18 but didn't do anything — paths was a reserved
attrset that never reached xdg.configFile.
Now wired: every entry in nomarchy.overrides.paths substitutes the
matching xdg.configFile.<key>.source at lib.mkForce priority, beating
Nomarchy's own lib.mkDefault writes. Other fields on the original
entry (recursive, etc.) survive via the standard module-system merge.
nomarchy.overrides.paths = {
"nomarchy/default/hypr/looknfeel.conf" = ./looknfeel.conf;
"waybar/style.css" = ./waybar.css;
};
Picked the attrset model from the row's two options rather than
runtime ~/.config/nomarchy/overrides/ directory discovery — Nix needs
every managed file declared at evaluation time, and the attrset
matches the explicit-config shape used everywhere else in the
Nomarchy surface.
docs/OPTIONS.md updated: both overrides.{enable,paths} entries get
real content + an example, the configOverrides row now contrasts
bulk-vs-per-file accurately, and the "Where these are defined" footer
drops the (reserved) tag.
`nix flake check --no-build` clean.
65 lines
2.2 KiB
Nix
65 lines
2.2 KiB
Nix
{ config, lib, ... }:
|
|
|
|
# File-based override system for Nomarchy.
|
|
#
|
|
# When `nomarchy.overrides.enable = true` (default), every entry in
|
|
# `nomarchy.overrides.paths` substitutes the `xdg.configFile.<key>.source`
|
|
# Nomarchy ships by default. The substitution is done with `lib.mkForce`
|
|
# so it wins over Nomarchy's own `lib.mkDefault` writes. Other fields on
|
|
# the original entry (e.g. `recursive`) survive the merge.
|
|
#
|
|
# Usage in a downstream home.nix:
|
|
#
|
|
# nomarchy.overrides.paths = {
|
|
# "nomarchy/default/hypr/looknfeel.conf" = ./mine/looknfeel.conf;
|
|
# "waybar/style.css" = ./mine/waybar.css;
|
|
# };
|
|
#
|
|
# The keys are xdg.configFile paths (i.e. relative to ~/.config/). Drop-
|
|
# in-a-dir discovery is intentionally not supported — Nix needs every
|
|
# managed file declared at evaluation time, and the attrset is the
|
|
# explicit-config shape the rest of the Nomarchy module surface uses.
|
|
|
|
let
|
|
cfg = config.nomarchy.overrides;
|
|
in
|
|
{
|
|
options.nomarchy.overrides = {
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = ''
|
|
Whether file-based overrides in nomarchy.overrides.paths are
|
|
applied. Defaults to true so an empty `paths` is a no-op and
|
|
a populated one Just Works without a second toggle.
|
|
'';
|
|
};
|
|
|
|
paths = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.path;
|
|
default = {};
|
|
example = lib.literalExpression ''
|
|
{
|
|
"nomarchy/default/hypr/looknfeel.conf" = ./looknfeel.conf;
|
|
"waybar/style.css" = ./waybar.css;
|
|
}
|
|
'';
|
|
description = ''
|
|
Attribute set mapping xdg.configFile paths (relative to
|
|
~/.config/) to Nix paths whose contents should replace the
|
|
Nomarchy-shipped source. Each entry deploys at lib.mkForce
|
|
priority so it overrides Nomarchy's lib.mkDefault writes;
|
|
recursive flags and other fields on the original entry are
|
|
preserved. Pointing at a path Nomarchy doesn't manage just
|
|
creates a new xdg.configFile entry.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
xdg.configFile = lib.mapAttrs (_path: src: {
|
|
source = lib.mkForce src;
|
|
}) cfg.paths;
|
|
};
|
|
}
|