add separate option for directories
This commit is contained in:
parent
9f430fa2d9
commit
0a57783a87
1 changed files with 20 additions and 5 deletions
25
flake.nix
25
flake.nix
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue