44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
{ lib, config, pkgs, flakeRoot, home-manager, inputs, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
assetPath = "${flakeRoot}/generated/.config/hypr";
|
|
|
|
hyprlandPkg =
|
|
pkgs.hyprland or
|
|
pkgs.hyprland-git or
|
|
inputs.hyprland.packages.${pkgs.system}.default;
|
|
|
|
# Recursively read directory and generate Home Manager file entries
|
|
readDirRecursive = dir:
|
|
let
|
|
entries = builtins.attrNames (builtins.readDir dir);
|
|
files = lib.concatMap (e:
|
|
let
|
|
path = "${dir}/${e}";
|
|
stat = builtins.pathInfo path;
|
|
in if stat.type == "directory"
|
|
then readDirRecursive path
|
|
else [{
|
|
name = ".config/hypr/${builtins.substring (builtins.stringLength assetPath + 1) (builtins.stringLength path - (builtins.stringLength assetPath + 1)) path}";
|
|
value = { source = path; };
|
|
}]
|
|
) entries;
|
|
in files;
|
|
|
|
hyprFilesAttrs = lib.listToAttrs (readDirRecursive assetPath);
|
|
|
|
in
|
|
{
|
|
environment.systemPackages = [ hyprlandPkg ];
|
|
|
|
home-manager.users = {
|
|
${username} = {
|
|
home.file = hyprFilesAttrs;
|
|
|
|
# Optional Hyprland settings
|
|
settings.general."col.active_border" = "0xff97cbcd 0xff89b4fa";
|
|
};
|
|
};
|
|
}
|