From 8775c6a4bf279ba0cc0d133d26ee47d3432ca05d Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 4 Apr 2026 17:35:37 +0100 Subject: [PATCH] feat(upstream): switch to remote git repository for engine - Update installer to use git+https://git.bemagri.xyz/bernardo/Nomarchy.git - Remove redundant bundling/copying of the engine to /etc/nixos/nomarchy - Expose all themes via xdg.dataFile for script accessibility - Update theme scripts to resolve directories via local share instead of hardcoded system paths - Update documentation to reflect the new remote-first architecture --- GEMINI.md | 2 +- README.md | 2 +- bin/nomarchy-theme-bg-next | 9 ++++----- bin/nomarchy-theme-set | 10 ++++------ installer/install-nomarchy.sh | 7 +------ modules/home/theme-files.nix | 3 +++ modules/home/theme-switcher.nix | 12 +++++------- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/GEMINI.md b/GEMINI.md index d1bdcf7..7cb28aa 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -25,7 +25,7 @@ The installer is designed to bootstrap a fresh system with this modular structur 1. **Repo Detection:** Identifies the location of the Nomarchy source. 2. **Scaffolding:** Creates a new downstream `flake.nix` that imports Nomarchy core modules. 3. **User Files:** Generates skeleton `system.nix` and `home.nix` files for the user to customize. -4. **Bundling:** Copies the entire Nomarchy source to `/etc/nixos/nomarchy` so the system can be rebuilt offline. +4. **Flake Updates:** Uses the public Git repository as the upstream source, allowing users to update their system via `nix flake update`. ### 3. Home Manager Integration * **Hybrid Declarative State:** While the distro is declarative, it uses state files in `~/.config/home-manager/` (managed by the distro's scripts) to allow for instant UI feedback (theming, fonts, wallpapers) without needing a full system rebuild for every small tweak. diff --git a/README.md b/README.md index 048c05b..5bf40ad 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The wizard will guide you through: Nomarchy uses a "Downstream" model. After installation, your configuration lives in `/etc/nixos/` and is split into three main parts: ### 1. Distro Core (Upstream) -Located in `/etc/nixos/nomarchy/`. This is the engine. You should generally not modify files here. +Managed via the public Git repository. This is the engine. You should generally not modify files here. ### 2. Your System (`system.nix`) Add system-wide packages, services, and hardware tweaks here. diff --git a/bin/nomarchy-theme-bg-next b/bin/nomarchy-theme-bg-next index 0b9c9fd..1ed4dc9 100755 --- a/bin/nomarchy-theme-bg-next +++ b/bin/nomarchy-theme-bg-next @@ -10,12 +10,11 @@ mkdir -p "$STATE_DIR" THEME_NAME=$(jq -r '.theme // "nord"' "$STATE_FILE") -if [ -d "/etc/nixos/nomarchy/themes" ]; then - THEMES_DIR="/etc/nixos/nomarchy/themes" -elif [ -d "/etc/nomarchy/themes" ]; then - THEMES_DIR="/etc/nomarchy/themes" +# Resolve themes directory (Built-in from Nix store via Home Manager, or user extra) +if [ -d "$HOME/.config/nomarchy/themes/$THEME_NAME" ]; then + THEMES_DIR="$HOME/.config/nomarchy/themes" else - THEMES_DIR="/etc/nixos/themes" + THEMES_DIR="$HOME/.local/share/nomarchy/themes" fi BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds" diff --git a/bin/nomarchy-theme-set b/bin/nomarchy-theme-set index aaea1b4..dff3ae9 100755 --- a/bin/nomarchy-theme-set +++ b/bin/nomarchy-theme-set @@ -13,13 +13,11 @@ fi STATE_DIR="$HOME/.config/home-manager" STATE_FILE="$STATE_DIR/state.json" -# Logic for finding themes -if [ -d "/etc/nixos/nomarchy/themes" ]; then - THEMES_DIR="/etc/nixos/nomarchy/themes" -elif [ -d "/etc/nomarchy/themes" ]; then - THEMES_DIR="/etc/nomarchy/themes" +# Resolve themes directory (Built-in from Nix store via Home Manager, or user extra) +if [ -d "$HOME/.config/nomarchy/themes/$THEME_NAME" ]; then + THEMES_DIR="$HOME/.config/nomarchy/themes" else - THEMES_DIR="/etc/nixos/themes" + THEMES_DIR="$HOME/.local/share/nomarchy/themes" fi mkdir -p "$STATE_DIR" diff --git a/installer/install-nomarchy.sh b/installer/install-nomarchy.sh index 89faf53..6508592 100644 --- a/installer/install-nomarchy.sh +++ b/installer/install-nomarchy.sh @@ -269,7 +269,7 @@ cat < /mnt/etc/nixos/flake.nix inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; - nomarchy.url = "path:./nomarchy"; # Offline bundled nomarchy + nomarchy.url = "git+https://git.bemagri.xyz/bernardo/Nomarchy.git"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; home-manager = { @@ -318,11 +318,6 @@ cat < /mnt/etc/nixos/flake.nix } EOF -# 7. Copy Bundled Flake -echo "Copying bundled upstream Nomarchy flake from $NOMARCHY_REPO..." -cp -rL "$NOMARCHY_REPO" /mnt/etc/nixos/nomarchy -chmod -R u+w /mnt/etc/nixos/nomarchy - # 8. Version Control cd /mnt/etc/nixos/ git init diff --git a/modules/home/theme-files.nix b/modules/home/theme-files.nix index 58fce9e..f9245e9 100644 --- a/modules/home/theme-files.nix +++ b/modules/home/theme-files.nix @@ -7,4 +7,7 @@ }; xdg.configFile."nomarchy/current/theme.name".text = config.nomarchy.theme; + + # Expose all themes to the system via local share for script accessibility + xdg.dataFile."nomarchy/themes".source = ../../themes; } diff --git a/modules/home/theme-switcher.nix b/modules/home/theme-switcher.nix index a35ea23..79b762c 100644 --- a/modules/home/theme-switcher.nix +++ b/modules/home/theme-switcher.nix @@ -32,19 +32,17 @@ let nomarchy-wallpaper-selector = pkgs.writeShellScriptBin "nomarchy-wallpaper-selector" '' STATE_DIR="$HOME/.config/home-manager" STATE_FILE="$STATE_DIR/state.json" - if [ -d "/etc/nixos/nomarchy/themes" ]; then - THEMES_DIR="/etc/nixos/nomarchy/themes" - elif [ -d "/etc/nomarchy/themes" ]; then - THEMES_DIR="/etc/nomarchy/themes" - else - THEMES_DIR="/etc/nixos/themes" - fi + THEMES_DIR="$HOME/.local/share/nomarchy/themes" mkdir -p "$STATE_DIR" [[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE" # List all images in all themes backgrounds WALLPAPERS=$(find "$THEMES_DIR" -type f \( -name "*.jpg" -o -name "*.png" \)) + # Include user themes if they exist + if [ -d "$HOME/.config/nomarchy/themes" ]; then + WALLPAPERS="$WALLPAPERS\n$(find "$HOME/.config/nomarchy/themes" -type f \( -name "*.jpg" -o -name "*.png" \))" + fi SELECTED_WP=$(echo -e "$WALLPAPERS" | walker --dmenu) if [ -n "$SELECTED_WP" ]; then