Regenerated
This commit is contained in:
+29
-48
@@ -1793,64 +1793,45 @@ the top of the file."
|
||||
|
||||
|
||||
|
||||
** =generated/parked/apps/wofi.nix=
|
||||
** =generated/modules/apps/wofi.nix=
|
||||
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
|
||||
#+BEGIN_SRC nix :tangle generated/parked/apps/wofi.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
{ lib, config, ... }:
|
||||
#+BEGIN_SRC nix :tangle generated/modules/apps/wofi.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
# --- Program definition ---
|
||||
programName = "wofi";
|
||||
|
||||
# Path to assets
|
||||
assetPath = ../../../assets/system/conf/${programName};
|
||||
|
||||
# Generate file mappings
|
||||
programFiles =
|
||||
if builtins.pathExists assetPath then builtins.readDir assetPath else {};
|
||||
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
|
||||
src = "${assetPath}/${name}";
|
||||
});
|
||||
|
||||
# Top-level toggle for this module
|
||||
enableProgram = config.enableWofi or false;
|
||||
|
||||
# Default user
|
||||
username = config.defaultUser or "henrov";
|
||||
assetPath = ../../../assets/system/conf/${programName};
|
||||
in
|
||||
{
|
||||
# --- Module option ---
|
||||
options.enableWofi = lib.mkEnableOption "Enable Wofi terminal launcher";
|
||||
# Deploy assets to ~/.config/wofi via Home Manager
|
||||
home-manager.users.${username}.home.file =
|
||||
if builtins.pathExists assetPath then
|
||||
lib.genAttrs (builtins.attrNames (builtins.readDir assetPath)) (name: {
|
||||
source = "${assetPath}/${name}";
|
||||
target = ".config/${programName}/${name}";
|
||||
})
|
||||
else {};
|
||||
|
||||
# --- Config ---
|
||||
config = lib.mkIf enableProgram {
|
||||
# Optional systemd service to sync assets manually
|
||||
systemd.services."${programName}-sync" = {
|
||||
description = "Sync ${programName} configuration files";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
# --- Deploy assets to ~/.config/wofi ---
|
||||
environment.etc."${programName}".source = assetPath;
|
||||
|
||||
# --- Optional systemd service to sync config ---
|
||||
systemd.services."${programName}-sync" = {
|
||||
description = "Sync ${programName} configuration files";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
set -euo pipefail
|
||||
if [ -d "${assetPath}" ]; then
|
||||
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
|
||||
mkdir -p "/home/${username}/.config/${programName}"
|
||||
cp -u "${assetPath}/$f" "/home/${username}/.config/${programName}/$f"
|
||||
done
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
restartTriggers = [ assetPath ];
|
||||
path = [];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = ''
|
||||
set -euo pipefail
|
||||
if [ -d "${assetPath}" ]; then
|
||||
mkdir -p "/home/${username}/.config/${programName}"
|
||||
cp -u ${lib.concatStringsSep " " (builtins.attrNames (builtins.readDir assetPath))} "${assetPath}/" "/home/${username}/.config/${programName}/"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
restartTriggers = [ assetPath ];
|
||||
path = [];
|
||||
};
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
Reference in New Issue
Block a user