Regenerated
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
{ lib, config, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
# --- Module-specific variables ---
|
||||
moduleName = "kitty";
|
||||
username = config.defaultUser or "henrov";
|
||||
assetPath = "${flakeRoot}/assets/system/conf/${moduleName}";
|
||||
|
||||
# Read all files in the asset directory
|
||||
programFiles = builtins.readDir assetPath;
|
||||
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
|
||||
src = "${assetPath}/${name}";
|
||||
});
|
||||
|
||||
# Top-level enable toggle
|
||||
enableProgram = config.enableKitty or true;
|
||||
in
|
||||
{
|
||||
# --- Declare the top-level toggle for this module ---
|
||||
options.enableKitty = lib.mkEnableOption "Enable Kitty terminal integration";
|
||||
|
||||
# --- Actual configuration applied only if enabled ---
|
||||
config = lib.mkIf enableProgram {
|
||||
|
||||
# Dendritic container for this program
|
||||
myApps.${moduleName} = {
|
||||
enable = true;
|
||||
user = username;
|
||||
assetsDir = assetPath;
|
||||
files = files;
|
||||
|
||||
# Example program-specific metadata
|
||||
theme = "Catppuccin-Mocha";
|
||||
};
|
||||
|
||||
# Deploy config files to user's ~/.config
|
||||
home-manager.users.${username} = {
|
||||
programs.kitty.enable = true;
|
||||
|
||||
xdg.configFile =
|
||||
lib.mapAttrs' (name: value: {
|
||||
name = "${moduleName}/${name}";
|
||||
value.source = value.src;
|
||||
}) files;
|
||||
};
|
||||
|
||||
# Optional: systemd service to sync / deploy configuration
|
||||
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}"
|
||||
|
||||
# Copy all asset files into user's config directory
|
||||
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
|
||||
cp -u "$CONF/$f" "$USER_HOME/.config/${moduleName}/$f"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
# Restart service if assets change
|
||||
restartTriggers = [ assetPath ];
|
||||
|
||||
# Minimal PATH for the service
|
||||
path = [
|
||||
# Use symbolic references if needed, e.g., coreutils binaries
|
||||
# pkgs.coreutils
|
||||
# pkgs.gnugrep
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{ 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