Regenerated
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
# --- Module variables ---
|
||||
moduleName = "kitty";
|
||||
username = config.defaultUser or "henrov";
|
||||
|
||||
# Path to program assets (relative, self-contained)
|
||||
assetPath = ../../../assets/system/conf/${moduleName};
|
||||
|
||||
# Read all files in the assets directory
|
||||
programFiles = builtins.readDir assetPath;
|
||||
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
|
||||
src = "${assetPath}/${name}";
|
||||
});
|
||||
|
||||
# Top-level toggle for this module
|
||||
enableProgram = config.enableKitty or true;
|
||||
in
|
||||
{
|
||||
# --- Declare the top-level toggle ---
|
||||
options.enableKitty = lib.mkEnableOption "Enable Kitty terminal integration";
|
||||
|
||||
# --- Only apply configuration if enabled ---
|
||||
config = lib.mkIf enableProgram {
|
||||
|
||||
# Kitty program configuration
|
||||
programs.kitty.enable = true;
|
||||
programs.kitty.extraConfig = ''
|
||||
# 1) Theme first
|
||||
include themes/Catppuccin-Mocha.conf
|
||||
# 2) Force transparency last
|
||||
#background_opacity 0.60
|
||||
#dynamic_background_opacity yes
|
||||
'';
|
||||
|
||||
# Deploy configuration files to user's XDG config
|
||||
home-manager.users.${username} = {
|
||||
xdg.configFile =
|
||||
lib.mapAttrs' (name: value: {
|
||||
name = "${moduleName}/${name}";
|
||||
value.source = value.src;
|
||||
}) files;
|
||||
};
|
||||
|
||||
# Example systemd service to sync assets to user's config directory
|
||||
systemd.services."${moduleName}-sync" = {
|
||||
description = "Sync ${moduleName} configuration";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
set -euo pipefail
|
||||
CONF="${assetPath}"
|
||||
USER_HOME="/home/${username}"
|
||||
|
||||
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
|
||||
cp -u "$CONF/$f" "$USER_HOME/.config/${moduleName}/$f"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
restartTriggers = [ assetPath ];
|
||||
|
||||
# Minimal PATH (no pkgs references needed unless necessary)
|
||||
path = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
# Path to your Starship config inside the flake
|
||||
starshipAssets = ../../../assets/system/conf/starship.toml;
|
||||
|
||||
# Read and parse the TOML file as a symbolic value
|
||||
starshipConfig = lib.importTOML starshipAssets;
|
||||
|
||||
# Toggle on/off
|
||||
enableStarship = true;
|
||||
in
|
||||
{
|
||||
# Declare a top-level module option
|
||||
options.starship = {
|
||||
enable = lib.mkEnableOption "Enable Starship prompt";
|
||||
configFiles = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.any;
|
||||
default = {};
|
||||
description = "Symbolic Starship configuration files";
|
||||
};
|
||||
};
|
||||
|
||||
# Populate the option safely
|
||||
config = lib.mkIf enableStarship {
|
||||
starship.enable = true;
|
||||
starship.configFiles = {
|
||||
"starship.toml" = starshipConfig;
|
||||
assetsDir = ../../../assets/system/conf;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user