41 lines
1.0 KiB
Nix
41 lines
1.0 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 gather files as Home Manager entries
|
|
gatherFiles = dir:
|
|
let
|
|
entries = builtins.attrNames (builtins.readDir dir);
|
|
files = lib.concatMap (e:
|
|
let
|
|
path = "${dir}/${e}";
|
|
in if builtins.pathInfo path.type == "directory"
|
|
then gatherFiles path
|
|
else [{
|
|
name = ".config/hypr/${builtins.replaceStrings [ "${assetPath}/" ] [ "" ] path}";
|
|
value = { source = path; };
|
|
}]
|
|
) entries;
|
|
in files;
|
|
|
|
hyprFilesAttrs = lib.listToAttrs (gatherFiles assetPath);
|
|
|
|
in
|
|
{
|
|
environment.systemPackages = [ hyprlandPkg ];
|
|
|
|
home-manager.users = {
|
|
${username} = {
|
|
# Place all files (and subdirectories) into ~/.config/hypr/
|
|
home.file = hyprFilesAttrs;
|
|
};
|
|
};
|
|
}
|