30 lines
620 B
Nix
30 lines
620 B
Nix
{ lib, config, pkgs, flakeRoot, ... }:
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
scriptsPath = flakeRoot + "/generated/.config/scripts";
|
|
|
|
scriptFiles = lib.filesystem.listFilesRecursive scriptsPath;
|
|
|
|
toRelative = file:
|
|
let
|
|
base = toString flakeRoot + "/generated/";
|
|
in
|
|
lib.removePrefix base (toString file);
|
|
|
|
toFileEntry = file: {
|
|
name = toRelative file;
|
|
value = {
|
|
source = file;
|
|
executable = true;
|
|
force = true;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
home-manager.users = {
|
|
${username} = {
|
|
home.file = builtins.listToAttrs (map toFileEntry scriptFiles);
|
|
};
|
|
};
|
|
}
|