Add method parameter.

This commit is contained in:
Tom Alexander 2025-04-11 18:09:52 -04:00
parent c26d6f34ea
commit 6284ce8d86
No known key found for this signature in database
GPG Key ID: D3A179C9A53C0EDE

View File

@ -51,44 +51,55 @@ in
file = lib.mkOption { file = lib.mkOption {
type = lib.types.attrsOf ( type = lib.types.attrsOf (
lib.types.submodule ( lib.types.submodule (
{ name, config, ... }: { path, config, ... }:
{ {
options = { options = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
defaultText = "me.install.file.name.enable"; defaultText = "me.install.file.path.enable";
example = false; example = false;
description = "Whether we want to install this file."; description = "Whether we want to install this file.";
}; };
method = lib.mkOption {
type = lib.types.enum [
"symlink"
"overwrite"
# "bind_mount" TODO: for directories?
];
default = "symlink";
defaultText = "me.install.file.path.method";
example = "overwrite";
description = "The way in which the file should be installed.";
};
mode = lib.mkOption { mode = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "0444"; default = "0444";
defaultText = "me.install.file.name.mode"; defaultText = "me.install.file.path.mode";
example = "0750"; example = "0750";
description = "The read, write, execute permission flags."; description = "The read, write, execute permission flags.";
}; };
source = lib.mkOption { source = lib.mkOption {
type = lib.types.path; type = lib.types.path;
defaultText = "me.install.file.name.source"; defaultText = "me.install.file.path.source";
example = ./files/foo.txt; example = ./files/foo.txt;
description = "The source file to install into the destination."; description = "The source file to install into the destination.";
}; };
target = lib.mkOption { target = lib.mkOption {
type = lib.types.str; type = lib.types.str;
defaultText = "me.install.file.name.target"; defaultText = "me.install.file.path.target";
example = ".local/share/foo/bar.txt"; example = ".local/share/foo/bar.txt";
description = "The path where the file should be written."; description = "The path where the file should be written.";
}; };
}; };
config = { config = {
target = lib.mkDefault name; target = lib.mkDefault path;
}; };
} }
) )
); );
defaultText = "me.install.file.name"; defaultText = "me.install.file.path";
default = { }; default = { };
example = lib.literalExpression '' example = lib.literalExpression ''
{ {