Compare commits

...

3 Commits

Author SHA1 Message Date
Bernardo Magri
42f515f4a9 feat(themes): declaratively manage icons, cursors, and dark/light modes
- Automatically detect light mode via 'light.mode' file in theme folder
- Read icon theme name from 'icons.theme' file in theme folder
- Switch Stylix polarity and iconTheme based on theme selection
- Add yaru-theme and bibata-cursors to default packages
- Remove obsolete imperative nomarchy-theme-set-gnome script
2026-04-04 18:33:00 +01:00
Bernardo Magri
0bd67f1ee0 fix(flake): expose inputs for downstream propagation 2026-04-04 17:43:33 +01:00
Bernardo Magri
8775c6a4bf 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
2026-04-04 17:35:37 +01:00
13 changed files with 69 additions and 49 deletions

View File

@@ -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. 1. **Repo Detection:** Identifies the location of the Nomarchy source.
2. **Scaffolding:** Creates a new downstream `flake.nix` that imports Nomarchy core modules. 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. 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 ### 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. * **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.

View File

@@ -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: Nomarchy uses a "Downstream" model. After installation, your configuration lives in `/etc/nixos/` and is split into three main parts:
### 1. Distro Core (Upstream) ### 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`) ### 2. Your System (`system.nix`)
Add system-wide packages, services, and hardware tweaks here. Add system-wide packages, services, and hardware tweaks here.

View File

@@ -10,12 +10,11 @@ mkdir -p "$STATE_DIR"
THEME_NAME=$(jq -r '.theme // "nord"' "$STATE_FILE") THEME_NAME=$(jq -r '.theme // "nord"' "$STATE_FILE")
if [ -d "/etc/nixos/nomarchy/themes" ]; then # Resolve themes directory (Built-in from Nix store via Home Manager, or user extra)
THEMES_DIR="/etc/nixos/nomarchy/themes" if [ -d "$HOME/.config/nomarchy/themes/$THEME_NAME" ]; then
elif [ -d "/etc/nomarchy/themes" ]; then THEMES_DIR="$HOME/.config/nomarchy/themes"
THEMES_DIR="/etc/nomarchy/themes"
else else
THEMES_DIR="/etc/nixos/themes" THEMES_DIR="$HOME/.local/share/nomarchy/themes"
fi fi
BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds" BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds"

View File

@@ -13,13 +13,11 @@ fi
STATE_DIR="$HOME/.config/home-manager" STATE_DIR="$HOME/.config/home-manager"
STATE_FILE="$STATE_DIR/state.json" STATE_FILE="$STATE_DIR/state.json"
# Logic for finding themes # Resolve themes directory (Built-in from Nix store via Home Manager, or user extra)
if [ -d "/etc/nixos/nomarchy/themes" ]; then if [ -d "$HOME/.config/nomarchy/themes/$THEME_NAME" ]; then
THEMES_DIR="/etc/nixos/nomarchy/themes" THEMES_DIR="$HOME/.config/nomarchy/themes"
elif [ -d "/etc/nomarchy/themes" ]; then
THEMES_DIR="/etc/nomarchy/themes"
else else
THEMES_DIR="/etc/nixos/themes" THEMES_DIR="$HOME/.local/share/nomarchy/themes"
fi fi
mkdir -p "$STATE_DIR" mkdir -p "$STATE_DIR"

View File

@@ -1,18 +0,0 @@
#!/bin/bash
# Change gnome modes
if [[ -f ~/.config/nomarchy/current/theme/light.mode ]]; then
gsettings set org.gnome.desktop.interface color-scheme "prefer-light"
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita"
else
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
fi
# Change gnome icon theme color
GNOME_ICONS_THEME=~/.config/nomarchy/current/theme/icons.theme
if [[ -f $GNOME_ICONS_THEME ]]; then
gsettings set org.gnome.desktop.interface icon-theme "$(<$GNOME_ICONS_THEME)"
else
gsettings set org.gnome.desktop.interface icon-theme "Yaru-blue"
fi

View File

@@ -23,6 +23,9 @@
}; };
outputs = { self, nixpkgs, nixos-hardware, disko, impermanence, home-manager, nix-colors, stylix, walker, ... } @ inputs: { outputs = { self, nixpkgs, nixos-hardware, disko, impermanence, home-manager, nix-colors, stylix, walker, ... } @ inputs: {
# Expose inputs for downstream use
inherit inputs;
nixosModules = { nixosModules = {
system = import ./modules/system; system = import ./modules/system;
home = import ./modules/home; home = import ./modules/home;

View File

@@ -269,7 +269,7 @@ cat <<EOF > /mnt/etc/nixos/flake.nix
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; 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"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = { home-manager = {
@@ -318,11 +318,6 @@ cat <<EOF > /mnt/etc/nixos/flake.nix
} }
EOF 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 # 8. Version Control
cd /mnt/etc/nixos/ cd /mnt/etc/nixos/
git init git init

View File

@@ -49,6 +49,8 @@ in
mise mise
jq jq
xmlstarlet xmlstarlet
yaru-theme
bibata-cursors
nerd-fonts.jetbrains-mono nerd-fonts.jetbrains-mono
nerd-fonts.roboto-mono nerd-fonts.roboto-mono
nerd-fonts.fira-code nerd-fonts.fira-code

View File

@@ -1,4 +1,4 @@
{ lib, ... }: { lib, pkgs, ... }:
{ {
options.nomarchy = { options.nomarchy = {
@@ -73,6 +73,28 @@
description = "System monospace font."; description = "System monospace font.";
}; };
}; };
iconsTheme = lib.mkOption {
type = lib.types.str;
default = "Yaru-blue";
description = "System icon theme name.";
};
isLightMode = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether the current theme is light mode.";
};
cursor = {
name = lib.mkOption {
type = lib.types.str;
default = "Bibata-Modern-Ice";
description = "Mouse cursor theme name.";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.bibata-cursors;
description = "Package providing the cursor theme.";
};
};
configOverrides = lib.mkOption { configOverrides = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;

View File

@@ -117,6 +117,15 @@ in
border_size = togglesState.hyprland.border_size or 2; border_size = togglesState.hyprland.border_size or 2;
}; };
fonts.monospace = togglesState.font or "JetBrainsMono Nerd Font"; fonts.monospace = togglesState.font or "JetBrainsMono Nerd Font";
# Derived properties from the theme directory
isLightMode = builtins.pathExists (../../themes + "/${togglesState.theme or "nord"}/light.mode");
iconsTheme = let
iconsFile = ../../themes + "/${togglesState.theme or "nord"}/icons.theme";
in
if builtins.pathExists iconsFile
then lib.removeSuffix "\n" (builtins.readFile iconsFile)
else "Yaru-blue";
}; };
}; };
} }

View File

@@ -21,12 +21,12 @@ in
image = activeWallpaper; image = activeWallpaper;
base16Scheme = currentPalette; base16Scheme = currentPalette;
# Force dark/light mode based on theme name if possible, or just default to dark # Use detected light mode state
polarity = if lib.strings.hasInfix "light" activeThemeName then "light" else "dark"; polarity = if config.nomarchy.isLightMode then "light" else "dark";
cursor = { cursor = {
package = pkgs.bibata-cursors; package = config.nomarchy.cursor.package;
name = "Bibata-Modern-Ice"; name = config.nomarchy.cursor.name;
size = 24; size = 24;
}; };
@@ -65,4 +65,13 @@ in
gnome.enable = true; gnome.enable = true;
}; };
}; };
# GTK Icon Theme configuration
gtk = {
enable = true;
iconTheme = {
package = pkgs.yaru-theme;
name = config.nomarchy.iconsTheme;
};
};
} }

View File

@@ -7,4 +7,7 @@
}; };
xdg.configFile."nomarchy/current/theme.name".text = config.nomarchy.theme; 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;
} }

View File

@@ -32,19 +32,17 @@ let
nomarchy-wallpaper-selector = pkgs.writeShellScriptBin "nomarchy-wallpaper-selector" '' nomarchy-wallpaper-selector = pkgs.writeShellScriptBin "nomarchy-wallpaper-selector" ''
STATE_DIR="$HOME/.config/home-manager" STATE_DIR="$HOME/.config/home-manager"
STATE_FILE="$STATE_DIR/state.json" STATE_FILE="$STATE_DIR/state.json"
if [ -d "/etc/nixos/nomarchy/themes" ]; then THEMES_DIR="$HOME/.local/share/nomarchy/themes"
THEMES_DIR="/etc/nixos/nomarchy/themes"
elif [ -d "/etc/nomarchy/themes" ]; then
THEMES_DIR="/etc/nomarchy/themes"
else
THEMES_DIR="/etc/nixos/themes"
fi
mkdir -p "$STATE_DIR" mkdir -p "$STATE_DIR"
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE" [[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
# List all images in all themes backgrounds # List all images in all themes backgrounds
WALLPAPERS=$(find "$THEMES_DIR" -type f \( -name "*.jpg" -o -name "*.png" \)) 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) SELECTED_WP=$(echo -e "$WALLPAPERS" | walker --dmenu)
if [ -n "$SELECTED_WP" ]; then if [ -n "$SELECTED_WP" ]; then