Add support for setting the group owning the file.
This commit is contained in:
parent
7254bc8c7c
commit
504f8ecf09
@ -58,6 +58,13 @@ let
|
||||
example = ".local/share/foo/bar.txt";
|
||||
description = "The path where the file should be written.";
|
||||
};
|
||||
group = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
defaultText = "${prefix}.‹path›.group";
|
||||
example = ".local/share/foo/bar.txt";
|
||||
description = "The group that should own the file.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
@ -138,9 +145,14 @@ in
|
||||
destination = lib.strings.escapeShellArg "${target_config.target}";
|
||||
mode = lib.strings.escapeShellArg "${target_config.mode}";
|
||||
escaped_username = lib.strings.escapeShellArg "${username}";
|
||||
escaped_group =
|
||||
if target_config.group == null then
|
||||
"$(id -g ${escaped_username})"
|
||||
else
|
||||
(lib.strings.escapeShellArg "${target_config.group}");
|
||||
in
|
||||
''
|
||||
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare -o ${escaped_username} -m ${mode} ${source} ${destination}
|
||||
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare -o ${escaped_username} -g ${escaped_group} -m ${mode} ${source} ${destination}
|
||||
''
|
||||
) active_install_file_targets
|
||||
) active_install_users
|
||||
|
Loading…
x
Reference in New Issue
Block a user