fs: notice when a fs entry is set to two incompatible types (e.g. symlink + dir) and error
This commit is contained in:
parent
62b39bf01e
commit
5b8f13d9cc
|
@ -97,9 +97,9 @@ let
|
||||||
|
|
||||||
# actually generate the item
|
# actually generate the item
|
||||||
generated.command = lib.mkMerge [
|
generated.command = lib.mkMerge [
|
||||||
(lib.mkIf (config.dir != null) [ "${ensure-dir}/bin/ensure-dir" name ])
|
(lib.mkIf (config.dir != null) (lib.escapeShellArgs [ "${ensure-dir}/bin/ensure-dir" name ]))
|
||||||
(lib.mkIf (config.file != null) [ "${ensure-file}/bin/ensure-file" name config.file.copyFrom ])
|
(lib.mkIf (config.file != null) (lib.escapeShellArgs [ "${ensure-file}/bin/ensure-file" name config.file.copyFrom ]))
|
||||||
(lib.mkIf (config.symlink != null) [ "${ensure-symlink}/bin/ensure-symlink" name config.symlink.target ])
|
(lib.mkIf (config.symlink != null) (lib.escapeShellArgs [ "${ensure-symlink}/bin/ensure-symlink" name config.symlink.target ]))
|
||||||
];
|
];
|
||||||
|
|
||||||
# make the unit file which generates the underlying thing available so that `mount` can use it.
|
# make the unit file which generates the underlying thing available so that `mount` can use it.
|
||||||
|
@ -199,8 +199,13 @@ let
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
command = mkOption {
|
command = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.coercedTo (types.listOf types.str) lib.escapeShellArgs types.str;
|
||||||
default = [];
|
default = "";
|
||||||
|
description = ''
|
||||||
|
command to `exec` which will generate the output.
|
||||||
|
this can be a list -- in which case it's treated as some `argv` to exec,
|
||||||
|
or a string, in which case it's passed onto the CLI unescaped.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
unit = mkOption {
|
unit = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -240,7 +245,7 @@ let
|
||||||
gen-opt.acl.user
|
gen-opt.acl.user
|
||||||
gen-opt.acl.group
|
gen-opt.acl.group
|
||||||
gen-opt.acl.mode
|
gen-opt.acl.mode
|
||||||
] ++ gen-opt.command;
|
];
|
||||||
in {
|
in {
|
||||||
systemd.services."${serviceNameFor path}" = {
|
systemd.services."${serviceNameFor path}" = {
|
||||||
description = "prepare ${path}";
|
description = "prepare ${path}";
|
||||||
|
@ -248,7 +253,7 @@ let
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true; # makes `systemctl start ensure-blah` a noop if already completed, instead of a restart
|
RemainAfterExit = true; # makes `systemctl start ensure-blah` a noop if already completed, instead of a restart
|
||||||
ExecStart = escapeShellArgs wrappedCommand;
|
ExecStart = (escapeShellArgs wrappedCommand) + " " + gen-opt.command;
|
||||||
};
|
};
|
||||||
|
|
||||||
after = gen-opt.depends;
|
after = gen-opt.depends;
|
||||||
|
@ -321,7 +326,9 @@ let
|
||||||
extraDefs = builtins.map (p: {
|
extraDefs = builtins.map (p: {
|
||||||
file = ./.;
|
file = ./.;
|
||||||
value = {
|
value = {
|
||||||
"${p}".dir = {};
|
"${p}" = lib.mkDefault {
|
||||||
|
dir = {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}) extraPaths;
|
}) extraPaths;
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in New Issue
Block a user