add separate option for directories

This commit is contained in:
atagen 2025-07-21 00:34:57 +10:00
parent 9f430fa2d9
commit 0a57783a87

View file

@ -65,7 +65,13 @@
source = mkOption {
type = nullOr path;
default = null;
description = "Path of the source file or directory";
description = "Path of the source file";
};
dir = mkOption {
type = nullOr path;
default = null;
description = "Path of directory to link";
};
executable = mkOption {
@ -134,7 +140,7 @@
n: v:
let
processed =
if (v.source == null) then
if (v.source == null && v.dir == null) then
(
if (v.text == "") then
throw "Must provide source or text for ${n}"
@ -154,13 +160,22 @@
"text"
"enable"
"executable"
"dir"
];
nullFiltered = lib.filterAttrs (_: v: v != null) filtered;
in
nullFiltered
// {
type = "symlink";
}
// (
if (v.dir == null) then
{
type = "symlink";
}
else
{
source = v.dir;
type = "directory";
}
)
) enabled;
in
lib.foldlAttrs (