feat: implement hybrid declarative state with automatic Nix sync
Some checks failed
Check / eval-and-lint (push) Has been cancelled
Some checks failed
Check / eval-and-lint (push) Has been cancelled
This commit is contained in:
@@ -1714,6 +1714,12 @@ EOF
|
||||
cat > /mnt/etc/nixos/home.nix << EOF
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Machine-managed state (theme, font, toggles).
|
||||
# UI scripts update this file automatically.
|
||||
./nomarchy-state.nix
|
||||
];
|
||||
|
||||
# Physical form factor — mirrors nomarchy.system.formFactor in system.nix.
|
||||
# Gates UI affordances like the waybar battery widget.
|
||||
nomarchy.formFactor = "$FORM_FACTOR";
|
||||
@@ -1854,6 +1860,45 @@ EOF
|
||||
state = schema.system // { timezone = \"$_state_tz\"; };
|
||||
in builtins.toJSON state
|
||||
" | nrun jq '.' > /mnt/etc/nixos/state.json
|
||||
|
||||
# nomarchy-state.nix — the declarative counterpart to state.json.
|
||||
# Imported by home.nix so UI changes are solidified in code.
|
||||
# Generated from lib/state-schema.nix's home block.
|
||||
nix --extra-experimental-features 'nix-command flakes' eval \
|
||||
--impure --raw \
|
||||
--expr "
|
||||
let
|
||||
flake = builtins.getFlake \"$NOMARCHY_REPO\";
|
||||
lib = flake.inputs.nixpkgs.lib;
|
||||
schema = import \"$NOMARCHY_REPO/lib/state-schema.nix\" { inherit lib; };
|
||||
s = schema.home;
|
||||
in ''
|
||||
# DO NOT EDIT MANUALLY - Managed by Nomarchy scripts.
|
||||
# This file mirrors your UI choices (theme, font, etc.) into the declarative
|
||||
# Nix configuration. It is imported by your home.nix.
|
||||
{
|
||||
nomarchy = {
|
||||
theme = \"\${s.theme}\";
|
||||
fonts.monospace = \"\${s.font}\";
|
||||
panelPosition = \"\${s.panelPosition}\";
|
||||
wallpaper = \"\${s.wallpaper}\";
|
||||
hyprland = {
|
||||
scale = \"\${s.hyprland.scale}\";
|
||||
gaps_in = \${toString s.hyprland.gaps_in};
|
||||
gaps_out = \${toString s.hyprland.gaps_out};
|
||||
border_size = \${toString s.hyprland.border_size};
|
||||
};
|
||||
toggles = {
|
||||
suspend = \${lib.boolToString s.suspend};
|
||||
screensaver = \${lib.boolToString s.screensaver};
|
||||
idle = \${lib.boolToString s.idle};
|
||||
nightlight = \${lib.boolToString s.nightlight};
|
||||
waybar = \${lib.boolToString s.waybar};
|
||||
};
|
||||
};
|
||||
}
|
||||
''
|
||||
" > /mnt/etc/nixos/nomarchy-state.nix
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user