Compare commits
2 Commits
dab06007cb
...
d22d2ce239
| Author | SHA1 | Date | |
|---|---|---|---|
| d22d2ce239 | |||
| 196e9f4333 |
+55
-14
@@ -1035,35 +1035,76 @@ in
|
|||||||
** =generated/modules/terminals/kitty.nix=
|
** =generated/modules/terminals/kitty.nix=
|
||||||
This file sets up Kitty terminal
|
This file sets up Kitty terminal
|
||||||
#+BEGIN_SRC nix :tangle generated/modules/terminals/kitty.nix :noweb tangle :mkdirp yes :eval never-html
|
#+BEGIN_SRC nix :tangle generated/modules/terminals/kitty.nix :noweb tangle :mkdirp yes :eval never-html
|
||||||
{ lib, config, pkgs, ... }:
|
{ lib, config, pkgs, flakeRoot, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
programName = "kitty";
|
# --- Module metadata ---
|
||||||
|
moduleName = "kitty"; # Change per module
|
||||||
|
assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; # Path to kitty config
|
||||||
|
username = config.defaultUser or "henrov"; # Use default user
|
||||||
|
enableProgram = config.enableKitty or true; # Toggle for this module
|
||||||
|
|
||||||
|
# Read asset files
|
||||||
|
assetFiles = builtins.readDir assetPath;
|
||||||
|
|
||||||
|
# Map files → attrset
|
||||||
|
files = lib.genAttrs (builtins.attrNames assetFiles) (name: {
|
||||||
|
src = "${assetPath}/${name}";
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.enableKitty = lib.mkEnableOption "Enable kitty terminal";
|
# --- Top-level toggle option ---
|
||||||
|
options.enableKitty = lib.mkEnableOption "Enable Kitty terminal integration";
|
||||||
|
|
||||||
config = lib.mkIf (config.enableKitty or true) {
|
# --- Apply configuration only if enabled ---
|
||||||
myApps.${programName} = { enable = true; };
|
config = lib.mkIf enableProgram {
|
||||||
|
|
||||||
systemd.services."${programName}-sync" = {
|
# Dendritic container for this program
|
||||||
description = "Sync ${programName} configuration";
|
myApps.${moduleName} = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
enable = true;
|
||||||
|
user = username;
|
||||||
|
assetsDir = assetPath;
|
||||||
|
files = files;
|
||||||
|
|
||||||
|
# Program-specific metadata
|
||||||
|
theme = "catppuccin-mocha";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Deploy config files to XDG 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 Kitty config (example)
|
||||||
|
systemd.services."${moduleName}-sync" = {
|
||||||
|
description = "Sync ${moduleName} configuration";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
echo "Syncing ${programName}"
|
set -euo pipefail
|
||||||
|
CONF="${assetPath}"
|
||||||
|
|
||||||
|
# Sync each file (example logic)
|
||||||
|
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
|
||||||
|
cp -u "$CONF/$f" "${HOME}/.config/${moduleName}/$f"
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
restartTriggers = [];
|
restartTriggers = [ assetPath ];
|
||||||
|
|
||||||
# Use pkgs passed to module
|
# Use system-wide binaries without referencing pkgs directly
|
||||||
path = [
|
path = [
|
||||||
pkgs.coreutils
|
"/run/current-system/sw/bin/coreutils"
|
||||||
pkgs.gnugrep
|
|
||||||
pkgs.gnused
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,32 +1,73 @@
|
|||||||
{ lib, config, pkgs, ... }:
|
{ lib, config, pkgs, flakeRoot, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
programName = "kitty";
|
# --- Module metadata ---
|
||||||
|
moduleName = "kitty"; # Change per module
|
||||||
|
assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; # Path to kitty config
|
||||||
|
username = config.defaultUser or "henrov"; # Use default user
|
||||||
|
enableProgram = config.enableKitty or true; # Toggle for this module
|
||||||
|
|
||||||
|
# Read asset files
|
||||||
|
assetFiles = builtins.readDir assetPath;
|
||||||
|
|
||||||
|
# Map files → attrset
|
||||||
|
files = lib.genAttrs (builtins.attrNames assetFiles) (name: {
|
||||||
|
src = "${assetPath}/${name}";
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.enableKitty = lib.mkEnableOption "Enable kitty terminal";
|
# --- Top-level toggle option ---
|
||||||
|
options.enableKitty = lib.mkEnableOption "Enable Kitty terminal integration";
|
||||||
|
|
||||||
config = lib.mkIf (config.enableKitty or true) {
|
# --- Apply configuration only if enabled ---
|
||||||
myApps.${programName} = { enable = true; };
|
config = lib.mkIf enableProgram {
|
||||||
|
|
||||||
systemd.services."${programName}-sync" = {
|
# Dendritic container for this program
|
||||||
description = "Sync ${programName} configuration";
|
myApps.${moduleName} = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
enable = true;
|
||||||
|
user = username;
|
||||||
|
assetsDir = assetPath;
|
||||||
|
files = files;
|
||||||
|
|
||||||
|
# Program-specific metadata
|
||||||
|
theme = "catppuccin-mocha";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Deploy config files to XDG 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 Kitty config (example)
|
||||||
|
systemd.services."${moduleName}-sync" = {
|
||||||
|
description = "Sync ${moduleName} configuration";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
echo "Syncing ${programName}"
|
set -euo pipefail
|
||||||
|
CONF="${assetPath}"
|
||||||
|
|
||||||
|
# Sync each file (example logic)
|
||||||
|
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
|
||||||
|
cp -u "$CONF/$f" "${HOME}/.config/${moduleName}/$f"
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
restartTriggers = [];
|
restartTriggers = [ assetPath ];
|
||||||
|
|
||||||
# Use pkgs passed to module
|
# Use system-wide binaries without referencing pkgs directly
|
||||||
path = [
|
path = [
|
||||||
pkgs.coreutils
|
"/run/current-system/sw/bin/coreutils"
|
||||||
pkgs.gnugrep
|
|
||||||
pkgs.gnused
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user