forked from Shinonome/alt-illogical-impulse
Add complete configuration override system
✨ NEW FEATURE: Complete file override capability 🎯 Problem Solved: - No more mixed configuration approaches causing broken symlinks - Clean separation: either rich config OR manual override - Complete control over configuration files 🔧 New Options: - overrides.hyprlandConf: Complete hyprland.conf override - overrides.quickshellConfig: Complete Config.qml override - overrides.footConfig: Complete foot.ini override - overrides.hyprDirectory: Complete directory override - overrides.quickshellDirectory: Complete directory override 🛡️ Safety Features: - Warnings when overrides conflict with rich config - Rich config modules respect override settings - No file mixing - one approach per file ✅ Use Cases: - Manual configuration: Set overrides.hyprlandConf - Rich NixOS config: Use hyprland.* options - Directory copy: Use overrides.hyprDirectory - Never mix approaches on same file!
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
# Configuration override system - allows complete manual control
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.dots-hyprland;
|
||||
in
|
||||
{
|
||||
options.programs.dots-hyprland.overrides = {
|
||||
# Complete file overrides - when set, completely replaces any generated config
|
||||
hyprlandConf = mkOption {
|
||||
type = types.nullOr types.lines;
|
||||
default = null;
|
||||
description = ''
|
||||
Complete hyprland.conf content. When set, completely overrides:
|
||||
- Any rich hyprland.* configuration options
|
||||
- Any copied hyprland.conf from source
|
||||
- Generates the entire file from this content
|
||||
'';
|
||||
example = ''
|
||||
# Custom Hyprland configuration
|
||||
general {
|
||||
gaps_in = 10
|
||||
gaps_out = 20
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
quickshellConfig = mkOption {
|
||||
type = types.nullOr types.lines;
|
||||
default = null;
|
||||
description = ''
|
||||
Complete Config.qml content. When set, completely overrides:
|
||||
- Any rich quickshell.* configuration options
|
||||
- Any copied Config.qml from source
|
||||
- Generates the entire file from this content
|
||||
'';
|
||||
};
|
||||
|
||||
footConfig = mkOption {
|
||||
type = types.nullOr types.lines;
|
||||
default = null;
|
||||
description = ''
|
||||
Complete foot.ini content. When set, completely overrides:
|
||||
- Any rich terminal.* configuration options
|
||||
- Any copied foot.ini from source
|
||||
- Generates the entire file from this content
|
||||
'';
|
||||
};
|
||||
|
||||
# Directory-level overrides
|
||||
hyprDirectory = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Complete hypr directory override. When set, copies entire directory
|
||||
and ignores all hyprland configuration options.
|
||||
'';
|
||||
};
|
||||
|
||||
quickshellDirectory = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Complete quickshell directory override. When set, copies entire directory
|
||||
and ignores all quickshell configuration options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Override warnings
|
||||
warnings =
|
||||
(optional (cfg.overrides.hyprlandConf != null && cfg.hyprland != {})
|
||||
"dots-hyprland: overrides.hyprlandConf is set, ignoring all hyprland.* options") ++
|
||||
(optional (cfg.overrides.quickshellConfig != null && cfg.quickshell != {})
|
||||
"dots-hyprland: overrides.quickshellConfig is set, ignoring all quickshell.* options") ++
|
||||
(optional (cfg.overrides.footConfig != null && cfg.terminal != {})
|
||||
"dots-hyprland: overrides.footConfig is set, ignoring all terminal.* options");
|
||||
|
||||
# File overrides take absolute priority
|
||||
xdg.configFile = mkMerge [
|
||||
# Hyprland complete override
|
||||
(mkIf (cfg.overrides.hyprlandConf != null) {
|
||||
"hypr/hyprland.conf".text = cfg.overrides.hyprlandConf;
|
||||
})
|
||||
|
||||
# Quickshell complete override
|
||||
(mkIf (cfg.overrides.quickshellConfig != null) {
|
||||
"quickshell/ii/modules/common/Config.qml".text = cfg.overrides.quickshellConfig;
|
||||
})
|
||||
|
||||
# Terminal complete override
|
||||
(mkIf (cfg.overrides.footConfig != null) {
|
||||
"foot/foot.ini".text = cfg.overrides.footConfig;
|
||||
})
|
||||
|
||||
# Directory overrides
|
||||
(mkIf (cfg.overrides.hyprDirectory != null) {
|
||||
"hypr" = {
|
||||
source = cfg.overrides.hyprDirectory;
|
||||
recursive = true;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.overrides.quickshellDirectory != null) {
|
||||
"quickshell" = {
|
||||
source = cfg.overrides.quickshellDirectory;
|
||||
recursive = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -68,8 +68,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.programs.dots-hyprland.enable {
|
||||
# Generate Hyprland configuration files
|
||||
config = mkIf (config.programs.dots-hyprland.enable && config.programs.dots-hyprland.overrides.hyprlandConf == null) {
|
||||
# Only generate if no manual override is set
|
||||
xdg.configFile."hypr/general.conf".text = ''
|
||||
# General Hyprland configuration for dots-hyprland (NixOS-managed)
|
||||
|
||||
|
||||
@@ -208,8 +208,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.programs.dots-hyprland.enable {
|
||||
# Generate the Config.qml file with NixOS-managed values
|
||||
config = mkIf (config.programs.dots-hyprland.enable && config.programs.dots-hyprland.overrides.quickshellConfig == null) {
|
||||
# Only generate if no manual override is set
|
||||
xdg.configFile."quickshell/ii/modules/common/Config.qml".text = ''
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
@@ -66,8 +66,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.programs.dots-hyprland.enable {
|
||||
# Generate foot configuration
|
||||
config = mkIf (config.programs.dots-hyprland.enable && config.programs.dots-hyprland.overrides.footConfig == null) {
|
||||
# Only generate if no manual override is set
|
||||
xdg.configFile."foot/foot.ini".text = ''
|
||||
[main]
|
||||
term=xterm-256color
|
||||
|
||||
@@ -17,6 +17,7 @@ in
|
||||
./components/hyprland-config.nix
|
||||
./components/terminal-config.nix
|
||||
./components/touchegg.nix
|
||||
./components/config-override.nix
|
||||
];
|
||||
|
||||
options.programs.dots-hyprland = {
|
||||
|
||||
Reference in New Issue
Block a user